/* NK-Abrechnung – Gestaltung. Hell/Dunkel über Variablen, Modus über data-theme am <html>. */
/* DM Sans (SIL Open Font License), lokal ausgeliefert – keine Verbindung zu Google. */
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 100 1000; font-display: swap; src: url('fonts/dm-sans-latin-wght-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 100 1000; font-display: swap; src: url('fonts/dm-sans-latin-ext-wght-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
    --bg: #F8F8F8;
    --surface: #FFFFFF;
    --surface-2: #F3F3F2;
    --line: #E7E7E5;
    --line-soft: #EFEFED;
    --ink: #292928;
    --ink-2: #4A4A48;
    --muted: #6B6B69;
    --accent: #C3F832;
    --accent-ink: #292928;
    --accent-soft: #F1FCD6;
    --strong: #292928;
    --strong-ink: #FFFFFF;
    --lav-bg: #EBDDFB;
    --lav-ink: #5B2A86;
    --red-bg: #FDE2E1;
    --red-ink: #A3261B;
    --radius: 22px;
    --radius-s: 14px;
    color-scheme: light;
}
:root[data-theme="dark"] {
    --bg: #141413;
    --surface: #1E1E1D;
    --surface-2: #282826;
    --line: #363634;
    --line-soft: #2C2C2A;
    --ink: #F2F2EF;
    --ink-2: #D6D6D2;
    --muted: #A6A6A2;
    --accent: #C3F832;
    --accent-ink: #1A1A19;
    --accent-soft: #283214;
    --strong: #F2F2EF;
    --strong-ink: #1A1A19;
    --lav-bg: #3A2A50;
    --lav-ink: #E6D2FF;
    --red-bg: #4A201C;
    --red-ink: #FFB8AF;
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #141413; --surface: #1E1E1D; --surface-2: #282826; --line: #363634; --line-soft: #2C2C2A;
        --ink: #F2F2EF; --ink-2: #D6D6D2; --muted: #A6A6A2; --accent-soft: #283214; --strong: #F2F2EF; --strong-ink: #1A1A19;
        --lav-bg: #3A2A50; --lav-ink: #E6D2FF; --red-bg: #4A201C; --red-ink: #FFB8AF; color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: 32px; line-height: 1.15; }
h2 { font-size: 20px; line-height: 1.25; }
h3 { font-size: 17px; line-height: 1.3; }
p { margin: 0 0 12px; }
a { color: var(--ink); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
small { font-size: 12px; }
[hidden] { display: none !important; }

/* ---------- Grundgerüst ---------- */
.shell { display: flex; gap: 20px; padding: 20px; min-height: 100vh; align-items: flex-start; }
.rail { position: sticky; top: 20px; flex: 0 0 92px; background: var(--surface); border-radius: 24px; padding: 16px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; max-height: calc(100vh - 40px); overflow-y: auto; }
.rail-logo { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--ink); display: flex; align-items: center; justify-content: center; font-weight: 700; text-decoration: none; margin-bottom: 14px; flex: 0 0 auto; }
.rail-item { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 76px; padding: 4px 0; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1.2; text-align: center; background: none; border: 0; cursor: pointer; font-family: inherit; }
.rail-item .ico { position: relative; width: 52px; height: 42px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: var(--ink-2); }
.rail-item:hover .ico { background: var(--surface-2); }
.rail-item.active { color: var(--ink); }
.rail-item.active .ico { background: var(--accent); color: var(--accent-ink); }
.rail-item .ico .pip { position: absolute; top: 5px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
.rail-sep { width: 40px; height: 1px; background: var(--line); margin: 8px 0; flex: 0 0 auto; }
.rail-spacer { flex: 1 1 auto; min-height: 16px; }
.rail form { margin: 0; }
.page { flex: 1 1 auto; min-width: 0; max-width: 100%; display: flex; flex-direction: column; gap: 20px; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-height: 48px; }
.topbar .crumbs { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); min-width: 0; }
.topbar .crumbs a { color: var(--muted); text-decoration: none; }
.topbar .crumbs a:hover { color: var(--ink); }
.topbar .crumbs strong { color: var(--ink); font-weight: 600; }
.segmented { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface); border-radius: 16px; }
.segmented form { margin: 0; display: contents; }
.segmented form > button { margin: 0; }
.actions form > button, .rail form > button { margin: 0; }
.segmented button, .segmented a { height: 40px; padding: 0 18px; border: 0; border-radius: 12px; background: transparent; color: var(--ink); font: 500 14px/40px inherit; font-family: inherit; cursor: pointer; text-decoration: none; white-space: nowrap; }
.segmented .on, .segmented [aria-pressed="true"], .segmented [aria-current] { background: var(--strong); color: var(--strong-ink); font-weight: 600; }
.icon-btn { width: 48px; height: 48px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; flex: 0 0 auto; }
.icon-btn.round { border-radius: 50%; width: 44px; height: 44px; }
.avatar { width: 48px; height: 48px; border-radius: var(--radius-s); background: var(--strong); color: var(--strong-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex: 0 0 auto; }
main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
footer.foot { color: var(--muted); font-size: 12px; padding: 8px 4px 0; }

/* Gäste (Anmeldung) */
.guest { min-height: 100vh; display: flex; flex-direction: column; padding: 20px; gap: 20px; }
.guest-top { display: flex; align-items: center; gap: 12px; }
.guest-top .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; flex: 1 1 auto; }
.guest main { flex: 1 1 auto; justify-content: center; }

/* ---------- Bausteine ---------- */
.card { background: var(--surface); border-radius: var(--radius); padding: 22px; }
.card.selected, .card.focus { border: 2px solid var(--ink); }
.card.soft { background: var(--surface-2); }
.card.dark { background: var(--strong); color: var(--strong-ink); }
.card.dark p, .card.dark .muted { color: inherit; opacity: .85; }
.tile { background: var(--surface-2); border-radius: 16px; padding: 12px 14px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.row > .grow { flex: 1 1 auto; min-width: 0; }
.row.nowrap { flex-wrap: nowrap; }
.row > .primary.grow { padding: 0 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 10px 16px; margin: 0; font-size: 13px; }
.facts dt, .label { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; font-weight: 600; font-size: 15px; color: var(--ink); }
.facts div { min-width: 0; }
.facts dd small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.meter-list td { vertical-align: top; }
.tag, .badge, .count { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; line-height: 1.4; }
.tag.ok, .badge { background: var(--accent); color: var(--accent-ink); }
.tag.due { background: var(--lav-bg); color: var(--lav-ink); }
.tag.missing { background: var(--red-bg); color: var(--red-ink); }
.badge.inactive { background: var(--surface-2); color: var(--muted); }
.progress { height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.muted, .hint { color: var(--muted); }
.hint { font-size: 13px; margin: 8px 0; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }
.lead { font-size: 17px; color: var(--ink-2); }
.numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* Buttons */
button { font-family: inherit; }
.primary, .secondary, .link-button, .accent-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: var(--radius-s); font: 600 15px/1.2 inherit; font-family: inherit; text-decoration: none; cursor: pointer; border: 1px solid transparent; }
.primary { background: var(--strong); color: var(--strong-ink); }
.primary:hover { opacity: .9; }
.accent-btn { background: var(--accent); color: var(--accent-ink); }
.secondary, .link-button { background: var(--surface); color: var(--ink); border-color: var(--line); }
.link-button.primary { background: var(--strong); color: var(--strong-ink); border-color: transparent; }
.secondary:hover, .link-button:hover { border-color: var(--ink); }
.full { width: 100%; }
.text-button { background: none; border: 0; padding: 6px 0; color: var(--ink); font: 600 14px inherit; font-family: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.small-link { font-size: 14px; font-weight: 600; }
.danger-link { background: none; border: 0; padding: 6px 0; color: var(--red-ink); font: 600 14px inherit; font-family: inherit; cursor: pointer; text-decoration: underline; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); text-decoration: none; min-height: 32px; }
.back-link:hover { color: var(--ink); }

/* Kleine Aktionsknöpfe */
.btn-sm { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 13px/1.2 inherit; font-family: inherit; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn-sm:hover { border-color: var(--ink); }
.btn-sm.danger { color: var(--red-ink); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions form { display: contents; }

/* Formulare */
form { margin: 0; }
label { display: block; font-size: 14px; font-weight: 600; margin: 14px 0 6px; }
input, select, textarea { width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); color: var(--ink); font: 15px/1.4 inherit; font-family: inherit; }
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 1px var(--ink); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--ink); flex: 0 0 auto; }
input[type="file"] { padding: 10px; }
input.code { font-size: 28px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
form > .primary, form > .secondary, form > button { margin-top: 18px; }
fieldset { border: 1px solid var(--line); border-radius: 16px; padding: 4px 16px 14px; margin: 16px 0 0; }
legend { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 6px; }
.field-row, .form-grid { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.delete-confirm { display: flex; align-items: center; gap: 10px; font-weight: 500; margin: 12px 0 0; }
.form-stack { display: flex; flex-direction: column; gap: 16px; }

fieldset.group { border: 0; border-top: 1px solid var(--line-soft); border-radius: 0; padding: 14px 0 0; margin: 18px 0 0; }
fieldset.group > legend { padding: 0 8px 0 0; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
details.more { margin-top: 18px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
details.more > summary { font-size: 15px; }

/* Foto-Ablesung */
.photo-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; margin: 14px 0 0; padding: 22px 16px; border: 2px dashed var(--line); border-radius: 18px; background: var(--surface-2); cursor: pointer; font-weight: 400; }
.photo-drop:hover, .photo-drop:focus-within { border-color: var(--ink); }
.photo-drop input[type="file"] { margin-top: 8px; max-width: 100%; min-height: 0; background: var(--surface); }
input.big-number { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Aufklappbare Formulare */
details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 17px; min-height: 28px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: '+'; margin-left: auto; width: 36px; height: 36px; flex: 0 0 auto; border-radius: 50%; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 400; }
details[open] > summary::after { content: '–'; }
details[open] > summary { margin-bottom: 6px; }
.entry-form { margin-top: 16px; }
.danger-zone { margin-top: 20px; border: 1px solid var(--red-bg); border-radius: 16px; padding: 14px 16px; }
.danger-zone summary { font-size: 15px; color: var(--red-ink); }

/* Seitenkopf & Abschnitte */
.page-heading { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.page-heading > div:first-child { flex: 1 1 320px; min-width: 0; }
.page-heading h1 { margin: 2px 0 4px; }
.page-heading p { color: var(--muted); margin: 0; }
.section-block { display: flex; flex-direction: column; gap: 14px; scroll-margin-top: 20px; }
.section-block > h2 { margin-top: 4px; }
.section-block.card { gap: 6px; }
.section-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.section-heading h2 { flex: 1 1 auto; }
.section-heading span { font-size: 13px; color: var(--muted); }
.workspace { display: grid; gap: 20px; align-items: start; }
@media (min-width: 1100px) { .workspace { grid-template-columns: minmax(0, 1fr) 400px; } }
.workspace > div:empty { display: none; }
.subnav { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 4px; padding: 4px; background: var(--surface); border-radius: 16px; align-self: flex-start; max-width: 100%; }
.subnav a { flex: 0 0 auto; min-height: 40px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 12px; text-decoration: none; font-size: 14px; font-weight: 500; color: var(--ink); }
.subnav a:hover { background: var(--surface-2); }
.subnav a.selected, .subnav a[aria-current] { background: var(--strong); color: var(--strong-ink); font-weight: 600; }
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); }
.stats > div { background: var(--surface); border-radius: 18px; padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stats span { font-size: 13px; color: var(--muted); }
.stats strong { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Schrittleiste der Abrechnung */
.stepper { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); width: 100%; padding: 6px; gap: 6px; }
.stepper a { min-height: 60px; gap: 12px; padding: 8px 12px; border-radius: 14px; }
.stepper a > span:last-child { display: flex; flex-direction: column; line-height: 1.25; font-weight: 600; }
.stepper .step-no { font-size: 11px; font-weight: 500; color: var(--muted); }
.stepper .step-dot { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); }
.stepper a.done .step-dot { background: var(--accent); color: var(--accent-ink); }
.stepper a.selected, .stepper a[aria-current] { background: var(--surface); color: var(--ink); outline: 2px solid var(--ink); outline-offset: -2px; }
.stepper a.selected .step-no, .stepper a[aria-current] .step-no { color: var(--muted); }
.wizard { display: grid; gap: 20px; align-items: start; }
@media (min-width: 1150px) { .wizard { grid-template-columns: minmax(0, 1fr) 360px; } .result-panel { position: sticky; top: 20px; } }
.wizard-nav { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.panel-intro { display: flex; flex-direction: column; gap: 4px; }
.panel-intro p { margin: 0; color: var(--muted); }

.soft-table { background: var(--surface-2); }
.card.soft .table-wrap { background: var(--surface); }
.month-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0 12px; }
.month-grid .delete-confirm { margin-top: 10px; }
details.statement > summary { font-size: 16px; }
details.statement > summary .grow { flex: 1 1 auto; }

/* Mieterportal */
.tenant-grid { display: grid; gap: 20px; align-items: start; }
@media (min-width: 1100px) { .tenant-grid { grid-template-columns: 380px minmax(0, 1fr); } }
.hero-number { font-size: 40px; font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hero-number span { font-size: 18px; font-weight: 500; color: var(--muted); }
.legend { display: flex; gap: 14px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.key { display: inline-block; width: 24px; height: 0; border-top: 3px solid var(--ink); }
.key-prev { border-top: 2px dashed var(--muted); }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart-grid { stroke: var(--line-soft); stroke-width: 1; }
.chart-label { fill: var(--muted); font-size: 12px; font-family: inherit; }
.chart-area { fill: var(--accent); fill-opacity: .35; }
.chart-cur { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-prev { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 6 5; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--ink); stroke: var(--surface); stroke-width: 2; }
.chart-dot:hover { fill: var(--accent); stroke: var(--ink); }
.chart-dot-prev { fill: var(--muted); stroke: var(--surface); stroke-width: 2; }
.choice { display: flex; align-items: center; gap: 12px; margin: 0; padding: 14px 16px; border: 2px solid var(--line); border-radius: 16px; background: var(--surface); cursor: pointer; font-weight: 400; }
.choice:has(input:checked) { border-color: var(--ink); }
.choice .grow { display: flex; flex-direction: column; flex: 1 1 auto; }
.btn-sm[aria-current] { background: var(--strong); color: var(--strong-ink); border-color: transparent; }

details.portal > summary { font-size: 13px; min-height: 36px; margin: 0; }
details.portal > summary::after { display: none; }
details.portal[open] { flex-basis: 100%; order: 10; background: var(--surface); border-radius: 14px; padding: 12px; }
.invite-btn { margin-top: 29px !important; }
.review { display: grid; gap: 14px; grid-template-columns: 120px minmax(0, 1fr); align-items: start; }
.review img { width: 120px; height: 120px; object-fit: cover; border-radius: 14px; background: var(--surface-2); }

/* Haus-Ansicht */
.canvas-wrap { position: relative; height: calc(100vh - 250px); min-height: 520px; border-radius: 24px; overflow: hidden; background-color: var(--surface); background-image: radial-gradient(var(--line) 1.2px, transparent 1.2px); background-size: 22px 22px; }
.canvas-viewport { position: absolute; inset: 0; cursor: grab; touch-action: none; outline: none; }
.canvas-viewport:active { cursor: grabbing; }
.canvas-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.canvas-edges { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; }
.edge { fill: none; stroke: var(--ink-2); stroke-width: 2; }
.edge-parent { stroke: var(--muted); stroke-dasharray: 7 6; }
.edge-static { stroke: var(--line); stroke-width: 2.5; }
.edge.is-selected { stroke: var(--accent); stroke-width: 5; }
.edge-hit { fill: none; stroke: transparent; stroke-width: 16; cursor: pointer; pointer-events: stroke; }
.edge-draft { fill: none; stroke: var(--ink); stroke-width: 2; stroke-dasharray: 4 4; pointer-events: none; }
.node { position: absolute; left: 0; top: 0; width: 230px; padding: 12px 16px 13px; border-radius: 18px; background: var(--surface); border: 2px solid var(--line); box-shadow: 0 6px 18px rgba(0, 0, 0, .06); cursor: pointer; user-select: none; display: flex; flex-direction: column; gap: 1px; }
.node:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.node-kind { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.node-title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.node-sub { font-size: 12px; color: var(--muted); line-height: 1.35; }
.node-property { background: var(--strong); color: var(--strong-ink); border-color: var(--strong); width: 240px; padding: 16px 18px; }
.node-property .node-kind, .node-property .node-sub { color: inherit; opacity: .75; }
.node-heating { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.node-heating .node-kind, .node-heating .node-sub { color: inherit; opacity: .8; }
.node-meter .node-kind::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.node-meter.t-heat .node-kind::before { background: #E8590C; }
.node-meter.t-hot_water .node-kind::before { background: #D6336C; }
.node-meter.t-cold_water .node-kind::before { background: #1C7ED6; }
.node-meter.t-electricity .node-kind::before { background: #F2B705; }
.node-meter.t-gas .node-kind::before { background: #7048E8; }
.node-meter.t-oil .node-kind::before, .node-meter.t-oil_counter .node-kind::before { background: #8D6E63; }
.node.s-due { border-color: var(--lav-ink); }
.node.s-retired, .node.is-archived { opacity: .55; }
.node.is-selected { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--ink); }
.node.is-target { box-shadow: 0 0 0 4px var(--accent); }
.port { position: absolute; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink-2); }
.port-parent { right: -9px; }
.port-child { left: -10px; width: 18px; height: 18px; margin-top: -9px; background: var(--accent); border-color: var(--ink); cursor: crosshair; }
.port-child:hover { transform: scale(1.2); }
.port-child::before { content: ''; position: absolute; inset: -12px; border-radius: 50%; }
.port-parent::before { content: ''; position: absolute; inset: -8px; }
.canvas-toolbar { position: absolute; left: 16px; top: 16px; z-index: 2; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.canvas-toolbar .icon-btn { width: 40px; height: 40px; }
.canvas-panel { position: absolute; right: 16px; top: 16px; z-index: 3; width: 300px; max-width: calc(100% - 32px); max-height: calc(100% - 32px); overflow: auto; box-shadow: 0 10px 30px rgba(0, 0, 0, .12); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.canvas-panel label { margin-top: 8px; }
.canvas-panel .panel-close { position: absolute; right: 12px; top: 12px; font-size: 20px; }
.canvas-panel h3 { padding-right: 40px; }
.canvas-toast { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 4; background: var(--strong); color: var(--strong-ink); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px); }
.canvas-toast.bad { background: var(--red-bg); color: var(--red-ink); }
.canvas-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
.canvas-legend span { display: inline-flex; align-items: center; gap: 8px; }
.lg { display: inline-block; width: 26px; border-top: 2px solid var(--ink-2); }
.lg-parent { border-top: 2px dashed var(--muted); }
.lg-static { border-top: 3px solid var(--line); }

/* Objekt-Umschalter */
.switcher { position: relative; }
.switcher > summary { font-size: 14px; min-height: 32px; gap: 6px; }
.switcher > summary::after { display: none; }
.switcher-menu { position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; min-width: 260px; max-height: 60vh; overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; box-shadow: 0 10px 30px rgba(0, 0, 0, .14); border: 1px solid var(--line); }
.topbar .crumbs .switcher-menu a { color: var(--ink); }
.switcher-menu a { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--ink); }
.switcher-menu a:hover, .switcher-menu a[aria-current] { background: var(--surface-2); }
.switcher-menu .switcher-all { border-top: 1px solid var(--line-soft); border-radius: 0 0 12px 12px; margin-top: 4px; font-weight: 600; font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Meldungen */
.notice, .errors { border-radius: 16px; padding: 14px 18px; font-size: 14px; }
.notice { background: var(--accent-soft); color: var(--ink); }
.errors { background: var(--red-bg); color: var(--red-ink); }
.errors ul { margin: 6px 0 0; padding-left: 20px; }
.errors p { margin: 6px 0 0; color: inherit; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 32px 24px; text-align: center; }
.empty h2 { margin-bottom: 6px; }
.empty p { color: var(--muted); margin: 0 auto; max-width: 460px; }
.empty.compact { padding: 22px; }
.empty-icon { display: inline-flex; width: 48px; height: 48px; border-radius: 50%; background: var(--surface-2); align-items: center; justify-content: center; font-size: 22px; margin-bottom: 10px; }

/* Tabellen */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); padding: 6px 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td small { display: block; color: var(--muted); margin-top: 2px; }
tbody tr:hover { background: var(--surface-2); }
.total-row td { font-weight: 600; background: var(--surface-2); }
.calculation { font-size: 13px; }
.statement .table-wrap { padding: 0; background: transparent; }

/* Listen & Karten aus der bisherigen Oberfläche */
.user-heading { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 16px; }
.user-heading > div:first-child { flex: 1 1 220px; min-width: 0; }
.user-heading p { color: var(--muted); margin: 2px 0 0; font-size: 14px; }
.inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inline-actions form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inline-actions .delete-confirm { margin: 0; font-size: 13px; }
.unit-card, .statement, .user-card { display: flex; flex-direction: column; gap: 12px; }
.tenancy-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); }
.tenancy-line > div { flex: 1 1 auto; display: flex; flex-direction: column; }
.tenancy-line span { font-size: 13px; color: var(--muted); }
.period-link { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); }
.period-link > div { flex: 1 1 auto; }
.period-link p { color: var(--muted); margin: 2px 0 0; }
.period-link > span { font-weight: 600; font-size: 14px; }
.period-link:hover { outline: 2px solid var(--ink); outline-offset: -2px; }
.user-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.user-controls select { width: auto; }
.narrow { max-width: 520px; width: 100%; margin: 0 auto; }
.step { font-size: 11px; font-weight: 600; letter-spacing: .03em; padding: 3px 8px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); display: inline-block; margin-bottom: 12px; }

/* Seitenumbruch */
.pagination, .log-pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
.log-pagination-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.log-pagination-buttons a, .log-pagination-buttons span, .pagination a { min-width: 40px; height: 40px; padding: 0 12px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface); text-decoration: none; font-size: 14px; }
.log-pagination-buttons [aria-current="page"] { background: var(--strong); color: var(--strong-ink); }
.log-pagination-buttons [aria-disabled="true"] { color: var(--muted); }
.pagination svg { width: 16px; height: 16px; }

/* Hilfsklassen (Inline-Styles sind per Content-Security-Policy gesperrt) */
.m0 { margin: 0 !important; }
.mt0 { margin-top: 0 !important; }
.mt-s { margin-top: 8px; }
.mt { margin-top: 14px; }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.gap-s { gap: 8px !important; }
.gap-m { gap: 12px !important; }
.gap-l { gap: 16px !important; }
.align-start { align-items: flex-start !important; }
.divider-top { padding-top: 12px; border-top: 1px solid var(--line-soft); }
.avatar.soft { width: 44px; height: 44px; background: var(--surface-2); color: var(--ink); }
.w-form { max-width: 640px; }
.progress > .w-0 { width: 0%; }
.progress > .w-10 { width: 10%; }
.progress > .w-20 { width: 20%; }
.progress > .w-30 { width: 30%; }
.progress > .w-40 { width: 40%; }
.progress > .w-50 { width: 50%; }
.progress > .w-60 { width: 60%; }
.progress > .w-70 { width: 70%; }
.progress > .w-80 { width: 80%; }
.progress > .w-90 { width: 90%; }
.progress > .w-100 { width: 100%; }

/* Kontoumsätze */
.bank-table td { vertical-align: middle; }
.bank-table select { min-width: 220px; min-height: 40px; padding: 6px 10px; font-size: 14px; }
.bank-text { min-width: 220px; max-width: 420px; }
.bank-text .tag { margin-top: 6px; }
.bank-text small.warn, small.warn { color: var(--red-ink); }
.amount-input { width: 110px; min-height: 40px; padding: 6px 10px; text-align: right; font-variant-numeric: tabular-nums; }
td.pos { font-weight: 600; }
.subnav .count { margin-left: 6px; }

/* Einfach / Technisch */
body[data-mode="simple"] .tech-only { display: none !important; }
body[data-mode="technical"] .simple-only { display: none !important; }

/* Schmale Bildschirme */
@media (max-width: 760px) {
    .shell { flex-direction: column; padding: 12px; gap: 12px; }
    .rail { position: static; flex: 0 0 auto; width: 100%; flex-direction: row; max-height: none; overflow-x: auto; padding: 8px; border-radius: 20px; }
    .rail-logo { margin: 0 6px 0 0; }
    .rail-sep { width: 1px; height: 40px; margin: 0 6px; }
    .rail-spacer { min-width: 8px; min-height: 0; }
    .rail-item { width: 68px; }
    h1 { font-size: 26px; }
    .card { padding: 18px; }
    .segmented button, .segmented a { padding: 0 12px; }
    .topbar .avatar { display: none; }
    .topbar .crumbs { flex-basis: 100%; }
}
@media print {
    .rail, .topbar { display: none; }
    body { background: #FFFFFF; }
}
