:root {
  /* Kims Farben: #364156 Schieferblau (Akzent), #DFF8EB Mint (Kopf, Hervorhebung), #CDCDCD Grau (Linien) */
  --bg: #F7FCF9; --surface: #FFFFFF; --head: #DFF8EB; --fg: #1F2633; --muted: #5E6878; --line: #CDCDCD;
  --accent: #364156; --accent-fg: #FFFFFF; --accent-soft: #DFF8EB; --danger: #C2412D; --warn: #A35C12;
  /* Farben für die Anfangsbuchstaben: Kim, Christian, weitere */
  --p0: #364156; --p1: #2C8A5A; --p2: #7A3E6E; --p3: #A35C12;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1A1F29; --surface: #242B38; --head: #364156; --fg: #EEF3F0; --muted: #A3ACB9; --line: #3A4352;
    --accent: #DFF8EB; --accent-fg: #364156; --accent-soft: #2B3A3A; --danger: #E06A55; --warn: #E3A35C;
    --p0: #DFF8EB; --p1: #7FD6A6; --p2: #D492C6; --p3: #E3A35C;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Kopfbereich */
.top {
  position: sticky; top: 0; z-index: 5;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 12px;
  background: color-mix(in srgb, var(--head) 92%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.brand { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bar h1 { margin: 0; color: var(--accent); font-size: 26px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
.status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.status.off::before { background: var(--muted); }
.status.busy::before { background: var(--warn); }
.status.err::before { background: var(--danger); }
.icon-btn {
  width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--surface);
  display: grid; place-items: center; font-size: 11px; letter-spacing: 1px; color: var(--muted);
}

.add { display: flex; gap: 8px; }
.add input {
  flex: 1; min-width: 0; padding: 12px 14px; font-size: 17px;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--fg);
  -webkit-appearance: none; appearance: none;
}
.add input:focus { outline: none; border-color: var(--accent); }
.add button {
  width: 50px; border: 0; border-radius: 14px; background: var(--accent); color: var(--accent-fg);
  font-size: 28px; font-weight: 500; line-height: 1;
}
.suggest { display: flex; gap: 8px; overflow-x: auto; padding-top: 10px; scrollbar-width: none; }
.suggest::-webkit-scrollbar { display: none; }
.suggest button {
  flex: none; padding: 7px 13px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 99px; background: var(--surface);
}

.banner { margin: 12px 16px 0; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); font-size: 14px; }

/* Liste */
main { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 100px); }
.group h2 {
  margin: 0; padding: 20px 16px 6px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted);
}
.row { position: relative; overflow: hidden; background: var(--danger); }
.row .del {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end;
  padding-right: 20px; color: #fff; font-size: 15px; font-weight: 600;
}
.item {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 54px;
  padding: 10px 16px; border: 0; border-bottom: 1px solid var(--line); background: var(--bg);
  text-align: left; transition: transform 0.2s ease, background 0.15s;
  touch-action: pan-y;
}
.item.swiping { transition: none; }
.box {
  flex: none; width: 24px; height: 24px; border: 2px solid var(--line); border-radius: 8px;
  display: grid; place-items: center; transition: background 0.15s, border-color 0.15s;
}
.done .box { background: var(--accent); border-color: var(--accent); }
.done .box::after {
  content: ""; width: 10px; height: 5px; border: solid var(--accent-fg); border-width: 0 0 2.5px 2.5px;
  transform: translateY(-1px) rotate(-45deg);
}
.txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.qty { font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.done .txt { color: var(--muted); text-decoration: line-through; }
.ini {
  flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent);
}
.flash .item { animation: flash 1.2s ease-out; }
@keyframes flash { 0%, 40% { background: var(--accent-soft); } }

.empty { padding: 72px 32px; text-align: center; color: var(--muted); }
.empty b { display: block; margin-bottom: 6px; font-size: 20px; color: var(--fg); }

.foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 4;
  padding: 24px 16px calc(env(safe-area-inset-bottom, 0px) + 12px);
  background: linear-gradient(transparent, var(--bg) 40%);
}
.foot button { width: 100%; padding: 15px; border: 0; border-radius: 16px; background: var(--fg); color: var(--bg); font-weight: 600; }

.toast {
  position: fixed; left: 16px; right: 16px; z-index: 20;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 84px);
  display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  border-radius: 14px; background: var(--fg); color: var(--bg); font-size: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.toast span { flex: 1; }
.toast button { padding: 4px 0; border: 0; background: none; color: var(--bg); font-weight: 700; }

/* Menü-Blatt */
.sheet { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; background: rgba(0, 0, 0, 0.35); }
.sheet-card {
  width: 100%; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column;
  padding: 8px 16px calc(env(safe-area-inset-bottom, 0px) + 18px);
  border-radius: 20px 20px 0 0; background: var(--surface);
}
.grab { align-self: center; width: 40px; height: 5px; margin: 4px 0 12px; border-radius: 3px; background: var(--line); }
#sheetBody { display: flex; flex-direction: column; gap: 12px; }
.menu { display: flex; flex-direction: column; }
.menu-btn {
  display: flex; justify-content: space-between; gap: 12px; width: 100%; padding: 16px 4px;
  border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font-size: 17px;
}
.menu-btn small { color: var(--muted); font-size: 15px; }
.sheet-title { margin: 0; font-size: 22px; }
.sheet-text { margin: 0; color: var(--muted); }
.linkbox {
  padding: 12px; border-radius: 12px; background: var(--bg); font: 13px/1.4 ui-monospace, Menlo, monospace;
  overflow-wrap: anywhere; -webkit-user-select: all; user-select: all;
}
.meta { margin: 6px 0 0; font: 12px/1.4 ui-monospace, Menlo, monospace; color: var(--muted); overflow-wrap: anywhere; }

/* Einrichtung */
.setup {
  min-height: 100dvh; max-width: 480px; margin: 0 auto;
  display: flex; flex-direction: column; justify-content: center; gap: 18px;
  padding: calc(env(safe-area-inset-top, 0px) + 32px) 24px calc(env(safe-area-inset-bottom, 0px) + 32px);
}
.setup h1 { margin: 0; font-size: 34px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
.setup p { margin: 0; color: var(--muted); }
.setup .small { font-size: 15px; }
.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.btn {
  display: block; width: 100%; padding: 15px; border: 0; border-radius: 16px;
  background: var(--accent); color: var(--accent-fg); font-size: 17px; font-weight: 600; text-align: center;
}
.btn.ghost { background: var(--surface); color: var(--fg); border: 1.5px solid var(--line); }
.link-btn { align-self: center; padding: 8px; border: 0; background: none; color: var(--accent); font-weight: 600; }
.field {
  width: 100%; padding: 14px; font-size: 17px;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--fg);
}
.field:focus { outline: none; border-color: var(--accent); }
.setup .error { color: var(--danger); font-size: 15px; }

@media (prefers-reduced-motion: reduce) {
  .item, .box { transition: none; }
  .flash .item { animation: none; }
}
