/* Einkaufsliste – Gestaltung (hell & dunkel, iPhone/iPad/Mac) */

:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --elev: #ffffff;
  --text: #000000;
  --muted: #6c6c70;
  --muted2: #aeaeb2;
  --sep: rgba(60, 60, 67, 0.22);
  --fill: rgba(118, 118, 128, 0.12);
  --fill2: rgba(118, 118, 128, 0.2);
  --press: rgba(0, 0, 0, 0.06);
  --accent: #007aff;
  --accent-tint: rgba(0, 122, 255, 0.09);
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  --bar: rgba(242, 242, 247, 0.86);
  --seg-on: #ffffff;
  --sheet-bg: #f2f2f7;
  --sheet-card: #ffffff;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  --radius: 12px;
  --gutter: max(16px, env(safe-area-inset-left));
  --gutter-r: max(16px, env(safe-area-inset-right));
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --elev: #2c2c2e;
    --text: #ffffff;
    --muted: #98989f;
    --muted2: #636366;
    --sep: rgba(84, 84, 88, 0.6);
    --fill: rgba(118, 118, 128, 0.24);
    --fill2: rgba(118, 118, 128, 0.36);
    --press: rgba(255, 255, 255, 0.08);
    --accent: #0a84ff;
    --accent-tint: rgba(10, 132, 255, 0.16);
    --green: #30d158;
    --orange: #ff9f0a;
    --red: #ff453a;
    --bar: rgba(0, 0, 0, 0.82);
    --seg-on: #636366;
    --sheet-bg: #1c1c1e;
    --sheet-card: #2c2c2e;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
  background: var(--bg);
}
html.locked, html.locked body { overflow: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; }
svg { width: 22px; height: 22px; flex: none; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.boot { min-height: 100vh; }

/* ---------- Kopfbereich ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  padding-top: env(safe-area-inset-top);
  border-bottom: 0.5px solid var(--sep);
}
.bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px var(--gutter-r) 6px var(--gutter);
  max-width: 760px;
  margin: 0 auto;
}
.tabs {
  position: relative;
  flex: 1;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}
.tabs.overflow {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent);
  padding-right: 22px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  border: 0;
  background: var(--fill);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.tab.on { background: var(--accent); color: #fff; }
.badge {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  background: var(--accent);
  color: #fff;
}
.tab.on .badge { background: rgba(255, 255, 255, 0.28); }
.icon-btn {
  position: relative;
  border: 0;
  background: none;
  color: var(--accent);
  width: 38px;
  height: 40px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex: none;
}
.icon-btn svg { width: 26px; height: 26px; }
.icon-btn:active { background: var(--press); }
.icon-btn.danger { color: var(--red); }
.icon-btn.danger svg { width: 22px; height: 22px; }
.dot {
  position: absolute;
  top: 7px;
  right: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--bg);
  background: transparent;
}
.dot.off { background: var(--orange); }
.dot.busy { background: var(--accent); }

.seg {
  display: flex;
  gap: 2px;
  background: var(--fill);
  border-radius: 9px;
  padding: 2px;
  margin: 2px var(--gutter-r) 10px var(--gutter);
  max-width: 728px;
}
@media (min-width: 761px) { .seg { margin-left: auto; margin-right: auto; } }
.seg:empty { display: none; }
.seg button {
  flex: 1;
  border: 0;
  background: none;
  border-radius: 7px;
  padding: 6px 4px;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}
.seg button.on { background: var(--seg-on); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); }
.seg .badge { font-size: 12px; min-width: 18px; line-height: 16px; }

#tools:empty { display: none; }
.search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--fill);
  border-radius: 10px;
  padding: 0 6px 0 10px;
  margin: 0 var(--gutter-r) 10px var(--gutter);
  max-width: 728px;
  color: var(--muted);
}
@media (min-width: 761px) { .search { margin-left: auto; margin-right: auto; } }
.search svg { width: 19px; height: 19px; }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  padding: 9px 0;
  font-size: 17px;
  color: var(--text);
  outline: none;
}
.search input::placeholder { color: var(--muted); }
.search .clear {
  border: 0;
  background: var(--muted2);
  color: var(--bg);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0;
}
.search .clear svg { width: 12px; height: 12px; }

.status {
  background: var(--orange);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  padding: 5px var(--gutter-r) 5px var(--gutter);
}

/* ---------- Inhalt ---------- */
main {
  max-width: 760px;
  margin: 0 auto;
  padding: 6px var(--gutter-r) calc(40px + env(safe-area-inset-bottom)) var(--gutter);
}
body.has-footer main { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }

.summary { color: var(--muted); font-size: 15px; margin: 8px 4px 2px; }
.summary b { color: var(--text); }
.hint { color: var(--muted); font-size: 14px; margin: 6px 4px 12px; }
.center { text-align: center; }
.meta { color: var(--muted); font-size: 13px; margin: 14px 4px; }

.group { margin-top: 18px; }
.group h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px 7px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}
.group h2 > span:first-child { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count {
  background: var(--fill2);
  color: var(--text);
  border-radius: 999px;
  padding: 0 7px;
  font-size: 12px;
  line-height: 18px;
}
.group h2 .link { margin-left: auto; text-transform: none; letter-spacing: 0; }
.group.complete h2 { color: var(--green); }
.group.complete .count { background: var(--green); color: #fff; }

.card {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Artikelzeile */
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 7px 4px 7px 14px;
  position: relative;
  cursor: pointer;
  outline: none;
  transition: background-color 0.15s;
}
.card > li + li::before {
  content: "";
  position: absolute;
  top: 0;
  left: 52px;
  right: 0;
  border-top: 0.5px solid var(--sep);
}
.row:active { background: var(--press); }
.row:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.chk {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--muted2);
  display: grid;
  place-items: center;
  flex: none;
  color: transparent;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}
.chk svg { width: 17px; height: 17px; }
.row.on { background: var(--accent-tint); }
.row.on .chk { background: var(--accent); border-color: var(--accent); color: #fff; }
.row.done .chk { background: var(--green); border-color: var(--green); color: #fff; }
.row.done .name, .row.done .qty { text-decoration: line-through; color: var(--muted); }
.row.done .thumb { opacity: 0.5; }
.row.done .sub { opacity: 0.6; }
.txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.l1 { display: block; min-width: 0; overflow-wrap: anywhere; }
.l1 .name { margin-right: 8px; }
.l1 .pend { display: inline-block; vertical-align: 2px; margin-left: 4px; }
.name { overflow-wrap: anywhere; }
.proj .name, .arow .name { display: block; }
.row.on .name { font-weight: 600; }
.qty {
  flex: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}
.pend { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }
.sub {
  color: var(--muted);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.who::before { content: "von "; }
.tag {
  display: inline-block;
  background: rgba(255, 149, 0, 0.16);
  color: #c46a00;
  border-radius: 6px;
  padding: 0 6px;
  font-size: 13px;
  font-weight: 600;
}
@media (prefers-color-scheme: dark) { .tag { color: var(--orange); } }
.thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex: none;
  background: var(--fill);
  cursor: zoom-in;
}
.info {
  border: 0;
  background: none;
  color: var(--accent);
  width: 42px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 10px;
}
.info:active { background: var(--press); }
.info svg { width: 24px; height: 24px; }

.newrow {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  border: 0;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--accent);
  font-weight: 600;
  text-align: left;
}
.newrow em { font-style: normal; color: var(--muted); font-weight: 500; }

.progress { margin: 12px 4px 4px; }
.ptext { font-size: 15px; color: var(--muted); margin-bottom: 6px; }
.ptext b { color: var(--text); }
.pbar { height: 6px; border-radius: 3px; background: var(--fill2); overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--green); border-radius: 3px; transition: width 0.3s; }

.empty { text-align: center; padding: 56px 20px 24px; color: var(--muted); }
.empty h3 { color: var(--text); font-size: 20px; margin: 0 0 6px; }
.empty p { margin: 0 auto 18px; max-width: 340px; }

/* Projekte */
.projects { margin-top: 14px; }
.proj {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 8px 8px 8px 14px;
  position: relative;
  cursor: pointer;
}
.proj:active { background: var(--press); }
.proj .picon { color: var(--orange); }
.proj.paused .picon, .proj.paused .name { color: var(--muted); }
.proj .chev { color: var(--muted2); }
.proj .chev svg { width: 18px; height: 18px; }
.phead { margin: 6px 0 4px; }
.back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 17px;
  padding: 6px 6px 6px 0;
  margin-left: -6px;
}
.ptitle { display: flex; align-items: baseline; gap: 12px; margin: 4px 4px 4px; }
.ptitle h1 { flex: 1; font-size: 28px; line-height: 1.15; margin: 0; overflow-wrap: anywhere; }
.pnote { color: var(--muted); margin: 6px 4px 10px; white-space: pre-wrap; }
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-top: 10px;
  cursor: pointer;
}

/* Schalter (iOS-Stil) */
.switch { position: relative; display: inline-block; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--fill2);
  transition: background-color 0.2s;
  pointer-events: none;
}
.switch span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s;
}
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch.small { width: 42px; height: 26px; }
.switch.small span::after { width: 22px; height: 22px; }
.switch.small input:checked + span::after { transform: translateX(16px); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--accent);
  font-weight: 600;
  padding: 12px 16px;
}
.btn:active { filter: brightness(0.92); }
.btn svg { width: 21px; height: 21px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.big { width: 100%; padding: 15px; font-size: 17px; }
.btn.small { padding: 8px 12px; font-size: 15px; border-radius: 9px; }
.btn.wide { width: 100%; margin-top: 18px; }
.btn.danger { color: var(--red); }
.btn.icon { padding: 12px; }
.btn:disabled { opacity: 0.4; cursor: default; }
.link {
  border: 0;
  background: none;
  color: var(--accent);
  padding: 6px 2px;
  font-size: 17px;
}
.link.small { font-size: 15px; padding: 0; }
.link.strong { font-weight: 600; }

/* Fußleiste (Einkauf abschließen) */
.footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  padding: 10px var(--gutter-r) calc(10px + env(safe-area-inset-bottom)) var(--gutter);
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--sep);
}
.footer .btn { max-width: 728px; margin: 0 auto; display: flex; }

/* ---------- Blätter (Sheets) ---------- */
.overlay {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--vv-top, 0px);
  height: var(--vv-h, 100%);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  transition: background-color 0.28s;
}
.overlay.open { background: rgba(0, 0, 0, 0.4); }
.sheet {
  width: 100%;
  max-width: 640px;
  max-height: calc(100% - max(28px, env(safe-area-inset-top) + 10px));
  --card: var(--sheet-card);
  background: var(--sheet-bg);
  border-radius: 14px 14px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(105%);
  transition: transform 0.3s cubic-bezier(0.2, 0.85, 0.25, 1);
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.15);
}
.sheet.tall { height: calc(100% - max(28px, env(safe-area-inset-top) + 10px)); }
.overlay.open .sheet { transform: none; }
@media (min-width: 700px) and (min-height: 600px) {
  .overlay { align-items: center; padding: 24px; }
  .sheet { border-radius: 14px; max-height: min(860px, 100%); transform: translateY(24px) scale(0.98); opacity: 0; transition: transform 0.25s, opacity 0.2s; }
  .sheet.tall { height: min(860px, 100%); }
  .overlay.open .sheet { opacity: 1; }
}
.sheet-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--sep);
}
.sheet-head h3 { margin: 0; font-size: 17px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 52vw; }
.sheet-head > :first-child { justify-self: start; }
.sheet-head > :last-child { justify-self: end; }
.sheet-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 14px var(--gutter-r) calc(28px + env(safe-area-inset-bottom)) var(--gutter);
  flex: 1;
}
.sheet-body h4 {
  margin: 20px 4px 7px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.sheet-body > .card + .card, .sheet-body form > .card + .card { margin-top: 18px; }

/* Formulare */
.form .field {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 4px 14px;
  position: relative;
}
.form .field + .field::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 0;
  border-top: 0.5px solid var(--sep);
}
.form .field > span:first-child { flex: none; width: 108px; color: var(--text); }
.form .field > span.switch { margin-left: auto; }
.form .field input:not([type=checkbox]), .form .field select {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  padding: 10px 0;
  font-size: 17px;
  outline: none;
  text-align: right;
  color: var(--text);
}
.form .field select { -webkit-appearance: none; appearance: none; color: var(--accent); direction: rtl; text-align: right; cursor: pointer; }
.form .field select option { direction: ltr; }
.form .field input.invalid { color: var(--red); }
.form .field input.invalid::placeholder { color: var(--red); }
.form textarea {
  display: block;
  width: 100%;
  border: 0;
  background: none;
  padding: 12px 14px;
  font-size: 17px;
  resize: vertical;
  min-height: 90px;
  outline: none;
}
.form .needed-row > span:first-child { width: auto; flex: 1; }
input::placeholder, textarea::placeholder { color: var(--muted2); }

.photo-area { margin-bottom: 18px; }
.photo-box {
  height: 190px;
  border-radius: var(--radius);
  background: var(--card);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  position: relative;
}
.photo-box span { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 15px; }
.photo-box span svg { width: 34px; height: 34px; }
.photo-box.has { cursor: zoom-in; background: #000; }
.photo-box img { width: 100%; height: 100%; object-fit: contain; }
.photo-box.busy::after {
  content: "";
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid var(--fill2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.photo-btns { display: flex; gap: 10px; margin-top: 10px; }
.photo-btns .btn { flex: 1; }
.photo-btns .btn.icon { flex: none; }

/* Menü */
.menu button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  background: none;
  min-height: 50px;
  padding: 8px 14px;
  text-align: left;
  position: relative;
}
.menu button + button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 48px;
  right: 0;
  border-top: 0.5px solid var(--sep);
}
.menu button:active { background: var(--press); }
.menu button svg { color: var(--accent); }
.menu button span { flex: 1; }
.menu button em { font-style: normal; color: var(--muted); font-size: 15px; }
.menu button.danger, .menu button.danger svg { color: var(--red); }

/* Sortierbare Zeilen */
.srow {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 4px 6px 4px 4px;
  position: relative;
  background: var(--card);
  transition: transform 0.15s ease;
}
.sortable.sorting .srow { transition: transform 0.15s ease; }
.srow.dragging { transition: none !important; z-index: 2; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22); border-radius: 10px; }
.srow.empty-row { color: var(--muted); padding: 14px; }
.grip {
  color: var(--muted2);
  width: 40px;
  height: 44px;
  display: grid;
  place-items: center;
  touch-action: none;
  cursor: grab;
  flex: none;
}
.inline {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font-size: 17px;
  padding: 10px 0;
  outline: none;
}
.inline:focus { color: var(--accent); }
.srow .n { color: var(--muted); font-size: 14px; min-width: 22px; text-align: right; }
.card > .srow + .srow::before { left: 44px; }
.inline-icon { display: inline-block; vertical-align: -5px; }
.inline-icon svg { width: 18px; height: 18px; }
.mini-switch { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.addrow { display: flex; gap: 8px; padding: 6px 6px 6px 14px; margin-top: 18px; align-items: center; }
.addrow input { flex: 1; min-width: 0; border: 0; background: none; font-size: 17px; outline: none; padding: 8px 0; }

/* Zuordnen */
.arow { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; min-height: 50px; position: relative; }
.arow .name { flex: 1; white-space: normal; }
.arow select { max-width: 52%; border: 0; border-radius: 8px; background: var(--fill); padding: 8px 10px; font-size: 16px; }
.arow.ok select { color: var(--green); font-weight: 600; }

/* Import-Vorschau */
.pv-sum { margin: 18px 4px 8px; font-size: 15px; color: var(--muted); }
.pv-sum b { color: var(--text); }
.pv li { display: flex; gap: 10px; align-items: baseline; padding: 9px 14px; position: relative; font-size: 15px; }
.pv li .name { flex: 1; }
.pv li .sec { color: var(--muted); font-size: 13px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.pv li.dupe .name { color: var(--muted); }
.pv li.more { color: var(--muted); }
.pv li + li::before { left: 14px; }

/* Verlauf */
.log li { display: flex; gap: 12px; padding: 10px 14px; position: relative; font-size: 15px; }
.log li + li::before { left: 14px; }
.log time { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }

/* Dialog */
.alert-wrap { align-items: center; z-index: 70; padding: 24px; }
.alert {
  width: 100%;
  max-width: 300px;
  background: var(--elev);
  border-radius: 14px;
  text-align: center;
  overflow: hidden;
  transform: scale(1.08);
  opacity: 0;
  transition: transform 0.2s, opacity 0.2s;
}
.alert-wrap.open .alert { transform: none; opacity: 1; }
.alert h3 { margin: 18px 16px 4px; font-size: 17px; }
.alert p { margin: 0 16px 14px; font-size: 14px; color: var(--muted); }
.alert input {
  display: block;
  width: calc(100% - 32px);
  margin: 4px 16px 16px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 0.5px solid var(--sep);
  background: var(--card);
  font-size: 16px;
}
.alert-btns { display: flex; border-top: 0.5px solid var(--sep); }
.alert-btns button { flex: 1; border: 0; background: none; color: var(--accent); padding: 12px; font-size: 17px; }
.alert-btns button + button { border-left: 0.5px solid var(--sep); }
.alert-btns .strong { font-weight: 600; }
.alert-btns .danger { color: var(--red); font-weight: 600; }

/* Meldung unten */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 140%);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border-radius: 14px;
  background: rgba(40, 40, 42, 0.95);
  color: #fff;
  font-size: 15px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.2, 0.85, 0.25, 1), opacity 0.2s;
}
body.has-footer .toast { bottom: calc(92px + env(safe-area-inset-bottom)); }
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast button { border: 0; background: none; color: #64d2ff; font-weight: 700; padding: 4px 0; white-space: nowrap; }
@media (prefers-color-scheme: dark) { .toast { background: rgba(72, 72, 74, 0.96); } }

.update {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 95;
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 15px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
}
.update button { border: 0; background: rgba(255, 255, 255, 0.22); color: #fff; border-radius: 8px; padding: 5px 10px; font-weight: 700; }

/* Fotoansicht */
.viewer {
  --fade: 1;
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, calc(0.96 * var(--fade)));
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s;
  -webkit-user-select: none;
  user-select: none;
}
.viewer.open { opacity: 1; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center; will-change: transform; -webkit-user-drag: none; }
.vclose {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(60, 60, 60, 0.7);
  color: #fff;
  display: grid;
  place-items: center;
}
.vcap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 20px calc(16px + env(safe-area-inset-bottom));
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  pointer-events: none;
}

/* Anmeldung */
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
}
.login-card { width: 100%; max-width: 380px; text-align: center; }
.login-card .logo { border-radius: 20px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15); }
.login-card h1 { font-size: 28px; margin: 16px 0 4px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.login-card input {
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  background: var(--card);
  padding: 14px 16px;
  font-size: 17px;
  outline: none;
}
.login-card input:focus { box-shadow: 0 0 0 2px var(--accent); }
.err { color: var(--red); min-height: 1.3em; margin: 0; font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 18px 0 4px; }
.chip {
  border: 0;
  background: var(--card);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 17px;
  font-weight: 600;
  color: var(--accent);
  box-shadow: var(--shadow);
}
.chip.on { background: var(--accent); color: #fff; }
.sheet .nameform { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.sheet .nameform input { border: 0; border-radius: var(--radius); background: var(--card); padding: 14px 16px; font-size: 17px; outline: none; }

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