@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("vendor/fonts/inter-latin-wght-normal.woff2") format("woff2");
}

:root {
  --bg: #0f1114;
  --panel: #15181c;
  --panel2: #1b1f24;
  --line: #262b32;
  --line2: #333a43;
  --text: #eceef0;
  --muted: #8d959e;
  --faint: #5f6771;
  --accent: #e2b56f;
  --accent-ink: #171105;
  --bad: #e0938a;
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Inter", system-ui, sans-serif;
  font-feature-settings: "tnum", "cv11";
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

/* Kopf */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 3vw, 40px);
  background: rgba(15, 17, 20, 0.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.mark { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.topright { display: flex; align-items: center; gap: 10px; min-width: 0; }
.status { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

main { padding: clamp(20px, 3vw, 40px) clamp(16px, 3vw, 40px) 80px; }
.intro { margin-bottom: 28px; max-width: 760px; }
.intro h1 { font-size: clamp(26px, 3vw, 34px); letter-spacing: -0.02em; }
.intro p { color: var(--muted); margin: 8px 0 0; }

/* Bedienelemente */
.btn, select, input[type="text"], input[type="date"] {
  font: inherit; color: var(--text);
  background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px;
}
.btn { padding: 8px 14px; cursor: pointer; white-space: nowrap; transition: border-color .15s, background .15s; }
.btn:hover { border-color: var(--faint); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; }
input[type="text"], input[type="date"], select { width: 100%; min-width: 0; height: 38px; padding: 0 10px; }
input.num { text-align: right; }
input::placeholder { color: var(--faint); }
input:focus-visible, select:focus-visible, .btn:focus-visible, .del:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }

/* Karten */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(16px, 2vw, 26px); margin-bottom: 18px;
}
.card > header { display: flex; align-items: baseline; gap: 6px 18px; flex-wrap: wrap; margin-bottom: 16px; }
.card > header h2 { font-size: 17px; }
.card > header p { margin: 0; color: var(--muted); font-size: 13.5px; }
.card > footer { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin-top: 14px; }
.hint { color: var(--muted); font-size: 13px; }
.empty { color: var(--faint); margin: 4px 0; }

/* Eingabezeilen: auf Desktop eine Rasterzeile, Beschriftung nur über der ersten Zeile */
.rows { display: grid; gap: 8px; }
.row { display: grid; gap: 8px; align-items: end; }
.f { display: grid; gap: 4px; min-width: 0; }
.f > span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f.check { justify-items: start; }
.f.check input { margin: 10px 0; }
.del {
  width: 38px; height: 38px; border-radius: 8px; border: 1px solid transparent; background: transparent;
  color: var(--faint); font-size: 20px; line-height: 1; cursor: pointer;
}
.del:hover { color: var(--bad); border-color: var(--line2); }

.row-property { grid-template-columns: 1.2fr 1.8fr 170px 170px; }
.row-unit { grid-template-columns: minmax(180px, 2fr) repeat(4, minmax(90px, 1fr)) 38px; }
.row-tenancy { grid-template-columns: minmax(140px, 1.2fr) minmax(160px, 1.6fr) 160px 160px minmax(120px, 1fr) minmax(130px, 1fr) 38px; }
.row-cost { grid-template-columns: minmax(180px, 2fr) minmax(120px, 1fr) minmax(200px, 1.6fr) minmax(140px, 1.2fr) 120px 160px 160px 38px; }
.row-cost .del { grid-column: -2; }

@media (min-width: 1001px) {
  .row + .row .f > span { display: none; }
  .row + .row .f.check input { margin: 10px 0; }
}

/* Ergebnis */
.results > header { justify-content: space-between; align-items: center; }
.switch { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; cursor: pointer; }
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.tile { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.tile span { display: block; font-size: 12px; color: var(--muted); }
.tile strong { display: block; font-size: 19px; font-weight: 600; letter-spacing: -0.01em; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.good strong { color: var(--accent); }
.tile.bad strong { color: var(--bad); }
.warnings { margin: 12px 0 0; padding: 12px 14px 12px 32px; border: 1px solid var(--line2); border-radius: 10px; color: var(--bad); font-size: 13.5px; }
.results h3 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 26px 0 10px; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th, table.grid td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid th { font-size: 12px; font-weight: 500; color: var(--muted); }
table.grid .num { text-align: right; }
table.grid td small { display: block; color: var(--faint); font-size: 12px; }
table.grid td.zero { color: var(--faint); }
table.grid td.strong { font-weight: 600; }
table.grid td.bad { color: var(--bad); }
table.grid tr.vacancy td { color: var(--muted); }
table.grid tfoot td { font-weight: 600; background: var(--panel2); border-bottom: 1px solid var(--line); }
table.grid tfoot tr.control td { font-weight: 500; }
table.grid tfoot tr.control.good td { color: var(--accent); }
table.grid tfoot tr.control.bad td { color: var(--bad); }
.pill { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); }
.pill.due { color: var(--text); border-color: var(--faint); }
.pill.back { color: var(--accent); border-color: rgba(226, 181, 111, .4); }
.m-only { display: none; }
.note { color: var(--faint); font-size: 12.5px; margin: 22px 0 0; }

/* Schmale Bildschirme: Zeilen werden zu kleinen Karten mit Beschriftung pro Feld */
@media (max-width: 1000px) {
  .row { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; position: relative; }
  .row input[type="text"], .row input[type="date"], .row select { background: var(--panel); }
  .row .f:first-child, .row-cost .f-key, .row-tenancy .f-name { grid-column: 1 / -1; }
  .row .placeholder { display: none; }
  .row .del { grid-column: auto; justify-self: end; align-self: end; }
  .row-unit .del, .row-tenancy .del { grid-column: 1 / -1; height: 30px; }
  .row-cost .del { grid-column: 2; }
  .row-cost.has-range .del { grid-column: 1 / -1; height: 30px; }
  .row-property { background: none; border: 0; padding: 0; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile:first-child { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .status { display: none; }
  .btn { padding: 7px 10px; font-size: 14px; }
  .top { gap: 8px; }
}
@media (max-width: 700px) {
  .row-property { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .row-property .f-address { grid-column: 1 / -1; }
  table.grid { font-size: 12.5px; }
  table.grid th, table.grid td { padding: 8px 6px; }
  table.grid td:first-child, table.grid td:nth-child(2), table.grid td.wrap { white-space: normal; }
  table.grid .c-wide { display: none; }
  table.grid td small { display: none; }
  table.grid .m-only { display: block; color: var(--muted); font-size: 12px; }
}

/* Startseite: sichtbar, solange noch nichts erfasst ist */
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); align-items: center; padding: clamp(12px, 3vw, 48px) 0 clamp(28px, 4vw, 56px); }
.hero h1 { font-size: clamp(30px, 4.2vw, 56px); line-height: 1.08; letter-spacing: -0.03em; max-width: 20ch; }
.eyebrow { margin: 0 0 14px; color: var(--accent); font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
.lead { margin: 18px 0 0; color: var(--muted); font-size: clamp(16px, 1.3vw, 19px); max-width: 56ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.hero-cta .btn { padding: 11px 18px; text-decoration: none; display: inline-block; }
.hero-note { margin: 14px 0 0; color: var(--faint); font-size: 13px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { border-color: var(--accent); filter: brightness(1.06); }
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 10px; }
.steps li { counter-increment: step; position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 16px 58px; }
.steps li::before { content: counter(step); position: absolute; left: 18px; top: 16px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line2); color: var(--accent); font-size: 13px; font-weight: 600; display: grid; place-items: center; }
.steps strong { display: block; font-weight: 600; }
.steps span { display: block; color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.intro { display: none; }
body.has-data .hero { display: none; }
body.has-data .intro { display: block; }
.notfound { grid-template-columns: 1fr; min-height: 60vh; }

/* Abrechnung: Einstellungen und Blatt */
.row-bill { grid-template-columns: minmax(160px, 1.3fr) minmax(200px, 1.8fr) minmax(110px, 1fr) 170px 170px; }
.row-bill2 { grid-template-columns: 1fr 1fr; }
@media (min-width: 1001px) { .row-bill + .row-bill2 .f > span { display: block; } }
.billbar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-top: 16px; }
.billbar .f-party { min-width: min(320px, 100%); flex: 0 1 360px; }
.billbar .hint { align-self: center; }
.sheetwrap { margin-top: 18px; padding: clamp(10px, 2vw, 28px); background: #0a0c0e; border: 1px solid var(--line); border-radius: 10px; }
#sheets .sheet { display: none; }
#sheets .sheet.active { display: flex; }
.sheet {
  flex-direction: column; width: 210mm; min-height: 297mm; margin: 0 auto; padding: 15mm 18mm 14mm 22mm;
  background: #fff; color: #15171a; font-size: 10.5pt; line-height: 1.45; box-shadow: 0 10px 40px rgba(0, 0, 0, .45);
  font-feature-settings: "tnum";
}
.sheet strong { font-weight: 600; }
.sh-head { display: flex; justify-content: space-between; gap: 10mm; font-size: 9.5pt; color: #444a52; }
.sh-sender strong, .sh-sender span { display: block; }
.sh-sender strong { color: #15171a; }
.sh-place { white-space: nowrap; }
.sh-to { margin: 11mm 0 0 95mm; min-height: 21mm; }
.sh-to strong, .sh-to span { display: block; }
.sh-title { font-size: 16pt; font-weight: 600; letter-spacing: -0.015em; margin: 6mm 0 4mm; color: #15171a; }
.sh-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 2mm 10mm; margin: 0 0 6mm; padding: 3mm 0; border-top: 1px solid #15171a; border-bottom: 1px solid #d5d8dc; }
.sh-meta dt { font-size: 8pt; text-transform: uppercase; letter-spacing: .05em; color: #6b727b; }
.sh-meta dd { margin: 0; }
.sh-table, .sh-sum { width: 100%; border-collapse: collapse; }
.sh-table th { font-size: 8pt; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: #6b727b; text-align: left; padding: 0 2mm 2mm 0; border-bottom: 1px solid #15171a; white-space: nowrap; }
.sh-table { font-size: 9.5pt; }
.sh-table td { white-space: nowrap; padding: 1.7mm 3mm 1.7mm 0; border-bottom: 1px solid #e1e4e8; vertical-align: top; }
.sh-table th:last-child, .sh-table td:last-child { padding-right: 0; }
.sh-table td:first-child { white-space: normal; width: 34%; }
.sh-table td small { display: block; font-size: 8pt; color: #6b727b; }
.sheet .num { text-align: right; white-space: nowrap; }
.sh-table tr { break-inside: avoid; }
.sh-sum { width: 62%; margin: 5mm 0 0 auto; break-inside: avoid; }
.sh-sum td { padding: 1.8mm 0; border-bottom: 1px solid #e1e4e8; }
.sh-sum .sh-saldo td { font-weight: 600; font-size: 11.5pt; border-top: 1px solid #15171a; border-bottom: 2px solid #15171a; padding: 2.6mm 0; }
.sh-text { margin-top: 6mm; break-inside: avoid; }
.sh-text p { margin: 0 0 2.5mm; }
.sh-text p + p { color: #444a52; font-size: 9.5pt; }
.sh-text p:first-child { color: #15171a; font-size: 10.5pt; }
.sh-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 14mm; margin-top: auto; padding-top: 10mm; break-inside: avoid; }
.sh-sign .line { display: block; border-bottom: 1px solid #15171a; height: 10mm; }
.sh-sign small { display: block; margin-top: 1.5mm; font-size: 8pt; color: #6b727b; }

@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; }
  .row-bill2 { grid-template-columns: 1fr !important; }
  .billbar .btn { flex: 1 1 auto; }
}
