:root {
  --bg: #f8f3ec;
  --surface: #fffdf9;
  --surface-2: #f2ebe1;
  --ink: #2a2220;
  --muted: #7b6e66;
  --line: #e6dcd0;
  --red: #7d1d2c;
  --red-soft: #f5e3e3;
  --gold: #a9853a;
  --gold-soft: #f6eedc;
  --green: #3f7a52;
  --green-soft: #e3f0e6;
  --warn: #b5541c;
  --on-accent: #ffffff;
  --shadow: 0 1px 2px rgba(60, 30, 20, .06), 0 6px 20px rgba(60, 30, 20, .06);
  --serif: "Cormorant Garamond", Georgia, serif;
  --script: "Pinyon Script", "Snell Roundhand", "Apple Chancery", cursive;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161112;
    --surface: #211a1b;
    --surface-2: #2b2223;
    --ink: #f2e9e1;
    --muted: #a99a90;
    --line: #3a2f2f;
    --red: #e07a88;
    --red-soft: #3b2226;
    --gold: #d6b46c;
    --gold-soft: #352c1d;
    --green: #7cc092;
    --green-soft: #1f3226;
    --warn: #ec9a62;
    --on-accent: #1a1112;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #161112;
    --surface: #211a1b;
    --surface-2: #2b2223;
    --ink: #f2e9e1;
    --muted: #a99a90;
    --line: #3a2f2f;
    --red: #e07a88;
    --red-soft: #3b2226;
    --gold: #d6b46c;
    --gold-soft: #352c1d;
    --green: #7cc092;
    --green-soft: #1f3226;
    --warn: #ec9a62;
    --on-accent: #1a1112;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: .01em; }

/* ── Login ─────────────────────────────────── */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 360px; text-align: center; }
.monogram {
  font-family: var(--serif); font-size: 54px; color: var(--red); line-height: 1;
  margin-bottom: 12px;
}
.monogram span { color: var(--gold); font-family: var(--script); font-size: 92px; margin: 0 2px 0 8px; line-height: 0; position: relative; top: 10px; }
.login h1 { font-size: 32px; }
.login-form { display: grid; gap: 12px; margin-top: 28px; }
.who-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.who-pick input { position: absolute; opacity: 0; pointer-events: none; }
.who-pick span {
  display: block; padding: 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); font-weight: 600;
}
.who-pick input:checked + span { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.who-pick input:focus-visible + span { outline: 2px solid var(--gold); }
.error { color: var(--warn); margin: 0; font-size: 14px; }

/* ── Inputs / Buttons ──────────────────────── */
input[type=text], input[type=password], input[type=date], input:not([type]), select, textarea {
  width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); font-size: 16px; outline: none; min-height: 46px;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
textarea { min-height: 130px; resize: vertical; line-height: 1.5; }
.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px;
  padding: 12px 16px; font-weight: 600; min-height: 46px;
}
.btn.primary { background: var(--red); border-color: var(--red); color: var(--on-accent); }
.btn.danger { color: var(--warn); background: transparent; border-color: transparent; }
.link { background: none; border: 0; color: var(--red); font-weight: 600; padding: 4px 0; }

/* ── Layout ────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand { font-family: var(--serif); font-size: 22px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.ring { width: 16px; height: 16px; border: 2.5px solid var(--gold); border-radius: 50%; display: inline-block; }
.logout { color: var(--muted); text-decoration: none; font-size: 13px; }
#main { max-width: 680px; margin: 0 auto; padding: 4px 16px calc(110px + env(safe-area-inset-bottom)); outline: none; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabs button {
  background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 6px 0;
}
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.active { color: var(--red); }

.fab {
  position: fixed; right: max(16px, calc(50% - 324px)); bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 6;
  width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--red); color: var(--on-accent);
  font-size: 30px; line-height: 1; box-shadow: 0 6px 18px rgba(125, 29, 44, .35);
}
.fab[hidden] { display: none; }

.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 26px 2px 10px; }
.section-title h2 { font-size: 23px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }

/* ── Hero ──────────────────────────────────── */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 22px 20px 20px; margin-top: 8px;
  background: linear-gradient(150deg, #7d1d2c 0%, #5a1220 100%); color: #fbefe6;
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 170px; height: 170px; border-radius: 50%;
  border: 2px solid rgba(214, 180, 108, .45); box-shadow: 30px 30px 0 -2px rgba(214, 180, 108, .0), inset 0 0 0 14px rgba(214, 180, 108, .08);
}
.hero::before {
  content: ""; position: absolute; right: 30px; top: 10px; width: 120px; height: 120px; border-radius: 50%;
  border: 2px solid rgba(214, 180, 108, .3);
}
.hero .names { font-family: var(--serif); font-size: 19px; font-style: italic; color: #e8cf9a; }
.hero .count { font-family: var(--serif); font-size: 64px; line-height: 1; font-weight: 600; margin-top: 10px; }
.hero .count small { font-size: 22px; font-weight: 500; margin-left: 6px; }
.hero .what { font-size: 15px; margin-top: 4px; opacity: .92; }
.hero .bar { height: 6px; background: rgba(255, 255, 255, .16); border-radius: 9px; margin-top: 18px; overflow: hidden; }
.hero .bar i { display: block; height: 100%; background: #d6b46c; border-radius: 9px; }
.hero .bar-label { font-size: 12.5px; opacity: .85; margin-top: 7px; display: flex; justify-content: space-between; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.stat { padding: 12px 12px 11px; }
.stat b { display: block; font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat.warn b { color: var(--warn); }

/* ── Timeline ──────────────────────────────── */
.timeline { padding: 6px 0; }
.tl-item {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center;
  padding: 12px 14px 12px 10px; width: 100%; background: none; border: 0; text-align: left; position: relative;
}
.tl-item + .tl-item { border-top: 1px solid var(--line); }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid var(--gold); justify-self: center; background: var(--surface); }
.tl-item.complete .tl-dot { background: var(--gold); }
.tl-item.event .tl-dot { border-color: var(--red); }
.tl-item.event.complete .tl-dot { background: var(--red); }
.tl-title { font-weight: 700; }
.tl-date { font-size: 13px; color: var(--muted); }
.tl-prog { font-size: 12.5px; font-weight: 700; color: var(--muted); text-align: right; min-width: 52px; }
.mini-bar { height: 4px; border-radius: 4px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: var(--gold); }

/* ── Tasks ─────────────────────────────────── */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 4px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 8px 14px; font-weight: 600; font-size: 13.5px; white-space: nowrap;
}
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip.add { color: var(--red); border-style: dashed; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 11px; padding: 3px; margin: 10px 0 2px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

.phase-head { padding: 16px; margin-top: 12px; display: flex; gap: 12px; align-items: flex-start; }
.phase-head .ph-main { flex: 1; min-width: 0; }
.phase-head h2 { font-size: 26px; line-height: 1.1; }
.phase-head .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.phase-head .when { margin-top: 8px; font-weight: 700; font-size: 13.5px; color: var(--red); }
.icon-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; width: 38px; height: 38px; display: grid; place-items: center; flex: none; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.group-title { font-family: var(--serif); font-size: 20px; font-weight: 600; margin: 22px 2px 8px; display: flex; justify-content: space-between; align-items: baseline; }
.group-title small { font-family: var(--sans); font-size: 12.5px; color: var(--muted); font-weight: 600; }
.list { overflow: hidden; }
.task { display: flex; align-items: flex-start; gap: 4px; }
.task + .task { border-top: 1px solid var(--line); }
.check {
  flex: none; width: 50px; min-height: 52px; background: none; border: 0; display: grid; place-items: center; padding: 0;
}
.check i {
  width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center;
  transition: background .15s, border-color .15s;
}
.check svg { width: 15px; height: 15px; fill: none; stroke: var(--surface); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.task.done .check i { background: var(--green); border-color: var(--green); }
.task.done .check svg { opacity: 1; }
.t-body { flex: 1; min-width: 0; background: none; border: 0; text-align: left; padding: 14px 14px 12px 0; }
.t-title { font-weight: 600; }
.task.done .t-title { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.t-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.due-soon { background: var(--gold-soft); color: var(--gold); }
.pill.overdue { background: var(--red-soft); color: var(--warn); }
.pill.who { background: transparent; border: 1px solid var(--line); }
.pill.phase { background: var(--red-soft); color: var(--red); }
.pill.note-ind { background: transparent; padding: 2px 4px; }

.empty { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty b { display: block; font-family: var(--serif); font-size: 21px; color: var(--ink); margin-bottom: 4px; font-weight: 600; }

/* ── Gifts ─────────────────────────────────── */
.sumbar { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; margin-top: 12px; }
.sumbar b { font-family: var(--serif); font-size: 26px; font-weight: 600; }
.gift { padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: start; }
.gift + .gift { border-top: 1px solid var(--line); }
.gift .g-main { background: none; border: 0; text-align: left; padding: 0; min-width: 0; }
.gift .g-title { font-weight: 700; }
.gift .g-sub { font-size: 13.5px; color: var(--muted); }
.gift .g-price { font-weight: 700; font-size: 14px; text-align: right; }
.gift.hl {
  background: linear-gradient(135deg, var(--gold-soft), var(--surface) 70%);
  border-left: 4px solid var(--gold);
}
.gift.hl .g-title { font-family: var(--serif); font-size: 22px; line-height: 1.15; }
.star { color: var(--gold); font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.status {
  border: 0; border-radius: 999px; padding: 5px 11px; font-weight: 700; font-size: 12.5px; justify-self: end;
}
.status[data-s="Idee"] { background: var(--surface-2); color: var(--muted); }
.status[data-s="Ausgesucht"] { background: var(--gold-soft); color: var(--gold); }
.status[data-s="Gekauft"] { background: var(--green-soft); color: var(--green); }
.status[data-s="Verpackt"] { background: var(--green); color: var(--surface); }

/* ── Notes ─────────────────────────────────── */
.notes { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 12px; }
@media (min-width: 560px) { .notes { grid-template-columns: 1fr 1fr; } }
.note { padding: 14px 16px; text-align: left; width: 100%; display: block; }
.note.pinned { border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
.note h3 { font-size: 21px; line-height: 1.2; }
.note .n-body { white-space: pre-wrap; margin-top: 6px; color: var(--ink); max-height: 9.2em; overflow: hidden; font-size: 14.5px; }
.note .n-meta { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }

/* ── Sheet ─────────────────────────────────── */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: rgba(20, 10, 10, .42); }
.sheet-wrap[hidden] { display: none; }
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; background: var(--bg);
  border-radius: 22px 22px 0 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
  animation: up .22s ease-out;
}
@media (min-width: 600px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 22px; } }
@keyframes up { from { transform: translateY(30px); opacity: .4; } }
.grab { width: 40px; height: 5px; border-radius: 5px; background: var(--line); margin: 0 auto 10px; }
.sheet h2 { font-size: 26px; margin-bottom: 12px; }
.field { display: grid; gap: 5px; margin-bottom: 12px; }
.field > span { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle { display: flex; align-items: center; gap: 10px; padding: 8px 0 14px; font-weight: 600; }
.toggle input { width: 22px; height: 22px; accent-color: var(--red); }
.sheet-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.sheet-actions .spacer { flex: 1; }
.info { font-size: 13px; color: var(--muted); margin: -2px 0 12px; }

.toast {
  position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px;
  max-width: calc(100% - 32px);
}
.toast[hidden] { display: none; }

/* ── Benachrichtigungen ────────────────────── */
.top-actions { display: flex; align-items: center; gap: 10px; }
.bell { position: relative; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--muted); }
.bell svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bell.on { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 50%, var(--line)); }
.bell i { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid var(--surface); }
.push-state { display: flex; gap: 12px; align-items: center; padding: 14px 16px; margin-bottom: 14px; }
.push-state .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--line); flex: none; }
.push-state.on .dot { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.push-state.blocked .dot { background: var(--warn); }
.push-state b { display: block; }
.push-state span { font-size: 13.5px; color: var(--muted); }
.push-btns { display: grid; gap: 10px; margin-bottom: 18px; }
.rules { margin: 0 0 16px; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 14px; }
.rules li { display: grid; grid-template-columns: 22px 1fr; gap: 6px; }
.rules li::before { content: "◦"; color: var(--gold); font-weight: 800; text-align: center; }
.ios-steps { margin: 0 0 16px; padding-left: 20px; display: grid; gap: 6px; font-size: 14.5px; }
.devices { font-size: 13.5px; color: var(--muted); margin: 0 0 14px; }
.sheet h3 { font-family: var(--serif); font-size: 20px; margin: 4px 0 8px; }

.amp { font-family: var(--script); font-style: normal; color: #d6b46c; font-size: 2.3em; line-height: 0; margin: 0 .12em 0 .2em; position: relative; top: .2em; }
