/* Quitt – helles Dashboard: Arbeitsfläche mit Seitenleiste, weiße Panels,
   schwarze Primär-Buttons, kleine Chips, Altrosa als einziger Akzent. */

@font-face { font-family: 'Geist'; src: url('/fonts/geist-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --bg: #e8e7e4;
  --shell: #f3f2f0;
  --panel: #ffffff;
  --panel-2: #f6f5f3;
  --hover: #efeeeb;
  --line: #e8e6e2;
  --line-2: #d9d6d0;
  --text: #191919;
  --text-2: #5a5650;
  --text-3: #726e68; /* ≥ 4,5:1 auf allen Flächen – trägt echte Infos (Meta-Zeilen, Hinweise) */
  --field-border: #8f8a82; /* ≥ 3:1 gegen Weiß, damit Eingabefelder erkennbar sind */
  --primary: #111111;
  --on-primary: #ffffff;
  --rose: #9a5450;
  --rose-soft: #f4e7e5;
  --on-rose: #ffffff;
  --logo-accent: #d49a96;
  --pos: #2d7a4e;
  --neg: #c2492e;
  --danger: #c2372b;
  --on-danger: #ffffff;
  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

/* Dunkel: nach Geräteeinstellung, außer „Hell“ wurde gewählt – oder ausdrücklich „Dunkel“ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0c0d;
    --shell: #141415;
    --panel: #1c1c1e;
    --panel-2: #232325;
    --hover: #28282b;
    --line: #2b2b2e;
    --line-2: #38383c;
    --text: #ededeb;
    --text-2: #b5b2ac;
    --text-3: #95918b;
    --field-border: #6b6863;
    --primary: #f2f1ee;
    --on-primary: #111111;
    --rose: #c8837e;
    --rose-soft: #3a2927;
    --on-rose: #1a1110;
    --logo-accent: #a55f5b;
    --pos: #6fcf99;
    --neg: #ff8e70;
    --danger: #ff7b6e;
    --on-danger: #1a0f0e; /* weiß auf dem hellen Rot wäre kaum lesbar */
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0c0d;
  --shell: #141415;
  --panel: #1c1c1e;
  --panel-2: #232325;
  --hover: #28282b;
  --line: #2b2b2e;
  --line-2: #38383c;
  --text: #ededeb;
  --text-2: #b5b2ac;
  --text-3: #95918b;
  --field-border: #6b6863;
  --primary: #f2f1ee;
  --on-primary: #111111;
  --rose: #c8837e;
  --rose-soft: #3a2927;
  --on-rose: #1a1110;
  --logo-accent: #a55f5b;
  --pos: #6fcf99;
  --neg: #ff8e70;
  --danger: #ff7b6e;
  --on-danger: #1a0f0e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* Kein Zoomen wie in einer nativen App: manipulation verhindert den Doppeltipp-Zoom (Pinch siehe js/app.js) */
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }

h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 450; letter-spacing: -0.015em; }
h1 { display: flex; align-items: center; gap: 12px; font-size: 1.9rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
a { color: inherit; }
hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
b, strong { font-weight: 550; }

.muted { color: var(--text-2); }
.small { font-size: 0.82rem; }
.fine { margin-top: 12px; font-size: 0.76rem; color: var(--text-3); }
.sub { display: block; font-size: 0.78rem; color: var(--text-3); }
.lead { font-size: 0.95rem; }
.block { display: block; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.eyebrow { font-size: 0.78rem; color: var(--text-3); margin-bottom: 6px; }
.icon { flex: none; display: inline-block; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Gerüst ---------- */
.shell {
  display: grid; grid-template-columns: 240px minmax(0, 1fr);
  min-height: calc(100dvh - 32px); margin: 16px;
  background: var(--shell); border-radius: 24px;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.06);
}
.main { min-width: 0; display: flex; flex-direction: column; }
#app { padding: 8px 28px 48px; }

.sidebar { position: sticky; top: 16px; align-self: start; height: calc(100dvh - 32px); display: flex; flex-direction: column; gap: 4px; padding: 20px 14px 14px; overflow-y: auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; padding: 2px 8px 18px; font-weight: 600; font-size: 1.05rem; letter-spacing: -0.02em; text-decoration: none; }
.logo { flex: none; display: block; }
.logo-bg { fill: var(--primary); }
.logo-arc { stroke: var(--on-primary); fill: none; }
.logo-bars { stroke: var(--logo-accent); fill: none; }
.nav { display: grid; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 450; }
.nav-item .icon { color: var(--text-2); }
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--panel); box-shadow: 0 1px 2px rgb(0 0 0 / 0.05); }
.nav-item.active .icon { color: var(--rose); }
.nav-section { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 4px; padding: 14px 4px 0 10px; border-top: 1px solid var(--line-2); font-size: 0.75rem; color: var(--text-3); }
.nav-groups { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.nav-group { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; text-decoration: none; }
.nav-group:hover { background: var(--hover); }
.nav-group.active { background: var(--panel); box-shadow: 0 1px 2px rgb(0 0 0 / 0.05); }
.nav-group .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-empty { padding: 6px 10px; color: var(--text-3); font-size: 0.82rem; }
.swatch { display: inline-block; flex: none; width: 12px; height: 12px; border-radius: 3px; }
.swatch-lg { width: 16px; height: 16px; border-radius: 4px; }
.sidebar-foot { display: flex; align-items: center; gap: 6px; margin-top: auto; padding: 12px 4px 0; border-top: 1px solid var(--line-2); }
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 4px; border-radius: 10px; text-decoration: none; }
.me:hover { background: var(--hover); }
.me-text { display: grid; min-width: 0; line-height: 1.3; }
.me-text b, .me-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text span { font-size: 0.75rem; color: var(--text-3); }

.topbar { display: flex; align-items: center; gap: 8px; padding: 16px 28px 12px 12px; }
.pill, .pill-btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--panel); color: var(--text); font: 450 0.84rem var(--font); box-shadow: 0 1px 2px rgb(0 0 0 / 0.04); }
.pill .icon, .pill-btn .icon { color: var(--text-2); }
.pill-btn { cursor: pointer; }
.pill-btn:hover { background: var(--hover); }
.menu-btn, .brand-compact { display: none; }
.theme-btn { padding: 0 9px; }
.sidebar-scrim { display: none; }

/* Abgemeldet: ohne Seitenleiste */
.guest .shell { grid-template-columns: 1fr; }
.guest .sidebar, .guest .topbar { display: none; }
.guest #app { padding: 40px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; margin: 0; border-radius: 0; min-height: 100dvh; box-shadow: none; }
  #app { padding: 4px 16px 40px; }
  .guest #app { padding: calc(24px + env(safe-area-inset-top)) 16px 24px; }
  /* Seitenhintergrund = App-Fläche: iOS färbt die Statusleiste der Web-App damit, sie geht so nahtlos in die Kopfzeile über */
  body { background: var(--shell); }
  .topbar { position: sticky; top: 0; z-index: 20; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--shell) 90%, transparent); backdrop-filter: blur(12px); }
  .menu-btn { display: inline-flex; padding: 0 9px; }
  .brand-compact { display: inline-flex; padding: 0 4px; font-size: 1rem; }
  .date-pill { display: none; }
  .sidebar { position: fixed; z-index: 60; top: 0; left: 0; height: 100dvh; width: 280px; background: var(--shell); transform: translateX(-100%); transition: transform 0.25s ease; box-shadow: 20px 0 60px rgb(0 0 0 / 0.15); padding-top: max(20px, env(safe-area-inset-top)); }
  .sidebar-open .sidebar { transform: none; }
  .sidebar-open .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgb(0 0 0 / 0.3); }
}

/* ---------- Seitenkopf ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 8px 0 20px; }
.crumbs { display: flex; gap: 6px; margin-bottom: 8px; font-size: 0.78rem; color: var(--text-3); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs .current { color: var(--text); }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* Gruppenname: Stift direkt dahinter, beim Bearbeiten wird der Titel zum Eingabefeld */
.group-title { gap: 10px; min-width: 0; }
.group-title .title-edit { color: var(--text-3); }
.group-title .title-edit:hover { color: var(--text); }
.title-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.title-input { width: min(420px, 100%); min-height: 44px; font-size: 1.4rem; font-weight: 450; letter-spacing: -0.015em; }

/* ---------- Panels ---------- */
.panel, .card { background: var(--panel); border-radius: var(--radius-lg); padding: 18px; box-shadow: 0 1px 2px rgb(0 0 0 / 0.04); }
.card { margin-bottom: 16px; }
.card-title { font-size: 1.05rem; margin-bottom: 10px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.narrow { max-width: 460px; margin: 24px auto; }

.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.stat-head { display: flex; align-items: center; gap: 10px; font-size: 0.84rem; color: var(--text-2); }
.stat-big { min-height: 38px; display: flex; align-items: center; }
.stat-big .amount { align-items: flex-start; }
.stat-breakdown { display: none; font-size: 0.84rem; color: var(--text-2); }
.stat-big .amount-value, .stat-value { font-size: 1.75rem; font-weight: 450; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
@media (max-width: 1100px) { .stat-row-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } /* minmax: breite Inhalte dürfen die Seite nicht verbreitern */
  .stat-row > :first-child { grid-column: 1 / -1; }
  .stat-secondary { display: none; }
  .stat-breakdown { display: block; }
  .stat-row-4 > :first-child { grid-column: auto; }
}

.icon-tile { display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-tag { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--panel); font-size: 0.74rem; color: var(--text-2); white-space: nowrap; }
.chip-tag .icon { color: var(--text-3); }
.dot { display: inline-block; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.dot-pos { background: var(--pos); }
.dot-neg { background: var(--neg); }
.dot-rose { background: var(--rose); }

/* Beträge */
.amount { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1.25; white-space: nowrap; }
.amount-label { font-size: 0.72rem; color: var(--text-3); }
.amount-value { font-weight: 550; font-variant-numeric: tabular-nums; }
.amount.pos .amount-value { color: var(--pos); }
.amount.neg .amount-value { color: var(--neg); }
.amount.zero .amount-value { color: var(--text-3); font-weight: 400; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* Layout mit Seitenspalte */
.split-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.aside { display: grid; gap: 16px; }
@media (max-width: 1100px) { .split-layout { grid-template-columns: 1fr; } }

/* Gruppenkarten */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.group-card { position: relative; display: flex; flex-direction: column; gap: 6px; transition: box-shadow 0.15s; }
.group-card:hover { box-shadow: 0 6px 20px rgb(0 0 0 / 0.07); }
.group-card:has(.group-card-title:focus-visible) { outline: 2px solid var(--rose); outline-offset: 2px; }
.group-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.group-card-top .amount-value { font-size: 1.15rem; }
.group-card-title { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 1.1rem; font-weight: 500; line-height: 1.3; text-decoration: none; outline: none; }
/* Titel-Link über die ganze Karte strecken */
.group-card-title::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.group-card-foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.card-action { position: relative; z-index: 1; }

/* Avatare */
.avatar { display: inline-grid; place-items: center; flex: none; border-radius: 50%; background: var(--panel-2); color: #3a3733; font-weight: 600; letter-spacing: 0.01em; }
.avatar-xs { width: 20px; height: 20px; font-size: 0.55rem; }
.avatar-sm { width: 28px; height: 28px; font-size: 0.64rem; }
.avatar-md { width: 34px; height: 34px; font-size: 0.72rem; }
.avatar-lg { width: 52px; height: 52px; font-size: 1rem; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--panel); margin-left: -5px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-more { background: var(--rose) !important; color: var(--on-rose); }

/* Listen im Panel */
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.feed-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: var(--radius); background: var(--panel-2); }
.feed-item b { display: block; font-weight: 500; }
.transfer { align-items: flex-start; padding: 10px 12px; }
.transfer .grow { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.transfer-amount { font-weight: 550; font-size: 0.95rem; white-space: nowrap; }

.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 14px 10px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: inherit; font: inherit; text-align: left; transition: background 0.15s, border-color 0.15s; }
button.row-item { cursor: pointer; }
button.row-item:hover { background: var(--panel-2); border-color: var(--line-2); }
.row-item.is-settlement { background: var(--panel-2); }
.row-title { display: block; font-weight: 500; font-size: 0.95rem; }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 1px; font-size: 0.78rem; color: var(--text-3); }
.meta-tag { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; border-radius: 5px; background: var(--rose-soft); color: var(--rose); font-size: 0.7rem; font-weight: 500; }
.date-tile { display: grid; place-items: center; align-content: center; flex: none; width: 44px; height: 44px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); line-height: 1.05; }
.date-tile b { font-size: 1rem; font-weight: 550; }
.date-tile span { font-size: 0.64rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }

/* Promo-Karte (Passkey) */
.promo { display: grid; gap: 8px; padding: 18px; border-radius: var(--radius-lg); background: var(--panel); box-shadow: 0 1px 2px rgb(0 0 0 / 0.04); }
.promo p { font-size: 0.84rem; color: var(--text-2); margin-bottom: 6px; }
.promo-art {
  display: grid; place-items: center; height: 110px; margin-bottom: 6px; border-radius: 14px; color: var(--rose);
  background:
    radial-gradient(90% 90% at 85% 15%, color-mix(in srgb, var(--rose) 30%, transparent) 0%, transparent 60%),
    linear-gradient(135deg, var(--rose-soft), color-mix(in srgb, var(--rose) 22%, var(--rose-soft)));
}

.empty { padding: 28px 8px; text-align: center; display: grid; justify-items: center; gap: 6px; }
.empty-title { font-size: 1.1rem; font-weight: 500; }
.empty .btn { margin-top: 8px; }

/* Klassische Listen (Konto, Admin, Formulare) */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list.compact > li { padding: 9px 0; }
.row { display: flex; align-items: center; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
/* minmax(0, …): Felder mit eigener Mindestbreite (Datum auf iOS) dürfen die Spalte nicht sprengen */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.profile { display: flex; align-items: center; gap: 14px; }
.tag { display: inline-block; margin-left: 8px; padding: 0 6px; border: 1px solid var(--line-2); border-radius: 6px; font-size: 0.7rem; font-weight: 500; color: var(--text-2); vertical-align: 1px; }
.tag-warn { border-color: transparent; background: var(--rose-soft); color: var(--rose); }
.tag-danger { border-color: var(--danger); color: var(--danger); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--text);
  font: 500 0.86rem var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible, .nav-item:focus-visible, .nav-group:focus-visible, .row-item:focus-visible, .chip:focus-visible, .tab:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary); opacity: 0.86; }
.btn-rose { background: var(--rose); border-color: var(--rose); color: var(--on-rose); }
.btn-rose:hover { background: var(--rose); opacity: 0.9; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.btn-danger:hover { background: var(--danger); opacity: 0.9; }
.btn-danger-ghost { color: var(--danger); }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: 0.82rem; }
.btn-xs { min-height: 28px; padding: 0 10px; font-size: 0.76rem; border-radius: 7px; }
.btn-lg { min-height: 46px; font-size: 0.95rem; }
.btn-block { width: 100%; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading > * { visibility: hidden; }
.btn.loading::after { content: ''; position: absolute; width: 15px; height: 15px; border: 1.5px solid var(--text); border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
.btn-primary.loading::after { border-color: var(--on-primary); border-right-color: transparent; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--text); font: 500 0.84rem var(--font); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }

.icon-btn { display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn-sm { width: 26px; height: 26px; border-radius: 7px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* ---------- Formulare ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 0.78rem; font-weight: 500; color: var(--text-2); }
.hint { font-size: 0.76rem; color: var(--text-3); }
input, select {
  width: 100%; min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--field-border); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--text);
  font: 400 16px var(--font); /* 16px verhindert Zoom auf iOS */
}
@media (min-width: 900px) { input, select { font-size: 0.9rem; } }
input:hover, select:hover { border-color: var(--text-2); }
input:focus, select:focus { outline: none; border-color: var(--rose); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rose) 18%, transparent); }
/* iOS zeichnet Datumsfelder breiter, höher und zentriert – an die anderen Felder angleichen */
input[type='date'] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; height: 40px; text-align: left; }
input[type='date']::-webkit-date-and-time-value { margin: 0; text-align: left; }
input[type='checkbox'] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); flex: none; box-shadow: none; }
.input-group { display: flex; gap: 8px; }
.form-error { padding: 10px 12px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); font-size: 0.86rem; }
.notice { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--rose-soft); color: var(--text); font-size: 0.86rem; }

/* Darstellung: System / Hell / Dunkel */
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; max-width: 420px; padding: 3px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.segment { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 6px; border: 0; border-radius: 8px; background: none; color: var(--text-2); font: 500 0.84rem var(--font); cursor: pointer; }
.segment:hover { color: var(--text); }
.segment[aria-checked='true'] { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 0.08); }
.segment:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; }

/* Aufteilung: Segment-Umschalter */
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 3px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.tab { padding: 6px 4px; border: 0; border-radius: 8px; background: none; color: var(--text-2); font: 500 0.82rem var(--font); cursor: pointer; }
.tab:hover { color: var(--text); }
.tab[aria-selected='true'] { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 0.08); }
.split-list > li { border-bottom: 1px solid var(--line); }
.split-list .row { gap: 10px; }
.check-label { cursor: pointer; gap: 10px; }
.value-wrap { display: none; align-items: center; gap: 6px; width: 112px; }
.value-input { text-align: right; min-height: 34px; padding: 5px 8px; font-variant-numeric: tabular-nums; }
.suffix { font-size: 0.82rem; }
.split-list .share { width: 76px; text-align: right; font-variant-numeric: tabular-nums; }
.split-list:not([data-type='equal']) input[type='checkbox'] { display: none; }
.split-list:not([data-type='equal']) .value-wrap { display: flex; }
.split-status { font-size: 0.8rem; font-weight: 500; color: var(--pos); }
.split-status.error { color: var(--neg); }
.split-status.muted { color: var(--text-3); }

/* ---------- Modal ---------- */
/* Dialoge füllen nur den sichtbaren Bereich: Auf iOS liegt die Tastatur über der Seite, ohne sie zu verkleinern.
   --vv-top/--vv-height setzt js/ui.js (trackKeyboard) aus window.visualViewport. */
:root { --safe-bottom: env(safe-area-inset-bottom); }
.keyboard-open { --safe-bottom: 0px; } /* über der Tastatur braucht es keinen Abstand für den Home-Balken */
.backdrop { position: fixed; left: 0; right: 0; top: var(--vv-top, 0px); height: var(--vv-height, 100dvh); z-index: 70; display: grid; place-items: center; padding: 20px; background: rgb(20 18 16 / 0.35); backdrop-filter: blur(2px); animation: fade 0.15s; }
.modal { width: 100%; max-width: 480px; max-height: calc(var(--vv-height, 100dvh) - 40px); display: flex; flex-direction: column; background: var(--panel); border-radius: 20px; box-shadow: 0 24px 70px rgb(0 0 0 / 0.22); animation: rise 0.2s ease-out; }
.modal-wide { max-width: 740px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 18px 14px 6px 22px; }
.modal-head h2 { font-size: 1.25rem; }
.modal-body { padding: 12px 22px 22px; overflow-y: auto; }
@media (max-width: 600px) {
  .backdrop { padding: 0; place-items: end stretch; }
  .modal { max-width: none; max-height: calc(var(--vv-height, 100dvh) - 24px); border-radius: 20px 20px 0 0; animation: slide-up 0.24s ease-out; }
  .modal-body { padding: 10px 18px calc(22px + var(--safe-bottom)); }
}
.detail-head { display: flex; flex-direction: column; gap: 3px; padding: 14px; border-radius: var(--radius); background: var(--panel-2); }
.amount.big { align-items: flex-start; font-size: 2rem; font-weight: 450; letter-spacing: -0.02em; }
.receipt-thumb img { display: block; max-width: 100%; max-height: 380px; margin: 0 auto; border-radius: var(--radius); }
.passkey-offer { text-align: center; }
.passkey-icon-sm { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); }

/* ---------- Belegscanner ---------- */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 16px; border: 1.5px dashed var(--line-2); border-radius: var(--radius); text-align: center; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.dropzone:hover, .dropzone.over { border-color: var(--rose); background: var(--rose-soft); }
.dropzone-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 16px; background: var(--panel-2); color: var(--text); }
.dropzone-icon .icon { width: 30px; height: 30px; }
.scanning { position: relative; overflow: hidden; max-height: 380px; border-radius: var(--radius); }
.scanning img { display: block; width: 100%; max-height: 380px; object-fit: contain; background: var(--panel-2); }
.scan-line { position: absolute; left: 0; right: 0; height: 3px; background: var(--rose); box-shadow: 0 0 18px 4px color-mix(in srgb, var(--rose) 60%, transparent); animation: scan 1.6s ease-in-out infinite alternate; }
.progress { height: 4px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.progress-bar { display: block; width: 0; height: 100%; background: var(--rose); transition: width 0.3s ease; }
.dropzone .chip-tag { margin-top: 6px; }
.spinner { display: inline-block; width: 12px; height: 12px; border: 1.5px solid var(--text); border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -1px; }

.itemizer-top { display: flex; gap: 16px; align-items: flex-start; }
.receipt-preview { width: 104px; max-height: 180px; object-fit: cover; object-position: top; border-radius: var(--radius-sm); flex: none; }
@media (max-width: 600px) { .receipt-preview { display: none; } }
.items-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.items-head h3 { margin: 0; }
.items { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.item { padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); }
.item.unassigned { border-color: color-mix(in srgb, var(--rose) 55%, var(--line)); }
.item-head { display: flex; gap: 8px; align-items: center; }
.item-name { flex: 1; min-width: 0; font-weight: 500; }
.money-input { width: 100px; flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.item-head input { min-height: 36px; padding: 6px 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 2px 10px 2px 3px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel); color: var(--text); font: 500 0.78rem var(--font); cursor: pointer; }
.chip:hover { border-color: var(--text-3); }
.chip-all { padding-left: 10px; }
.chip[aria-pressed='true'] { background: var(--rose); border-color: var(--rose); color: var(--on-rose); }
.item .chips { margin-top: 8px; }
.sticky-footer { position: sticky; bottom: -22px; margin: 0 -22px -22px; padding: 14px 22px 18px; background: var(--panel); border-top: 1px solid var(--line); display: grid; gap: 10px; border-radius: 0 0 20px 20px; }
@media (max-width: 600px) { .sticky-footer { margin: 0 -18px calc(-22px - var(--safe-bottom)); padding: 12px 18px calc(16px + var(--safe-bottom)); border-radius: 0; } }
.item-summary { display: flex; gap: 16px; overflow-x: auto; }
.summary-person { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 56px; font-size: 0.76rem; }
.summary-person strong { font-size: 0.84rem; font-variant-numeric: tabular-nums; }

/* ---------- Anmeldung ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 48px; align-items: center; max-width: 1040px; min-height: calc(100dvh - 112px); margin: 0 auto; }
.auth-hero .brand { padding: 0 0 28px; }
.auth-hero h1 { display: block; font-size: clamp(2rem, 4.6vw, 3.4rem); line-height: 1.08; letter-spacing: -0.03em; max-width: 14ch; }
.hero-copy { margin-top: 18px; max-width: 42ch; color: var(--text-2); font-size: 1rem; }
.auth-card { padding: 26px; margin: 0; }
.auth-card h2, .narrow h2 { margin-bottom: 18px; font-size: 1.4rem; }
.auth-card .muted.center, .narrow .muted.center { margin-top: 16px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 0.76rem; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; gap: 24px; min-height: 0; }
  .hero-copy { display: none; }
  .auth-hero .brand { padding-bottom: 16px; }
}

/* ---------- Admin ---------- */
.admin-user { flex-wrap: wrap; }
.admin-user.is-disabled .grow { opacity: 0.5; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
@media (max-width: 700px) { .admin-actions { width: 100%; justify-content: flex-start; } }

/* ---------- Ausgabe hinzufügen: überall präsent ---------- */
.btn-add { min-height: 40px; padding: 0 12px 0 14px; font-size: 0.9rem; box-shadow: 0 4px 14px rgb(0 0 0 / 0.18); }
kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 4px; padding: 0 5px; border-radius: 5px; background: color-mix(in srgb, var(--on-primary) 16%, transparent); color: inherit; font: 600 0.7rem var(--font); }
.page-head .btn-lg { min-height: 44px; padding: 0 18px; }
.page-head .btn-lg.btn-primary { box-shadow: 0 4px 14px rgb(0 0 0 / 0.18); }

.composer { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; padding: 6px 6px 6px 8px; border: 1.5px dashed var(--line-2); border-radius: 14px; background: var(--panel-2); transition: border-color 0.15s, background 0.15s, box-shadow 0.15s; }
.composer:focus-within { border-style: solid; border-color: var(--rose); background: var(--panel); box-shadow: 0 0 0 4px color-mix(in srgb, var(--rose) 14%, transparent); }
.composer-icon { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--primary); color: var(--on-primary); }
.composer-input { flex: 1; min-width: 0; min-height: 38px; border: 0; background: transparent; padding: 0 4px; font-size: 1rem; box-shadow: none !important; }
.composer-input:hover { border: 0; }
.composer-input::placeholder { color: var(--text-3); }

.fab { display: none; }
.pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pick-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.pick-item:hover { background: var(--panel-2); border-color: var(--line-2); }
.pick-item b { display: block; font-weight: 500; }
.pick-item > .icon { color: var(--text-3); }

@media (max-width: 900px) {
  .hide-mobile, .btn-add, .page-head .head-add { display: none; }
  .page-head .head-scan { min-height: 40px; padding: 0 14px; font-size: 0.86rem; }
  body:not(.guest) .fab {
    display: grid; place-items: center; position: fixed; z-index: 40;
    right: max(18px, env(safe-area-inset-right)); bottom: calc(18px + env(safe-area-inset-bottom));
    width: 60px; height: 60px; border: 0; border-radius: 20px;
    background: var(--primary); color: var(--on-primary); cursor: pointer;
    box-shadow: 0 10px 28px rgb(0 0 0 / 0.28), 0 2px 6px rgb(0 0 0 / 0.15);
    transition: transform 0.15s;
  }
  .fab:active { transform: scale(0.94); }
  .modal-open .fab, .sidebar-open .fab { display: none !important; }
  #app { padding-bottom: 100px; }
}

/* ---------- Toast ---------- */
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 100; transform: translate(-50%, 16px); padding: 10px 16px; border-radius: 12px; background: var(--primary); color: var(--on-primary); font-size: 0.86rem; font-weight: 500; box-shadow: 0 10px 30px rgb(0 0 0 / 0.2); opacity: 0; pointer-events: none; transition: 0.2s; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.success::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 9px; border-radius: 50%; background: #6fcf99; vertical-align: 1px; }
#toast.error { background: var(--danger); color: var(--on-danger); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(0.99); } }
@keyframes slide-up { from { transform: translateY(100%); } }
@keyframes scan { from { top: 0; } to { top: calc(100% - 3px); } }

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