/* ============================================================
   Flow · To-Do  —  Samsung One UI inspired design
   ============================================================ */

:root {
  /* One UI signature blue + signal red */
  --accent: #4d8cff;
  --accent-soft: rgba(77, 140, 255, .16);
  --signal: #ff5466;
  --signal-soft: rgba(255, 84, 102, .16);
  --green: #37d67a;

  --radius-sheet: 30px;
  --radius-card: 24px;
  --radius-pill: 999px;

  --ease-spring: cubic-bezier(.22, 1, .36, 1);
  --ease-out: cubic-bezier(.2, .8, .2, 1);

  --font: 'Inter', -apple-system, 'Segoe UI', 'SamsungOne', Roboto, system-ui, sans-serif;
}

/* ---------- Dark theme (default) ---------- */
html[data-theme="dark"] {
  --bg: #000000;
  --surface: #16171a;
  --surface-2: #1f2125;
  --surface-3: #2a2d33;
  --card: #1a1c1f;
  --card-press: #25282d;
  --text: #f3f4f6;
  --text-dim: #9aa0a8;
  --text-faint: #6b7077;
  --divider: rgba(255, 255, 255, .07);
  --nav-bg: rgba(16, 17, 20, .82);
  --shadow: 0 18px 50px rgba(0, 0, 0, .55);
}

/* ---------- Light theme ---------- */
html[data-theme="light"] {
  --bg: #f1f3f6;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --surface-3: #e3e6ec;
  --card: #ffffff;
  --card-press: #eef0f4;
  --text: #14161a;
  --text-dim: #5d636d;
  --text-faint: #9aa0a8;
  --divider: rgba(0, 0, 0, .07);
  --nav-bg: rgba(255, 255, 255, .82);
  --shadow: 0 18px 50px rgba(60, 70, 90, .18);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }   /* hidden-Attribut darf nie von display:flex/grid überstimmt werden */

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  background: #050507;
  color: var(--text);
  overscroll-behavior: none;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Phone frame (desktop) ---------- */
#phone {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  max-height: 932px;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  isolation: isolate;
}
@media (min-width: 480px) {
  body { background: radial-gradient(120% 120% at 50% 0%, #15161b 0%, #050507 60%); padding: 24px; }
  #phone { border-radius: 46px; box-shadow: 0 40px 90px rgba(0,0,0,.6), 0 0 0 11px #0c0d10, 0 0 0 12px #26282e; }
}

#screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ============================================================
   Header — One UI collapsing big title
   ============================================================ */
#appHeader {
  padding: max(env(safe-area-inset-top), 18px) 24px 6px;
  flex-shrink: 0;
  transition: padding .25s var(--ease-out);
}
.header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  min-height: 56px;
}
#headerTitle {
  margin: 0;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.05;
  transition: font-size .25s var(--ease-out);
  transform-origin: left center;
}
.header-sub {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 500;
  transition: opacity .2s var(--ease-out), max-height .25s var(--ease-out), margin .25s var(--ease-out);
  max-height: 24px;
  overflow: hidden;
}

/* collapsed state when scrolled */
#appHeader.collapsed { padding-top: max(env(safe-area-inset-top), 14px); padding-bottom: 10px; box-shadow: 0 1px 0 var(--divider); }
#appHeader.collapsed #headerTitle { font-size: 21px; }
#appHeader.collapsed .header-sub { opacity: 0; max-height: 0; margin: 0; }

.icon-btn {
  width: 42px; height: 42px;
  border: none; border-radius: 50%;
  background: transparent;
  color: var(--text);
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .15s;
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn svg { width: 24px; height: 24px; }

/* ============================================================
   Content / task list
   ============================================================ */
#content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#content::-webkit-scrollbar { display: none; }
.scroll-spacer { height: 140px; }

.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 26px 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.section-head .count {
  margin-left: auto;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-faint);
  font-weight: 600;
}
.section-head.signal { color: var(--signal); }

/* ---------- Task row with swipe ---------- */
.task {
  position: relative;
  margin: 7px 16px;
  border-radius: var(--radius-card);
  overflow: hidden;
  touch-action: pan-y;
}
.task-bg {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}
.task-bg .bg-action {
  display: flex; align-items: center; gap: 9px;
  padding: 0 26px;
  opacity: 0;
  transition: opacity .12s;
}
.task-bg .bg-action svg { width: 22px; height: 22px; }
.task-bg.reveal-left { background: linear-gradient(90deg, var(--accent), #6aa0ff); }
.task-bg.reveal-left .bg-left { opacity: 1; }
.task-bg.reveal-right { background: linear-gradient(90deg, #8a72ff, #b07bff); }
.task-bg.reveal-right .bg-right { opacity: 1; }
.bg-right { margin-left: auto; }

.task-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 16px;
  background: var(--card);
  border-radius: var(--radius-card);
  will-change: transform;
  cursor: pointer;
  user-select: none;
}
.task-card.dragging { transition: none; }
.task-card.snap { transition: transform .32s var(--ease-spring); }
.task-card:active { background: var(--card-press); }

.task.flagged .task-card { box-shadow: inset 3px 0 0 var(--signal); }
.task.done .task-card { opacity: .55; }

/* check circle */
.check {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2.4px solid var(--text-faint);
  display: grid; place-items: center;
  transition: all .2s var(--ease-spring);
  background: transparent;
  cursor: pointer;
}
.check svg { width: 15px; height: 15px; opacity: 0; transform: scale(.4); transition: all .2s var(--ease-spring); }
.task.done .check { background: var(--green); border-color: var(--green); }
.task.done .check svg { opacity: 1; transform: scale(1); color: #04150a; }

.task-body { flex: 1; min-width: 0; }
.task-title {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text);
  word-break: break-word;
}
.task.done .task-title { text-decoration: line-through; text-decoration-color: var(--text-faint); }
.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-dim);
}
.task-meta .chip {
  display: inline-flex; align-items: center; gap: 4px;
}
.task-meta .chip svg { width: 13px; height: 13px; }
.task-meta .chip.overdue { color: var(--signal); }
.task-meta .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--text-faint); }

/* signal flag button */
.flag-btn {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border: none; background: transparent;
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--text-faint);
  transition: background .15s, transform .2s var(--ease-spring);
}
.flag-btn svg { width: 21px; height: 21px; }
.flag-btn:active { background: var(--surface-2); }
.task.flagged .flag-btn { color: var(--signal); transform: scale(1.06); }
.task.flagged .flag-btn svg path { fill: var(--signal); }

/* ---------- List cards (Lists tab) ---------- */
.list-card {
  display: flex;
  align-items: center;
  gap: 15px;
  margin: 8px 16px;
  padding: 17px 18px;
  background: var(--card);
  border-radius: var(--radius-card);
  cursor: pointer;
  transition: background .15s;
}
.list-card:active { background: var(--card-press); }
.list-emoji {
  width: 46px; height: 46px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 23px;
  flex-shrink: 0;
}
.list-info { flex: 1; min-width: 0; }
.list-name { font-size: 16.5px; font-weight: 600; }
.list-sub { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.list-chevron { color: var(--text-faint); }
.list-chevron svg { width: 20px; height: 20px; }

.add-list-card {
  margin: 8px 16px;
  padding: 17px 18px;
  border: 1.5px dashed var(--divider);
  border-radius: var(--radius-card);
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
  display: flex; align-items: center; gap: 12px;
  background: transparent;
  width: calc(100% - 32px);
  cursor: pointer;
}
.add-list-card svg { width: 22px; height: 22px; }

/* ============================================================
   Empty states
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 80px 40px;
  color: var(--text-dim);
}
.empty-state .emoji { font-size: 52px; margin-bottom: 16px; filter: saturate(.9); }
.empty-state h3 { margin: 0 0 6px; font-size: 19px; font-weight: 700; color: var(--text); }
.empty-state p { margin: 0; font-size: 14.5px; line-height: 1.5; max-width: 260px; }

/* ============================================================
   FAB + bottom nav
   ============================================================ */
.fab {
  position: absolute;
  right: 18px;
  bottom: calc(78px + env(safe-area-inset-bottom));
  width: 60px; height: 60px;
  border-radius: 20px;
  border: none;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 10px 26px rgba(77, 140, 255, .45);
  cursor: pointer;
  z-index: 20;
  transition: transform .22s var(--ease-spring), box-shadow .2s;
}
.fab:active { transform: scale(.9); box-shadow: 0 6px 16px rgba(77,140,255,.4); }

#bottomNav {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: var(--nav-bg);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  border-top: 1px solid var(--divider);
  z-index: 15;
}
.nav-item {
  position: relative;
  flex: 1;
  border: none; background: transparent;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 7px 0 5px;
  color: var(--text-faint);
  cursor: pointer;
  border-radius: 16px;
  transition: color .18s;
}
.nav-icon { width: 26px; height: 26px; display: grid; place-items: center; }
.nav-icon svg { width: 25px; height: 25px; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .01em; }
.nav-item.active { color: var(--accent); }
.nav-item.active .nav-icon { transform: translateY(-1px); }
.nav-badge {
  position: absolute;
  top: 4px;
  left: 56%;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--signal);
  color: #fff;
  font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
}
.nav-badge[hidden] { display: none; }   /* sonst überschreibt display:grid das hidden-Attribut */

/* ============================================================
   Bottom sheets
   ============================================================ */
.scrim {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 40;
  opacity: 0;
  transition: opacity .28s var(--ease-out);
}
.scrim.show { opacity: 1; }

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 100%);
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  z-index: 50;
  padding: 10px 22px calc(26px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
  transition: transform .42s var(--ease-spring);
  max-height: 88dvh;
  overflow-y: auto;
  scrollbar-width: none;
}
.sheet::-webkit-scrollbar { display: none; }
.sheet.show { transform: translate(-50%, 0); }

.sheet-grip {
  width: 40px; height: 5px;
  border-radius: 3px;
  background: var(--surface-3);
  margin: 4px auto 16px;
}
.sheet h2 {
  margin: 2px 0 18px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.sheet h2.center { text-align: center; }

/* add task input */
.add-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border-radius: 18px;
  padding: 6px 6px 6px 18px;
}
.add-input {
  flex: 1;
  border: none; background: transparent;
  font-family: var(--font);
  font-size: 17px;
  color: var(--text);
  padding: 12px 0;
  outline: none;
}
.add-input::placeholder { color: var(--text-faint); }
.add-send {
  width: 46px; height: 46px;
  border-radius: 14px;
  border: none;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform .18s var(--ease-spring), opacity .2s;
}
.add-send:disabled { opacity: .4; }
.add-send:active:not(:disabled) { transform: scale(.9); }
.add-send svg { width: 22px; height: 22px; }

.add-row-toggle {
  display: flex; align-items: center; gap: 10px;
  margin-top: 16px;
  padding: 12px 4px 0;
}
.signal-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--divider);
  background: transparent;
  color: var(--text-dim);
  font-size: 14px; font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all .18s;
}
.signal-toggle svg { width: 17px; height: 17px; }
.signal-toggle.on { background: var(--signal-soft); border-color: transparent; color: var(--signal); }
.signal-toggle.on svg path { fill: var(--signal); }

/* sheet option rows */
.opt-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 16px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 16.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  border-radius: 16px;
  transition: background .14s;
}
.opt-row:active { background: var(--surface-2); }
.opt-row .opt-ic {
  width: 42px; height: 42px;
  border-radius: 13px;
  display: grid; place-items: center;
  flex-shrink: 0;
  background: var(--surface-2);
  color: var(--accent);
}
.opt-row .opt-ic svg { width: 22px; height: 22px; }
.opt-row.danger { color: var(--signal); }
.opt-row.danger .opt-ic { background: var(--signal-soft); color: var(--signal); }
.opt-row .opt-sub { font-size: 13px; color: var(--text-dim); font-weight: 500; margin-top: 2px; }
.opt-row .opt-text { flex: 1; min-width: 0; }
.opt-row .opt-trail { color: var(--text-faint); font-size: 14px; font-weight: 600; }
.opt-row.selected .opt-trail { color: var(--accent); }

.sheet-divider { height: 1px; background: var(--divider); margin: 8px 12px; }

/* quick date chips */
.date-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 6px;
}
.date-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border-radius: 18px;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 15.5px; font-weight: 600;
  cursor: pointer;
  transition: background .14s, transform .12s;
}
.date-chip:active { transform: scale(.97); }
.date-chip .dc-ic { color: var(--accent); display: grid; place-items: center; }
.date-chip .dc-ic svg { width: 21px; height: 21px; }
.date-chip small { display: block; font-size: 12px; font-weight: 500; color: var(--text-dim); margin-top: 1px; }
.date-native-wrap {
  margin-top: 10px;
  position: relative;
}
.date-native-wrap input[type=date] {
  width: 100%;
  padding: 15px 16px;
  border-radius: 18px;
  border: 1.5px solid var(--divider);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 15.5px;
  font-weight: 600;
  outline: none;
}
html[data-theme="dark"] input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.7); }

/* list pick / emoji */
.emoji-pick { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px; }
.emoji-pick button {
  width: 46px; height: 46px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: var(--surface-2);
  font-size: 22px;
  cursor: pointer;
  transition: transform .12s;
}
.emoji-pick button.sel { border-color: var(--accent); background: var(--accent-soft); }
.emoji-pick button:active { transform: scale(.92); }

.sheet-primary {
  width: 100%;
  margin-top: 8px;
  padding: 16px;
  border: none;
  border-radius: 18px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s var(--ease-spring), opacity .2s;
}
.sheet-primary:active { transform: scale(.97); }
.sheet-primary:disabled { opacity: .4; }

/* edit title input inside detail */
.detail-title-input {
  width: 100%;
  border: none;
  background: var(--surface-2);
  border-radius: 16px;
  padding: 15px 16px;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  margin-bottom: 6px;
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(100px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: var(--surface-3);
  color: var(--text);
  padding: 13px 18px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 600;
  z-index: 60;
  opacity: 0;
  transition: opacity .25s, transform .3s var(--ease-spring);
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
  max-width: 90%;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .undo {
  color: var(--accent);
  font-weight: 700;
  margin-left: 4px;
  cursor: pointer;
}

/* entrance animation for tasks */
@keyframes taskIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.task, .list-card { animation: taskIn .32s var(--ease-out) both; }

/* ============================================================
   Task-Aktions-Buttons (Desktop) — am Handy versteckt (dort Swipe)
   ============================================================ */
.task-actions { display: none; align-items: center; gap: 2px; flex-shrink: 0; }
.act {
  width: 38px; height: 38px;
  border: none; background: transparent;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text-faint);
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
}
.act svg { width: 19px; height: 19px; }
.act:hover { background: var(--surface-2); color: var(--accent); }
.act:active { transform: scale(.9); }

/* ============================================================
   Elemente, die nur im Desktop-Modus existieren — sonst aus
   ============================================================ */
.nav-brand { display: none; }
#addBar { display: none; }
#detailPane { display: none; }

/* ============================================================
   DESKTOP-MODUS — echte App: Sidebar · Liste · Detail-Panel
   ============================================================ */
html[data-mode="desktop"] body {
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: #060708;
  padding: 0;
}
html[data-theme="light"][data-mode="desktop"] body { background: #d7dbe2; }

html[data-mode="desktop"] #phone {
  flex-direction: row;
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--bg);
}

/* Sidebar + FAB am Desktop ausgeblendet – Spalten stehen ja nebeneinander */
html[data-mode="desktop"] #bottomNav,
html[data-mode="desktop"] .fab { display: none; }

/* --- (ungenutzt) Sidebar-Styles, falls wieder aktiviert --- */
html[data-mode="desktop"] #bottomNav.__legacy {
  position: static;
  order: -1;
  flex-direction: column;
  align-items: stretch;
  width: 248px;
  height: 100%;
  flex-shrink: 0;
  padding: 22px 16px;
  gap: 3px;
  background: var(--surface);
  border-top: none;
  border-right: 1px solid var(--divider);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html[data-mode="desktop"] .nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px 16px;
}
html[data-mode="desktop"] .nav-brand img { width: 34px; height: 34px; border-radius: 10px; }
html[data-mode="desktop"] .nav-brand b { font-size: 21px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }

html[data-mode="desktop"] .nav-item {
  flex-direction: row;
  justify-content: flex-start;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  transition: background .15s, color .15s;
}
html[data-mode="desktop"] .nav-item:hover { background: var(--surface-2); }
html[data-mode="desktop"] .nav-item.active { background: var(--accent-soft); }
html[data-mode="desktop"] .nav-label { font-size: 15px; font-weight: 600; }
html[data-mode="desktop"] .nav-icon { transform: none !important; }
html[data-mode="desktop"] .nav-badge { position: static; margin-left: auto; left: auto; top: auto; }

/* --- Mittlerer Bereich wird zum Board-Container --- */
html[data-mode="desktop"] #screen { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
html[data-mode="desktop"] #appHeader { padding-left: 28px; padding-right: 22px; }
html[data-mode="desktop"] #headerTitle { font-size: 26px; }
html[data-mode="desktop"] #appHeader.collapsed #headerTitle { font-size: 21px; }
html[data-mode="desktop"] #content { display: none; }   /* Einzelliste nur am Handy */

/* Inline-Add-Leiste */
html[data-mode="desktop"] #addBar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 24px 8px;
  padding: 5px 5px 5px 14px;
  background: var(--surface-2);
  border-radius: 16px;
  border: 1.5px solid transparent;
  transition: border-color .15s, background .15s;
}
html[data-mode="desktop"] #addBar:focus-within { border-color: var(--accent); background: var(--surface); }
#addBarInput {
  flex: 1; min-width: 0;
  border: none; background: transparent;
  color: var(--text);
  font-family: var(--font); font-size: 15px;
  padding: 10px 0; outline: none;
}
#addBarInput::placeholder { color: var(--text-faint); }
.addbar-flag {
  width: 34px; height: 34px;
  border: none; background: transparent;
  border-radius: 50%;
  color: var(--text-faint);
  display: grid; place-items: center;
  cursor: pointer; flex-shrink: 0;
  transition: background .15s, color .15s;
}
.addbar-flag svg { width: 18px; height: 18px; }
.addbar-flag.on { color: var(--signal); background: var(--signal-soft); }
.addbar-flag.on svg path { fill: var(--signal); }
.addbar-send {
  border: none; background: var(--accent); color: #fff;
  border-radius: 11px; padding: 10px 16px;
  font-family: var(--font); font-weight: 700; font-size: 14px;
  cursor: pointer; flex-shrink: 0;
  transition: opacity .2s, transform .15s var(--ease-spring);
}
.addbar-send:disabled { opacity: .4; cursor: default; }
.addbar-send:active:not(:disabled) { transform: scale(.94); }

/* ============================================================
   Kanban-Board (Desktop) — Spalten nebeneinander, Drag & Drop
   ============================================================ */
#board { display: none; }
html[data-mode="desktop"] #board {
  display: flex;
  gap: 14px;
  flex: 1; min-height: 0;
  padding: 6px 20px 20px;
  overflow-x: auto; overflow-y: hidden;
  align-items: stretch;
}
html[data-mode="desktop"] #board::-webkit-scrollbar { height: 10px; }
html[data-mode="desktop"] #board::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }

.board-col {
  flex: 0 0 296px; width: 296px;
  display: flex; flex-direction: column;
  max-height: 100%;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 20px;
  outline: 2px solid transparent; outline-offset: -2px;
  transition: outline-color .12s, background .12s;
}
.board-col.drop-over { outline-color: var(--accent); background: var(--accent-soft); }
.col-head { display: flex; align-items: center; gap: 9px; padding: 15px 15px 11px; flex-shrink: 0; }
.col-head .col-ic { width: 22px; height: 22px; display: grid; place-items: center; color: var(--text-dim); }
.col-head .col-ic svg { width: 21px; height: 21px; }
.col-head .col-label { font-weight: 700; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-head .col-count { margin-left: auto; flex-shrink: 0; font-size: 12.5px; font-weight: 700; color: var(--text-faint); background: var(--surface-2); padding: 2px 9px; border-radius: 10px; }
.col-body { flex: 1; overflow-y: auto; padding: 2px 9px 12px; display: flex; flex-direction: column; gap: 8px; scrollbar-width: none; }
.col-body::-webkit-scrollbar { display: none; }
.col-empty { color: var(--text-faint); font-size: 13px; text-align: center; padding: 16px 8px; border: 1.5px dashed var(--divider); border-radius: 14px; }

.bcard {
  background: var(--card);
  border: 1px solid transparent;
  border-radius: 15px;
  padding: 12px 11px;
  display: flex; align-items: flex-start; gap: 10px;
  cursor: pointer;
  animation: taskIn .3s var(--ease-out) both;
  transition: background .14s, box-shadow .14s, opacity .14s;
}
.bcard:hover { background: var(--card-press); }
.bcard.dragging { opacity: .45; }
.bcard.flagged { box-shadow: inset 3px 0 0 var(--signal); }
.bcard.done { opacity: .55; }
.bcard.done .bcard-title { text-decoration: line-through; text-decoration-color: var(--text-faint); }
.bcard.selected { box-shadow: inset 0 0 0 1.6px var(--accent); background: var(--accent-soft); }
.bcard.flagged.selected { box-shadow: inset 3px 0 0 var(--signal), inset 0 0 0 1.6px var(--accent); }
.bcard .check { width: 22px; height: 22px; border-width: 2px; margin-top: 1px; flex-shrink: 0; }
.bcard .check svg { width: 13px; height: 13px; }
.bcard.done .check { background: var(--green); border-color: var(--green); }
.bcard.done .check svg { opacity: 1; transform: scale(1); color: #04150a; }
.bcard-body { flex: 1; min-width: 0; }
.bcard-title { font-size: 14.5px; font-weight: 500; line-height: 1.35; word-break: break-word; }
.bcard-meta { margin-top: 6px; display: flex; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text-dim); }
.bcard-meta .chip { display: inline-flex; align-items: center; gap: 4px; }
.bcard-meta .chip svg { width: 12px; height: 12px; }
.bcard-meta .chip.overdue { color: var(--signal); }
.bcard .flag-btn { width: 30px; height: 30px; flex-shrink: 0; }
.bcard .flag-btn svg { width: 17px; height: 17px; }
.bcard.flagged .flag-btn { color: var(--signal); }
.bcard.flagged .flag-btn svg path { fill: var(--signal); }

.board-addcol {
  flex: 0 0 200px; align-self: flex-start;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 15px;
  background: transparent;
  border: 1.5px dashed var(--divider); border-radius: 18px;
  color: var(--accent); font-family: var(--font); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: background .14s;
}
.board-addcol:hover { background: var(--surface); }
.board-addcol svg { width: 20px; height: 20px; }

/* --- Detail als Vollbild (deckt die ganze Seite) --- */
html[data-mode="desktop"] body { overflow: hidden; }
html[data-mode="desktop"] #detailPane {
  display: flex; flex-direction: column;
  position: fixed; inset: 0;
  width: 100%; height: 100dvh;
  background: var(--bg);
  z-index: 100;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .24s var(--ease-out), transform .3s var(--ease-spring);
  overflow-y: auto; scrollbar-width: none;
}
html[data-mode="desktop"] #detailPane::-webkit-scrollbar { display: none; }
html[data-mode="desktop"] #detailPane.open { opacity: 1; transform: none; pointer-events: auto; }

.pane-topbar {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 16px;
  padding: 16px 26px;
  background: var(--bg);
  border-bottom: 1px solid var(--divider);
}
.pane-back {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; background: transparent;
  color: var(--text);
  font-family: var(--font); font-size: 15px; font-weight: 600;
  padding: 8px 12px 8px 8px; border-radius: 12px;
  cursor: pointer; transition: background .14s;
}
.pane-back:hover { background: var(--surface-2); }
.pane-back svg { width: 22px; height: 22px; }
.pane-inner { width: 100%; max-width: 680px; margin: 0 auto; padding: 30px 26px 48px; }
.pane-where { font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); }
.pane-titlebar { display: flex; gap: 16px; align-items: flex-start; padding: 0 4px 22px; }
.pane-titlebar .check { width: 30px; height: 30px; }
.pane-titlebar .check svg { width: 17px; height: 17px; }
.pane-titlebar .check { margin-top: 4px; }
.pane-titlebar .check.done-check { background: var(--green); border-color: var(--green); }
.pane-titlebar .check.done-check svg { opacity: 1; transform: scale(1); color: #04150a; }
.pane-title {
  flex: 1; min-width: 0;
  border: none; background: transparent; resize: none; overflow: hidden;
  color: var(--text);
  font-family: var(--font); font-size: 27px; font-weight: 800; line-height: 1.25; letter-spacing: -.01em;
  outline: none; padding: 2px 0;
}
#detailPane.is-done .pane-title { text-decoration: line-through; text-decoration-color: var(--text-faint); color: var(--text-dim); }
.pane-props { padding: 0; display: flex; flex-direction: column; gap: 4px; }
.pane-prop {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: none; background: var(--surface); border-radius: 16px;
  color: var(--text);
  font-family: var(--font); font-size: 16px; font-weight: 500;
  text-align: left; cursor: pointer;
  transition: background .14s;
}
.pane-prop:hover { background: var(--surface-2); }
.pane-prop .pp-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-2); color: var(--accent); }
.pane-prop .pp-ic svg { width: 21px; height: 21px; }
.pane-prop .pp-text { flex: 1; display: flex; flex-direction: column; }
.pane-prop .pp-text small { font-size: 12.5px; color: var(--text-dim); font-weight: 500; margin-top: 2px; }
.pane-prop .pp-trail { color: var(--text-faint); display: grid; place-items: center; }
.pane-prop .pp-trail svg { width: 18px; height: 18px; }
.pane-prop.sig .pp-ic { background: var(--signal-soft); color: var(--signal); }
.pane-prop.sig .pp-ic svg path { fill: var(--signal); }
.pane-foot { margin-top: 26px; padding: 18px 0 0; border-top: 1px solid var(--divider); }
.pane-del {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  border: none; background: transparent;
  color: var(--signal);
  font-family: var(--font); font-size: 14.5px; font-weight: 600;
  padding: 13px; border-radius: 13px; cursor: pointer;
  transition: background .14s;
}
.pane-del:hover { background: var(--signal-soft); }
.pane-del svg { width: 18px; height: 18px; }
.pane-empty { margin: auto; text-align: center; color: var(--text-dim); padding: 40px; }
.pane-empty .emoji { font-size: 46px; margin-bottom: 14px; }
.pane-empty h3 { margin: 0 0 6px; color: var(--text); font-size: 18px; font-weight: 700; }
.pane-empty p { margin: 0; font-size: 14px; max-width: 240px; line-height: 1.5; }

/* ============================================================
   Popover (Desktop-Menüs: Datum, Liste, Optionen)
   ============================================================ */
.popover {
  position: fixed;
  z-index: 55;
  width: 320px;
  max-width: calc(100vw - 16px);
  max-height: 72vh;
  overflow-y: auto;
  scrollbar-width: none;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 12px;
  opacity: 0;
  transform: translateY(-6px) scale(.98);
  transform-origin: top center;
  transition: opacity .14s var(--ease-out), transform .16s var(--ease-spring);
}
.popover::-webkit-scrollbar { display: none; }
.popover.show { opacity: 1; transform: none; }
.popover h2 { font-size: 14px; margin: 2px 6px 12px; color: var(--text-dim); font-weight: 700; }
.popover .opt-row { font-size: 15px; padding: 11px 10px; }
.popover .opt-ic { width: 36px; height: 36px; border-radius: 11px; }
.popover .date-grid { gap: 8px; margin-bottom: 4px; }
.popover .date-chip { padding: 12px 13px; font-size: 14px; }
.popover .emoji-pick { margin: 4px 0 14px; }
.popover .sheet-divider { margin: 8px 6px; }

/* Kontextmenü (Rechtsklick) — kompakter */
.popover.ctx { width: 244px; padding: 8px; }
.popover.ctx .opt-row { font-size: 14.5px; padding: 10px 10px; }
.popover.ctx .opt-ic { width: 32px; height: 32px; border-radius: 10px; }
.popover.ctx .opt-ic svg { width: 18px; height: 18px; }
.popover.ctx .sheet-divider { margin: 6px 6px; }
.popover.ctx .opt-trail svg { width: 16px; height: 16px; }

/* ============================================================
   Konto-Zeile im ⋮-Menü
   ============================================================ */
.acct-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px 12px; }
.acct-ic { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.acct-ic svg { width: 22px; height: 22px; }
.acct-text { display: flex; flex-direction: column; min-width: 0; font-weight: 700; font-size: 15.5px; }
.acct-text small { font-size: 12.5px; font-weight: 500; color: var(--text-dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================
   Login / Owner-Setup (Vollbild)
   ============================================================ */
#auth:not([hidden]) {
  position: fixed; inset: 0;
  z-index: 200;
  background: radial-gradient(120% 90% at 50% 0%, #15161b 0%, var(--bg) 60%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
html[data-theme="light"] #auth { background: radial-gradient(120% 90% at 50% 0%, #eef1f6 0%, var(--bg) 60%); }
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 26px;
  padding: 34px 28px 24px;
  box-shadow: var(--shadow);
  animation: taskIn .4s var(--ease-out) both;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand img { width: 40px; height: 40px; border-radius: 12px; }
.auth-brand b { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.auth-card h1 { margin: 0 0 6px; font-size: 23px; font-weight: 800; letter-spacing: -.01em; }
.auth-sub { margin: 0 0 22px; font-size: 14px; color: var(--text-dim); line-height: 1.5; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input {
  width: 100%;
  border: 1.5px solid var(--divider); background: var(--surface-2);
  border-radius: 14px; padding: 14px 16px;
  font-family: var(--font); font-size: 15px; color: var(--text);
  outline: none; transition: border-color .15s, background .15s;
}
.auth-form input:focus { border-color: var(--accent); background: var(--surface); }
.auth-form input::placeholder { color: var(--text-faint); }
.auth-err { color: var(--signal); font-size: 13.5px; font-weight: 600; padding: 2px 2px 0; }
.auth-submit {
  margin-top: 6px; padding: 15px;
  border: none; border-radius: 14px;
  background: var(--accent); color: #fff;
  font-family: var(--font); font-size: 15.5px; font-weight: 700;
  cursor: pointer; transition: transform .15s var(--ease-spring), opacity .2s;
}
.auth-submit:disabled { opacity: .5; }
.auth-submit:active:not(:disabled) { transform: scale(.97); }
.auth-remember {
  display: flex; align-items: center; gap: 9px;
  padding: 2px 2px; margin-top: 2px;
  font-size: 14px; color: var(--text-dim); cursor: pointer; user-select: none;
}
.auth-remember input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.auth-toggle {
  display: block; width: 100%;
  margin-top: 16px; padding: 10px;
  border: none; background: transparent;
  color: var(--text-dim); font-family: var(--font); font-size: 14px; font-weight: 500;
  cursor: pointer; text-align: center;
}
.auth-toggle b { color: var(--accent); font-weight: 700; }
.auth-toggle:hover { color: var(--text); }
.auth-server {
  display: block; width: 100%;
  margin-top: 6px; padding: 8px;
  border: none; background: transparent;
  color: var(--text-faint); font-family: var(--font); font-size: 12px; font-weight: 500;
  cursor: pointer; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.auth-server:hover { color: var(--text-dim); }

/* ============================================================
   Benutzerverwaltung (Vollbild)
   ============================================================ */
#usersScreen {
  position: fixed; inset: 0;
  z-index: 110;
  background: var(--bg);
  display: flex; flex-direction: column;
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity .24s var(--ease-out), transform .3s var(--ease-spring);
  overflow-y: auto; scrollbar-width: none;
}
#usersScreen::-webkit-scrollbar { display: none; }
#usersScreen.open { opacity: 1; transform: none; pointer-events: auto; }
.users-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.users-head h1 { margin: 0; font-size: 27px; font-weight: 800; letter-spacing: -.01em; }
.users-add {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; background: var(--accent); color: #fff;
  border-radius: 13px; padding: 10px 16px;
  font-family: var(--font); font-size: 14px; font-weight: 700; cursor: pointer;
  transition: transform .15s var(--ease-spring);
}
.users-add:active { transform: scale(.96); }
.users-add svg { width: 18px; height: 18px; }
.users-hint { margin: 10px 0 18px; font-size: 13.5px; color: var(--text-dim); line-height: 1.5; }
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border-radius: 16px;
  padding: 13px 16px;
}
.user-ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-2); color: var(--text-dim); }
.user-ic svg { width: 22px; height: 22px; }
.user-ic.owner { background: rgba(255,196,77,.16); color: #ffc44d; }
.user-ic.admin { background: var(--accent-soft); color: var(--accent); }
.user-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 600; font-size: 15.5px; }
.user-text em { color: var(--text-faint); font-style: normal; font-weight: 500; }
.user-text small { font-size: 12.5px; font-weight: 500; color: var(--text-dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-badge { flex-shrink: 0; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 9px; background: var(--surface-2); color: var(--text-dim); text-transform: uppercase; letter-spacing: .03em; }
.role-badge.owner { background: rgba(255,196,77,.16); color: #ffc44d; }
.role-badge.admin { background: var(--accent-soft); color: var(--accent); }
.user-actions { display: flex; gap: 4px; flex-shrink: 0; }
.ubtn { width: 36px; height: 36px; border: none; background: transparent; border-radius: 10px; color: var(--text-faint); display: grid; place-items: center; cursor: pointer; transition: background .14s, color .14s; }
.ubtn svg { width: 19px; height: 19px; }
.ubtn:hover { background: var(--surface-2); color: var(--accent); }
.ubtn.danger:hover { background: var(--signal-soft); color: var(--signal); }

/* Rollen-Auswahl im "Neuer Benutzer"-Sheet */
.role-pick { display: flex; gap: 8px; margin: 12px 0 16px; }
.role-pick .rp {
  flex: 1; padding: 11px; border-radius: 13px;
  border: 1.5px solid var(--divider); background: transparent;
  color: var(--text-dim); font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.role-pick .rp.sel { background: var(--accent-soft); border-color: transparent; color: var(--accent); }

/* Umschalter (Servereinstellungen) */
.toggle { width: 46px; height: 28px; border-radius: 14px; background: var(--surface-3); position: relative; flex-shrink: 0; transition: background .18s; }
.toggle .knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .22s var(--ease-spring); box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.toggle.on { background: var(--accent); }
.toggle.on .knob { transform: translateX(18px); }
.toggle-row { cursor: pointer; }

/* reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition-duration: .01ms !important; }
}
