:root {
  --night: #1B2038;
  --panel: #262C4C;
  --panel-2: #2F3660;
  --line: #363D66;
  --cream: #F4EFE3;
  --muted: #A6ACC9;
  --berlin: #FFCF33;
  --ch: #E5403A;
  --round: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif;
  --text: -apple-system, system-ui, "Helvetica Neue", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html { background: var(--night); }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--night);
  color: var(--cream);
  font: 16px/1.4 var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
h1, h2, h3, p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
:focus-visible { outline: 2px solid var(--cream); outline-offset: 2px; }

.primary {
  display: block; width: 100%;
  padding: 16px 20px;
  border-radius: 18px;
  background: var(--cream); color: var(--night);
  font: 700 18px/1 var(--round);
}
.primary:active { transform: scale(.98); }
.error { color: #FFB1AC; font-size: 15px; }

/* ---------- Anmeldung ---------- */
.login {
  min-height: 100dvh;
  padding: calc(var(--safe-t) + 56px) 28px calc(var(--safe-b) + 28px);
  display: flex; flex-direction: column; align-items: center;
}
.login-logo { border-radius: 26px; }
.login h1 { font: 800 40px/1 var(--round); margin-top: 18px; }
.login-lead { color: var(--muted); margin: 8px 0 34px; }
.login form { width: 100%; max-width: 380px; display: grid; gap: 8px; }
.login label { font-size: 14px; color: var(--muted); margin-top: 8px; }
.login input {
  width: 100%; padding: 15px 16px;
  border: 1.5px solid var(--line); border-radius: 16px;
  background: var(--panel); font-size: 18px;
}
.login input:focus { outline: none; border-color: var(--cream); }
.login .primary { margin-top: 18px; }

/* ---------- Kopf ---------- */
#app { max-width: 560px; margin: 0 auto; padding-bottom: calc(var(--safe-b) + 108px); }
.top { padding: calc(var(--safe-t) + 14px) 20px 6px; }
.brand { display: flex; align-items: center; gap: 9px; font: 700 17px/1 var(--round); color: var(--muted); }
.brand img { border-radius: 9px; }
.top h1 { font: 800 34px/1.05 var(--round); letter-spacing: -.01em; margin: 18px 0 20px; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.berlin { background: var(--berlin); }
.dot.ch { background: var(--ch); }

.places { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.places button {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 13px 6px; border-radius: 16px;
  background: var(--panel); color: var(--muted);
  font: 600 16px/1 var(--round);
  border: 1.5px solid transparent;
}
.places button b { font-weight: 600; opacity: .7; font-variant-numeric: tabular-nums; }
.places button.on { color: var(--cream); border-color: var(--cream); background: var(--panel-2); }
.places button[data-place="berlin"].on { border-color: var(--berlin); }
.places button[data-place="ch"].on { border-color: var(--ch); }

.bar { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.views { display: flex; gap: 18px; }
.views button { font: 600 16px/1 var(--round); color: var(--muted); padding: 10px 0; border-bottom: 2px solid transparent; }
.views button.on { color: var(--cream); border-color: var(--cream); }
.sort select {
  appearance: none; -webkit-appearance: none;
  border: 0; border-radius: 12px;
  padding: 9px 30px 9px 12px;
  font: 500 15px/1.2 var(--text); color: var(--cream);
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.500l5 5 5-5' fill='none' stroke='%23A6ACC9' stroke-width='1.800' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 11px center / 11px;
}

/* ---------- Liste ---------- */
.list { list-style: none; margin: 8px 0 0; padding: 0 20px; }
.item { display: flex; align-items: flex-start; gap: 4px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.check { flex: none; width: 44px; height: 58px; display: grid; place-items: center; margin-left: -10px; }
.check span {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--muted);
  display: grid; place-items: center;
  transition: background .15s, border-color .15s;
}
.check span svg { width: 14px; height: 14px; stroke: var(--night); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.item.done .check span { background: var(--cream); border-color: var(--cream); }
.item.done .check span svg { opacity: 1; }
.item.leaving { opacity: 0; transform: translateX(24px); transition: opacity .25s, transform .25s; }

.body { flex: 1; min-width: 0; text-align: left; padding: 15px 0 15px; display: block; }
.title { font: 700 19px/1.25 var(--round); overflow-wrap: anywhere; }
.item.done .title { color: var(--muted); }
.title svg { width: 15px; height: 15px; fill: var(--cream); margin-left: 6px; vertical-align: -1px; }
.kind { color: var(--muted); font-size: 14px; margin-top: 2px; }
.note { color: var(--muted); font-size: 14px; margin-top: 6px; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 9px;
  font: 600 13.500px/1.2 var(--round);
}
.tag small { font: 500 13.500px/1.2 var(--text); opacity: .8; }
.tag.berlin { background: var(--berlin); color: #2A2100; }
.tag.ch { background: var(--ch); color: #fff; }
.tag.none { background: transparent; border: 1.5px dashed var(--line); color: var(--muted); font-weight: 500; }

.empty { padding: 56px 36px; text-align: center; color: var(--muted); font-size: 17px; line-height: 1.45; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 26px 20px calc(var(--safe-b) + 16px);
  background: linear-gradient(to top, var(--night) 62%, rgba(27,32,56,0));
  pointer-events: none;
}
.dock .primary { pointer-events: auto; max-width: 520px; margin: 0 auto; box-shadow: 0 10px 30px rgba(8,10,24,.55); }

/* ---------- Blatt ---------- */
.shade { position: fixed; inset: 0; background: rgba(8,10,24,.6); z-index: 10; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11;
  max-height: calc(100dvh - var(--safe-t) - 24px);
  background: var(--panel);
  border-radius: 26px 26px 0 0;
  display: flex; flex-direction: column;
  animation: rise .26s cubic-bezier(.2,.8,.2,1);
}
.sheet form { display: flex; flex-direction: column; min-height: 0; }
@keyframes rise { from { transform: translateY(40%); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } .item.leaving { transition: none; } }

.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 16px 18px 10px; }
.sheet-head h2 { font: 700 17px/1 var(--round); }
.plain { font-size: 17px; color: var(--muted); padding: 8px 2px; justify-self: start; }
.plain.strong { color: var(--cream); font-weight: 700; justify-self: end; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 18px calc(var(--safe-b) + 24px); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }

.title-input {
  width: 100%; border: 0; border-bottom: 2px solid var(--line); border-radius: 0;
  background: none; padding: 8px 0 10px;
  font: 700 24px/1.2 var(--round);
}
.title-input:focus { outline: none; border-color: var(--cream); }
::placeholder { color: #7F86A8; opacity: 1; }

.kinds { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--night); border-radius: 14px; padding: 4px; }
.kinds button { padding: 10px 0; border-radius: 11px; font: 600 15px/1 var(--round); color: var(--muted); }
.kinds button.on { background: var(--panel-2); color: var(--cream); }

.sheet h3 { font: 600 14px/1 var(--text); color: var(--muted); margin-top: 8px; }
.place-card { background: var(--night); border-radius: 16px; border: 1.5px solid transparent; }
.place-card.on[data-for="berlin"] { border-color: var(--berlin); }
.place-card.on[data-for="ch"] { border-color: var(--ch); }
.place-toggle { width: 100%; display: flex; align-items: center; gap: 10px; padding: 15px 14px; font: 700 17px/1 var(--round); text-align: left; }
.place-toggle span { flex: 1; }
.switch { width: 46px; height: 28px; border-radius: 14px; background: var(--line); position: relative; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--cream); transition: transform .15s; }
.place-card.on .switch { background: #5ECB7B; }
.place-card.on .switch::after { transform: translateX(18px); }
.service { padding: 0 14px 12px; }
.service input, textarea {
  width: 100%; border: 0; border-radius: 12px;
  background: var(--panel); padding: 12px 13px; font-size: 16px;
}
.service input:focus, textarea:focus { outline: 1.5px solid var(--muted); }
textarea { background: var(--night); resize: none; display: block; }
.chips { display: flex; gap: 6px; overflow-x: auto; margin: 10px -14px 0; padding: 0 14px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; padding: 8px 12px; border-radius: 10px; background: var(--panel-2); font-size: 14px; white-space: nowrap; }
.chips button.on { background: var(--cream); color: var(--night); }

.fav-toggle { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 16px; background: var(--night); font: 600 16px/1 var(--round); color: var(--muted); }
.fav-toggle svg { fill: none; stroke: var(--muted); stroke-width: 1.800; }
.fav-toggle[aria-pressed="true"] { color: var(--cream); }
.fav-toggle[aria-pressed="true"] svg { fill: var(--cream); stroke: var(--cream); }

.meta { color: var(--muted); font-size: 14px; }
.danger { padding: 14px; border-radius: 16px; color: #FFB1AC; font: 600 16px/1 var(--round); }
