/* ================================================================ Schriften */
@font-face { font-family: "Instrument Sans"; src: url("/fonts/InstrumentSans-Regular.woff") format("woff"); font-weight: 300 550; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/fonts/InstrumentSans-Bold.woff") format("woff"); font-weight: 551 800; font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url("/fonts/BricolageGrotesque-Bold.woff") format("woff"); font-weight: 400 800; font-display: swap; }

/* ================================================================ Farben
   Pflaume  #4A3AA8  eigene Nachrichten, Knöpfe, Häkchen
   Aprikose #FF8F5A  Partner-Avatar, Hinweis-Punkte
   Tinte    #221D3B  Text
   Nebel    #7A7493  Nebentext
   Der Hintergrund wechselt mit der Tageszeit (siehe data-time unten). */
:root {
  --bg: #F4F3FA;
  --w-base: #F4F3FA;
  --w1: rgba(214, 228, 255, 0.95);
  --w2: rgba(232, 220, 255, 0.9);
  --w3: rgba(255, 233, 214, 0.85);
  --surface: #FFFFFF;
  --surface-2: rgba(34, 29, 59, 0.06);
  --ink: #221D3B;
  --ink-2: #453F63;
  --muted: #7A7493;
  --line: rgba(34, 29, 59, 0.08);
  --accent: #4A3AA8;
  --accent-2: #6552D0;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(74, 58, 168, 0.14);
  --warm: #FF8F5A;
  --warm-2: #FF6F7D;
  --theirs: rgba(255, 255, 255, 0.86);
  --theirs-ink: #221D3B;
  --mine-ink: #FFFFFF;
  --danger: #E0364A;

  --glass-bg: rgba(255, 255, 255, 0.58);
  --glass-strong: rgba(250, 249, 255, 0.86);
  --glass-card: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.85);
  --glass-shadow: 0 10px 30px rgba(34, 29, 59, 0.1), 0 1px 3px rgba(34, 29, 59, 0.06),
                  inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 -1px 0 rgba(255, 255, 255, 0.3);
  --indicator: rgba(74, 58, 168, 0.1);
  --fade: rgba(244, 243, 250, 0.7);
  --shadow-l: 0 30px 70px rgba(34, 29, 59, 0.24), 0 2px 8px rgba(34, 29, 59, 0.06);
  --grain-opacity: 0.05;

  --font: "Instrument Sans", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --display: "Bricolage Grotesque", "Instrument Sans", -apple-system, system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --spring: cubic-bezier(0.3, 1.35, 0.5, 1);
  color-scheme: light dark;
}

/* Tageszeiten – hell */
:root[data-time="morning"] { --w-base: #FBF3EF; --w1: rgba(255, 214, 190, 0.95); --w2: rgba(255, 236, 200, 0.85); --w3: rgba(208, 224, 255, 0.85); }
:root[data-time="day"]     { --w-base: #F4F3FA; --w1: rgba(206, 224, 255, 0.95); --w2: rgba(230, 216, 255, 0.9);  --w3: rgba(255, 232, 214, 0.8); }
:root[data-time="evening"] { --w-base: #F7ECEF; --w1: rgba(255, 196, 170, 0.95); --w2: rgba(232, 188, 230, 0.9);  --w3: rgba(196, 188, 245, 0.9); }
:root[data-time="night"]   { --w-base: #EEEDF7; --w1: rgba(196, 196, 240, 0.95); --w2: rgba(214, 200, 240, 0.9);  --w3: rgba(240, 214, 222, 0.8); }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14112A;
    --w-base: #14112A;
    --surface: #221E3D;
    --surface-2: rgba(255, 255, 255, 0.09);
    --ink: #F1EEFF;
    --ink-2: #D2CCEB;
    --muted: #958FB3;
    --line: rgba(255, 255, 255, 0.08);
    --accent: #5F4BDD;
    --accent-2: #7C68F2;
    --accent-soft: rgba(123, 103, 240, 0.22);
    --theirs: rgba(46, 41, 76, 0.86);
    --theirs-ink: #F1EEFF;
    --glass-bg: rgba(44, 38, 78, 0.5);
    --glass-strong: rgba(30, 26, 56, 0.88);
    --glass-card: rgba(40, 35, 70, 0.62);
    --glass-border: rgba(255, 255, 255, 0.11);
    --glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    --indicator: rgba(255, 255, 255, 0.12);
    --fade: rgba(20, 17, 42, 0.66);
    --shadow-l: 0 30px 70px rgba(0, 0, 0, 0.6);
    --grain-opacity: 0.07;
  }
  /* Tageszeiten – dunkel: tiefer Grund, farbiger Schimmer */
  :root[data-time="morning"] { --w-base: #17132A; --w1: rgba(150, 82, 60, 0.55);  --w2: rgba(120, 90, 50, 0.4);  --w3: rgba(60, 80, 150, 0.5); }
  :root[data-time="day"]     { --w-base: #131430; --w1: rgba(60, 90, 170, 0.55);  --w2: rgba(100, 70, 170, 0.5); --w3: rgba(140, 90, 70, 0.35); }
  :root[data-time="evening"] { --w-base: #1A1129; --w1: rgba(170, 70, 80, 0.5);   --w2: rgba(130, 60, 140, 0.5); --w3: rgba(70, 60, 160, 0.5); }
  :root[data-time="night"]   { --w-base: #100E24; --w1: rgba(70, 50, 150, 0.55);  --w2: rgba(110, 50, 110, 0.4); --w3: rgba(150, 80, 60, 0.25); }
}

.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(22px) saturate(1.9);
  backdrop-filter: blur(22px) saturate(1.9);
  border: 0.5px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}
.glass-strong {
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(34px) saturate(1.9);
  backdrop-filter: blur(34px) saturate(1.9);
  border: 0.5px solid var(--glass-border);
}
.glass-card {
  background: var(--glass-card);
  -webkit-backdrop-filter: blur(20px) saturate(1.7);
  backdrop-filter: blur(20px) saturate(1.7);
  border: 0.5px solid var(--glass-border);
  box-shadow: 0 8px 28px rgba(34, 29, 59, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

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

html, body {
  margin: 0;
  height: 100%;
  background-color: var(--w-base);
  color: var(--ink);
  font: 400 16.5px/1.42 var(--font);
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
body {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(90% 60% at 100% 0%, var(--w1), transparent 70%),
    radial-gradient(80% 55% at 0% 45%, var(--w2), transparent 70%),
    radial-gradient(100% 60% at 70% 105%, var(--w3), transparent 70%),
    var(--w-base);
  transition: background-color 2s;
}
/* feine Körnung, damit der Verlauf wie Papier/Licht wirkt statt wie ein Bildschirm */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

#app {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--app-top, 0px);
  height: var(--app-h, 100dvh);
  display: flex;
  flex-direction: column;
}
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#chat { position: relative; overflow: hidden; }
.view { position: absolute; inset: 0; }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
h1, h2 { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; }

.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ================================================================ Knöpfe */
.btn {
  border: 0;
  border-radius: 999px;
  padding: 13px 20px;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 600;
  font-size: 15.5px;
  transition: opacity 0.15s, transform 0.2s var(--spring);
}
.btn.small { padding: 7px 14px; font-size: 13.5px; }
.btn.primary {
  background: linear-gradient(160deg, var(--accent-2), var(--accent));
  color: var(--accent-ink);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn.danger { color: var(--danger); }
.btn.wide { width: 100%; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; }

.icon-btn {
  border: 0;
  background: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--ink);
  border-radius: 50%;
  flex: none;
  transition: transform 0.2s var(--spring);
}
.icon-btn.round { width: 44px; height: 44px; }
.icon-btn.small { width: 30px; height: 30px; color: var(--muted); }
.icon-btn svg { fill: currentColor; }
.icon-btn:active { transform: scale(0.9); }

.send-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--accent-2), var(--accent));
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 40%, transparent);
  transition: transform 0.25s var(--spring), opacity 0.15s;
}
.send-btn:disabled { background: var(--surface-2); color: var(--muted); box-shadow: none; transform: scale(0.86); }

/* Eingabefeld mit eingebautem Knopf */
.field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  border-radius: 23px;
  padding: 5px 5px 5px 16px;
  transition: box-shadow 0.2s;
}
.field:not(.glass) { background: var(--surface); border: 1px solid var(--line); }
.field:focus-within { box-shadow: var(--glass-shadow), 0 0 0 4px var(--accent-soft); }
.field textarea, .field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  outline: none;
  font-size: 16px; /* verhindert Zoom auf dem iPhone */
  line-height: 1.35;
  padding: 6.5px 0;
  resize: none;
}
.field textarea { min-height: 34px; max-height: 140px; }
::placeholder { color: var(--muted); opacity: 1; }

/* ================================================================ Anmeldung */
#login { justify-content: center; align-items: center; padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom)); }
.login-card { width: 100%; max-width: 380px; text-align: center; padding: 34px 22px 26px; border-radius: 34px; }
.login-icon { border-radius: 20px; box-shadow: var(--shadow-l); width: 76px; height: 76px; }
.login-card h1 { font-size: 40px; line-height: 1.05; margin: 22px 0 10px; letter-spacing: -0.035em; }
.login-card > .muted { font-size: 15.5px; margin: 0 auto; max-width: 280px; }
#loginForm { display: flex; flex-direction: column; gap: 12px; margin-top: 28px; }
#codeInput {
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.16em;
  font-feature-settings: "tnum";
  padding: 15px;
  border-radius: 20px;
  border: 0.5px solid var(--glass-border);
  background: var(--glass-card);
  box-shadow: inset 0 1px 3px rgba(34, 29, 59, 0.06);
  outline: none;
  text-transform: uppercase;
  transition: box-shadow 0.2s;
}
#codeInput::placeholder { font-weight: 500; }
#codeInput:focus { box-shadow: 0 0 0 4px var(--accent-soft); }
#loginForm .btn { padding: 15px; }
.error { color: var(--danger); min-height: 1.4em; margin: 14px 0 0; font-size: 14.5px; font-weight: 500; }
#safariTip { line-height: 1.5; margin: 14px 0 0; }

/* ================================================================ Schwebende Kopfzeile */
.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(6px + var(--safe-top)) 12px 12px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
/* weicher Übergang: Inhalt verschwimmt nach oben hin */
.topbar::before {
  content: "";
  position: absolute;
  inset: 0 0 -18px;
  background: linear-gradient(to bottom, var(--fade), transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  -webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent);
  mask-image: linear-gradient(to bottom, #000 45%, transparent);
  pointer-events: none;
  z-index: -1;
}
.title-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: calc(100% - 56px);
  height: 44px;
  padding: 4px 18px 4px 4px;
  border-radius: 999px;
  transition: opacity 0.25s, transform 0.3s var(--spring);
}
.topbar.title-hidden .title-pill { opacity: 0; transform: translateY(-6px) scale(0.95); pointer-events: none; }
.title-pill:has(.avatar[hidden]) { padding-left: 18px; }
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--warm), var(--warm-2));
  color: #FFFFFF;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
  flex: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.titles { min-width: 0; display: flex; flex-direction: column; }
.titles h1 { margin: 0; font-size: 18px; line-height: 1.15; letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titles .sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titles .sub:empty { display: none; }
#menuBtn { color: var(--ink-2); }

/* ================================================================ Schwebende Leiste unten */
.dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 12px max(calc(var(--safe-bottom) - 6px), 12px);
  pointer-events: none;
}
.dock > * { pointer-events: auto; }
.dock::before {
  content: "";
  position: absolute;
  inset: -22px 0 0;
  background: linear-gradient(to top, var(--fade), transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  -webkit-mask-image: linear-gradient(to top, #000 55%, transparent);
  mask-image: linear-gradient(to top, #000 55%, transparent);
  pointer-events: none;
  z-index: -1;
}
body.keyboard .dock { padding-bottom: 8px; }
body.keyboard .tabbar { display: none; }

#composer { display: flex; align-items: flex-end; gap: 8px; }
.photo-btn { color: var(--ink-2); }
.photo-btn svg { fill: none; }

.tabbar {
  position: relative;
  align-self: center;
  display: flex;
  width: min(250px, 72%);
  padding: 4px;
  border-radius: 999px;
}
.tab-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 999px;
  background: var(--indicator);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.45s var(--spring);
}
.tabbar[data-active="list"] .tab-indicator { transform: translateX(100%); }
.tab {
  flex: 1;
  position: relative;
  z-index: 1;
  border: 0;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 0 5px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-2);
  transition: color 0.2s, transform 0.2s var(--spring);
}
.tab:active { transform: scale(0.94); }
.tab svg { fill: none; }
.tab.active { color: var(--accent); }
.tab .dot {
  position: absolute;
  top: 4px;
  left: calc(50% + 8px);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warm);
  box-shadow: 0 0 0 2px var(--surface);
}

/* ================================================================ Hinweisleiste */
.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 10px;
  padding: 10px 6px 10px 16px;
  border-radius: 22px;
  font-size: 14px;
  line-height: 1.35;
}
.banner span { flex: 1; }

/* ================================================================ Nachrichten */
#scroller {
  position: absolute;
  inset: 0;
  padding: calc(var(--top-h, 64px) + 4px) 12px calc(var(--dock-h, 130px) + 8px);
}
.empty { text-align: center; margin-top: 26vh; }
.empty p { margin: 4px; }
.empty p:first-child { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -0.02em; }

.day { display: flex; justify-content: center; margin: 16px 0 10px; }
.day span {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 0.5px solid var(--glass-border);
}

.msg { display: flex; margin-top: 8px; }
.msg.cont { margin-top: 2px; }
.msg.mine { justify-content: flex-end; }

.bubble {
  max-width: min(78%, 520px);
  padding: 8px 13px 7px;
  border-radius: 21px;
  background: var(--theirs);
  color: var(--theirs-ink);
  border: 0.5px solid var(--glass-border);
  box-shadow: 0 2px 10px rgba(34, 29, 59, 0.06);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  position: relative;
  line-height: 1.38;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  transition: transform 0.2s var(--spring);
}
.mine .bubble {
  background: linear-gradient(160deg, var(--accent-2), var(--accent));
  color: var(--mine-ink);
  border-color: transparent;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 22%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.theirs.cont .bubble { border-top-left-radius: 7px; }
.theirs:not(.end) .bubble { border-bottom-left-radius: 7px; }
.mine.cont .bubble { border-top-right-radius: 7px; }
.mine:not(.end) .bubble { border-bottom-right-radius: 7px; }
.bubble.pressed { transform: scale(0.95); }

.bubble a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.bubble .emoji-only { font-size: 42px; line-height: 1.1; }
.bubble.big-emoji { background: none; box-shadow: none; border: 0; padding: 0 2px; }

.bubble .meta {
  float: right;
  margin: 7px 0 -3px 10px;
  font-size: 11px;
  font-weight: 500;
  opacity: 0.5;
  font-feature-settings: "tnum";
  letter-spacing: 0;
  white-space: nowrap;
}
.mine .bubble .meta { opacity: 0.78; }

/* Fotos */
.bubble.photo { padding: 0; overflow: hidden; width: min(68vw, 290px); }
.bubble.photo img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 380px;
  object-fit: cover;
  background: var(--surface-2);
  cursor: zoom-in;
}
.bubble.photo .caption { padding: 8px 13px 7px; }
.bubble.photo .meta.overlay {
  position: absolute;
  right: 8px;
  bottom: 8px;
  margin: 0;
  float: none;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  opacity: 1;
}

.msg.sending .bubble, .msg.failed .bubble { opacity: 0.55; }
.failed-note { font-size: 12.5px; font-weight: 500; color: var(--danger); text-align: right; margin: 4px 4px 0; cursor: pointer; }
.receipt { font-size: 11.5px; font-weight: 500; color: var(--muted); text-align: right; margin: 4px 6px 0; }

/* ================================================================ Listen */
#viewList { padding: calc(var(--top-h, 64px) - 6px) 0 calc(var(--dock-h, 80px) + 16px); }
.large-title { font-size: 42px; letter-spacing: -0.04em; margin: 0 20px 2px; line-height: 1.05; }

.chips {
  display: flex;
  gap: 8px;
  padding: 10px 16px 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  border: 0.5px solid var(--glass-border);
  border-radius: 999px;
  padding: 8px 15px;
  background: var(--glass-card);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: var(--ink-2);
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 2px 10px rgba(34, 29, 59, 0.06);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  transition: background 0.2s, color 0.2s, transform 0.2s var(--spring);
}
.chip:active { transform: scale(0.95); }
.chip .count {
  display: inline-block;
  min-width: 20px;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-feature-settings: "tnum";
}
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 6px 18px var(--accent-soft); }
.chip.active .count { background: rgba(255, 255, 255, 0.22); color: inherit; }
.chip.add { background: none; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; border: 1px dashed color-mix(in srgb, var(--muted) 55%, transparent); color: var(--muted); }

.todo-form { display: flex; padding: 10px 16px 6px; }
.todo-form .field { align-items: center; padding-left: 18px; }
.todo-form .field input { padding: 8px 0; }

.todo-scroll { padding: 10px 16px 20px; }
.todos { list-style: none; margin: 0; padding: 0; border-radius: 24px; overflow: hidden; }
.todos:empty { display: none; }
.todo { position: relative; overflow: hidden; }
.todo + .todo .todo-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 53px;
  right: 0;
  border-top: 0.5px solid var(--line);
}
.todo-del {
  visibility: hidden;
  position: absolute;
  inset: 0;
  background: var(--danger);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 22px;
  font-weight: 600;
  font-size: 14px;
}
.todo-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 18px;
  min-height: 54px;
  background: transparent;
  touch-action: pan-y;
  transition: transform 0.3s var(--spring), background 0.2s;
  cursor: pointer;
}
.todo-row.dragging { transition: none; }
.todo.swiping .todo-del { visibility: visible; }
.todo.swiping .todo-row { background: var(--surface); }
.todo-row:active { background: var(--surface-2); }
.check {
  flex: none;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  border: 1.75px solid color-mix(in srgb, var(--muted) 65%, transparent);
  display: grid;
  place-items: center;
  transition: background 0.2s, border-color 0.2s, transform 0.3s var(--spring);
}
.check svg { opacity: 0; transform: scale(0.5); transition: opacity 0.2s, transform 0.3s var(--spring); }
.todo-row:active .check { transform: scale(0.85); }
.done .check { background: linear-gradient(160deg, var(--accent-2), var(--accent)); border-color: transparent; }
.done .check svg { opacity: 1; transform: none; }
.todo-text { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 15.5px; font-weight: 500; }
.todo-meta { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.done .todo-text > span:first-child { text-decoration: line-through; text-decoration-color: var(--muted); color: var(--muted); font-weight: 400; }
.todo.new .todo-row { animation: pop 0.7s; }

.done-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 6px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.done-head .btn { background: none; color: var(--accent); padding: 4px 6px; font-weight: 700; }
.small-empty { margin-top: 8vh; }
.hint { text-align: center; margin-top: 24px; line-height: 1.5; }
@media (pointer: fine) { .hint { display: none; } }

/* ================================================================ Untere Blätter */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.25); animation: fade 0.25s; }
.sheet-panel {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: max(calc(var(--safe-bottom) - 4px), 8px);
  border-radius: 34px;
  padding: 8px 14px 14px;
  box-shadow: var(--shadow-l);
  animation: up 0.42s var(--spring);
  max-width: 560px;
  margin: 0 auto;
}
.sheet-grip { width: 36px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--muted) 35%, transparent); margin: 2px auto 14px; }
.sheet-panel h2 { font-size: 28px; margin: 2px 6px; letter-spacing: -0.03em; }
.sheet-panel > p { margin: 4px 6px 0; }
.sheet-group { background: var(--surface-2); border-radius: 22px; margin: 14px 0; overflow: hidden; }
@media (prefers-color-scheme: light) { .sheet-group { background: rgba(255, 255, 255, 0.75); } }
.sheet-group .btn.wide { background: none; border-radius: 0; }
.row-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; font-weight: 500; }
.row-item .small { font-weight: 400; margin-top: 2px; }
.row-item + .row-item { border-top: 0.5px solid var(--line); }
.row-item .btn.small:not(.primary) { background: var(--surface-2); }

.action-btn {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  border: 0;
  background: none;
  padding: 15px 16px;
  text-align: left;
  font-size: 16px;
  font-weight: 500;
}
.action-btn:active { background: var(--surface-2); }
.action-btn + .action-btn { border-top: 0.5px solid var(--line); }
.action-btn svg { flex: none; color: var(--accent); fill: none; }
#actionsTitle { margin: 0 8px; font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ================================================================ Fotoansicht */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.92);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  display: grid;
  place-items: center;
  animation: fade 0.2s;
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .icon-btn {
  position: absolute;
  top: calc(10px + var(--safe-top));
  right: 12px;
  width: 44px;
  height: 44px;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 0.5px solid rgba(255, 255, 255, 0.2);
}

/* ================================================================ Meldung */
.toast {
  position: fixed;
  left: 50%;
  top: calc(var(--top-h, 64px) + 6px);
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--ink) 86%, transparent);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  color: var(--bg);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  z-index: 40;
  max-width: calc(100% - 40px);
  text-align: center;
  box-shadow: var(--shadow-l);
  animation: drop 0.4s var(--spring);
}

@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(110%); } }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -10px) scale(0.95); } }
@keyframes pop { from { background: var(--accent-soft); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
