:root {
  color-scheme: light;
  /* Farben aus dem EvenUp-Logo: Dunkelblau #0F1A34 und Grün #23DA8F */
  --bg: #F2F4F8;
  --surface: #FFFFFF;
  --ink: #0F1A34;
  --muted: #5A6478;
  --line: #D8DDE7;
  --brand: #0F1A34;
  --on-brand: #FFFFFF;
  --accent: #23DA8F;
  --on-accent: #0F1A34;
  --plus: #0E8A5B;
  --minus: #C62F3B;
  --plus-soft: #D4F6E6;
  --minus-soft: #FADADD;
  --marker: #23DA8F;
  --on-marker: #0F1A34;
  --font: ui-rounded, "SF Pro Rounded", "Segoe UI Variable", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0F1A34;
    --surface: #182649;
    --ink: #EEF2FA;
    --muted: #9AA6BF;
    --line: #2B3B63;
    --brand: #23DA8F;
    --on-brand: #0F1A34;
    --plus: #3BE3A0;
    --minus: #FF8C95;
    --plus-soft: #164536;
    --minus-soft: #4A2433;
  }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0F1A34;
    --surface: #182649;
    --ink: #EEF2FA;
    --muted: #9AA6BF;
    --line: #2B3B63;
    --brand: #23DA8F;
    --on-brand: #0F1A34;
    --plus: #3BE3A0;
    --minus: #FF8C95;
    --plus-soft: #164536;
    --minus-soft: #4A2433;
  }

* { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; touch-action: pan-x pan-y; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.45 var(--font);
  font-variant-numeric: tabular-nums;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
main { --pad: 1.125rem; display: block; max-width: 34rem; margin: 0 auto; padding: 1rem 1.125rem calc(10.5rem + env(safe-area-inset-bottom, 0px)); outline: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.75rem; line-height: 1.15; font-weight: 750; letter-spacing: -0.01em; }
h2 { font-size: 1.1875rem; line-height: 1.25; font-weight: 700; margin: 2rem 0 0.625rem; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: 0.9375rem; }
.stack > * + * { margin-top: 0.875rem; }
.row { display: flex; align-items: center; gap: 0.75rem; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.wrap { overflow-wrap: anywhere; }

button, .button {
  font: inherit;
  font-weight: 650;
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--line);
  border-radius: 0.75rem;
  min-height: 2.875rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  touch-action: manipulation;
}
button.primary, .button.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
button.danger { color: var(--minus); border-color: var(--minus); }
button.plain { border-color: transparent; color: var(--brand); padding-inline: 0.25rem; min-height: 2.75rem; }
button.block, .button.block { width: 100%; }
button:disabled { opacity: 0.55; cursor: default; }
:focus-visible { outline: 3px solid var(--marker); outline-offset: 2px; }

label.field { display: block; font-weight: 600; font-size: 0.9375rem; }
label.field > span { display: block; margin-bottom: 0.25rem; }
label.field small { display: block; font-weight: 400; color: var(--muted); margin-top: 0.25rem; }
input, select {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 0.625rem;
  min-height: 2.875rem;
  padding: 0.5rem 0.75rem;
  width: 100%;
}
input[type="checkbox"] { width: 1.5rem; height: 1.5rem; min-height: 0; accent-color: var(--brand); flex: none; }
.money-input { font-size: 1.75rem; font-weight: 700; text-align: right; }
.error { color: var(--minus); font-weight: 600; font-size: 0.9375rem; }

/* Kopfzeile */
.top { display: flex; align-items: center; gap: 0.25rem; min-height: 3rem; margin-bottom: 0.5rem; }
.top h1 { font-size: 1.25rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon { min-width: 2.75rem; padding: 0; border-color: transparent; font-size: 1.375rem; }

/* Die Waage ist das Erkennungszeichen der App: Die Mitte ist 0 €,
   links liegt, wer schuldet, rechts, wer Geld bekommt. */
.verdict { padding: 0.75rem 0 1.25rem; }
.verdict p { font-size: 1.0625rem; color: var(--muted); }
.verdict strong { display: block; font-size: 3rem; line-height: 1.05; font-weight: 800; letter-spacing: -0.02em; }
.verdict .plus { color: var(--plus); }
.verdict .minus { color: var(--minus); }
.scale { list-style: none; margin: 0; padding: 0; }
.scale li { padding: 0.5rem 0 0.75rem; }
.scale .who { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-weight: 600; }
.scale .bar { position: relative; height: 0.75rem; margin-top: 0.5rem; border-radius: 0.375rem; background: var(--line); }
.scale .bar::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: 50%;
  top: -0.1875rem;
  bottom: -0.1875rem;
  width: 2px;
  transform: translateX(-1px);
  background: var(--ink);
}
.scale .bar i { position: absolute; top: 0; bottom: 0; display: block; min-width: 2px; }
.scale .bar i.plus { left: 50%; background: var(--plus); border-radius: 0 0.375rem 0.375rem 0; }
.scale .bar i.minus { right: 50%; background: var(--minus); border-radius: 0.375rem 0 0 0.375rem; }
.amount-plus { color: var(--plus); }
.amount-minus { color: var(--minus); }

/* Listen */
.list { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--line); }
.list > li { border-bottom: 1.5px solid var(--line); }
.item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 0;
  border-radius: 0;
  padding: 0.75rem 0;
  font-weight: 400;
  text-align: left;
  min-height: 3.5rem;
}
.item b { font-weight: 650; display: block; overflow-wrap: anywhere; }
.item .end { text-align: right; white-space: nowrap; font-weight: 650; }
.todo { background: var(--marker); color: var(--on-marker); border-radius: 0.75rem; padding: 0.875rem 1rem; }
.todo .row { margin-top: 0.625rem; }
.todo button { color: var(--on-marker); border-color: var(--on-marker); flex: 1; }
.todo button.primary { background: var(--on-marker); color: var(--marker); }
.tag { font-size: 0.8125rem; font-weight: 650; border: 1.5px solid currentColor; border-radius: 0.375rem; padding: 0 0.3125rem; color: var(--muted); white-space: nowrap; }

/* Reiter unten */
.tabs {
  position: fixed;
  z-index: 5;
  left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top: 1.5px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabs div { display: flex; max-width: 34rem; margin: 0 auto; }
.tabs button { flex: 1; border: 0; border-radius: 0; min-height: 3.5rem; color: var(--muted); font-size: 0.9375rem; }
.tabs button[aria-current="page"] { color: var(--brand); box-shadow: inset 0 3px 0 var(--brand); }
.add {
  position: fixed;
  z-index: 6;
  right: max(1.125rem, calc(50vw - 16rem));
  bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
  background: var(--brand);
  color: var(--on-brand);
  border-color: var(--brand);
  border-radius: 1.5rem;
  min-height: 3.25rem;
  padding-inline: 1.25rem;
}

/* Blatt von unten */
dialog {
  color: var(--ink);
  background: var(--surface);
  border: 0;
  width: 100%;
  max-width: 34rem;
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 1.5rem);
  margin: auto auto 0;
  padding: 1.25rem 1.125rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  border-radius: 1.25rem 1.25rem 0 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
dialog::backdrop { background: rgba(8, 14, 32, 0.55); }
dialog h2 { margin-top: 0; font-size: 1.375rem; }
/* Bewegungen wie in nativen Apps: Blätter gleiten von unten herein,
   der Hintergrund blendet weich ein und beim Schließen wieder aus. */
@media (prefers-reduced-motion: no-preference) {
  dialog[open] { animation: sheet-in 0.34s cubic-bezier(0.32, 0.72, 0, 1); }
  dialog[open]::backdrop { animation: fade-in 0.28s ease-out; }
  dialog.closing { animation: sheet-out 0.2s cubic-bezier(0.4, 0, 1, 1) forwards; }
  dialog.closing::backdrop { animation: fade-out 0.2s ease-in forwards; }
  dialog.picker[open] { animation: picker-in 0.3s cubic-bezier(0.32, 0.72, 0, 1); }
  dialog.picker.closing { animation: picker-out 0.18s ease-in forwards; }
  #view.from-right { animation: view-right 0.24s cubic-bezier(0.2, 0.8, 0.2, 1); }
  #view.from-left { animation: view-left 0.24s cubic-bezier(0.2, 0.8, 0.2, 1); }
  #toast.show { animation: toast-in 0.26s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .add, .give, button.primary, .tile, .bubble, .person-pick { transition: transform 0.12s ease, background-color 0.15s ease; }
  .add:active, .give:active, button.primary:active, .tile:active, .bubble:active, .person-pick:active { transform: scale(0.97); }
}
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }
@keyframes picker-in { from { transform: translateY(1.5rem) scale(0.97); opacity: 0; } }
@keyframes picker-out { to { transform: translateY(1rem) scale(0.98); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes view-right { from { transform: translateX(1.5rem); opacity: 0; } }
@keyframes view-left { from { transform: translateX(-1.5rem); opacity: 0; } }
@keyframes toast-in { from { transform: translate(-50%, -0.75rem); opacity: 0; } }
.segments { display: flex; border: 1.5px solid var(--line); border-radius: 0.75rem; padding: 0.1875rem; gap: 0.1875rem; }
.segments button { flex: 1; border: 0; min-height: 2.5rem; padding: 0.25rem 0.375rem; font-size: 0.9375rem; border-radius: 0.5625rem; }
.segments button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); }
/* Feste Spalten, damit Eingabefelder immer genau untereinander stehen */
.part { display: grid; grid-template-columns: minmax(0, 1fr) 5rem; align-items: center; gap: 0.375rem; min-height: 3.25rem; border-bottom: 1.5px solid var(--line); font-weight: 600; }
.mode-percent .part { grid-template-columns: minmax(0, 1fr) 4.5rem 2.875rem 4.75rem; }
.mode-fixed .part { grid-template-columns: minmax(0, 1fr) 5.5rem 2.875rem; }
.mode-fixed .part .share { display: none; }
.part label { display: flex; align-items: center; gap: 0.5rem; min-width: 0; min-height: 3rem; }
.part input.value { width: 100%; text-align: right; padding-inline: 0.5rem; }
.part .share { color: var(--muted); font-weight: 400; white-space: nowrap; text-align: right; font-size: 0.9375rem; }
.part button.rest { width: 100%; padding: 0.25rem; }
.part button.rest.off { visibility: hidden; }
@media (max-width: 400px) {
  .mode-percent .part .avatar, .mode-fixed .part .avatar { display: none; }
}
.plain-link { display: block; text-align: center; color: var(--brand); font-weight: 600; font-size: 0.9375rem; padding: 0.625rem 0 0; cursor: pointer; }
.sum { display: flex; justify-content: space-between; font-weight: 650; padding-top: 0.25rem; }
.methods { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.methods button[aria-pressed="true"] { border-color: var(--brand); box-shadow: inset 0 0 0 1.5px var(--brand); }
.copy { display: flex; align-items: center; gap: 0.5rem; background: var(--bg); padding: 0.5rem 0.75rem; border-radius: 0.625rem; }
.copy code { flex: 1; min-width: 0; font: inherit; font-weight: 650; overflow-wrap: anywhere; }
.qr { background: #fff; padding: 0.5rem; border-radius: 0.75rem; width: min(15rem, 100%); margin: 0 auto; }
.qr svg { display: block; width: 100%; height: auto; }
.code-big { font-size: 1.375rem; font-weight: 750; letter-spacing: 0.02em; text-align: center; background: var(--marker); color: var(--on-marker); padding: 0.875rem; border-radius: 0.75rem; overflow-wrap: anywhere; }

/* Willkommen */
.welcome { padding-top: 12vh; }
.welcome h1 { font-size: 2.75rem; }
.welcome .lead { font-size: 1.25rem; margin: 0.5rem 0 1.75rem; }
.mark { width: 4rem; height: 4rem; display: block; margin-bottom: 1.25rem; border-radius: 22%; }

#toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  top: calc(0.75rem + env(safe-area-inset-top, 0px));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 0.625rem 1rem;
  border-radius: 0.75rem;
  max-width: min(30rem, calc(100vw - 2rem));
  font-weight: 600;
  display: none;
}
#toast.show { display: flex; }
#toast { align-items: center; gap: 0.75rem; }
#toast button { min-height: 2.25rem; padding: 0.25rem 0.75rem; color: var(--bg); border-color: var(--bg); flex: none; }
.spinner { padding: 3rem 0; text-align: center; color: var(--muted); }

/* Installationshilfe */
.guide { padding-top: 6vh; }
.guide h1 { font-size: 2rem; }
.os-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 0.625rem; }
.os-choice button { flex-direction: column; min-height: 6rem; font-size: 1.0625rem; border-radius: 1rem; }
.os-choice button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 0 0 0.875rem 2.5rem; min-height: 2.5rem; }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 1.75rem; height: 1.75rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--marker);
  color: var(--on-marker);
  font-weight: 750;
  font-size: 0.9375rem;
}

/* Profilbilder */
.avatar {
  width: 2rem; height: 2rem;
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  object-fit: cover;
  background: var(--plus-soft);
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 750;
}
.person { display: inline-flex; align-items: center; gap: 0.5rem; min-width: 0; }
.avatars { display: inline-flex; flex: none; }
.avatars .avatar { outline: 2px solid var(--bg); }
.avatars .avatar + .avatar { margin-left: -0.625rem; }
.photo { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.photo #my-photo .avatar { width: 5.5rem; height: 5.5rem; font-size: 2rem; }
.hidden-file { position: absolute; width: 1px; height: 1px; opacity: 0; min-height: 0; padding: 0; border: 0; }
.photo label.button:focus-within, .hidden-file:focus-visible + * { outline: 3px solid var(--marker); }
[hidden] { display: none !important; }

/* Darstellung */
.theme-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.theme-choice button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

/* Einladungscode */
.invite > * + * { margin-top: 0.625rem; }
.invite .row { margin-top: 0.625rem; }
.invite-code {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  background: var(--surface);
  color: var(--ink);
  border-radius: 0.625rem;
  padding: 0.5rem;
  -webkit-user-select: all;
  user-select: all;
}

/* Ausstehende Zahlungen */
.item .grow .small { display: block; }
.actions { display: flex; flex-direction: column; gap: 0.375rem; flex: none; }
button.pending {
  min-height: 2.25rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.875rem;
  color: var(--muted);
  border-style: dashed;
}
.captcha:empty { display: none; }
.plain-list { margin: 0; padding-left: 1.25rem; }
.plain-list li + li { margin-top: 0.375rem; }

/* Schritt-für-Schritt-Anleitung */
.wizard { border: 1.5px solid var(--line); border-radius: 1rem; padding: 1rem; background: var(--surface); }
.wizard > * + * { margin-top: 0.75rem; }
.wizard h2 { margin: 0.25rem 0 0; }
.wizard.done { opacity: 0.6; }
.wizard.done #code-noted, .wizard.done #copy-help { display: none; }
.step-label { font-size: 0.9375rem; font-weight: 700; color: var(--brand); }
button.big { min-height: 3.5rem; font-size: 1.125rem; }
.guide .wizard + .wizard { margin-top: 0.875rem; }

/* Verlauf: Suche und Filter */
.history-tools { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; }
.search { position: relative; flex: 1; min-width: 0; }
.search svg { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 2.5rem; }
#hist-toggle { flex: none; }
#hist-toggle[aria-expanded="true"] { border-color: var(--brand); color: var(--brand); }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 0.625rem; margin-bottom: 1rem; }
.filters .plain { grid-column: 1 / -1; justify-self: start; }
.list > li.month { border-bottom: 0; padding: 1rem 0 0.25rem; font-weight: 750; color: var(--muted); font-size: 0.9375rem; }
.list > li.month:first-child { padding-top: 0.25rem; }
.summary { background: var(--plus-soft); border-radius: 0.75rem; padding: 0.625rem 0.875rem; margin-bottom: 0.75rem; font-size: 0.9375rem; }

/* Einkaufsformular */
.label { font-weight: 600; font-size: 0.9375rem; margin-bottom: 0.25rem; }
.payer-choice { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.25rem; }
.payer-choice button { flex: none; min-height: 2.75rem; padding: 0.25rem 0.875rem 0.25rem 0.25rem; border-radius: 1.5rem; font-weight: 600; }
.payer-choice button[aria-checked="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.suggest { margin-top: 0.375rem; border: 1.5px solid var(--line); border-radius: 0.625rem; max-height: 12.5rem; overflow-y: auto; background: var(--surface); }
.suggest button { width: 100%; justify-content: space-between; border: 0; border-radius: 0; border-bottom: 1px solid var(--line); font-weight: 500; min-height: 2.75rem; text-align: left; }
.suggest button:last-child { border-bottom: 0; }
.sum { flex-wrap: wrap; gap: 0.25rem 1rem; }

/* Auswahl beim Entfernen */
.choice-list { display: grid; gap: 0.5rem; }
.choice { display: flex; gap: 0.75rem; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 0.75rem; padding: 0.75rem; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1.5px var(--brand); }
.choice input { width: 1.375rem; height: 1.375rem; min-height: 0; margin: 0.125rem 0 0; accent-color: var(--brand); flex: none; }
.choice b, .choice .small { display: block; }

/* Kassenbon */
.receipt label.button { gap: 0.5rem; }
#receipt-preview { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.625rem; }
#receipt-preview img { width: 4.5rem; height: 6rem; object-fit: cover; border-radius: 0.5rem; border: 1.5px solid var(--line); }
.receipt-full { display: block; width: 100%; border-radius: 0.75rem; border: 1.5px solid var(--line); }
.items { list-style: none; margin: 0.5rem 0 0; padding: 0; border-top: 1.5px solid var(--line); }
.items li { padding: 0.625rem 0; border-bottom: 1.5px solid var(--line); }
.items .who { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 0.5rem; }
.items .who button { min-height: 2.25rem; padding: 0.125rem 0.625rem 0.125rem 0.125rem; border-radius: 1.25rem; font-size: 0.875rem; font-weight: 600; }
.items .who .avatar { width: 1.75rem; height: 1.75rem; font-size: 0.8125rem; }
.items .who button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.items .who button[aria-pressed="false"] { opacity: 0.6; }
button.rest { min-height: 2.25rem; font-size: 0.8125rem; }

/* Schalter */
button.switch { width: 100%; justify-content: space-between; text-align: left; gap: 1rem; padding: 0.75rem 1rem; font-weight: 400; }
button.switch b, button.switch .small { display: block; }
button.switch i { flex: none; width: 3rem; height: 1.75rem; border-radius: 1rem; background: var(--line); position: relative; }
button.switch i::after { content: ""; position: absolute; top: 0.1875rem; left: 0.1875rem; width: 1.375rem; height: 1.375rem; border-radius: 50%; background: var(--surface); transition: transform 0.15s; }
button.switch[aria-checked="true"] i { background: var(--brand); }
button.switch[aria-checked="true"] i::after { transform: translateX(1.25rem); }
@media (prefers-reduced-motion: reduce) { button.switch i::after { transition: none; } }

/* Personen-Auswahl im Formular */
.person-pick { width: 100%; justify-content: flex-start; gap: 0.625rem; text-align: left; font-weight: 600; padding: 0.375rem 0.75rem 0.375rem 0.375rem; min-height: 3.25rem; }
.person-pick > .avatar { width: 2.25rem; height: 2.25rem; }
.person-pick svg { flex: none; color: var(--muted); }
.small-pick { min-height: 2.75rem; margin-top: 0.5rem; font-size: 0.9375rem; }
.stack-faces { display: inline-flex; flex: none; padding-left: 0.375rem; }
.stack-faces .avatar { width: 2rem; height: 2rem; margin-left: -0.5rem; outline: 2px solid var(--surface); font-size: 0.8125rem; }
.stack-faces .avatar.more { background: var(--line); color: var(--ink); font-size: 0.75rem; }
.part .who-name { display: flex; align-items: center; gap: 0.5rem; min-width: 0; min-height: 3rem; }

/* Auswahlfenster: schwebt über dem weichgezeichneten Formular */
dialog.picker {
  color: var(--ink);
  background: var(--surface);
  border: 0;
  width: calc(100% - 1rem);
  max-width: 32rem;
  max-height: min(85dvh, 44rem);
  margin: auto auto calc(0.5rem + env(safe-area-inset-bottom, 0px));
  padding: 1.125rem 1rem 1rem;
  border-radius: 1.5rem;
  overflow-y: auto;
}
dialog.picker::backdrop {
  background: rgba(8, 14, 32, 0.35);
  -webkit-backdrop-filter: blur(10px) saturate(0.9);
  backdrop-filter: blur(10px) saturate(0.9);
}

.picker-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 0.75rem; }
.picker-head h2 { margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; }
.picker .search { margin-bottom: 0.625rem; }
.pick-quick button { flex: 1; min-height: 2.5rem; }
.bubbles { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.75rem, 1fr)); gap: 0.75rem 0.25rem; margin: 1rem 0; }
.bubble { flex-direction: column; border: 0; min-height: 0; padding: 0.25rem; gap: 0.375rem; font-weight: 600; font-size: 0.875rem; line-height: 1.2; text-align: center; }
.bubble .avatar { width: 3.5rem; height: 3.5rem; font-size: 1.25rem; position: relative; outline: 2px solid transparent; outline-offset: 2px; }
.bubble[aria-pressed="false"] .avatar { opacity: 0.55; }
.bubble[aria-pressed="false"] > span { color: var(--muted); }
.bubble[aria-pressed="true"] .avatar { outline-color: var(--brand); opacity: 1; }
.bubble[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  top: 2.6rem;
  left: calc(50% + 0.85rem);
  width: 1.375rem; height: 1.375rem;
  border-radius: 50%;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 0.8125rem;
  display: grid;
  place-items: center;
  border: 2px solid var(--surface);
}
.bubble { position: relative; }

/* Rechnen in Betragsfeldern */
.calc-line { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; font-size: 0.9375rem; color: var(--muted); font-weight: 400; }
.part .calc-line { grid-column: 1 / -1; padding-bottom: 0.5rem; margin-top: -0.25rem; }
.calc-line b { color: var(--ink); }
.calc-keys { display: inline-flex; gap: 0.375rem; margin-right: auto; }
.calc-keys button { min-width: 2.75rem; min-height: 2.5rem; padding: 0; font-size: 1.25rem; }

/* Betreiber-Übersicht */
.owner { border: 1.5px solid var(--line); border-radius: 0.875rem; padding: 0.75rem 0.875rem; margin-bottom: 1rem; background: var(--surface); }
.owner-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 0.75rem; margin-top: 0.5rem; }
.owner-grid span { display: flex; flex-direction: column; font-size: 0.875rem; color: var(--muted); }
.owner-grid b { font-size: 1.5rem; line-height: 1.15; color: var(--ink); }
.center { text-align: center; }
#receipt-hint { margin-top: 0.375rem; }

/* Schwebender Knopf für Geldübergabe */
.give {
  position: fixed;
  z-index: 6;
  left: max(1.125rem, calc(50vw - 16rem));
  bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
  width: 3.5rem;
  height: 3.5rem;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}

/* Personen im Stand sind antippbar */
.scale-row { display: block; width: 100%; border: 0; border-radius: 0.5rem; padding: 0; min-height: 0; text-align: left; font-weight: 400; }
.scale-row .who, .scale-row .bar { display: flex; }
.scale-row .bar { display: block; }

/* Kassenbon: zwei Kacheln */
.receipt-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 0.625rem; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.375rem; min-height: 6rem; padding: 0.75rem 0.5rem; border: 1.5px solid var(--line); border-radius: 1rem; background: var(--surface); color: var(--brand); font-weight: 650; font-size: 0.9375rem; text-align: center; cursor: pointer; }
.tile span { color: var(--ink); }
.tile:active { background: var(--plus-soft); }
.receipt:focus-within .tile { outline: none; }

/* Nur eine Person muss zahlen */
.single-hint { display: flex; align-items: center; gap: 0.625rem; background: var(--plus-soft); border-radius: 0.75rem; padding: 0.625rem 0.75rem; font-size: 0.9375rem; }
#items-off { margin: 0.25rem 0 0; font-size: 0.9375rem; }

#owner-groups { margin-top: 0.375rem; min-height: 2.5rem; }

.item .danger { flex: none; min-height: 2.5rem; padding: 0.25rem 0.75rem; }

/* Export */
button.round { width: 2.875rem; min-width: 2.875rem; padding: 0; border-radius: 50%; flex: none; color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips button { min-height: 2.5rem; border-radius: 1.25rem; padding: 0.25rem 0.875rem; font-size: 0.9375rem; }
.chips button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.export-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.export-tiles .tile { min-height: 5.5rem; font: inherit; font-weight: 650; }
#print-root { display: none; }

/* Druckansicht im Stil der App */
@media print {
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing { background: #fff; padding: 0; }
  body.printing #print-root { display: block; color: #0F1A34; font: 9.5pt/1.35 "Helvetica Neue", Arial, sans-serif; }
  #print-root header { display: flex; justify-content: space-between; align-items: flex-start; border-top: 5px solid #0F1A34; padding-top: 8px; }
  #print-root h1 { font-size: 18pt; color: #0F1A34; margin: 0; }
  #print-root header p { color: #5A6478; margin: 2px 0 0; }
  #print-root header p::after { content: ""; display: block; width: 50px; height: 3px; background: #23DA8F; margin-top: 6px; }
  #print-root header span { font-weight: 700; color: #5A6478; }
  #print-root .cards { display: flex; gap: 8px; margin: 12px 0; }
  #print-root .cards div { flex: 1; background: #E2F7EE; padding: 6px 9px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #print-root .cards small { display: block; color: #5A6478; font-size: 7.5pt; }
  #print-root .cards b { font-size: 13pt; color: #0F1A34; }
  #print-root h2 { font-size: 11.5pt; color: #0F1A34; margin: 14px 0 6px; }
  #print-root table { width: 100%; border-collapse: collapse; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #print-root table.narrow { width: auto; min-width: 50%; }
  #print-root thead { display: table-header-group; }
  #print-root th { background: #0F1A34; color: #fff; text-align: left; padding: 4px 6px; font-size: 8pt; }
  #print-root td { padding: 3.5px 6px; border-bottom: 0.5pt solid #D9DEE8; font-size: 8.5pt; }
  #print-root tbody tr:nth-child(even) td { background: #F4F6FA; }
  #print-root tr { break-inside: avoid; }
  #print-root .r { text-align: right; white-space: nowrap; }
  #print-root .plus { color: #12865A; }
  #print-root .minus { color: #B3261E; }
  #print-root .muted { color: #5A6478; }
  #print-root tr.total td { background: #E2F7EE; border-top: 1.5pt solid #0F1A34; font-weight: 700; }
  #print-root footer { margin-top: 18px; color: #5A6478; font-size: 7.5pt; }
}

/* Fenster offen: Seite dahinter bleibt stehen */
html.modal-open, html.modal-open body { overflow: hidden; overscroll-behavior: none; }
dialog.picker { overscroll-behavior: contain; }

/* Seitliche Ränder bei Handys mit Notch im Querformat */
body { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }

/* Breite Bildschirme und Handy quer: mehr Platz nutzen */
@media (min-width: 46rem) {
  main { max-width: 60rem; padding-inline: 1.5rem; --pad: 1.5rem; }
  .tabs div { max-width: 60rem; }
  .add { right: max(1.5rem, calc(50vw - 28.5rem)); }
  .give { left: max(1.5rem, calc(50vw - 28.5rem)); }
  .stand-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 2.5rem; align-items: start; }
  .stand-side > h2:first-child { margin-top: 1rem; }
  .filters { grid-template-columns: repeat(4, 1fr); }
  dialog { max-width: 40rem; }
}
@media (orientation: landscape) and (max-height: 32rem) {
  main { padding-top: 0.5rem; padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)); }
  .tabs button { min-height: 2.75rem; }
  .add { bottom: calc(3.5rem + env(safe-area-inset-bottom, 0px)); min-height: 2.875rem; }
  .give { bottom: calc(3.5rem + env(safe-area-inset-bottom, 0px)); width: 2.875rem; height: 2.875rem; }
  .give svg { width: 28px; height: 28px; }
  .verdict { padding: 0.25rem 0 0.75rem; }
  .verdict strong { font-size: 2.25rem; }
  dialog { max-height: calc(100dvh - 0.75rem); padding-top: 0.875rem; }
  dialog.picker { max-height: calc(100dvh - 1rem); margin-bottom: 0.5rem; }
  .bubbles { grid-template-columns: repeat(auto-fill, minmax(4.25rem, 1fr)); margin: 0.625rem 0; }
  .welcome { padding-top: 1.5rem; }
}

/* Reiter als Schiene zum Wischen */
.pager { overflow: hidden; margin-inline: calc(-1 * var(--pad)); touch-action: pan-y; }
.track { display: flex; align-items: flex-start; will-change: transform; }
.pane { flex: 0 0 100%; min-width: 0; box-sizing: border-box; padding-inline: var(--pad); }
.pane:not(.current) { max-height: 100dvh; overflow: hidden; }
.pager:not(.moving) .pane:not(.current) { visibility: hidden; }
.tab-leute .add, .tab-leute .give { opacity: 0; transform: scale(0.8); pointer-events: none; }
.add, .give { transition: opacity 0.2s ease, transform 0.2s ease; }
.tabs div { position: relative; }
.tabs button[aria-current="page"] { box-shadow: none; }
.tab-indicator { position: absolute; left: 0; top: 0; width: calc(100% / 3); height: 3px; background: var(--marker); transition: transform 0.32s cubic-bezier(0.22, 0.8, 0.25, 1); }
@media (prefers-reduced-motion: reduce) { .tab-indicator, .add, .give { transition: none; } }

/* Einweisung */
dialog.tour { position: fixed; inset: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; background: transparent; border-radius: 0; overflow: hidden; animation: none; }
dialog.tour::backdrop { background: transparent; }
.tour-hole { position: fixed; border-radius: 0.875rem; box-shadow: 0 0 0 200vmax rgba(8, 14, 32, 0.62); outline: 3px solid var(--marker); outline-offset: 0; pointer-events: none; transition: left 0.28s ease, top 0.28s ease, width 0.28s ease, height 0.28s ease; }
.tour-bubble { position: fixed; background: var(--surface); color: var(--ink); border-radius: 1rem; padding: 0.875rem 1rem 0.75rem; transition: left 0.28s ease, top 0.28s ease; }
.tour-count { font-size: 0.8125rem; font-weight: 700; color: var(--brand); }
.tour-text { margin: 0.25rem 0 0.75rem; }
.tour-bubble .row { justify-content: space-between; }
.tour-bubble .primary { min-width: 6.5rem; }
@media (prefers-reduced-motion: no-preference) {
  dialog.tour[open] .tour-bubble { animation: fade-in 0.25s ease-out; }
}
@media (prefers-reduced-motion: reduce) { .tour-hole, .tour-bubble { transition: none; } }

/* PDF-Vorschau */
.pdf-pages { display: grid; gap: 0.75rem; margin: 0.75rem 0; background: var(--bg); border-radius: 0.75rem; padding: 0.625rem; }
.pdf-pages canvas { width: 100%; height: auto; background: #fff; border-radius: 0.25rem; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); }
.pdf-actions { position: sticky; bottom: 0; background: var(--surface); padding-top: 0.5rem; display: grid; gap: 0.5rem; }

/* Kein Markieren bei langem Drücken, außer wo Kopieren sinnvoll ist */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
img, svg { -webkit-user-drag: none; }
input, textarea, select, .copy code, .invite-code, .code-big, .selectable { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
.invite-code { -webkit-user-select: all; user-select: all; }

/* Adresse der App */
.app-address { margin: 0 0 1rem; }
.app-address .copy { margin-top: 0.25rem; }
.app-address code { font-size: 0.9375rem; }
.owner-storage { margin-top: 0.625rem; }
.small-switch { margin-top: 0.25rem; margin-bottom: 0.75rem; padding: 0.5rem 0.75rem; min-height: 0; }
.small-switch i { transform: scale(0.85); }

/* Seitenleiste */
.menu-button { margin-left: -0.5rem; }
dialog.drawer {
  margin: 0 auto 0 0;
  height: 100dvh;
  max-height: 100dvh;
  width: min(20rem, 86vw);
  max-width: none;
  border-radius: 0 1.25rem 1.25rem 0;
  padding: calc(1rem + env(safe-area-inset-top, 0px)) 0.75rem calc(1rem + env(safe-area-inset-bottom, 0px)) calc(0.75rem + env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}
dialog.drawer:not([open]) { display: none; }
dialog.drawer::backdrop {
  background: rgba(8, 14, 32, 0.35);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.drawer-head { display: flex; align-items: center; gap: 0.625rem; padding: 0.25rem 0.5rem 0.75rem; font-size: 1.125rem; }
.drawer-head img { width: 2.5rem; height: 2.5rem; border-radius: 0.625rem; }
.drawer-label { font-size: 0.8125rem; font-weight: 700; color: var(--muted); padding: 0.5rem 0.5rem 0.25rem; }
.drawer-groups { list-style: none; margin: 0; padding: 0; }
.drawer-groups li.muted { padding: 0.5rem; }
.drawer-groups button, .drawer-links button { width: 100%; border: 0; justify-content: flex-start; gap: 0.75rem; text-align: left; border-radius: 0.75rem; padding: 0.5rem 0.75rem; min-height: 3rem; font-weight: 600; }
.drawer-groups button.current { background: var(--plus-soft); color: var(--ink); }
.drawer-links { border-top: 1.5px solid var(--line); margin-top: 0.5rem; padding-top: 0.5rem; display: grid; gap: 0.125rem; }
.drawer-links svg { color: var(--brand); flex: none; }
@media (prefers-reduced-motion: no-preference) {
  dialog.drawer[open] { animation: drawer-in 0.3s cubic-bezier(0.32, 0.72, 0, 1); }
  dialog.drawer.closing { animation: drawer-out 0.2s cubic-bezier(0.4, 0, 1, 1) forwards; }
}
@keyframes drawer-in { from { transform: translateX(-100%); } }
@keyframes drawer-out { to { transform: translateX(-100%); } }

/* Zurück-Knopf in den Einstellungen */
.settings-top { min-height: 3rem; }
.back-button { gap: 0.25rem; padding: 0.25rem 0.875rem 0.25rem 0.375rem; min-height: 2.75rem; border-radius: 1.5rem; color: var(--brand); font-weight: 650; max-width: 100%; }
.back-button svg { flex: none; }
.back-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-title { margin: 0.5rem 0 1rem; }

/* ------------------------------------------------ EvenUp: Startseite */
.home-top { gap: 0.625rem; }
.top-mark { width: 2.25rem; height: 2.25rem; border-radius: 22%; flex: none; }
.home-summary {
  position: relative; overflow: hidden;
  background: #0F1A34; color: #FFFFFF;
  border-radius: 1.25rem; padding: 1.125rem 1.25rem 1rem; margin: 0.25rem 0 1.25rem;
}
.home-summary::after {
  content: ""; position: absolute; right: -2.5rem; top: -2.5rem; width: 9rem; height: 9rem;
  border-radius: 50%; border: 1.25rem solid #23DA8F; opacity: 0.18;
}
.home-summary p { font-size: 0.9375rem; color: #B9C3D9; }
.home-summary strong { display: block; font-size: 2.5rem; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; margin: 0.125rem 0 0.25rem; }
.home-summary.plus strong { color: #23DA8F; }
.home-summary.minus strong { color: #FF9AA2; }
.home-summary span { color: #B9C3D9; }
:root[data-theme="dark"] .home-summary { background: #182649; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .home-summary { background: #182649; } }
.group-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.625rem; }
.group-card {
  width: 100%; min-height: 4.75rem; justify-content: flex-start; text-align: left; gap: 0.875rem;
  padding: 0.75rem 0.75rem 0.75rem 0.75rem; border: 1.5px solid var(--line); border-radius: 1rem;
  background: var(--surface); box-shadow: 0 1px 2px rgba(15, 26, 52, 0.06);
}
.group-card:active { transform: scale(0.985); }
.group-card b { font-size: 1.0625rem; display: block; }
.group-card .tag { display: inline-block; margin-top: 0.25rem; }
.group-card > svg { color: var(--muted); flex: none; }
.group-tile {
  width: 3rem; height: 3rem; flex: none; border-radius: 0.875rem;
  display: grid; place-items: center; font-weight: 800; font-size: 1.375rem; color: #0F1A34;
}
.tile-0 { background: #23DA8F; }
.tile-1 { background: #9BE7C6; }
.tile-2 { background: #8FB3FF; }
.tile-3 { background: #FFC979; }
.tile-4 { background: #F6A6C1; }
.tile-5 { background: #B8A8FF; }
.group-balance { display: flex; flex-direction: column; align-items: flex-end; text-align: right; white-space: nowrap; }
.group-balance .small { font-size: 0.8125rem; font-weight: 600; opacity: 0.85; }
.group-balance b { font-size: 1.0625rem; }
.tag.attention { color: var(--on-marker); background: var(--marker); border-color: var(--marker); }
.home-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.625rem; margin: 1.25rem 0 1.5rem; }
.home-actions button { gap: 0.375rem; }
.home-empty { text-align: center; padding: 2rem 1rem 0.5rem; color: var(--muted); }
.home-empty img { width: 4.5rem; height: 4.5rem; border-radius: 22%; margin-bottom: 0.75rem; }

/* ------------------------------------------------ Sprache */
.lang-list { display: grid; gap: 0.625rem; margin-top: 1.25rem; }
.lang-list button { font-size: 1.125rem; min-height: 3.25rem; }
.lang-choice { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.5rem; }
.lang-choice button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

/* ------------------------------------------------ Währung */
.fx-box { background: var(--surface); border: 1.5px dashed var(--line); border-radius: 0.875rem; padding: 0.75rem; }
.fx-box p { margin-top: 0.375rem; }
input.computed { background: transparent; border-style: dashed; color: var(--muted); }

/* ------------------------------------------------ Zoom-Betrachter */
.zoomable { cursor: zoom-in; }
dialog.zoom {
  position: fixed; inset: 0; width: 100vw; height: 100vh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; border-radius: 0; background: #0A1226; color: #FFFFFF;
  display: flex; flex-direction: column;
}
dialog.zoom:not([open]) { display: none; }
dialog.zoom::backdrop { background: #0A1226; }
.zoom-stage { flex: 1; overflow: hidden; display: grid; place-items: center; touch-action: none; padding-top: env(safe-area-inset-top, 0px); }
.zoom-stage img { max-width: 100%; max-height: 100%; transform-origin: center center; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }
.zoom-bar { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px)); background: rgba(15, 26, 52, 0.92); }
.zoom-bar span { flex: 1; color: #B9C3D9; }
.zoom-bar button.primary { background: #23DA8F; border-color: #23DA8F; color: #0F1A34; }
.receipt-full, #receipt-preview img { cursor: zoom-in; }
