/* Haus-Quest – Oberfläche. Weiß, Navy, Rot. */

:root {
  --bg: #ffffff;
  --tint: #f4f7fc;
  --tint-2: #e9eff8;
  --line: #dde5f2;
  --ink: #152c4f;
  --ink-2: #56698b;
  --ink-3: #8b9ab4;
  --accent: #ec0f06;
  --accent-tint: #fdecea;
  --navy-soft: #eaeff8;

  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-data: ui-monospace, "SF Mono", "DejaVu Sans Mono", Menlo, monospace;

  --oben: env(safe-area-inset-top, 0px);
  --unten: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

#app { display: flex; flex-direction: column; height: 100dvh; }

/* ---------- Kopf ---------- */
.appbar {
  flex: none; padding: calc(var(--oben) + 14px) 16px 12px;
  display: flex; align-items: center; gap: 10px;
}
.appbar .title { font-family: var(--font-display); font-weight: 800; font-size: 24px; letter-spacing: -.025em; }
.appbar .sub { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }
.iconbtn {
  margin-left: auto; width: 38px; height: 38px; border-radius: 12px; flex: none;
  border: 1px solid var(--line); background: var(--bg);
  display: grid; place-items: center; position: relative; color: var(--ink); cursor: pointer;
}
.iconbtn.links { margin-left: 0; margin-right: 2px; }
.iconbtn .ping { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }

.body {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0 16px 20px;
  display: flex; flex-direction: column; gap: 12px;
  -webkit-overflow-scrolling: touch;
}
/* Im scrollenden Bereich darf nichts zusammengedrückt werden — sonst schrumpfen
   Zeilen mit eigenem Überlauf (etwa die Chip-Reihen) auf wenige Pixel. */
.body > * { flex-shrink: 0; }

/* ---------- Bausteine ---------- */
.section-label {
  font-family: var(--font-data); font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); margin: 8px 0 -4px;
}
.card {
  border: 1px solid var(--line); border-radius: 16px; background: var(--bg);
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.card.flat { background: var(--tint); border-color: transparent; }
.card.alert { border-color: var(--accent); background: var(--accent-tint); }
.card.navy { background: var(--ink); border-color: var(--ink); color: #fff; }

.accounts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.account {
  border: 1px solid var(--line); border-radius: 16px; padding: 14px 10px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--bg);
}
.account.me { border-color: var(--ink); box-shadow: inset 0 -3px 0 var(--ink); }
.account .who { font-size: 13px; font-weight: 700; max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .pts { font-family: var(--font-display); font-weight: 800; font-size: 38px; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.account .unit { font-family: var(--font-data); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }

.avatar {
  width: 46px; height: 46px; border-radius: 50%; background: var(--tint);
  display: grid; place-items: center; overflow: hidden; flex: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 34px; height: 34px; }

.rowlink {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--bg);
  cursor: pointer; text-align: left; width: 100%; font: inherit; color: inherit;
}
.rowlink:active { background: var(--tint); }
.rowlink .grow { flex: 1; min-width: 0; }
.rowlink .t { display: block; font-size: 14.5px; font-weight: 600; }
.rowlink .m { display: block; font-size: 12px; color: var(--ink-3); }
.rowlink[disabled] { opacity: .55; }

.pts-pill {
  font-family: var(--font-data); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--accent-tint); color: var(--accent); border-radius: 999px; padding: 5px 10px; flex: none;
}
.chip { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 4px 9px; display: inline-flex; align-items: center; gap: 4px; }
.chip.wait { background: var(--accent-tint); color: var(--accent); }
.chip.done { background: var(--ink); color: #fff; }
.chip.open { background: var(--tint-2); color: var(--ink-2); }

.btn {
  font-family: var(--font-ui); font-size: 15px; font-weight: 700; border-radius: 13px;
  padding: 14px 16px; border: 1px solid transparent; cursor: pointer; text-align: center;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--ink);
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.ghost { background: var(--bg); border-color: var(--line); }
.btn.text { background: none; color: var(--ink-2); padding: 10px; font-weight: 600; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; }
.btn[hidden] { display: none; }
.btnrow { display: flex; gap: 8px; }
.btnrow > .btn { flex: 1; }

.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quick button {
  font: inherit; cursor: pointer; background: var(--tint); border: none; border-radius: 14px;
  padding: 14px 6px; display: flex; flex-direction: column; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 600; color: var(--ink); line-height: 1.25;
}
.quick svg { color: var(--accent); }

.feed { display: flex; flex-direction: column; list-style: none; margin: 0; padding: 14px; }
.feed li { display: flex; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.feed li:first-child { padding-top: 0; }
.feed li:last-child { border-bottom: none; padding-bottom: 0; }
.feed .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--ink); }
.feed .dot.red { background: var(--accent); }
.feed .txt { flex: 1; font-size: 13px; }
.feed .when { font-family: var(--font-data); font-size: 10px; color: var(--ink-3); }

.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button {
  font: inherit; font-size: 12.5px; font-weight: 600; white-space: nowrap; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-2);
  border-radius: 999px; padding: 7px 13px;
}
.filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-family: var(--font-data); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.field input, .field textarea, .field select {
  font: inherit; font-size: 15px; border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  background: var(--bg); color: var(--ink); width: 100%;
}
.field textarea { resize: none; min-height: 66px; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
  font-size: 21px; line-height: 1; cursor: pointer; color: var(--ink); font-family: var(--font-ui);
}
.stepper .val { font-family: var(--font-display); font-weight: 800; font-size: 24px; min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; }

.rewards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.reward {
  border: 1px solid var(--line); border-radius: 16px; padding: 13px; cursor: pointer;
  display: flex; flex-direction: column; gap: 7px; background: var(--bg); font: inherit; color: inherit; text-align: left;
}
.reward .ico { width: 32px; height: 32px; border-radius: 10px; background: var(--tint); display: grid; place-items: center; color: var(--accent); }
.reward .n { font-size: 13px; font-weight: 700; line-height: 1.25; }
.reward .c { font-family: var(--font-data); font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.reward[data-locked] { opacity: .5; }
.reward.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 12px; }
.reward.wide .n { flex: 1; }

.vote { display: flex; flex-direction: column; gap: 10px; }
.vote .change { display: flex; align-items: center; gap: 9px; font-family: var(--font-data); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.vote .old { color: var(--ink-3); text-decoration: line-through; }
.vote .new { color: var(--accent); }
.vote .why { font-size: 13px; color: var(--ink-2); }
.stance { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); }
.stance i { font-style: normal; font-weight: 700; color: var(--ink); }

.rules { display: flex; flex-direction: column; gap: 9px; margin: 0; padding: 14px; list-style: none; }
.rules li { display: flex; gap: 10px; font-size: 13px; align-items: flex-start; }
.rules .n {
  font-family: var(--font-data); font-size: 10px; font-weight: 700; color: var(--accent);
  background: var(--accent-tint); border-radius: 6px; padding: 2px 6px; flex: none; margin-top: 1px;
}

.ledger { list-style: none; margin: 0; padding: 6px 14px; }
.ledger li { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.ledger li:last-child { border: none; }
.ledger .amt { font-family: var(--font-data); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.ledger .amt.plus { color: var(--ink); }
.ledger .amt.minus { color: var(--accent); }

.leer { align-items: center; text-align: center; padding: 30px 18px; gap: 12px; }
.leer img { width: 130px; }
.leer .h { font-family: var(--font-display); font-weight: 800; font-size: 19px; }
.leer .t { font-size: 13px; color: var(--ink-2); max-width: 26ch; }

/* ---------- Fußleiste ---------- */
.navbar {
  flex: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
  border-top: 1px solid var(--line); padding: 8px 6px calc(var(--unten) + 10px); background: var(--bg);
}
.navbar button {
  font: inherit; background: none; border: none; cursor: pointer; border-radius: 12px; padding: 6px 2px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600; color: var(--ink-3); position: relative;
}
.navbar button[aria-current="true"] { color: var(--accent); }
.navbar .badge-n {
  position: absolute; top: -2px; right: 50%; transform: translateX(20px);
  background: var(--accent); color: #fff; font-family: var(--font-data); font-size: 9px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 999px; display: grid; place-items: center; padding: 0 4px;
}

/* ---------- Liste mit Bearbeiten-Knopf ---------- */
.zeile { display: flex; gap: 8px; align-items: stretch; }
.zeile > .rowlink { flex: 1; min-width: 0; }
.stiftbtn {
  flex: none; width: 46px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink-3); cursor: pointer;
  display: grid; place-items: center;
}
.stiftbtn:active { background: var(--tint); color: var(--ink); }

.reward-wrap { position: relative; display: flex; }
.reward-wrap > .reward { flex: 1; padding-right: 40px; }
.reward-wrap > .stiftbtn {
  position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 10px;
  border-color: transparent; background: transparent;
}

/* ---------- Suchen und Sortieren ---------- */
.suchzeile { position: relative; display: flex; align-items: center; }
.suchzeile svg { position: absolute; left: 13px; color: var(--ink-3); pointer-events: none; }
.suchzeile input {
  font: inherit; font-size: 15px; width: 100%; padding: 12px 40px 12px 40px;
  border: 1px solid var(--line); border-radius: 13px; background: var(--bg); color: var(--ink);
}
.suchzeile input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.suchzeile .leeren {
  position: absolute; right: 6px; width: 32px; height: 32px; border: none; background: none;
  color: var(--ink-3); font-size: 19px; cursor: pointer; border-radius: 9px;
}
.leer-hinweis { text-align: center; color: var(--ink-3); font-size: 13.5px; padding: 24px 0; }

/* ---------- Auswertung ---------- */
/* Zwei Reihen, geprüfte Palette: das hellere Geschwister des Navy und das Marken-Rot. */
:root { --reihe-ich: #2f6fd0; --reihe-partner: #ec0f06; --gitter: #e8edf6; }

.hero-zahl {
  font-family: var(--font-display); font-weight: 800; font-size: 52px; letter-spacing: -.045em;
  line-height: 1; font-variant-numeric: tabular-nums;
}
.hero-zusatz { font-size: 13.5px; color: var(--ink-2); }

.legende { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.legende span { display: inline-flex; align-items: center; gap: 7px; }
.legende i { width: 11px; height: 11px; border-radius: 3px; display: block; }

.diagramm { width: 100%; height: auto; display: block; touch-action: pan-y; }
.diagramm .gitter { stroke: var(--gitter); stroke-width: 1; }
.diagramm .achse { font-family: var(--font-data); font-size: 9px; fill: var(--ink-3); }
.diagramm .wert { font-family: var(--font-data); font-size: 10px; font-weight: 700; fill: var(--ink); }
.diagramm rect.balken { transition: opacity .12s; }
.diagramm rect.balken[data-aus] { opacity: .25; }

.kennzahlen { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kennzahl {
  border: 1px solid var(--line); border-radius: 14px; padding: 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.kennzahl .k { font-family: var(--font-data); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.kennzahl .v { font-family: var(--font-display); font-weight: 800; font-size: 24px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kennzahl .z { font-size: 11.5px; color: var(--ink-2); }

.prognose { display: flex; align-items: flex-end; gap: 14px; }
.prognose .jetzt { flex: 1; }
.prognose .pfeil { color: var(--ink-3); padding-bottom: 6px; }
.prognose .ziel { text-align: right; }
.prognose .ziel .v { color: var(--reihe-ich); }

.tabellenansicht { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.tabellenansicht th, .tabellenansicht td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--line); }
.tabellenansicht th:first-child, .tabellenansicht td:first-child { text-align: left; font-family: var(--font-data); font-size: 11px; }
.tabellenansicht th { font-family: var(--font-data); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 400; }
details.tabelle summary { font-size: 12.5px; color: var(--ink-2); cursor: pointer; padding: 6px 0; }

/* ---------- Overlays ---------- */
.scrim {
  position: fixed; inset: 0; background: rgba(21, 44, 79, .5); display: none;
  align-items: flex-end; z-index: 20;
}
.scrim[data-open] { display: flex; }
.sheet {
  width: 100%; background: var(--bg); border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(var(--unten) + 22px);
  display: flex; flex-direction: column; gap: 14px; max-height: 88dvh; overflow-y: auto;
  animation: hoch .28s cubic-bezier(.2, .9, .3, 1);
}
@keyframes hoch { from { transform: translateY(40px); opacity: .3; } }
.grabber { width: 40px; height: 4px; border-radius: 99px; background: var(--line); margin: 2px auto 4px; flex: none; }
.sheet h3 { font-family: var(--font-display); font-weight: 800; font-size: 20px; margin: 0; letter-spacing: -.02em; }
.note {
  font-size: 12.5px; color: var(--ink-2); background: var(--tint); border-radius: 12px; padding: 11px 12px;
  display: flex; gap: 9px; align-items: flex-start;
}
.note svg { flex: none; color: var(--accent); margin-top: 1px; }

.celebrate {
  position: fixed; inset: 0; z-index: 30; display: none;
  background: rgba(21, 44, 79, .95); color: #fff;
  flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 28px; text-align: center;
}
.celebrate[data-open] { display: flex; }
.celebrate img { width: min(260px, 70vw); }
.celebrate .big { font-family: var(--font-display); font-weight: 800; font-size: 58px; letter-spacing: -.04em; font-variant-numeric: tabular-nums; margin-top: 8px; }
.celebrate .cap { font-size: 15px; opacity: .85; max-width: 28ch; }
.celebrate .btn { margin-top: 22px; min-width: 170px; background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }

.anim-a { animation: wippen 1.1s ease-in-out infinite; }
.anim-b { animation: huepfen .8s ease-in-out infinite; }
.anim-c { animation: wackeln 1.4s ease-in-out infinite; }
@keyframes wippen { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-14px) rotate(3deg); } }
@keyframes huepfen { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-22px) scale(1.04); } }
@keyframes wackeln { 0%,100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }

.confetti { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 31; }
.confetti i { position: absolute; width: 8px; height: 13px; border-radius: 2px; animation: fallen 1.8s linear forwards; }
@keyframes fallen {
  from { transform: translateY(-40px) rotate(0deg); opacity: 1; }
  to { transform: translateY(105dvh) rotate(560deg); opacity: 0; }
}

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--unten) + 84px); z-index: 25;
  background: var(--ink); color: #fff; border-radius: 14px; padding: 14px 15px;
  font-size: 13.5px; display: none; gap: 10px; align-items: center;
  box-shadow: 0 12px 34px -14px rgba(0, 0, 0, .6);
}
.toast[data-open] { display: flex; }
.toast.fehler { background: var(--accent); }
.toast svg { flex: none; }

/* ---------- Anmeldung & Verbinden ---------- */
.mitte {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 30px 26px; gap: 0;
}
.mitte img.logo { width: min(230px, 62vw); }
.mitte h1 { font-family: var(--font-display); font-weight: 800; font-size: 34px; letter-spacing: -.03em; margin: 14px 0 0; }
.mitte p { font-size: 14.5px; color: var(--ink-2); margin: 10px 0 26px; max-width: 30ch; }
.mitte .btn { width: min(340px, 100%); }
.codeanzeige {
  font-family: var(--font-display); font-weight: 800; font-size: 34px; letter-spacing: .22em;
  padding-left: .22em; font-variant-numeric: tabular-nums;
}
.codefeld {
  font-family: var(--font-display); font-weight: 800; font-size: 30px; letter-spacing: .3em;
  text-align: center; padding-left: .3em;
}

.lader { display: grid; place-items: center; flex: 1; }
.lader img { width: 120px; animation: wippen 1.1s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}
