/* Unser Kalender – ruhig, rund, wie eine echte iPhone-App */
:root {
  --bg: #F4F4F6;
  --card: #FFFFFF;
  --card-2: #F7F7F9;
  --text: #111114;
  --text-2: #6C6C74;
  --text-3: #A8A8B0;
  --line: rgba(17, 17, 20, .08);
  --fill: rgba(17, 17, 20, .055);
  --ink: #111114;
  --on-ink: #FFFFFF;
  --danger: #F2453D;
  --green: #22B357;
  --green-ink: #138A3F;
  --shadow: 0 1px 2px rgba(17, 17, 20, .04), 0 6px 22px rgba(17, 17, 20, .05);
  --tint: 13%;

  /* Personenfarben – werden von app.js nach Wahl überschrieben */
  --a: #3D7BFF; --a-ink: #1A5BEA;
  --b: #FF4F8B; --b-ink: #D81F66;

  --round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Nunito", system-ui, sans-serif;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --gutter: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #17171B;
    --card-2: #202025;
    --text: #F4F4F6;
    --text-2: #9B9BA4;
    --text-3: #5E5E68;
    --line: rgba(255, 255, 255, .08);
    --fill: rgba(255, 255, 255, .08);
    --ink: #F4F4F6;
    --on-ink: #111114;
    --danger: #FF5A52;
    --green: #32D16B;
    --green-ink: #6BE38A;
    --shadow: none;
    --tint: 22%;
    --a: #5B95FF; --a-ink: #92B8FF;
    --b: #FF6A9E; --b-ink: #FF9DC0;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.35 var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  min-height: 100dvh;
  -webkit-user-select: none; user-select: none;
}
input, textarea { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, p { margin: 0; }
small { font-size: .85em; color: var(--text-2); font-weight: 500; }

.card { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); }
.error { color: var(--danger); font-size: 15px; text-align: center; }
.hint, .note { font-size: 13px; color: var(--text-2); margin: 8px 6px 0; }
.note { margin-top: 7px; }

/* ---------- Personenfarben: --c (Farbe) / --c-ink (Text) */
.p-tint { background: color-mix(in srgb, var(--c) var(--tint), var(--card)); }

.avatar {
  --size: 28px;
  width: var(--size); height: var(--size); border-radius: 50%; flex: none;
  display: inline-grid; place-items: center; background: var(--c); color: #fff;
  font: 700 calc(var(--size) * .44)/1 var(--round);
}
.avatar-pair { display: inline-flex; flex: none; }
.avatar-pair .avatar + .avatar { margin-left: calc(var(--size) * -.32); box-shadow: 0 0 0 2px var(--ring, var(--card)); }

/* Emoji-Kreis für Termine; gemeinsame bekommen einen Ring in beiden Farben */
.ico {
  --s: 44px;
  position: relative; width: var(--s); height: var(--s); border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: calc(var(--s) * .48); line-height: 1;
  background: color-mix(in srgb, var(--c) calc(var(--tint) + 4%), var(--card));
}
.ico.shared { background: color-mix(in srgb, color-mix(in srgb, var(--a), var(--b)) calc(var(--tint) + 2%), var(--card)); }
.ico.shared::before {
  content: ""; position: absolute; inset: -2.5px; border-radius: 50%;
  background: conic-gradient(var(--a) 0 50%, var(--b) 50% 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
}

/* ---------- Anmeldung */
.login { min-height: 100dvh; display: flex; align-items: center; padding: calc(32px + var(--safe-top)) 24px calc(32px + var(--safe-bottom)); }
.login-inner { width: 100%; max-width: 380px; margin: 0 auto; text-align: center; }
.login-icon { width: 96px; height: 96px; border-radius: 24px; box-shadow: 0 10px 30px rgba(0,0,0,.14); }
.login h1 { font: 800 32px/1.1 var(--round); letter-spacing: -.02em; margin-top: 22px; }
.login-lead { color: var(--text-2); font-size: 16px; margin: 10px auto 0; max-width: 300px; }
.login-form { margin-top: 30px; display: grid; gap: 14px; text-align: left; }

/* ---------- App-Gerüst */
.app { max-width: 640px; margin: 0 auto; }
.tab { padding: calc(10px + var(--safe-top)) var(--gutter) calc(110px + var(--safe-bottom)); }
.tab.enter { animation: tab-in .25s ease-out; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 8px 0 18px; }
.head-text { min-width: 0; }
.eyebrow { font: 600 14px var(--round); color: var(--text-2); margin-bottom: 2px; }
.head h1 { font: 800 32px/1.12 var(--round); letter-spacing: -.02em; }
.me { border-radius: 50%; margin-top: 4px; }
.me .avatar { --size: 38px; font-size: 16px; }
.me:active { transform: scale(.94); }
.head-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.month-head { display: flex; align-items: center; gap: 2px; }
.month-head h1 { margin-right: 6px; white-space: nowrap; }
.month-head h1 span { color: var(--text-3); font-weight: 700; }

.icon-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--card); box-shadow: var(--shadow); color: var(--text); }
.icon-btn.small { width: 32px; height: 32px; background: transparent; box-shadow: none; color: var(--text-2); }
.icon-btn svg { width: 19px; height: 19px; stroke-width: 2.3; }
.icon-btn:active, .pill-btn:active { transform: scale(.92); }
.pill-btn { height: 34px; padding: 0 14px; border-radius: 17px; background: var(--ink); color: var(--on-ink); font: 700 14px var(--round); }
.pill-btn.soft { background: var(--fill); color: var(--text); }

.sec { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 26px 4px 10px; }
.sec h2 { font: 700 21px/1.2 var(--round); letter-spacing: -.01em; }
.sec-sub { font-size: 14px; color: var(--text-2); margin-right: auto; }
.sec-link { font: 600 15px var(--round); color: var(--text-2); }
.sec-note { font-size: 14px; color: var(--text-2); margin: -4px 4px 10px; }

.offline-bar {
  position: sticky; top: 0; z-index: 9; margin: 0 auto; padding: calc(6px + var(--safe-top)) 16px 6px;
  text-align: center; font: 600 13px var(--round); color: #fff; background: var(--danger);
}
.offline-bar.syncing { background: var(--text-2); }

/* ---------- Tab-Leiste */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  padding: 6px max(8px, calc(50% - 320px)) calc(6px + var(--safe-bottom));
  background: color-mix(in srgb, var(--card) 86%, transparent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--line);
}
.tabbar button { display: grid; justify-items: center; gap: 3px; padding: 4px 0; color: var(--text-3); font: 700 10.5px var(--round); }
.tabbar button svg { width: 25px; height: 25px; stroke-width: 1.9; }
.tabbar button.on { color: var(--text); }
.tabbar button.on svg { stroke-width: 2.3; }
.tabbar .tab-add {
  justify-self: center; width: 50px; height: 50px; border-radius: 17px; background: var(--ink); color: var(--on-ink);
  display: grid; place-items: center; padding: 0; box-shadow: 0 6px 16px rgba(0,0,0,.18);
}
.tabbar .tab-add svg { width: 26px; height: 26px; stroke-width: 2.6; }
.tabbar .tab-add:active { transform: scale(.92); }

/* ---------- Heute: Jetzt-Karten */
.now-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.now-card {
  border-radius: 22px; padding: 14px 14px 15px; min-height: 118px; display: flex; flex-direction: column; gap: 6px;
  text-align: left; background: color-mix(in srgb, var(--c) var(--tint), var(--card)); transition: transform .15s;
}
.now-card:active { transform: scale(.98); }
.now-who { display: flex; align-items: center; gap: 7px; font: 700 14px var(--round); color: var(--c-ink); }
.now-who .avatar { --size: 24px; }
.now-live {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font: 800 10px var(--round);
  text-transform: uppercase; letter-spacing: .04em; color: var(--c-ink);
}
.now-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); animation: pulse 2s infinite; }
.now-emoji { font-size: 26px; line-height: 1; margin-top: 8px; }
.now-main { font: 700 17px/1.22 var(--round); color: var(--text); overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; }
.now-sub { font-size: 13px; color: var(--text-2); }

/* Hinweis-Karten (Viel Glück, freier Abend, Feiertag) */
.tip {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); column-gap: 12px; row-gap: 10px; align-items: start;
  padding: 14px 16px 15px 14px; margin-top: 10px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow);
}
.tip-emoji { font-size: 26px; line-height: 1; text-align: center; padding-top: 2px; }
.tip-text b { display: block; font: 700 16px/1.25 var(--round); }
.tip-text span { display: block; font-size: 13.5px; color: var(--text-2); margin-top: 2px; }
.tip .pill-btn { grid-column: 2; justify-self: start; }
.info-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.info-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 14px; font: 600 13px var(--round); background: var(--card); color: var(--text-2); box-shadow: var(--shadow); }
.info-chip.ferien { background: color-mix(in srgb, var(--green) 14%, var(--card)); color: var(--green-ink); }

/* ---------- Zeitleiste */
.timeline { position: relative; }
.timeline::before {
  content: ""; position: absolute; left: calc(50px + 12px + 21px); top: 24px; bottom: 24px; width: 2px;
  background: var(--line); border-radius: 1px;
}
.tl-item {
  position: relative; display: grid; grid-template-columns: 50px 44px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  width: 100%; padding: 7px 0; text-align: left;
}
.tl-item:active .tl-body { opacity: .6; }
.tl-time { font: 700 14px/1.15 var(--round); text-align: right; font-variant-numeric: tabular-nums; }
.tl-time small { display: block; font-size: 12px; color: var(--text-3); font-weight: 600; margin-top: 2px; }
.tl-item .ico { box-shadow: 0 0 0 5px var(--bg); }
.tl-body { min-width: 0; }
.tl-title { display: block; font: 600 16px/1.25 var(--font); overflow-wrap: anywhere; }
.tl-sub { display: block; font-size: 13px; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-side { display: flex; align-items: center; gap: 6px; }
.tl-side .avatar, .tl-side .avatar-pair .avatar { --size: 22px; --ring: var(--bg); }
.tl-reacts { font-size: 14px; letter-spacing: -2px; }
.tl-item.past { opacity: .42; }
.tl-now { position: relative; display: grid; grid-template-columns: 50px 1fr; gap: 12px; align-items: center; height: 14px; margin: 2px 0; }
.tl-now span { font: 800 11px var(--round); color: var(--danger); text-align: right; text-transform: uppercase; letter-spacing: .03em; }
.tl-now i { height: 2px; background: var(--danger); border-radius: 1px; position: relative; }
.tl-now i::before { content: ""; position: absolute; left: 15px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.allday { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.allday-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px 7px 8px; border-radius: 14px; max-width: 100%;
  font: 600 14px var(--round); color: var(--c-ink); background: color-mix(in srgb, var(--c) var(--tint), var(--card));
}
.allday-chip.shared { color: var(--text); background: var(--card); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--a) 50%, var(--b)); }
.allday-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.new-badge {
  display: inline-block; vertical-align: 2px; margin-left: 6px; padding: 1px 6px; border-radius: 6px;
  background: var(--ink); color: var(--on-ink); font: 800 9.5px/1.4 var(--round); letter-spacing: .03em; text-transform: uppercase;
}

.empty {
  display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow);
  color: var(--text-2); font-size: 14px;
}
.empty-emoji { font-size: 30px; line-height: 1; flex: none; }
.empty b { display: block; color: var(--text); font: 700 16px/1.3 var(--round); }
.empty .pill-btn { margin-left: auto; flex: none; }

/* ---------- Listen in Karten */
.list { padding: 4px 0; }
.list-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; text-align: left; position: relative; }
.list-row + .list-row::before { content: ""; position: absolute; top: 0; left: 62px; right: 0; border-top: .5px solid var(--line); }
.list-row .ico { --s: 36px; }
.list-main { flex: 1; min-width: 0; }
.list-title { display: block; font: 600 15px/1.3 var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { display: block; font-size: 13px; color: var(--text-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .avatar, .list-row .avatar-pair .avatar { --size: 22px; }
.day-tag { flex: none; width: 36px; text-align: center; }
.day-tag span { display: block; font: 700 10px var(--round); color: var(--text-3); text-transform: uppercase; }
.day-tag b { display: block; font: 800 19px/1.1 var(--round); }
.list-row .pill-btn { flex: none; height: 32px; padding: 0 13px; font-size: 13px; }

/* ---------- To-Dos */
.check {
  --s: 26px;
  position: relative; width: var(--s); height: var(--s); border-radius: 50%; flex: none;
  border: 2px solid color-mix(in srgb, var(--c, var(--text-3)) 70%, transparent); display: grid; place-items: center;
  transition: background .2s, border-color .2s;
}
.check svg { width: 15px; height: 15px; stroke: #fff; stroke-width: 3; stroke-dasharray: 20; stroke-dashoffset: 20; transition: stroke-dashoffset .25s .05s; }
.check.on { background: var(--c, var(--ink)); border-color: var(--c, var(--ink)); }
.check.on svg { stroke-dashoffset: 0; }
.check.ghost { border-style: dashed; border-color: var(--text-3); }
.todo { display: flex; align-items: center; gap: 12px; padding: 12px 14px; position: relative; }
.todo + .todo::before { content: ""; position: absolute; top: 0; left: 52px; right: 0; border-top: .5px solid var(--line); }
.todo .check { cursor: pointer; }
.todo .check::after { content: ""; position: absolute; inset: -10px; } /* größere Tippfläche */
.todo-main { flex: 1; min-width: 0; text-align: left; }
.todo-title { display: block; font: 600 15.5px/1.3 var(--font); overflow-wrap: anywhere; transition: color .2s; }
.todo-sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin-top: 2px; }
.todo-sub .late { color: var(--danger); font-weight: 600; }
.todo-sub .soon { color: var(--text); font-weight: 600; }
.todo .avatar, .todo .avatar-pair .avatar { --size: 22px; }
.todo.done .todo-title { color: var(--text-3); text-decoration: line-through; }
.todo.leaving { animation: leave .35s ease-in .25s forwards; }
.todo-group-title { font: 700 13px var(--round); color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; margin: 22px 6px 8px; }
.todo-group-title.late { color: var(--danger); }
.done-toggle { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 18px; padding: 12px; font: 600 14px var(--round); color: var(--text-2); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--fill); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.seg button { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 10px; border-radius: 9px; font: 700 14px var(--round); color: var(--text-2); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
@media (prefers-color-scheme: dark) { .seg button.on { background: #3A3A40; } }
.seg .avatar { --size: 20px; }

.quick { display: flex; align-items: center; gap: 12px; padding: 7px 7px 7px 14px; }
.quick input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; padding: 8px 0; }
.quick input::placeholder { color: var(--text-3); }
.quick-btn { width: 36px; height: 36px; border-radius: 12px; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; flex: none; }
.quick-btn svg { width: 18px; height: 18px; stroke-width: 2.6; }
.quick.inline { border-top: .5px solid var(--line); border-radius: 0 0 20px 20px; }
.quick-ico { font-size: 20px; width: 26px; text-align: center; }

/* ---------- Kalender */
.month { padding: 10px 6px 8px; }
.weekdays, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays span { text-align: center; font: 700 11.5px var(--round); color: var(--text-3); padding-bottom: 6px; }
.grid { touch-action: pan-y; }
.grid.in-left { animation: in-left .28s cubic-bezier(.2, .8, .2, 1); }
.grid.in-right { animation: in-right .28s cubic-bezier(.2, .8, .2, 1); }
.cell { min-height: 66px; padding: 3px 2px 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0; border-radius: 14px; }
.cell .num {
  align-self: center; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font: 600 16px var(--round); font-variant-numeric: tabular-nums; margin-bottom: 1px;
}
.cell.weekend .num { color: var(--text-2); }
.cell.other .num { color: var(--text-3); }
.cell.other .lbl { opacity: .45; }
.cell.selected { background: var(--card-2); }
@media (prefers-color-scheme: dark) { .cell.selected { background: #26262C; } }
.cell.today .num { background: var(--ink); color: var(--on-ink); font-weight: 800; }
.cell.ferien { background: color-mix(in srgb, var(--green) 9%, transparent); }
.cell.ferien.selected { background: color-mix(in srgb, var(--green) 16%, transparent); }
.lbl {
  display: block; height: 16px; padding: 0 4px; border-radius: 5px; margin: 0 1px;
  font: 700 10px/16px var(--round); letter-spacing: -.01em; white-space: nowrap; overflow: hidden;
  color: var(--c-ink); background: color-mix(in srgb, var(--c) var(--tint), transparent);
  -webkit-mask-image: linear-gradient(90deg, #000 78%, transparent); mask-image: linear-gradient(90deg, #000 78%, transparent);
}
.lbl.shared { color: var(--text); background: linear-gradient(90deg, color-mix(in srgb, var(--a) var(--tint), transparent), color-mix(in srgb, var(--b) var(--tint), transparent)); }
.lbl.cont { color: transparent; border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -3px; }
.lbl.ongoing { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: -3px; -webkit-mask-image: none; mask-image: none; }
.lbl.holiday { color: var(--text-2); background: var(--fill); }
.more { font: 700 10px var(--round); color: var(--text-3); text-align: center; line-height: 11px; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 12px; font: 600 13px var(--round); color: var(--text-2); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend .avatar, .legend .avatar-pair .avatar { --size: 18px; --ring: var(--bg); }
.swatch-ferien { width: 14px; height: 14px; border-radius: 5px; background: color-mix(in srgb, var(--green) 30%, transparent); }

/* ---------- Wir */
.together { padding: 18px 18px 16px; }
.together-top { display: flex; align-items: center; gap: 12px; }
.together-num { font: 800 50px/1 var(--round); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.together-unit { font: 700 16px/1.15 var(--round); color: var(--text-2); }
.together .avatar-pair { margin-left: auto; }
.together .avatar-pair .avatar { --size: 40px; font-size: 16px; }
.together-sub { font-size: 14px; color: var(--text-2); margin-top: 10px; }
.together-mile { display: inline-block; margin-top: 10px; padding: 6px 11px; border-radius: 12px; background: var(--fill); font: 700 13px var(--round); }
.together-set { display: grid; gap: 10px; padding: 16px 18px; }
.together-set b { font: 700 17px var(--round); }
.together-set input { font-size: 16px; padding: 10px 12px; border-radius: 12px; border: 0; background: var(--fill); }
.idea { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; text-align: left; position: relative; }
.idea + .idea::before { content: ""; position: absolute; top: 0; left: 52px; right: 0; border-top: .5px solid var(--line); }
.idea-emoji { font-size: 22px; width: 26px; text-align: center; flex: none; }
.idea-title { flex: 1; min-width: 0; font: 600 15px var(--font); }
.idea .chev { color: var(--text-3); width: 16px; height: 16px; }
.idea-pick {
  display: grid; gap: 4px; justify-items: center; text-align: center; padding: 22px 18px 18px; margin-bottom: 12px;
  border-radius: 22px; background: var(--card); box-shadow: var(--shadow); animation: pop .35s cubic-bezier(.2, 1.4, .4, 1);
}
.idea-pick .big { font-size: 46px; line-height: 1.1; }
.idea-pick b { font: 800 21px/1.25 var(--round); }
.idea-pick span { font-size: 14px; color: var(--text-2); }
.idea-pick .btn-row { display: flex; gap: 10px; margin-top: 12px; }
.idea-starters { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px; }
.idea-starters p { width: 100%; font-size: 14px; color: var(--text-2); }
.cd-row { display: flex; gap: 10px; overflow-x: auto; margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter) 6px; scrollbar-width: none; scroll-snap-type: x mandatory; }
.cd-row::-webkit-scrollbar { display: none; }
.cd-card { flex: none; width: 150px; padding: 14px; border-radius: 20px; display: grid; gap: 2px; text-align: left; scroll-snap-align: start; background: var(--card); box-shadow: var(--shadow); }
.cd-card .e { font-size: 22px; }
.cd-card .n { font: 800 30px/1.05 var(--round); letter-spacing: -.02em; margin-top: 6px; }
.cd-card .n small { font: 700 14px var(--round); color: var(--text-2); }
.cd-card .t { font: 600 13px/1.3 var(--font); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Buttons & Chips */
.btn {
  display: block; width: 100%; padding: 15px; border-radius: 16px; text-align: center; text-decoration: none;
  font: 700 16px var(--round); background: var(--card); color: var(--text); box-shadow: var(--shadow); transition: transform .15s;
}
.btn.primary { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.btn.danger { color: var(--danger); }
.btn:active { transform: scale(.98); }
.btn-col { display: grid; gap: 10px; margin-top: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button, .chip {
  height: 36px; padding: 0 14px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow);
  font: 600 14px var(--round); color: var(--text); display: inline-flex; align-items: center; gap: 6px; transition: transform .15s;
}
.chips button.on { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.chips button:active, .chip:active { transform: scale(.95); }
.link { font: 500 17px var(--font); color: var(--text-2); padding: 8px 0; }
.link.strong { font-weight: 700; color: var(--text); }

/* ---------- Sheets */
.backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .3); animation: fade .25s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-width: 640px; margin: 0 auto;
  max-height: calc(100dvh - var(--safe-top) - 14px); display: flex; flex-direction: column;
  background: var(--bg); border-radius: 26px 26px 0 0; animation: up .4s cubic-bezier(.2, .9, .25, 1);
  --ring: var(--card);
}
@media (prefers-color-scheme: dark) { .sheet { background: #0F0F12; } }
.sheet.tall { top: calc(var(--safe-top) + 14px); max-height: none; }
.grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--text-3); opacity: .5; margin: 7px auto 0; flex: none; }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 4px 18px 6px; flex: none; }
.sheet-head > :last-child { justify-self: end; }
.sheet-head strong { font: 700 17px var(--round); }
.sheet-body { overflow-y: auto; padding: 8px 18px calc(30px + var(--safe-bottom)); -webkit-overflow-scrolling: touch; }
.label { font: 700 13px var(--round); color: var(--text-2); margin: 22px 6px 8px; }

.rows { overflow: hidden; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 50px; padding: 0 16px; position: relative; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--line); }
.row > span:first-child { flex: none; }
.row input:not([type=checkbox]):not([type=date]):not([type=time]) {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; text-align: right;
}
.login .row input { text-align: left !important; font-size: 17px !important; }
.row input[type=date], .row input[type=time] {
  -webkit-appearance: none; appearance: none; border: 0; background: var(--fill); border-radius: 9px;
  padding: 6px 10px; font: 600 15px var(--round); min-height: 34px; color: var(--text); text-align: center;
}
.row input[type=date] { min-width: 128px; }
.row input[type=time] { width: 86px; }
.row select {
  -webkit-appearance: none; appearance: none; border: 0; background: transparent; color: var(--text-2); font-size: 16px;
  text-align: right; text-align-last: right; padding: 8px 18px 8px 0; min-width: 0; max-width: 55%; outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238E8E93' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 10l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right center; background-size: 16px;
}
.time-pair { display: flex; align-items: center; gap: 6px; }
.time-pair em { font-style: normal; color: var(--text-3); }
.switch {
  -webkit-appearance: none; appearance: none; width: 51px; height: 31px; border-radius: 999px; background: var(--fill);
  position: relative; transition: background .25s; flex: none; margin: 0;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition: transform .25s;
}
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }

.title-card { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; margin-top: 4px; }
.title-ico { --s: 46px; }
.title-ico.check-ico { width: 46px; height: 46px; display: grid; place-items: center; }
.title-input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font: 700 20px/1.25 var(--round); padding: 8px 0; }
.title-input::placeholder { color: var(--text-3); }
.qa-chip { display: flex; align-items: center; gap: 7px; margin: 9px 6px 0; font: 700 13px var(--round); color: var(--text); }
.qa-chip span { flex: 1; min-width: 0; }
.qa-chip button { color: var(--text-2); font-weight: 600; }
#idea-chips { margin-top: 12px; }
.cat-row { display: flex; gap: 8px; overflow-x: auto; margin: 0 -18px; padding: 2px 18px 6px; scrollbar-width: none; }
.cat-row::-webkit-scrollbar { display: none; }
.cat-row button {
  flex: none; width: 70px; padding: 10px 2px 9px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow);
  display: grid; justify-items: center; gap: 5px; font: 700 11.5px var(--round); color: var(--text-2); transition: transform .15s;
}
.cat-row button .e { font-size: 25px; line-height: 1; }
.cat-row button.on { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.cat-row button:active { transform: scale(.94); }
.who-pick { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.who-pick button {
  display: grid; justify-items: center; gap: 6px; padding: 12px 4px 10px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow);
  font: 700 14px var(--round); color: var(--text-2); min-width: 0; transition: transform .15s;
}
.who-pick button span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-pick .avatar { --size: 36px; font-size: 15px; }
.who-pick button.on { color: var(--text); box-shadow: inset 0 0 0 2.5px var(--c); }
.who-pick button.on.shared { box-shadow: inset 0 0 0 2.5px var(--ink); }
.who-pick button:active { transform: scale(.96); }
.notes { width: 100%; border: 0; outline: none; background: transparent; padding: 14px 16px; font-size: 16px; resize: none; display: block; }
.notes::placeholder { color: var(--text-3); }
#due-chips { margin-bottom: 10px; }
.sheet.all-day .time-row, .sheet.no-due .due-time-row { display: none; }
.until-row { display: none !important; }
.sheet.has-repeat .until-row { display: flex !important; }
.more { margin-top: 20px; }
.more summary { list-style: none; font: 700 15px var(--round); color: var(--text-2); padding: 6px; cursor: pointer; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: "＋ "; }
.more[open] summary::before { content: "－ "; }
.meta { font-size: 13px; color: var(--text-2); text-align: center; margin-top: 18px; }
#ed-delete { margin-top: 24px; }
.sheet:not(.is-todo) .todo-only, .sheet.is-todo .ev-only { display: none !important; }

/* Detail */
.dt-head { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 8px 0 20px; }
.dt-head .ico { --s: 72px; }
.dt-title { font: 800 26px/1.15 var(--round); letter-spacing: -.02em; overflow-wrap: anywhere; }
.dt-who { display: inline-flex; align-items: center; gap: 8px; font: 600 15px var(--round); color: var(--text-2); }
.dt-who .avatar, .dt-who .avatar-pair .avatar { --size: 22px; --ring: var(--bg); }
.dt-rows .row { justify-content: flex-start; gap: 14px; padding: 11px 16px; }
.dt-rows .row > svg { color: var(--text-2); }
.dt-rows .row > span { flex: 1 !important; min-width: 0; overflow-wrap: anywhere; }
.dt-sub { display: block; font-size: 14px; color: var(--text-2); }
a.row { color: inherit; text-decoration: none; }
.reactions { display: flex; gap: 7px; flex-wrap: wrap; }
.reactions button {
  height: 46px; min-width: 44px; padding: 0 10px; border-radius: 23px; background: var(--card); box-shadow: var(--shadow);
  font-size: 21px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; transition: transform .15s;
}
.reactions button span { font: 700 14px var(--round); }
.reactions button.on { background: var(--ink); color: var(--on-ink); }
.reactions button:active { transform: scale(.9); }
.react-others { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 6px 0; font: 600 14px var(--round); color: var(--text-2); }
.react-others > span { display: inline-flex; align-items: center; gap: 6px; }
.react-others .avatar { --size: 20px; }

/* Suche */
.search-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 6px; flex: none; }
.search-field { flex: 1; display: flex; align-items: center; gap: 7px; height: 40px; padding: 0 12px; border-radius: 12px; background: var(--fill); color: var(--text-2); }
.search-field svg { width: 17px; height: 17px; }
.search-field input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 17px; color: var(--text); }
.search-hint { color: var(--text-2); font-size: 15px; text-align: center; padding: 30px 12px; }

/* Einstellungen */
.profile-card { display: flex; align-items: center; gap: 14px; padding: 16px; }
.profile-card .avatar { --size: 56px; font-size: 23px; }
.profile-card strong { display: block; font: 800 21px var(--round); }
.profile-card span.sub { font-size: 14px; color: var(--text-2); }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; padding: 14px; }
.swatch-btn { aspect-ratio: 1; border-radius: 50%; background: var(--sw); color: #fff; font: 800 13px var(--round); display: grid; place-items: center; transition: transform .15s; }
@media (prefers-color-scheme: dark) { .swatch-btn { background: var(--sw-dark); } }
.swatch-btn.on { box-shadow: 0 0 0 2.5px var(--card), 0 0 0 4.5px var(--text); }
.swatch-btn:disabled { opacity: .35; cursor: default; }
.swatch-btn:not(:disabled):active { transform: scale(.88); }
.text { padding: 14px 16px; font-size: 15px; line-height: 1.45; }
.howto { margin-top: 10px; padding: 0 16px; }
.howto summary { padding: 14px 0; font: 700 15px var(--round); cursor: pointer; list-style: none; }
.howto summary::-webkit-details-marker { display: none; }
.howto summary::after { content: "  ›"; color: var(--text-3); }
.howto ol { margin: 0; padding: 0 0 16px 20px; font-size: 14px; line-height: 1.45; display: grid; gap: 8px; }
.howto code { font-size: 13px; background: var(--fill); padding: 1px 5px; border-radius: 5px; }

/* Aktionsblatt */
.chooser {
  position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .35); display: flex; flex-direction: column;
  justify-content: flex-end; gap: 8px; padding: 0 10px calc(10px + var(--safe-bottom)); animation: fade .2s;
}
.chooser > * { width: 100%; max-width: 500px; margin: 0 auto; animation: up .3s cubic-bezier(.2, .9, .25, 1); }
.chooser-box { border-radius: 16px; overflow: hidden; background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
@media (prefers-color-scheme: dark) { .chooser-box, .chooser-cancel { background: #2A2A30; } }
.chooser-box p { font-size: 13px; color: var(--text-2); text-align: center; padding: 14px 16px 13px; }
.chooser-box p:empty { display: none; }
.chooser-box button { display: block; width: 100%; padding: 17px; font: 600 18px var(--round); color: var(--text); border-top: .5px solid var(--line); }
.chooser-box p:empty + div button:first-child { border-top: 0; }
.chooser-box button.danger { color: var(--danger); }
.chooser-cancel { background: var(--card); border-radius: 16px; padding: 17px; font: 700 18px var(--round); color: var(--text); }

/* Toast */
.toast {
  position: fixed; left: 50%; top: calc(12px + var(--safe-top)); transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; gap: 8px; width: max-content; max-width: calc(100% - 32px);
  background: var(--ink); color: var(--on-ink); padding: 11px 18px; border-radius: 22px;
  font: 700 15px var(--round); box-shadow: 0 10px 30px rgba(0,0,0,.2); animation: drop .35s cubic-bezier(.2, .9, .25, 1);
}
.toast svg { width: 18px; height: 18px; color: var(--green); stroke-width: 2.6; }
.toast-action { color: var(--on-ink); opacity: .7; font-weight: 800; padding-left: 10px; margin-left: 2px; border-left: 1px solid color-mix(in srgb, var(--on-ink) 25%, transparent); }

@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(100%); } }
@keyframes drop { from { transform: translate(-50%, -20px); opacity: 0; } }
@keyframes in-left { from { transform: translateX(26px); opacity: 0; } }
@keyframes in-right { from { transform: translateX(-26px); opacity: 0; } }
@keyframes tab-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
@keyframes leave { to { opacity: 0; transform: translateX(16px); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 60%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

@media (min-width: 600px) {
  :root { --gutter: 28px; }
  .cell { min-height: 92px; }
  .lbl { font-size: 11px; height: 18px; line-height: 18px; }
}
@media (max-width: 360px) {
  .head h1 { font-size: 28px; }
  .now-main { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
