/* ════════════════════════════════════════════════════════════════════
   Mietverwaltung Poststraße – Stylesheet
   Teil 1: unverändert aus dem bisherigen Dashboard (index.html) übernommen.
   Teil 2 (unten): Ergänzungen für Login, Formulare, Detailseiten.
   ════════════════════════════════════════════════════════════════════ */

/* Inter lokal ausgeliefert (kein Google-Fonts-Abruf → keine IP-Übermittlung an Dritte) */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
  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: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/inter-latin-ext-wght-normal.woff2') format('woff2-variations');
  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: #0a0a0c;
    --bg-2: #111114;
    --surface: rgba(255,255,255,0.04);
    --surface-strong: rgba(255,255,255,0.06);
    --surface-hover: rgba(255,255,255,0.08);
    --border: rgba(255,255,255,0.08);
    --border-strong: rgba(255,255,255,0.14);
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #6e6e73;

    --accent: #0a84ff;
    --indigo: #5e5ce6;
    --purple: #bf5af2;
    --pink: #ff375f;
    --orange: #ff9f0a;
    --yellow: #ffd60a;
    --green: #30d158;
    --teal: #64d2ff;
    --red: #ff453a;

    --r-sm: 12px;
    --r-md: 18px;
    --r-lg: 24px;
    --r-xl: 32px;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }

  html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.011em;
    min-height: 100vh;
    overflow-x: hidden;
  }

  /* ── Animated aurora background ───────────────────────── */
  .aurora {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
  }
  .blob {
    position: absolute;
    width: 60vw;
    height: 60vw;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.5;
    animation: drift 26s ease-in-out infinite alternate;
  }
  .blob.a { background: radial-gradient(circle, #0a84ff 0%, transparent 60%); top: -20%; left: -10%; }
  .blob.b { background: radial-gradient(circle, #bf5af2 0%, transparent 60%); top: 10%; right: -15%; animation-duration: 32s; }
  .blob.c { background: radial-gradient(circle, #ff375f 0%, transparent 60%); bottom: -25%; left: 30%; animation-duration: 28s; opacity: 0.35; }
  @keyframes drift {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(4vw, -3vw) scale(1.1); }
    100% { transform: translate(-3vw, 5vw) scale(0.95); }
  }
  .grain {
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-image: radial-gradient(rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 3px 3px;
    mix-blend-mode: overlay;
  }

  /* ── Top nav ───────────────────────────────────────────── */
  .nav {
    position: sticky; top: 12px;
    z-index: 100;
    margin: 12px auto 0;
    max-width: 1320px;
    padding: 0 16px;
  }
  .nav-inner {
    backdrop-filter: saturate(180%) blur(24px);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    background: rgba(20,20,24,0.55);
    border: 1px solid var(--border);
    border-radius: 980px;
    padding: 10px 14px 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  }
  .brand {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
    display: flex; align-items: center; gap: 10px;
  }
  .brand-mark {
    width: 26px; height: 26px;
    border-radius: 8px;
    background:
      radial-gradient(circle at 30% 30%, #64d2ff 0%, transparent 50%),
      linear-gradient(135deg, #0a84ff 0%, #bf5af2 100%);
    display: grid; place-items: center;
    color: white; font-weight: 800; font-size: 13px;
    box-shadow: 0 4px 12px rgba(10, 132, 255, 0.45), inset 0 1px 0 rgba(255,255,255,0.25);
  }
  .nav-links { display: flex; gap: 4px; margin-left: 24px; }
  .nav-link {
    font-size: 14px; font-weight: 500;
    color: var(--text-2);
    padding: 6px 12px;
    border-radius: 980px;
    cursor: pointer;
    transition: color .15s ease, background .15s ease;
  }
  .nav-link:hover { color: var(--text); background: var(--surface); }
  .nav-link.active { color: var(--text); background: var(--surface-strong); }
  .nav-right { display: flex; gap: 8px; align-items: center; }
  .btn {
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 980px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .2s ease;
    background: transparent;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .btn-ghost { background: var(--surface); border-color: var(--border); }
  .btn-ghost:hover { background: var(--surface-hover); }
  .btn-primary {
    background: linear-gradient(135deg, #0a84ff 0%, #5e5ce6 100%);
    color: white;
    box-shadow: 0 6px 16px rgba(10, 132, 255, 0.4);
  }
  .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(10, 132, 255, 0.55); }

  /* ── Main ──────────────────────────────────────────────── */
  main {
    max-width: 1320px;
    margin: 0 auto;
    padding: 56px 24px 80px;
  }

  .hero {
    margin-bottom: 48px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
  }
  @media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; }
  }

  .hero-left {
    padding: 8px 8px 0 0;
  }
  .eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 600;
    color: var(--text-2);
    padding: 6px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 980px;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }
  .eyebrow::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: var(--green); box-shadow: 0 0 12px var(--green);
  }
  h1 {
    font-size: clamp(40px, 6vw, 64px);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.02;
    margin-bottom: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #b8b8c0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  h1 .accent {
    background: linear-gradient(135deg, #64d2ff 0%, #5e5ce6 50%, #bf5af2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  .lede {
    font-size: 18px;
    color: var(--text-2);
    max-width: 480px;
    line-height: 1.5;
    margin-bottom: 28px;
  }
  .hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }

  /* Donut card */
  .donut-card {
    background: linear-gradient(160deg, rgba(30,30,36,0.85) 0%, rgba(20,20,26,0.85) 100%);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 18px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
    position: relative;
    overflow: hidden;
  }
  .donut-card::before {
    content: '';
    position: absolute; top: -50%; right: -30%;
    width: 80%; height: 100%;
    background: radial-gradient(circle, rgba(94, 92, 230, 0.25) 0%, transparent 70%);
    pointer-events: none;
  }
  .donut-card h3 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-2);
    margin-bottom: 4px;
  }
  .donut-card .sub {
    font-size: 12px; color: var(--text-3);
  }
  .donut-wrap {
    position: relative;
    width: 100%; max-width: 132px;
    aspect-ratio: 1 / 1;
    margin: 12px auto;
  }
  .donut-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
  .donut-track { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 14; }
  .donut-fill { fill: none; stroke: url(#donutGrad); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.22,1,.36,1); }
  .donut-center {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
  }
  .donut-pct { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
  .donut-label { font-size: 11px; color: var(--text-2); margin-top: 3px; }
  .legend { display: flex; justify-content: space-around; gap: 10px; margin-top: 6px; }
  .legend-item { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); }
  .legend-dot { width: 10px; height: 10px; border-radius: 3px; }

  /* ── KPI cards ─────────────────────────────────────────── */
  .kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 48px;
  }
  .kpi {
    position: relative;
    background: var(--surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 22px 22px 18px;
    overflow: hidden;
    transition: transform .25s ease, border-color .25s ease, background .25s ease;
  }
  .kpi:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
    background: var(--surface-strong);
  }
  .kpi::after {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: var(--kpi-color, var(--accent));
    opacity: 0.7;
  }
  .kpi-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
  .kpi-label {
    font-size: 13px; font-weight: 500;
    color: var(--text-2);
    text-transform: uppercase; letter-spacing: 0.06em;
  }
  .kpi-icon {
    width: 32px; height: 32px;
    border-radius: 10px;
    background: var(--kpi-color, var(--accent));
    background: linear-gradient(135deg, var(--kpi-color) 0%, var(--kpi-color-2, var(--kpi-color)) 100%);
    display: grid; place-items: center;
    color: white;
    box-shadow: 0 4px 12px var(--kpi-glow, rgba(10,132,255,0.35));
  }
  .kpi-value {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.028em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
  }
  .kpi-foot { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 10px; gap: 12px; }
  .kpi-delta { font-size: 13px; color: var(--text-3); }
  .kpi-delta.up { color: var(--green); }
  .kpi-delta.down { color: var(--red); }
  .spark { flex: 0 0 80px; height: 28px; opacity: 0.9; }

  /* ── Section ───────────────────────────────────────────── */
  .section {
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  }
  .section-head {
    display: flex; justify-content: space-between; align-items: flex-end;
    margin-bottom: 22px; gap: 16px; flex-wrap: wrap;
  }
  .section-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.022em;
  }
  .section-sub {
    font-size: 14px; color: var(--text-2); margin-top: 4px;
  }
  .seg {
    display: inline-flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 980px;
    padding: 4px;
  }
  .seg button {
    font-family: inherit;
    border: none; background: transparent;
    color: var(--text-2);
    font-size: 13px; font-weight: 500;
    padding: 6px 14px;
    border-radius: 980px;
    cursor: pointer;
    transition: all .2s ease;
  }
  .seg button.active {
    background: linear-gradient(135deg, #0a84ff 0%, #5e5ce6 100%);
    color: white;
  }

  /* ── Unit cards grid ───────────────────────────────────── */
  .units-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
  }
  .unit {
    position: relative;
    background: linear-gradient(160deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 20px;
    overflow: hidden;
    transition: transform .25s ease, border-color .25s ease;
    cursor: pointer;
  }
  .unit:hover { transform: translateY(-3px); border-color: var(--border-strong); }
  .unit-thumb {
    height: 110px;
    border-radius: var(--r-md);
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    background: var(--surface-strong);
    display: grid; place-items: center;
  }
  .unit-thumb::before {
    content: '';
    position: absolute; inset: 0;
    background: var(--thumb-bg, linear-gradient(135deg, #0a84ff 0%, #5e5ce6 100%));
    opacity: 0.85;
  }
  .unit-thumb::after {
    content: '';
    position: absolute; inset: 0;
    background-image:
      radial-gradient(circle at 20% 30%, rgba(255,255,255,0.25) 0%, transparent 40%),
      radial-gradient(circle at 80% 70%, rgba(0,0,0,0.2) 0%, transparent 50%);
  }
  .unit-thumb svg {
    position: relative; z-index: 1;
    width: 44px; height: 44px;
    color: white;
    opacity: 0.95;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
  }
  .unit-id-pill {
    position: absolute; top: 12px; left: 12px;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(10px);
    color: white;
    padding: 4px 10px;
    border-radius: 980px;
    font-size: 12px; font-weight: 600;
    letter-spacing: 0.02em;
    z-index: 2;
  }
  .unit-status {
    position: absolute; top: 12px; right: 12px;
    z-index: 2;
  }
  .unit-type-pill {
    position: absolute; bottom: 12px; left: 12px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    color: white;
    padding: 4px 10px 4px 8px;
    border-radius: 980px;
    font-size: 11px; font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    display: inline-flex; align-items: center; gap: 5px;
    z-index: 2;
  }
  .unit-type-pill svg { width: 12px; height: 12px; }
  .unit-type-pill.gewerbe { background: linear-gradient(135deg, rgba(255,159,10,0.85), rgba(255,55,95,0.85)); }
  .unit-type-pill.privat   { background: rgba(10,132,255,0.85); }
  .unit h4 { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; margin-bottom: 2px; }
  .unit-addr { font-size: 13px; color: var(--text-2); margin-bottom: 16px; line-height: 1.4; }
  .unit-row {
    display: flex; justify-content: space-between;
    padding: 10px 0;
    border-top: 1px solid var(--border);
    font-size: 13px;
  }
  .unit-row span:first-child { color: var(--text-2); }
  .unit-row span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }
  .unit-row.total span:last-child {
    background: linear-gradient(135deg, #64d2ff 0%, #5e5ce6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 15px;
  }

  /* ── Pills ─────────────────────────────────────────────── */
  .pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border-radius: 980px;
    font-size: 11px; font-weight: 600;
    letter-spacing: 0.02em;
    backdrop-filter: blur(10px);
  }
  .pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
  .pill-ok    { background: rgba(48, 209, 88, 0.16);  color: #6ee597; }
  .pill-ok::before    { background: var(--green); box-shadow: 0 0 8px var(--green); }
  .pill-warn  { background: rgba(255, 159, 10, 0.18); color: #ffc266; }
  .pill-warn::before  { background: var(--orange); box-shadow: 0 0 8px var(--orange); }
  .pill-bad   { background: rgba(255, 69, 58, 0.18);  color: #ff8a82; }
  .pill-bad::before   { background: var(--red); box-shadow: 0 0 8px var(--red); }
  .pill-empty { background: rgba(255,255,255,0.08); color: var(--text-2); }
  .pill-empty::before { background: var(--text-3); }

  /* ── Cashflow stripe ──────────────────────────────────── */
  .cashflow {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    margin-bottom: 24px;
  }
  .cf-cell {
    background: rgba(20,20,24,0.6);
    padding: 18px 20px;
    backdrop-filter: blur(20px);
  }
  .cf-label {
    font-size: 12px; font-weight: 500;
    color: var(--text-2);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-bottom: 8px;
  }
  .cf-value {
    font-size: 24px; font-weight: 700;
    letter-spacing: -0.022em;
    font-variant-numeric: tabular-nums;
  }
  .cf-value.pos { color: var(--green); }
  .cf-value.neg { color: var(--red); }
  .cf-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }

  /* ── Loan cards ───────────────────────────────────────── */
  .loans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
  }
  .loan {
    position: relative;
    background: linear-gradient(160deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 22px;
    overflow: hidden;
    transition: transform .25s ease, border-color .25s ease;
  }
  .loan:hover { transform: translateY(-3px); border-color: var(--border-strong); }
  .loan::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--loan-color, linear-gradient(135deg,#0a84ff,#5e5ce6));
  }
  .loan-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 14px; gap: 10px;
  }
  .loan-id { display: flex; align-items: center; gap: 12px; }
  .bank-logo {
    width: 46px; height: 46px; flex: 0 0 46px;
    border-radius: 12px; background: #fff;
    display: grid; place-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(0,0,0,0.05);
  }
  .bank-logo img { width: 30px; height: 30px; object-fit: contain; }
  .loan-bank { font-size: 16px; font-weight: 600; letter-spacing: -0.015em; }
  .loan-obj  { font-size: 12px; color: var(--text-2); margin-top: 2px; }
  .loan-dnr  { font-size: 11px; color: var(--text-3); font-family: ui-monospace, SFMono-Regular, monospace; }
  .progress-wrap { margin: 16px 0 14px; }
  .progress-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
  .progress-meta .v { color: var(--text); font-weight: 600; }
  .progress-bar {
    height: 8px;
    background: var(--surface-strong);
    border-radius: 980px;
    overflow: hidden;
    position: relative;
  }
  .progress-fill {
    position: absolute; left: 0; top: 0; bottom: 0;
    background: var(--loan-color, linear-gradient(90deg,#0a84ff,#5e5ce6));
    border-radius: 980px;
    transition: width 1s cubic-bezier(.22,1,.36,1);
  }
  .loan-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 14px 0;
    padding: 12px;
    background: rgba(0,0,0,0.25);
    border-radius: var(--r-sm);
  }
  .loan-stat { text-align: center; }
  .loan-stat-label {
    font-size: 10px; color: var(--text-3);
    text-transform: uppercase; letter-spacing: 0.05em;
    margin-bottom: 4px;
  }
  .loan-stat-value {
    font-size: 14px; font-weight: 600;
    font-variant-numeric: tabular-nums;
  }
  .loan-rate {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: 14px;
    border-top: 1px solid var(--border);
  }
  .loan-rate-label { font-size: 12px; color: var(--text-2); }
  .loan-rate-value {
    font-size: 20px; font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(135deg, #64d2ff 0%, #5e5ce6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  .zb-warn {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 600;
    padding: 3px 9px;
    border-radius: 980px;
    background: rgba(255, 159, 10, 0.18);
    color: #ffc266;
    margin-top: 8px;
  }
  .zb-warn.urgent { background: rgba(255, 69, 58, 0.18); color: #ff8a82; }

  /* ── Payments table ────────────────────────────────────── */
  .pay-list { display: flex; flex-direction: column; gap: 8px; }
  .pay-row {
    display: grid;
    grid-template-columns: 40px 1fr auto auto;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    transition: background .2s ease, border-color .2s ease, transform .2s ease;
  }
  .pay-row:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
    transform: translateX(2px);
  }
  .avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 14px; font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--av-1, #0a84ff) 0%, var(--av-2, #5e5ce6) 100%);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  }
  .pay-name { font-weight: 600; font-size: 14px; }
  .pay-meta { font-size: 12px; color: var(--text-2); margin-top: 2px; }
  .pay-amount {
    font-size: 16px; font-weight: 700;
    letter-spacing: -0.015em;
    font-variant-numeric: tabular-nums;
  }

  /* ── Footer ───────────────────────────────────────────── */
  .hint {
    text-align: center;
    color: var(--text-3);
    font-size: 13px;
    margin-top: 48px;
  }
  .hint code {
    background: var(--surface);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
  }

  @media (max-width: 640px) {
    main { padding: 32px 16px 60px; }
    .nav-links { display: none; }
    .section { padding: 20px; }
    .donut-card { padding: 20px; }
    .nav-right .btn:not(.btn-primary) { display: none; }
  }

  /* ── Generische Datentabellen (Mieter, Verträge, Kosten, Rendite, Zähler) ── */
  .table-scroll { overflow-x: auto; margin: 0 -4px; }
  .dtable {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 560px;
  }
  .dtable thead th {
    text-align: left;
    font-weight: 600;
    color: var(--text-2);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-strong);
    white-space: nowrap;
    position: sticky; top: 0;
  }
  .dtable tbody td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    color: var(--text);
  }
  .dtable tbody tr { transition: background .15s ease; }
  .dtable tbody tr:hover { background: var(--surface); }
  .dtable .num { text-align: right; font-variant-numeric: tabular-nums; }
  .dtable .muted { color: var(--text-3); }
  .dtable .strong { font-weight: 600; }
  .dtable .row-head td { font-weight: 700; color: var(--text); background: var(--surface); text-transform: uppercase; font-size: 11px; letter-spacing: .05em; }
  .dtable .row-sum td { font-weight: 700; border-top: 1px solid var(--border-strong); }

  .ampel { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 980px; font-size: 11px; font-weight: 600; }
  .ampel.ok   { background: rgba(48,209,88,0.16);  color: #6ee597; }
  .ampel.warn { background: rgba(255,159,10,0.18); color: #ffc266; }
  .ampel.bad  { background: rgba(255,69,58,0.18);  color: #ff8a82; }
  .ampel.none { background: rgba(255,255,255,0.07); color: var(--text-3); }

  .chip { display:inline-block; padding: 2px 8px; border-radius: 980px; font-size: 11px; font-weight: 600; }
  .chip.privat  { background: rgba(10,132,255,0.18); color: #6db8ff; }
  .chip.gewerbe { background: rgba(255,159,10,0.18); color: #ffc266; }
  .chip.ja  { background: rgba(48,209,88,0.16); color: #6ee597; }
  .chip.nein{ background: rgba(255,255,255,0.07); color: var(--text-3); }

  /* Kostenbalken */
  .kosten-bar-wrap { display:flex; align-items:center; gap:10px; }
  .kosten-bar { flex:1; height:6px; border-radius:980px; background: rgba(255,255,255,0.08); overflow:hidden; min-width:60px; }
  .kosten-bar > div { height:100%; border-radius:980px; background: linear-gradient(90deg,#0a84ff,#5e5ce6); }

  /* Aufschlüsselung pro Haus */
  .haus-grid { display:grid; grid-template-columns: repeat(auto-fit,minmax(260px,1fr)); gap:16px; }
  .haus-card {
    background: linear-gradient(160deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
    border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px;
  }
  .haus-card h4 { font-size:16px; font-weight:600; margin-bottom:14px; }
  .haus-stat { display:flex; justify-content:space-between; padding:7px 0; font-size:13px; border-top:1px solid var(--border); }
  .haus-stat:first-of-type { border-top:none; }
  .haus-stat span:first-child { color: var(--text-2); }
  .haus-stat span:last-child { font-weight:600; font-variant-numeric: tabular-nums; }

  /* Rendite-Tabelle Akzent */
  .rendite-pos { color: #6ee597; font-weight:600; }
  .rendite-neg { color: #ff8a82; font-weight:600; }

  .src-note { font-size:12px; color: var(--text-3); margin-top:10px; }
  .src-note b { color: var(--orange); font-weight:600; }

  a.nav-link { text-decoration: none; }
  html { scroll-behavior: smooth; }
  .section[id], section[id] { scroll-margin-top: 96px; }

  /* ── Gebäude-Aufrisse als fest fixierter Hintergrund ── */
  main { position: relative; z-index: 1; }
  .skyline {
    position: fixed; inset: 0; z-index: 0;
    pointer-events: none; overflow: hidden;
  }
  /* Scrim: links + unten abdunkeln für Lesbarkeit */
  .skyline::after {
    content: '';
    position: absolute; inset: 0;
    background:
      linear-gradient(90deg, rgba(10,10,12,0.55) 0%, rgba(10,10,12,0.18) 34%, transparent 56%),
      linear-gradient(0deg, var(--bg) 0%, transparent 34%);
  }
  .bg-build {
    position: absolute; bottom: 0;
    background-repeat: no-repeat;
    background-size: contain;
    /* hell & entsättigt → schimmert auch durch die Frosted-Glass-Sektionen */
    filter: grayscale(0.4) brightness(1.35) contrast(0.92);
    opacity: 0.5;
  }
  .bg-build.bAll {
    background-image: url('../img/objekte.png');
    background-position: bottom center;
    left: 50%; transform: translateX(-50%);
    bottom: 0; width: 100vw; height: 94vh;
  }
  @media (max-width: 900px) {
    .bg-build.bAll { width: 150vw; opacity: 0.3; }
  }

/* ════════════════════════════════════════════════════════════════════
   Teil 2 – Ergänzungen CRM (gleiche Tokens, gleiche Formensprache)
   ════════════════════════════════════════════════════════════════════ */
:root { color-scheme: dark; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 8px; }
@media (prefers-reduced-motion: reduce) {
  .blob { animation: none; }
  .kpi, .unit, .loan, .pay-row { transition: none; }
}

/* Navigation: Links direkt neben der Marke (wie bisher), Nutzer rechts */
.nav-inner > .nav-links { margin-left: 24px; margin-right: auto; }
a.brand { color: var(--text); }
.nav-user { display: flex; align-items: center; gap: 8px; }
@media (max-width: 1080px) and (min-width: 641px) { .nav-link { padding: 6px 9px; } .nav-user .who { display: none; } }
/* Navigation: Nutzer-Menü und mobile Leiste */
.nav-user { display: flex; align-items: center; gap: 8px; }
.nav-user .who { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.nav-user .avatar { width: 32px; height: 32px; font-size: 12px; }
@media (max-width: 640px) {
  .nav-inner { flex-wrap: wrap; border-radius: 22px; row-gap: 8px; }
  .nav-links { display: flex !important; order: 3; width: 100%; margin-left: 0; overflow-x: auto;
               scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-link { white-space: nowrap; }
  .nav-user .who { display: none; }
}

/* Kleinere Buttons, Gefahr, Link-Button */
.btn-sm { font-size: 13px; padding: 6px 12px; }
.btn-danger { background: rgba(255,69,58,0.16); border-color: rgba(255,69,58,0.3); color: #ff8a82; }
.btn-danger:hover { background: rgba(255,69,58,0.26); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn-link { background: none; border: none; color: var(--teal); padding: 0; font: inherit; cursor: pointer; }

/* Zurück-Link / Brotkrumen */
.crumb { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-2);
         text-decoration: none; margin-bottom: 18px; }
.crumb:hover { color: var(--text); }

/* Seitenkopf für Unterseiten */
.page-head { margin-bottom: 28px; display: flex; justify-content: space-between; align-items: flex-end;
             gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(32px, 4.4vw, 48px); margin-bottom: 8px; }
.page-head .lede { margin-bottom: 0; }

/* Hinweis-Banner */
.notice { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: var(--r-md);
          border: 1px solid var(--border); background: var(--surface); margin-bottom: 16px; font-size: 14px;
          line-height: 1.5; }
.notice .ico { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; }
.notice.warn { background: rgba(255,159,10,0.08); border-color: rgba(255,159,10,0.25); }
.notice.warn .ico { background: rgba(255,159,10,0.2); color: #ffc266; }
.notice.bad { background: rgba(255,69,58,0.08); border-color: rgba(255,69,58,0.28); }
.notice.bad .ico { background: rgba(255,69,58,0.2); color: #ff8a82; }
.notice.info .ico { background: rgba(10,132,255,0.2); color: #6db8ff; }
.notice b { font-weight: 600; }
.notice ul { margin: 6px 0 0 18px; }
.notice li { margin: 2px 0; }

/* Frist-Karte Betriebskostenabrechnung */
.frist { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; }
.frist-tage { font-size: 56px; font-weight: 800; letter-spacing: -0.04em; line-height: 1;
              font-variant-numeric: tabular-nums; }
.frist-tage small { display: block; font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--text-2);
                    margin-top: 6px; text-transform: uppercase; }
.frist-list { display: grid; gap: 12px; }
.frist-row { display: grid; grid-template-columns: minmax(120px, 180px) 1fr auto; gap: 14px; align-items: center;
             font-size: 14px; text-decoration: none; padding: 10px 12px; border-radius: var(--r-sm);
             transition: background .15s ease; }
.frist-row:hover { background: var(--surface); }
.frist-row .meta { color: var(--text-2); font-size: 13px; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .frist { grid-template-columns: 1fr; gap: 14px; }
  .frist-row { grid-template-columns: 1fr auto; }
  .frist-row .progress-bar { grid-column: 1 / -1; }
}

/* Detail-Raster (Stammdaten) */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1px;
         background: var(--border); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.fact { background: rgba(20,20,24,0.6); padding: 14px 16px; }
.fact .k { font-size: 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.fact .v { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.fact .v.muted { color: var(--text-3); font-weight: 500; }

/* Akte */
.akte-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.ordner { border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px;
          background: linear-gradient(160deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01)); }
.ordner-head { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.ordner-head svg { color: var(--teal); flex: 0 0 auto; }
.ordner .anz { font-size: 13px; color: var(--text-2); }
.ordner ul { list-style: none; margin-top: 8px; font-size: 13px; color: var(--text-2); }
.ordner li { padding: 3px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pfad { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--text-3);
        overflow-wrap: anywhere; }

/* Mietverhältnis-Verlauf */
.mv-list { display: grid; gap: 10px; }
.mv-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 14px 16px;
           border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface);
           text-decoration: none; transition: background .15s ease, border-color .15s ease; }
.mv-item:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.mv-item .t { font-weight: 600; font-size: 15px; }
.mv-item .s { font-size: 13px; color: var(--text-2); margin-top: 3px; }

/* Formulare */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px 18px; }
.form-grid .wide { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field .field-hint { font-size: 12px; color: var(--text-3); }
.input, .field input, .field select, .field textarea {
  font: inherit; font-size: 16px; color: var(--text);
  background: rgba(0,0,0,0.28); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: 11px 13px; width: 100%; transition: border-color .15s ease, background .15s ease;
}
.field textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: rgba(255,255,255,0.24); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); background: rgba(0,0,0,0.4);
  box-shadow: 0 0 0 3px rgba(10,132,255,0.22);
}
.field select option { background: #1c1c22; }
.field.check { flex-direction: row; align-items: center; gap: 10px; padding-top: 24px; }
.field.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.field.check label { font-size: 14px; color: var(--text); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 22px;
                flex-wrap: wrap; }
.form-actions .status { margin-right: auto; font-size: 13px; color: var(--text-2); }
.form-sep { grid-column: 1 / -1; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase;
            letter-spacing: .08em; padding-top: 10px; border-top: 1px solid var(--border); margin-top: 4px; }

/* Klickbare Tabellenzeilen */
.dtable tr.link { cursor: pointer; }
.dtable td a { text-decoration: none; }
.dtable td.wrap { white-space: normal; min-width: 220px; }
.dtable tr.dim td { color: var(--text-3); }
.dtable tfoot td { padding: 12px; font-weight: 700; border-top: 1px solid var(--border-strong); }
.offen { color: #ffc266; font-weight: 600; }

/* Zähler-/Tag-Chip */
.tag { display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px;
       padding: 2px 7px; border-radius: 6px; background: rgba(255,255,255,0.07); color: var(--text-2); }
.chip.warn { background: rgba(255,159,10,0.18); color: #ffc266; }
.chip.info { background: rgba(100,210,255,0.16); color: #8fdfff; }

/* Leerer Zustand / Laden */
.empty { text-align: center; padding: 40px 20px; color: var(--text-2); font-size: 15px; }
.loading { padding: 80px 0; text-align: center; color: var(--text-3); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); opacity: 0;
         z-index: 300; padding: 12px 18px; border-radius: 980px; font-size: 14px; font-weight: 500;
         background: rgba(30,30,36,0.92); border: 1px solid var(--border-strong); backdrop-filter: blur(20px);
         box-shadow: 0 12px 40px rgba(0,0,0,0.5); transition: opacity .2s ease, transform .2s ease;
         pointer-events: none; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: rgba(48,209,88,0.4); }
.toast.err { border-color: rgba(255,69,58,0.5); color: #ffb1ab; }

/* Einmal-Passwort-Box */
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 20px; font-weight: 600;
          letter-spacing: .04em; padding: 14px 16px; border-radius: var(--r-sm); background: rgba(0,0,0,0.35);
          border: 1px dashed var(--border-strong); user-select: all; margin: 10px 0; }

/* Einheiten-Karte als Link */
a.unit { display: block; text-decoration: none; color: inherit; }

/* ── Login ─────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; position: relative; z-index: 1; }
.login-card { width: 100%; max-width: 420px; padding: 34px 30px 30px;
              background: linear-gradient(160deg, rgba(30,30,36,0.82) 0%, rgba(20,20,26,0.82) 100%);
              border: 1px solid var(--border); border-radius: var(--r-xl); backdrop-filter: blur(24px);
              -webkit-backdrop-filter: blur(24px); box-shadow: 0 30px 80px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05); }
.login-card .brand { margin-bottom: 26px; }
.login-card h1 { font-size: 34px; margin-bottom: 8px; }
.login-card .lede { font-size: 15px; margin-bottom: 26px; }
.login-card form { display: grid; gap: 16px; }
.login-card .btn-primary { justify-content: center; padding: 12px 18px; font-size: 16px; margin-top: 6px; }
.login-err { font-size: 14px; color: #ff8a82; min-height: 20px; }
.login-foot { margin-top: 22px; font-size: 12px; color: var(--text-3); text-align: center; line-height: 1.5; }
a.btn { text-decoration: none; }
/* Lesbarkeit über dem Gebäude-Hintergrund: Hinweise und Seitenkopf wie die Sektionen hinterlegen */
.notice { background: rgba(20,20,24,0.78); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.notice.warn { background: linear-gradient(rgba(255,159,10,0.10), rgba(255,159,10,0.10)), rgba(20,20,24,0.82); }
.notice.bad  { background: linear-gradient(rgba(255,69,58,0.10), rgba(255,69,58,0.10)), rgba(20,20,24,0.82); }
.page-head .lede { text-shadow: 0 1px 12px rgba(0,0,0,0.9); color: #c7c7cc; }
.facts { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.dtable tfoot td { white-space: nowrap; }
@media (max-width: 640px) { .nav-inner > .nav-links { margin-left: 0; margin-right: 0; } }

/* Modaler Dialog */
dialog.modal { margin: auto; width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto;
  color: var(--text); background: linear-gradient(160deg, rgba(34,34,40,0.98), rgba(22,22,28,0.98));
  border: 1px solid var(--border-strong); border-radius: var(--r-lg); padding: 26px; box-shadow: 0 30px 90px rgba(0,0,0,0.6); }
dialog.modal::backdrop { background: rgba(0,0,0,0.6); backdrop-filter: blur(6px); }
dialog.modal h3 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 18px; }
dialog.modal .notice { margin-top: 16px; margin-bottom: 0; }
.page-head > div:last-child { max-width: 100%; }

.sub-h { font-size: 15px; font-weight: 600; margin: 22px 0 10px; color: var(--text); }
.section .notice:first-child { margin-top: 0; }

/* Akte mit Upload */
.ablage { display: flex; flex-direction: column; gap: 8px; transition: border-color .15s ease, background .15s ease; }
.ablage.drop { border-color: var(--accent); background: rgba(10,132,255,0.10); }
.ablage-btn { align-self: flex-start; margin-top: auto; cursor: pointer; }
.ablage-hinweis { font-size: 13px; color: var(--text-3); padding: 6px 0; }
.ablage-status { font-size: 12px; color: var(--teal); min-height: 0; }
.dok-liste { list-style: none; display: grid; gap: 6px; margin: 0; }
.dok-liste li { position: relative; padding: 6px 26px 6px 0; border-top: 1px solid var(--border); white-space: normal; }
.dok-liste li:first-child { border-top: none; }
.dok-liste a { display: block; font-size: 14px; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.dok-liste a:hover { color: var(--teal); }
.dok-meta { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }
.dok-weg { position: absolute; right: 0; top: 6px; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--text-3); cursor: pointer; font-size: 15px; line-height: 1; }
.dok-weg:hover { color: #ff8a82; border-color: rgba(255,69,58,0.4); }
