/* Hausverwaltung Web – schlichtes Fluent-Design, hell/dunkel automatisch, handytauglich */
:root {
    --grund: #f3f3f3;
    --karte: #ffffff;
    --karte2: #f9f9f9;
    --text: #1b1b1b;
    --leise: #616161;
    --rand: #e5e5e5;
    --akzent: #0f6cbd;
    --akzent-hell: #e8f1fb;
    --akzent-text: #ffffff;
    --ok: #107c10;
    --warnung: #9d5d00;
    --warnung-hell: #fff4ce;
    --gefahr: #c42b1c;
    --erfolg-hell: #dff6dd;
    --radius: 8px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --grund: #202020;
        --karte: #2b2b2b;
        --karte2: #323232;
        --text: #f0f0f0;
        --leise: #a8a8a8;
        --rand: #3d3d3d;
        --akzent: #4ca0e0;
        --akzent-hell: #243746;
        --akzent-text: #0b0b0b;
        --ok: #6ccb5f;
        --warnung: #fce100;
        --warnung-hell: #433519;
        --gefahr: #ff99a4;
        --erfolg-hell: #1f3a1d;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    background: var(--grund);
    color: var(--text);
    font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.45;
}
a { color: var(--akzent); }
h1 { font-size: 26px; font-weight: 600; margin: 0 0 2px; outline: none; }
h2 { font-size: 18px; font-weight: 600; margin: 0 0 10px; }
h3 { font-size: 15px; font-weight: 600; margin: 18px 0 8px; }
code { font-family: Consolas, monospace; font-size: 13px; }

/* ---------- Rahmen: Navigation links, Inhalt rechts ---------- */
.rahmen { display: flex; min-height: 100vh; }
.navi {
    width: 240px; flex-shrink: 0; padding: 14px 10px;
    display: flex; flex-direction: column; gap: 2px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.marke { font-size: 17px; font-weight: 600; padding: 6px 12px 16px; }
.navkopf { font-size: 12px; color: var(--leise); padding: 14px 12px 4px; }
.navi a {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 6px;
    color: var(--text); text-decoration: none; position: relative;
}
.navi a:hover { background: var(--karte2); }
.navi a.active { background: var(--karte); font-weight: 600; }
.navi a.active::before {
    content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px;
    border-radius: 2px; background: var(--akzent);
}
.navi .abmelden { margin-top: auto; }
.sym { width: 20px; text-align: center; }
.inhalt { flex: 1; min-width: 0; padding: 24px 28px 48px; max-width: 1280px; }
.untertitel { color: var(--leise); margin: 0 0 18px; }

/* ---------- Karten und Layout ---------- */
.karte {
    background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius);
    padding: 18px 20px; margin-bottom: 16px;
}
.karte.mitte { text-align: center; padding: 36px 20px; }
.kopfzeile { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.kopfzeile.klein h2 { margin-bottom: 0; }
.zweispaltig { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 16px; align-items: start; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kachel {
    background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius);
    padding: 16px; text-decoration: none; color: var(--text); display: flex; flex-direction: column;
}
.kachel:hover { border-color: var(--akzent); }
.kachel .zahl { font-size: 28px; font-weight: 600; color: var(--akzent); }
.leer { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.anmelden { width: 100%; max-width: 380px; }
.anmelden form { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Formulare ---------- */
.felder { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; margin-bottom: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--leise); }
label.schalter { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; margin: 6px 0; }
input, select {
    font: inherit; color: var(--text); background: var(--karte2);
    border: 1px solid var(--rand); border-bottom: 2px solid var(--leise); border-radius: 4px;
    padding: 7px 10px; min-height: 36px;
}
input:focus, select:focus { outline: none; border-bottom-color: var(--akzent); }
input[type=checkbox] { min-height: 0; width: 18px; height: 18px; accent-color: var(--akzent); }
input.gross { font-size: 20px; font-weight: 600; }
.breit { width: 100%; }
select.filter { width: 100%; margin-bottom: 8px; }
.aktionen { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.fuellen { flex: 1; }
.versteckt { display: none; }

/* ---------- Knöpfe ---------- */
.knopf {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    font: inherit; font-size: 14px; color: var(--text); text-decoration: none; cursor: pointer;
    background: var(--karte2); border: 1px solid var(--rand); border-radius: 4px; padding: 7px 16px; min-height: 34px;
}
.knopf:hover { filter: brightness(0.97); }
.knopf:disabled { opacity: .5; cursor: default; }
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.knopf.gefahr { color: var(--gefahr); }
.knopf.mini { padding: 3px 10px; min-height: 28px; font-size: 13px; }
.knopfreihe { display: flex; gap: 8px; flex-wrap: wrap; }
.knopfreihe.gross { justify-content: center; margin-bottom: 14px; }
.knopfreihe.gross .knopf { font-size: 17px; padding: 14px 26px; }

/* ---------- Tabellen ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; font-size: 13px; color: var(--leise); padding: 8px; border-bottom: 1px solid var(--rand); }
td { padding: 8px; border-bottom: 1px solid var(--rand); vertical-align: middle; }
tfoot td { font-weight: 600; border-bottom: none; }
.rechts { text-align: right; }
table.auswahl tbody tr { cursor: pointer; }
table.auswahl tbody tr:hover { background: var(--karte2); }
tr.gewaehlt { background: var(--akzent-hell) !important; }
tr.blass { opacity: .55; }
h3.gruppe { margin: 14px 0 2px; color: var(--akzent); }

/* ---------- Hinweise, Status ---------- */
.leise { color: var(--leise); font-size: 13px; }
.fehler { color: var(--gefahr); }
.ok { color: var(--ok); }
.aus { color: var(--leise); }
.hinweis { border-radius: 6px; padding: 10px 12px; background: var(--akzent-hell); margin: 8px 0; }
.hinweis.warnung { background: var(--warnung-hell); }
.hinweis.erfolg { background: var(--erfolg-hell); }
ul.status { list-style: none; padding: 0; margin: 0 0 10px; }
ul.status li { padding: 3px 0; }
.modell { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rand); }
.foto { width: 100%; max-height: 60vh; object-fit: contain; border-radius: 6px; background: #0f172a; }

/* Unbestimmter Fortschrittsbalken */
.balken { height: 4px; background: var(--rand); border-radius: 2px; overflow: hidden; margin: 8px 0; }
.balken div { height: 100%; width: 35%; background: var(--akzent); border-radius: 2px; animation: laufen 1.2s ease-in-out infinite; }
@keyframes laufen { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* ---------- Abrechnung ---------- */
.reiter { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 1px solid var(--rand); }
.reiter a { padding: 8px 14px; color: var(--text); text-decoration: none; border-bottom: 3px solid transparent; }
.reiter a.aktiv { border-bottom-color: var(--akzent); font-weight: 600; }
.tabelle-scroll { overflow-x: auto; }
.tabelle-scroll table { min-width: 760px; }
td.nach { color: var(--gefahr); font-weight: 600; white-space: nowrap; }
td.gut { color: var(--ok); font-weight: 600; white-space: nowrap; }
tr.summe td { font-weight: 600; background: var(--karte2); }
table.parameter { width: auto; min-width: 50%; margin-bottom: 12px; }
table.parameter td { padding: 4px 8px; }
pre.text { white-space: pre-wrap; font-size: 12px; max-height: 300px; overflow: auto; background: var(--karte2); padding: 10px; border-radius: 6px; }
label.inline { display: inline-flex; flex-direction: row; gap: 6px; align-items: center; }
.hinweis ul { margin: 6px 0 0; padding-left: 20px; }

/* ---------- Auswahl je Wohnung, Vorschau ---------- */
.wohnungsauswahl { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin: 4px 0 14px;
    padding: 12px; background: var(--karte2); border-radius: 6px; }
.wohnungsauswahl label { min-width: 240px; }
.karte.vorschau iframe { width: 100%; height: 80vh; border: 1px solid var(--rand); border-radius: 6px; background: #fff; margin-top: 10px; }
.demo-banner { background: var(--warnung-hell); padding: 8px 14px; border-radius: 6px; margin-bottom: 14px;
    display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.druckauswahl { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: -8px 0 18px; font-size: 13px; }
.druckauswahl a { padding: 3px 10px; border: 1px solid #ccc; border-radius: 12px; color: #333; text-decoration: none; }
.druckauswahl a.aktiv { background: #0f6cbd; border-color: #0f6cbd; color: #fff; }

/* ---------- Druckansicht (immer hell, A4) ---------- */
.druck { background: #fff; color: #111; max-width: 820px; margin: 0 auto; padding: 24px; font-size: 13px; color-scheme: light; }
.leer:has(.druck) { display: block; background: #fff; padding: 0; }
.druck h1 { font-size: 22px; margin-bottom: 4px; }
.druck h3 { font-size: 15px; margin: 18px 0 4px; }
.druck .mieter { font-size: 17px; margin: 0 0 4px; }
.druck .grau, .druck .pflicht { color: #555; }
.druck .pflicht { font-size: 11px; margin-top: 18px; }
.druck table { margin: 8px 0; }
.druck th, .druck td { border-bottom: 1px solid #ddd; padding: 5px 6px; color: #111; }
.druck td.r, .druck th.r { text-align: right; white-space: nowrap; }
.druck td.e { padding-left: 22px; }
.druck tr.f td { font-weight: 600; }
.druck tr.ergebnis td { font-size: 15px; border-top: 2px solid #111; }
.druck .abstand { margin-top: 16px; }
.druckleiste { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid #ddd; }
.druckleiste .leise { color: #555; }
.blatt.neu { margin-top: 40px; padding-top: 30px; border-top: 2px dashed #ccc; }
@media print {
    @page { size: A4; margin: 18mm 16mm; }
    body { background: #fff; }
    .druckleiste, .druckauswahl { display: none; }
    .druck { padding: 0; max-width: none; }
    .blatt.neu { break-before: page; margin-top: 0; padding-top: 0; border-top: none; }
    tr, .pflicht { break-inside: avoid; }
}

#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: 12px 16px;
    background: var(--warnung-hell); color: var(--text); z-index: 1000;
}

/* ---------- Handy: Navigation oben als Leiste ---------- */
@media (max-width: 800px) {
    .rahmen { flex-direction: column; }
    .navi {
        width: 100%; height: auto; position: sticky; top: 0; z-index: 10; flex-direction: row;
        overflow-x: auto; padding: 8px; background: var(--grund); border-bottom: 1px solid var(--rand);
    }
    .marke, .navkopf { display: none; }
    .navi a { white-space: nowrap; padding: 8px 10px; }
    .navi .abmelden { margin-top: 0; }
    .inhalt { padding: 16px; }
    .zweispaltig { grid-template-columns: 1fr; }
    td, th { padding: 6px 4px; }
}
