/* T1 Immobilien: ruhig, gut lesbar, auch für Opa. Anthrazit und Petrol. */
:root {
  --schrift: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --schrift-titel: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --groesse: 15px;

  --flaeche: #f3f5f4;
  --karte: #ffffff;
  --karte-2: #f7f9f8;
  --linie: #e1e7e5;
  --linie-stark: #c9d3d0;
  --text: #17201f;
  --text-2: #4b5a57;
  --text-3: #7a8784;
  --akzent: #0f766e;
  --akzent-stark: #0b5d57;
  --akzent-hell: #e2f3f0;
  --akzent-text: #ffffff;
  --leiste: #172625;
  --leiste-2: #213433;
  --leiste-text: #c6d6d3;
  --leiste-aktiv: #2dd4bf;

  --einnahmen: #0f8a75;
  --ausgaben: #e8692e;
  --diagramm-flaeche: #fcfcfb;
  --raster: #eceeed;

  --gut: #0f7b3d;
  --gut-hell: #e3f4ea;
  --warnung: #9a6400;
  --warnung-hell: #fdf3dc;
  --fehler: #b42323;
  --fehler-hell: #fbe7e6;

  --schatten: 0 1px 2px rgba(16, 32, 30, .06), 0 4px 16px rgba(16, 32, 30, .05);
  --schatten-gross: 0 12px 48px rgba(10, 25, 24, .22);
  --radius: 12px;
  --radius-klein: 8px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --dunkel: 1; }
}
:root[data-theme="dark"] {
  --flaeche: #0f1514;
  --karte: #172120;
  --karte-2: #1c2827;
  --linie: #263533;
  --linie-stark: #34504c;
  --text: #e8efed;
  --text-2: #b2c1be;
  --text-3: #85948f;
  --akzent: #2bb39a;
  --akzent-stark: #5fd0bb;
  --akzent-hell: #12312d;
  --akzent-text: #06201c;
  --leiste: #0b1110;
  --leiste-2: #15201f;
  --einnahmen: #1f9e86;
  --ausgaben: #e26a33;
  --diagramm-flaeche: #1a1a19;
  --raster: #263231;
  --gut: #5bd08a;
  --gut-hell: #133524;
  --warnung: #f0b84a;
  --warnung-hell: #3a2c0e;
  --fehler: #ff8a80;
  --fehler-hell: #3d1716;
  --schatten: 0 1px 2px rgba(0, 0, 0, .3);
}
:root[data-schrift="gross"] { --groesse: 17px; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--schrift); font-size: var(--groesse); color: var(--text); background: var(--flaeche); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--akzent); }
h1, h2, h3 { font-family: var(--schrift-titel); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.7rem; font-weight: 650; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
.zahl, td.z, th.z { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.leise { color: var(--text-2); }
.sehr-leise { color: var(--text-3); font-size: .87em; }
.klein { font-size: .87em; }

/* ---------- Grundgerüst ---------- */
.rahmen { display: grid; grid-template-columns: 248px 1fr; height: 100vh; }
.leiste { background: var(--leiste); color: var(--leiste-text); display: flex; flex-direction: column; overflow-y: auto; }
.marke { display: flex; align-items: center; gap: 10px; padding: 20px 20px 14px; color: #fff; text-decoration: none; }
.marke img { width: 34px; height: 34px; }
.marke b { font-family: var(--schrift-titel); font-size: 1.12rem; font-weight: 650; letter-spacing: -.01em; }
.marke span { display: block; font-size: .72rem; color: #8fb3ad; letter-spacing: .08em; text-transform: uppercase; }
.profilwahl { margin: 4px 12px 10px; padding: 10px 12px; border-radius: 10px; background: var(--leiste-2); border: 1px solid #2c4442; cursor: pointer; text-align: left; width: calc(100% - 24px); color: #fff; display: flex; align-items: center; gap: 10px; }
.profilwahl:hover { border-color: #3d5d5a; }
.profilwahl .punkt { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.profilwahl small { display: block; color: #8fb3ad; font-size: .76rem; }
.nav { padding: 4px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-titel { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: #6f8f8a; padding: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px; color: var(--leiste-text); text-decoration: none; font-size: .95rem; }
.nav a:hover { background: var(--leiste-2); color: #fff; }
.nav a.aktiv { background: #1d3b38; color: #fff; box-shadow: inset 3px 0 0 var(--leiste-aktiv); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav .zaehler { margin-left: auto; background: var(--leiste-aktiv); color: #062420; border-radius: 99px; font-size: .72rem; font-weight: 700; padding: 1px 7px; }
.leiste-fuss { margin-top: auto; padding: 14px 16px; border-top: 1px solid #22322f; font-size: .85rem; }
.leiste-fuss button { background: none; border: none; color: #8fb3ad; cursor: pointer; padding: 0; text-decoration: underline; }
.inhalt { overflow-y: auto; position: relative; }
.seite { max-width: 1320px; margin: 0 auto; padding: 28px 36px 60px; }
.kopf { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.kopf .unter { color: var(--text-2); margin-top: 4px; }
.aktionen { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Bausteine ---------- */
.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten); }
.karte-innen { padding: 18px 20px; }
.karte-kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.raster { display: grid; gap: 16px; }
.raster-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.raster-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.raster-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1180px) { .raster-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .raster-3 { grid-template-columns: 1fr 1fr; } }
.stapel { display: flex; flex-direction: column; gap: 16px; }
.zeile { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.abstand { flex: 1; }

.knopf { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--linie-stark); background: var(--karte); color: var(--text); padding: 8px 14px; border-radius: var(--radius-klein); cursor: pointer; font-weight: 550; font-size: .93rem; line-height: 1.2; white-space: nowrap; }
.knopf:hover { border-color: var(--akzent); color: var(--akzent-stark); }
.knopf:disabled { opacity: .5; cursor: default; }
.knopf.haupt { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.knopf.haupt:hover { background: var(--akzent-stark); color: var(--akzent-text); }
.knopf.gefahr { color: var(--fehler); }
.knopf.gefahr:hover { border-color: var(--fehler); }
.knopf.flach { border-color: transparent; background: transparent; padding: 6px 8px; }
.knopf.klein { padding: 5px 10px; font-size: .85rem; }
.knopf svg { width: 16px; height: 16px; }

.feld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.feld > span { font-size: .82rem; font-weight: 600; color: var(--text-2); }
.feld small { color: var(--text-3); font-size: .78rem; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=month], input[type=search], select, textarea {
  border: 1px solid var(--linie-stark); background: var(--karte); border-radius: var(--radius-klein); padding: 8px 10px; min-width: 0; width: 100%;
}
input:focus, select:focus, textarea:focus, .knopf:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; border-color: transparent; }
textarea { resize: vertical; min-height: 70px; }
.felder { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.felder .breit { grid-column: 1 / -1; }
.haken { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.haken input { width: 17px; height: 17px; accent-color: var(--akzent); }

.marke-klein { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .75rem; font-weight: 650; background: var(--karte-2); color: var(--text-2); border: 1px solid var(--linie); white-space: nowrap; }
.marke-klein.gut { background: var(--gut-hell); color: var(--gut); border-color: transparent; }
.marke-klein.warn { background: var(--warnung-hell); color: var(--warnung); border-color: transparent; }
.marke-klein.fehler { background: var(--fehler-hell); color: var(--fehler); border-color: transparent; }
.marke-klein.akzent { background: var(--akzent-hell); color: var(--akzent-stark); border-color: transparent; }

.tabelle { width: 100%; border-collapse: collapse; }
.tabelle th { text-align: left; font-size: .76rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding: 10px 12px; border-bottom: 1px solid var(--linie); background: var(--karte); position: sticky; top: 0; }
.tabelle td { padding: 10px 12px; border-bottom: 1px solid var(--linie); vertical-align: middle; }
.tabelle tbody tr.klickbar { cursor: pointer; }
.tabelle tbody tr.klickbar:hover td { background: var(--karte-2); }
.tabelle tfoot td { font-weight: 650; border-bottom: none; }
.tabelle .aus td { opacity: .45; text-decoration: line-through; }
.tabelle input[type=text], .tabelle input[type=number], .tabelle select { padding: 5px 7px; }

.hinweis { border-radius: var(--radius-klein); padding: 10px 14px; background: var(--warnung-hell); color: var(--warnung); font-size: .9rem; }
.hinweis.info { background: var(--akzent-hell); color: var(--akzent-stark); }
.hinweis.fehler { background: var(--fehler-hell); color: var(--fehler); }
.leer { text-align: center; padding: 40px 20px; color: var(--text-2); }
.leer svg { width: 40px; height: 40px; color: var(--text-3); margin-bottom: 8px; }

/* ---------- Kennzahlen ---------- */
.kennzahl { padding: 16px 18px; }
.kennzahl .titel { font-size: .82rem; color: var(--text-2); font-weight: 600; }
.kennzahl .wert { font-family: var(--schrift-titel); font-size: 1.75rem; font-weight: 650; margin: 6px 0 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kennzahl .vergleich { font-size: .84rem; color: var(--text-2); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.trend { font-weight: 650; font-variant-numeric: tabular-nums; }
.trend.hoch { color: var(--gut); }
.trend.runter { color: var(--fehler); }
.diagramm { position: relative; height: 290px; padding: 6px 16px 14px; }
.legende { display: flex; gap: 16px; flex-wrap: wrap; font-size: .84rem; color: var(--text-2); padding: 10px 20px 0; }
.legende i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legende i.strich { height: 3px; border-radius: 2px; vertical-align: 3px; }

/* ---------- Start ---------- */
.begruessung { font-size: 2rem; font-weight: 650; }
.profilkarte { padding: 20px; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; display: flex; flex-direction: column; gap: 12px; border-top: 4px solid var(--farbe, var(--akzent)); }
.profilkarte:hover { transform: translateY(-2px); box-shadow: var(--schatten-gross); }
.profilkarte .objekte { display: flex; flex-direction: column; gap: 4px; font-size: .92rem; color: var(--text-2); }
.profilkarte .zahlen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid var(--linie); padding-top: 12px; }
.profilkarte .zahlen b { display: block; font-variant-numeric: tabular-nums; }
.profilkarte .zahlen span { font-size: .76rem; color: var(--text-3); }
.aufgabe { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--linie); cursor: pointer; }
.aufgabe:last-child { border-bottom: none; }
.aufgabe:hover { background: var(--karte-2); }
.aufgabe .symbol { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--warnung-hell); color: var(--warnung); flex: none; }
.aufgabe .symbol svg { width: 18px; height: 18px; }

/* ---------- Mieten ---------- */
.monate { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; }
.monat { border: 1px solid var(--linie); border-radius: 8px; padding: 8px 4px; text-align: center; cursor: pointer; background: var(--karte); font-size: .8rem; }
.monat b { display: block; font-size: .78rem; color: var(--text-2); font-weight: 650; }
.monat .betrag { font-variant-numeric: tabular-nums; font-size: .76rem; }
.monat.bezahlt { background: var(--gut-hell); border-color: transparent; color: var(--gut); }
.monat.bezahlt b { color: var(--gut); }
.monat.offen { background: var(--warnung-hell); border-color: transparent; color: var(--warnung); }
.monat.teilweise { background: var(--warnung-hell); border-style: dashed; border-color: var(--warnung); }
.monat.zukunft, .monat.ohne { opacity: .55; }
.monat.ohne { cursor: default; }
.monat:hover:not(.ohne) { outline: 2px solid var(--akzent); }

/* ---------- Dialoge ---------- */
.schleier { position: fixed; inset: 0; background: rgba(8, 18, 17, .45); display: grid; place-items: center; z-index: 50; padding: 24px; animation: ein .12s ease; }
@keyframes ein { from { opacity: 0; } }
.dialog { background: var(--karte); border-radius: 14px; box-shadow: var(--schatten-gross); width: min(720px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; }
.dialog.gross { width: min(1280px, 100%); height: calc(100vh - 48px); }
.dialog.mittel { width: min(960px, 100%); }
.dialog-kopf { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--linie); }
.dialog-inhalt { padding: 18px 20px; overflow-y: auto; flex: 1; }
.dialog-fuss { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--linie); flex-wrap: wrap; }
.zweigeteilt { display: grid; grid-template-columns: minmax(0, 1fr) minmax(460px, 1fr); height: 100%; min-height: 0; }
.vorschau { background: #525659; border-right: 1px solid var(--linie); min-height: 0; display: flex; align-items: stretch; justify-content: center; overflow: auto; }
.vorschau iframe { border: 0; width: 100%; height: 100%; }
.vorschau img { max-width: 100%; height: auto; align-self: flex-start; }
.vorschau .ohne { color: #dfe6e4; align-self: center; text-align: center; padding: 30px; }
.formular { overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; }

.ablegen { position: fixed; inset: 0; z-index: 80; background: rgba(15, 118, 110, .14); border: 3px dashed var(--akzent); display: grid; place-items: center; pointer-events: none; }
.ablegen div { background: var(--karte); padding: 28px 36px; border-radius: 16px; box-shadow: var(--schatten-gross); text-align: center; font-size: 1.15rem; font-weight: 600; }
.ablegen small { display: block; font-weight: 400; color: var(--text-2); margin-top: 6px; font-size: .9rem; }

.meldungen { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 90; }
.meldung { background: var(--leiste); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--schatten-gross); max-width: 420px; font-size: .92rem; animation: ein .15s ease; }
.meldung.fehler { background: #7f1d1d; }

/* ---------- Anmeldung ---------- */
.anmeldung { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 30% 20%, #1b3b38 0%, #0d1716 70%); padding: 24px; }
.anmeldung .karte { width: min(560px, 100%); padding: 32px; }
.personen { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 18px; }
.person { border: 1px solid var(--linie-stark); background: var(--karte); border-radius: 12px; padding: 16px; cursor: pointer; text-align: left; }
.person:hover, .person.gewaehlt { border-color: var(--akzent); box-shadow: 0 0 0 2px var(--akzent-hell); }
.person .initial { width: 40px; height: 40px; border-radius: 50%; background: var(--akzent-hell); color: var(--akzent-stark); display: grid; place-items: center; font-weight: 700; margin-bottom: 10px; }

/* ---------- Dokumente ---------- */
.baum-objekt { margin-bottom: 18px; }
.ordner { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-weight: 600; color: var(--text-2); }
.ordner svg { width: 18px; height: 18px; color: var(--akzent); }
.dateien { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; padding: 0 12px 12px; }
.datei { border: 1px solid var(--linie); border-radius: 10px; padding: 10px 12px; background: var(--karte); cursor: pointer; display: flex; gap: 10px; align-items: flex-start; }
.datei:hover { border-color: var(--akzent); }
.datei svg { width: 22px; height: 22px; color: var(--text-3); flex: none; margin-top: 2px; }
.datei b { display: block; font-weight: 600; font-size: .9rem; overflow-wrap: anywhere; }

.reiter { display: flex; gap: 4px; border-bottom: 1px solid var(--linie); margin-bottom: 18px; }
.reiter button { border: none; background: none; padding: 10px 14px; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.reiter button.aktiv { color: var(--akzent-stark); border-bottom-color: var(--akzent); }
.wohnungswahl { width: auto; max-width: 240px; }
.jahrwahl { display: inline-flex; align-items: center; border: 1px solid var(--linie-stark); border-radius: var(--radius-klein); background: var(--karte); }
.jahrwahl button { border: none; background: none; padding: 7px 10px; cursor: pointer; color: var(--text-2); }
.jahrwahl button:hover { color: var(--akzent); }
.jahrwahl b { padding: 0 6px; font-variant-numeric: tabular-nums; }
.lade { padding: 40px; text-align: center; color: var(--text-3); }

/* Anmeldung am Server */
.code-eingabe { font-size: 24px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.einrichten { margin: 16px 0 12px; padding-left: 20px; }
.einrichten li { margin-bottom: 6px; }
.qr-rahmen { display: grid; place-items: center; margin: 8px 0 10px; }
.qr { width: 220px; height: 220px; background: #fff; border-radius: 10px; }
.schluessel-text { font-size: 14px; overflow-wrap: anywhere; }
.link-knopf { background: none; border: 0; color: var(--akzent); cursor: pointer; padding: 4px; font: inherit; text-decoration: underline; }
.ersatzcodes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 10px; }
.ersatzcodes code { background: var(--karte-2); padding: 8px 10px; border-radius: 8px; text-align: center; font-size: 15px; }
@media print { .anmeldung { background: none; } .anmeldung .knopf { display: none; } }
