:root {
  --mint: #10b981; --mint-dunkel: #047857; --mint-text: #052e1f;
  --gruen: #15803d; --gelb: #b45309; --gelb-hg: #fef3c7; --rot: #b91c1c; --rot-hg: #fee2e2;
  --text: #0f172a; --text-2: #475569; --linie: rgba(15, 23, 42, .12);
  --karte: rgba(255, 255, 255, .82); --feld: #fff; --hg: #eef6f3;
  --schein: 0 18px 50px -22px rgba(13, 148, 136, .55), 0 6px 18px -10px rgba(79, 70, 229, .35);
  --r: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --mint: #2ad4a2; --mint-dunkel: #6ee7c4; --mint-text: #022c1e;
    --gruen: #4ade80; --gelb: #fbbf24; --gelb-hg: rgba(251, 191, 36, .14); --rot: #f87171; --rot-hg: rgba(248, 113, 113, .14);
    --text: #e2e8f0; --text-2: #94a3b8; --linie: rgba(226, 232, 240, .14);
    --karte: rgba(17, 24, 39, .78); --feld: #0b1220; --hg: #07110f;
    --schein: 0 18px 50px -22px rgba(45, 212, 191, .35), 0 6px 18px -10px rgba(129, 140, 248, .3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text); background: var(--hg); min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}
/* Farbwolken auf eigener fester Ebene, leise bewegt */
body::before {
  content: ""; position: fixed; inset: -12%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 35% at 15% 20%, rgba(16, 185, 129, .28), transparent 70%),
    radial-gradient(35% 30% at 85% 15%, rgba(59, 130, 246, .22), transparent 70%),
    radial-gradient(40% 40% at 75% 85%, rgba(168, 85, 247, .20), transparent 70%),
    radial-gradient(30% 30% at 20% 85%, rgba(245, 158, 11, .18), transparent 70%);
  animation: wolken 90s ease-in-out infinite alternate;
}
@keyframes wolken {
  from { transform: translate(0, 0) scale(1); filter: hue-rotate(-6deg); }
  to { transform: translate(1.5%, -1.5%) scale(1.05); filter: hue-rotate(6deg); }
}
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } }

.huelle { max-width: 1180px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 16px 24px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h2 { font-size: 1.05rem; }
.klein { font-size: .85rem; color: var(--text-2); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .02em; }
.umbrechen { word-break: break-all; font-size: .85rem; }
.warn { color: var(--gelb); }

.karte {
  background: var(--karte); border: 1px solid var(--linie); border-radius: var(--r);
  padding: 16px; box-shadow: var(--schein);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
}

/* Knöpfe: gefüllt, Mint */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  background: var(--mint); color: var(--mint-text); font: inherit; font-weight: 650;
  border: 0; border-radius: 12px; padding: .6rem 1rem; cursor: pointer; text-decoration: none;
  min-height: 44px;
}
.knopf:hover { filter: brightness(1.06); }
.knopf.zweit { background: rgba(16, 185, 129, .16); color: var(--mint-dunkel); border: 1px solid rgba(16, 185, 129, .45); }
.knopf:disabled { background: rgba(148, 163, 184, .2); color: var(--text-2); border-color: transparent; cursor: default; filter: none; }
.knopf.voll { width: 100%; }
.klein-knopf { min-height: 36px; padding: .35rem .8rem; font-size: .9rem; }
.gross-knopf { min-height: 56px; font-size: 1.05rem; flex: 1 1 200px; }
.knopf-text { background: none; border: 0; color: var(--mint-dunkel); font: inherit; cursor: pointer; padding: .3rem; text-decoration: underline; text-underline-offset: 3px; }
.knopf-text.rot { color: var(--rot); }

/* Anmeldung */
.anmeldung { max-width: 420px; margin: 8vh auto 0; text-align: center; }
.anmeldung form { text-align: left; margin: 1rem 0; display: grid; gap: .6rem; }
.logo-gross { width: 84px; height: 84px; border-radius: 20px; margin-bottom: .6rem; }
.fehlertext { color: var(--rot); margin: 0; font-weight: 600; }

/* Kopf */
.kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 14px; }
.marke { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.2rem; }
.marke img { width: 36px; height: 36px; border-radius: 9px; }
.kopf-rechts { display: flex; align-items: center; gap: 10px; }
.wer { font-size: .9rem; color: var(--text-2); }

/* Raster: Handy untereinander, ab 900 px zwei Spalten */
.raster { display: grid; gap: 14px; grid-template-columns: 1fr; }
.spalte-links { display: grid; gap: 14px; align-content: start; }
@media screen and (min-width: 900px) {
  .raster { grid-template-columns: 360px 1fr; align-items: start; }
  .detail { position: sticky; top: 12px; }
}

.einwurf-knoepfe { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.einwurf { border: 2px dashed rgba(16, 185, 129, .5); }
.nur-handy { display: none !important; }
@media (hover: none) and (pointer: coarse), screen and (max-width: 700px) {
  .nur-handy { display: inline-flex !important; }
  p.nur-handy { display: block !important; }
  .nur-gross { display: none !important; }
}

/* Liste */
.liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.eintrag {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--linie); background: var(--feld); cursor: pointer; border-left: 5px solid var(--mint);
}
.eintrag.aktiv { outline: 2px solid var(--mint); }
.eintrag.fehlt { border-left-color: var(--gelb); }
.eintrag.erledigt { border-left-color: #94a3b8; opacity: .7; }
.eintrag .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eintrag .summe { font-weight: 700; text-align: right; white-space: nowrap; }
.eintrag .zeile2 { grid-column: 1 / -1; font-size: .8rem; color: var(--text-2); display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-block; padding: 0 8px; border-radius: 99px; font-size: .75rem; font-weight: 650; }
.chip.gruen { background: rgba(21, 128, 61, .14); color: var(--gruen); }
.chip.gelb { background: var(--gelb-hg); color: var(--gelb); }
.chip.grau { background: rgba(148, 163, 184, .2); color: var(--text-2); }

/* Detail */
.detail { min-height: 300px; }
.detail-leer { display: grid; place-items: center; text-align: center; color: var(--text-2); padding: 40px 10px; gap: 10px; }
.qr-platzhalter { width: 140px; height: 140px; border: 3px dashed var(--linie); border-radius: 18px; display: grid; place-items: center; font-weight: 800; font-size: 2rem; opacity: .5; }
.kreisel { width: 46px; height: 46px; border-radius: 50%; border: 5px solid rgba(16, 185, 129, .25); border-top-color: var(--mint); animation: drehen 0.9s linear infinite; }
@keyframes drehen { to { transform: rotate(360deg); } }

.detail-raster { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media screen and (min-width: 1100px) { .detail-raster { grid-template-columns: 1fr 300px; } }
.felder { display: grid; gap: 12px; align-content: start; }
.feld { display: grid; gap: 4px; min-width: 0; }
.feld label { font-size: .85rem; font-weight: 600; color: var(--text-2); }
.feld-reihe { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
input, textarea {
  font: inherit; color: var(--text); background: var(--feld); border: 1px solid var(--linie);
  border-radius: 10px; padding: .55rem .7rem; width: 100%; min-width: 0;
}
input:focus, textarea:focus { outline: 2px solid var(--mint); outline-offset: 0; border-color: transparent; }
textarea { resize: vertical; }
input.betrag { font-weight: 700; font-size: 1.1rem; text-align: right; }
.mit-kopie { display: flex; gap: 6px; }
.kopie { flex: none; width: 44px; border-radius: 10px; border: 1px solid rgba(16, 185, 129, .45); background: rgba(16, 185, 129, .14); color: var(--mint-dunkel); font-size: 1.1rem; cursor: pointer; }
.iban-info { margin: 2px 0 0; font-size: .85rem; }
.iban-info.ok { color: var(--gruen); }
.iban-info.warn { color: var(--gelb); }
.iban-info.falsch { color: var(--rot); font-weight: 600; }

.hinweis { padding: 10px 12px; border-radius: 12px; margin-bottom: 10px; background: var(--gelb-hg); color: var(--gelb); font-weight: 550; border-left: 5px solid var(--gelb); }
.hinweis.rot { background: var(--rot-hg); color: var(--rot); border-left-color: var(--rot); }

.qr-seite { display: grid; gap: 10px; justify-items: center; text-align: center; align-content: start; }
.qr { width: 100%; max-width: 280px; aspect-ratio: 1; background: #fff; border-radius: 14px; padding: 6px; display: grid; place-items: center; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr.leer { background: rgba(148, 163, 184, .15); border: 2px dashed var(--linie); }
.klein-qr { max-width: 220px; margin: 0 auto; }
.qr-fehlt { list-style: none; padding: 0; margin: 0; color: var(--gelb); font-weight: 600; font-size: .9rem; }

.detail-fuss { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--linie); }
.detail-fuss #ablauf { flex: 1; }
.haken { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.haken input { width: 22px; height: 22px; accent-color: var(--mint); }

.fuss { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin-top: 18px; font-size: .8rem; color: var(--text-2); }
.fuss .knopf-text { font-size: .8rem; color: var(--text-2); }

/* Dialoge: deckend */
.dialog { border: 0; border-radius: var(--r); padding: 18px; width: min(520px, calc(100vw - 24px)); background: var(--feld); color: var(--text); box-shadow: var(--schein); }
.dialog::backdrop { background: rgba(2, 6, 23, .5); }
.dialog-fuss { display: flex; justify-content: flex-end; margin-top: 14px; }
.person { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--linie); border-radius: 12px; }
.person .name { font-weight: 600; flex: 1; }
.person-neu { display: flex; gap: 8px; margin-top: 12px; }
.einladung { margin-top: 14px; padding: 14px; border-radius: 14px; background: rgba(16, 185, 129, .1); text-align: center; }
.versionen li { padding: 8px 0; border-bottom: 1px solid var(--linie); }
.vorschau-dialog { width: min(900px, calc(100vw - 16px)); }
.vorschau-dialog img { width: 100%; height: auto; border-radius: 10px; background: #fff; }

.ablage-hinweis { position: fixed; inset: 10px; border: 4px dashed var(--mint); border-radius: 22px; background: rgba(16, 185, 129, .15); display: grid; place-items: center; font-size: 1.6rem; font-weight: 750; color: var(--mint-dunkel); z-index: 50; pointer-events: none; }
.meldung { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 60; max-width: calc(100vw - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }

/* Handy: Einlesen → Code → Liste (der Code gehört direkt unter den Knopf) */
@media screen and (max-width: 899px) {
  .spalte-links { display: contents; }
  #einwurf { order: 1; }
  #detail { order: 2; }
  #listenkarte { order: 3; }
}
@media screen and (max-width: 520px) {
  input.mono { letter-spacing: 0; font-size: .95rem; padding-left: .5rem; padding-right: .5rem; }
  .huelle { padding-left: 12px; padding-right: 12px; }
  .karte { padding: 14px; box-shadow: 0 10px 30px -20px rgba(13, 148, 136, .5); }
  .feld-reihe { grid-template-columns: 1fr; }
  body::before {
    background:
      radial-gradient(60% 25% at 10% 10%, rgba(16, 185, 129, .22), transparent 70%),
      radial-gradient(60% 25% at 90% 50%, rgba(59, 130, 246, .16), transparent 70%),
      radial-gradient(60% 25% at 20% 90%, rgba(168, 85, 247, .15), transparent 70%);
  }
}
