:root{
  --paper:#eef1f5; --surface:#ffffff; --surface-2:#e4e9f0; --ink:#17212b; --muted:#5b6878; --line:#d6dde6;
  --accent:#2f4bd8; --accent-ink:#ffffff; --accent-soft:#e3e8fd;
  --pos:#13795b; --pos-soft:#dcf2e9; --neg:#b93a2b; --neg-soft:#f9e1dd;
  --receipt:#fffef9; --receipt-ink:#23201a;
  --shadow:0 1px 2px rgba(23,33,43,.06),0 8px 24px rgba(23,33,43,.06);
  color-scheme:light;
  box-sizing:border-box;
  padding-top:env(safe-area-inset-top,0px);
  padding-bottom:env(safe-area-inset-bottom,0px);
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --paper:#10151b; --surface:#19212a; --surface-2:#232d38; --ink:#e8edf3; --muted:#97a4b4; --line:#2c3743;
    --accent:#90a3ff; --accent-ink:#0f1530; --accent-soft:#232c55;
    --pos:#4fd1a1; --pos-soft:#173a2f; --neg:#ff8d7c; --neg-soft:#43221e;
    --receipt:#f3f0e6; --receipt-ink:#23201a;
    --shadow:0 1px 2px rgba(0,0,0,.3),0 8px 24px rgba(0,0,0,.25);
    color-scheme:dark;
  }
}
:root[data-theme="dark"]{
  --paper:#10151b; --surface:#19212a; --surface-2:#232d38; --ink:#e8edf3; --muted:#97a4b4; --line:#2c3743;
  --accent:#90a3ff; --accent-ink:#0f1530; --accent-soft:#232c55;
  --pos:#4fd1a1; --pos-soft:#173a2f; --neg:#ff8d7c; --neg-soft:#43221e;
  --receipt:#f3f0e6; --receipt-ink:#23201a;
  --shadow:0 1px 2px rgba(0,0,0,.3),0 8px 24px rgba(0,0,0,.25);
  color-scheme:dark;
}
html{scroll-padding-top:env(safe-area-inset-top,0px)}
*,*::before,*::after{box-sizing:border-box}
body{margin:0;background:var(--paper);color:var(--ink);font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;font-size:15px;line-height:1.5;-webkit-font-smoothing:antialiased}
h1,h2,h3{margin:0;font-weight:700;letter-spacing:-.02em}
h1{font-size:clamp(28px,6vw,40px);line-height:1.05}
h2{font-size:19px;line-height:1.2}
h3{font-size:18px;line-height:1.2}
p{margin:0}
a{color:var(--accent)}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}


.wrap{max-width:760px;margin:0 auto;padding:22px 18px 90px}
.brand{display:flex;align-items:center;justify-content:space-between;margin-bottom:26px}
.brand-name{font-weight:700;font-size:17px;letter-spacing:-.01em;display:flex;align-items:center;gap:8px}
.brand-mark{width:26px;height:26px;border-radius:8px;background:var(--accent);color:var(--accent-ink);display:grid;place-items:center;font-size:14px;font-weight:700}
.role-tag{font-size:12px;font-weight:600;color:var(--muted)}

.lede{color:var(--muted);margin-top:8px;max-width:60ch}
.muted{color:var(--muted)}
.small{font-size:13px}
.block{margin-top:30px}
.panel{background:var(--surface);border:1px solid var(--line);border-radius:18px;padding:18px;box-shadow:var(--shadow)}
.head-row{display:flex;justify-content:space-between;align-items:baseline;gap:12px;margin-bottom:12px;flex-wrap:wrap}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;border:1px solid var(--line);background:var(--surface);color:var(--ink);font:inherit;font-weight:600;padding:10px 16px;border-radius:12px;cursor:pointer;text-decoration:none;min-height:44px;white-space:nowrap}
.btn:hover{border-color:var(--muted)}
.btn.primary{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
.btn.primary:hover{filter:brightness(1.07)}
.btn.quiet{background:transparent;border-color:transparent;color:var(--muted)}
.btn.quiet:hover{color:var(--ink);background:var(--surface-2)}
.btn.sm{padding:6px 12px;min-height:34px;font-size:13px;border-radius:10px}
.btn.danger{color:var(--neg)}
.btn:disabled{opacity:.45;cursor:not-allowed}
.linkbtn{border:0;background:none;padding:0;font:inherit;color:var(--accent);font-weight:600;cursor:pointer;text-decoration:underline;text-underline-offset:3px}

input,select{font:inherit;color:var(--ink);background:var(--paper);border:1px solid var(--line);border-radius:10px;padding:10px 12px;width:100%;min-height:44px}
input::placeholder{color:var(--muted);opacity:.8}
.field{display:flex;flex-direction:column;gap:6px;margin:0 0 14px;border:0;padding:0;min-width:0}
.field>span,.field>legend{font-size:13px;font-weight:600;color:var(--muted);padding:0;margin-bottom:6px}
.field>span{margin-bottom:0}
.row2{display:grid;grid-template-columns:1.3fr 1fr;gap:12px}
.inline-form{display:flex;gap:8px;margin-top:12px}
.inline-form input{flex:1;min-width:0}

.figures{display:flex;flex-wrap:wrap;gap:8px 28px;margin-top:20px}
.figure b{display:block;font-size:24px;font-weight:700;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
.figure span{font-size:13px;color:var(--muted)}

.status{display:inline-flex;white-space:nowrap;flex:none;align-items:center;gap:6px;font-size:12px;font-weight:600;padding:3px 10px;border-radius:999px;background:var(--accent-soft);color:var(--accent)}
.status::before{content:"";width:7px;height:7px;border-radius:50%;background:currentColor}
.status.closed{background:var(--surface-2);color:var(--muted)}
.status.done{background:var(--pos-soft);color:var(--pos)}

.people{display:flex;flex-wrap:wrap;gap:6px}
.person{display:inline-flex;align-items:center;gap:7px;padding:4px 11px 4px 4px;border-radius:999px;background:var(--surface);border:1px solid var(--line);font-size:13px;font-weight:500;color:var(--ink)}
.person.me{border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)}
button.person{cursor:pointer;font:inherit;font-size:14px;padding:6px 14px 6px 6px}
button.person:hover{border-color:var(--accent)}
.av{width:24px;height:24px;border-radius:50%;display:inline-grid;place-items:center;font-size:11px;font-weight:700;color:#fff;flex:none}
.av.lg{width:34px;height:34px;font-size:14px}

.groups{display:grid;gap:12px}
.gcard{background:var(--surface);border:1px solid var(--line);border-radius:18px;padding:18px;display:flex;flex-direction:column;gap:12px}
.gcard-top{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}
.gcard .facts{font-size:13px;color:var(--muted);margin-top:4px}
.actions{display:flex;gap:8px;flex-wrap:wrap}

.back{display:inline-block;font-weight:600;text-decoration:none;margin-bottom:14px;font-size:14px}
.gtitle{display:flex;flex-direction:column;gap:10px;align-items:flex-start}
.identity{margin-top:14px;font-size:14px;color:var(--muted);display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.identity select{width:auto;min-height:36px;padding:6px 10px}
.admin-note{font-size:12px;font-weight:600;color:var(--accent);background:var(--accent-soft);padding:3px 10px;border-radius:999px}

.invite{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.invite input{flex:1 1 240px;font-size:13px;min-height:38px}

.toolbar{display:flex;gap:10px;flex-wrap:wrap;margin-top:22px}

.list>.item{display:flex;gap:12px;align-items:flex-start;padding:14px 0;border-top:1px solid var(--line)}
.list>.item:first-child{border-top:0;padding-top:2px}
.item-main{flex:1;min-width:0}
.item-title{font-weight:600;overflow-wrap:anywhere}
.item-meta{font-size:13px;color:var(--muted)}
.item-amt{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
.item-amt b{font-size:16px}
.item .actions{margin-top:8px}
.empty{padding:22px 0 8px;color:var(--muted)}

.bal{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 0;border-top:1px solid var(--line)}
.bal:first-of-type{border-top:0}
.bal .who{display:flex;align-items:center;gap:9px;font-weight:500}
.bal .v{font-weight:600;font-variant-numeric:tabular-nums}
.pos{color:var(--pos)} .neg{color:var(--neg)}
.note{font-size:13px;color:var(--muted);margin-top:10px}

/* Der Kassenbon */
.receipt{position:relative;background:var(--receipt);color:var(--receipt-ink);padding:26px 22px 30px;margin-top:30px;filter:drop-shadow(0 6px 18px rgba(0,0,0,.12));
  --z:10px;
  -webkit-mask:conic-gradient(from -45deg at bottom,#0000,#000 1deg 89deg,#0000 90deg) 50%/calc(2*var(--z)) 100%,conic-gradient(from 135deg at top,#0000,#000 1deg 89deg,#0000 90deg) 50%/calc(2*var(--z)) 100%;
  -webkit-mask-composite:source-in;
  mask:conic-gradient(from -45deg at bottom,#0000,#000 1deg 89deg,#0000 90deg) 50%/calc(2*var(--z)) 51% repeat-x bottom,conic-gradient(from 135deg at top,#0000,#000 1deg 89deg,#0000 90deg) 50%/calc(2*var(--z)) 51% repeat-x top;
}
.receipt .r-head{text-align:center;padding-bottom:14px;border-bottom:2px dashed rgba(35,32,26,.25)}
.receipt .r-head h2{font-size:22px}
.receipt .r-head p{font-family:ui-monospace,"SF Mono",Menlo,Consolas,monospace;font-size:12px;opacity:.7;margin-top:6px}
.receipt .r-sum{display:flex;justify-content:space-between;font-family:ui-monospace,"SF Mono",Menlo,Consolas,monospace;font-size:13px;padding:12px 0;border-bottom:2px dashed rgba(35,32,26,.25)}
.transfer{display:grid;grid-template-columns:1fr auto;gap:8px 12px;align-items:center;padding:14px 0;border-bottom:1px dashed rgba(35,32,26,.18)}
.transfer .flow{display:flex;align-items:center;gap:7px;flex-wrap:wrap;font-weight:600}
.transfer .arrow{opacity:.5}
.transfer .amt{font-family:ui-monospace,"SF Mono",Menlo,Consolas,monospace;font-size:16px;text-align:right}
.transfer .sub{grid-column:1/-1;display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap}
.transfer .hint{font-size:12px;opacity:.65}
.transfer.paid .flow,.transfer.paid .amt{opacity:.45;text-decoration:line-through;text-decoration-thickness:1.5px}
.stamp{display:inline-flex;align-items:center;gap:6px;font-weight:700;font-size:13px;color:#13795b}
.receipt .btn{background:#23201a;border-color:#23201a;color:#fffef9}
.receipt .btn.quiet{background:transparent;border-color:transparent;color:#23201a}
.receipt .linkbtn{color:#23201a;font-size:12px;opacity:.7}
.r-foot{text-align:center;padding-top:16px;font-family:ui-monospace,"SF Mono",Menlo,Consolas,monospace;font-size:12px;opacity:.7}
.r-done{margin:16px auto 0;width:max-content;max-width:100%;border:2px solid #13795b;color:#13795b;font-weight:700;padding:6px 14px;border-radius:6px;transform:rotate(-3deg);letter-spacing:.02em}
.r-progress{height:6px;background:rgba(35,32,26,.12);border-radius:99px;overflow:hidden;margin-top:12px}
.r-progress i{display:block;height:100%;background:#13795b;transition:width .4s ease}
@media (prefers-reduced-motion: reduce){.r-progress i{transition:none}}

.join{max-width:520px;margin:6vh auto 0}
.join h1{font-size:clamp(26px,6vw,34px)}
.join .people{margin-top:12px}
.divider{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:13px;margin:22px 0 4px}
.divider::before,.divider::after{content:"";flex:1;height:1px;background:var(--line)}

dialog{border:0;border-radius:20px;background:var(--surface);color:var(--ink);padding:0;width:min(520px,calc(100vw - 24px));box-shadow:0 20px 60px rgba(0,0,0,.3);max-height:calc(100vh - 40px)}
dialog::backdrop{background:rgba(10,15,20,.45)}
.dlg-head{display:flex;justify-content:space-between;align-items:center;padding:18px 20px 6px}
.dlg-body{padding:12px 20px 4px}
.dlg-body p{color:var(--muted)}
.dlg-foot{display:flex;justify-content:flex-end;gap:8px;padding:12px 20px 20px}
.icon-btn{border:0;background:transparent;color:var(--muted);font-size:18px;width:36px;height:36px;border-radius:10px;cursor:pointer}
.icon-btn:hover{background:var(--surface-2);color:var(--ink)}
.preview{font-size:13px;color:var(--accent);font-weight:600;margin:-4px 0 14px;min-height:1em}
.checks{display:flex;flex-wrap:wrap;gap:8px}
.check{display:inline-flex;align-items:center;gap:7px;padding:7px 13px;border:1px solid var(--line);border-radius:999px;cursor:pointer;font-size:14px;user-select:none}
.check:has(input:checked){border-color:var(--accent);background:var(--accent-soft)}
.check input{width:auto;min-height:0;margin:0;accent-color:var(--accent)}

.toast{position:fixed;left:50%;bottom:calc(22px + env(safe-area-inset-bottom,0px));transform:translate(-50%,16px);background:var(--ink);color:var(--paper);padding:10px 16px;border-radius:12px;font-weight:600;font-size:14px;opacity:0;transition:opacity .2s,transform .2s;pointer-events:none;z-index:50;max-width:calc(100vw - 32px);text-align:center}
.toast.show{opacity:1;transform:translate(-50%,0)}
.rates{font-size:12px;color:var(--muted);margin-top:34px}

@media (max-width:520px){
  .wrap{padding:18px 14px 90px}
  .panel{padding:16px;border-radius:16px}
  .receipt{padding:24px 16px 28px}
  .toolbar .btn{flex:1}
}

/* Ergänzungen für die echte App */
.loading{padding:40px 0;color:var(--muted)}
.notice{max-width:520px;margin:6vh auto 0}
.notice .actions{margin-top:20px}
.danger-zone{margin-top:40px;padding-top:18px;border-top:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}
.danger-zone p{font-size:13px;color:var(--muted);max-width:46ch}
.inline-form.stack{flex-wrap:wrap}
.inline-form.stack input{flex:1 1 200px}
.fx{font-size:12px;color:var(--muted)}
.btn[aria-busy="true"]{opacity:.6;pointer-events:none}
.brand-icon{width:28px;height:28px;border-radius:8px;display:block}
.hero{display:block;width:100%;height:auto;border-radius:18px;margin:0 0 28px;border:1px solid var(--line)}
.notice .hero,.join .hero{margin-top:0}
.join,.notice{margin-top:0}
.member-state{display:inline-flex;align-items:center;gap:8px}
