:root {
  --bg: #ffffff;
  --bg-sidebar: #faf9f7;
  --bg-hover: #f0eeeb;
  --bg-active: #f0eafd;
  --bg-elev: #ffffff;
  --text: #202020;
  --text-2: #666666;
  --text-3: #8f8f8f;
  --border: #ebeae7;
  --accent: #7c3aed;
  --accent-2: #6d28d9;
  --accent-soft: #f3eefe;
  --danger: #c2410c;
  --overdue: #c2410c;
  --today: #15803d;
  --tomorrow: #b45309;
  --week: #9333ea;
  --p1: #dc2626;
  --p2: #ea8a0c;
  --p3: #2563eb;
  --p4: #9aa3a0;
  --shadow: 0 10px 30px rgba(15, 30, 25, .14), 0 2px 6px rgba(15, 30, 25, .08);
  --radius: 10px;
  --sidebar-w: 280px;
  --topbar-h: 48px;
  --overdue: #d1453b;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1e1d;
    --bg-sidebar: #222625;
    --bg-hover: #2b302e;
    --bg-active: #2d2645;
    --bg-elev: #262a29;
    --text: #e8ecea;
    --text-2: #a7b0ac;
    --text-3: #7a8380;
    --border: #343a38;
    --accent: #a78bfa;
    --accent-2: #c4b5fd;
    --accent-soft: #2d2645;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1e1d;
  --bg-sidebar: #222625;
  --bg-hover: #2b302e;
  --bg-active: #2d2645;
  --bg-elev: #262a29;
  --text: #e8ecea;
  --text-2: #a7b0ac;
  --text-3: #7a8380;
  --border: #343a38;
  --accent: #a78bfa;
  --accent-2: #c4b5fd;
  --accent-soft: #2d2645;
  --shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: var(--accent); }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: "side bar" "side main";
  height: 100dvh;
}
.app.sidebar-hidden { grid-template-columns: 0 1fr; }
.app.sidebar-hidden .sidebar { visibility: hidden; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 6px; color: var(--text-2);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

/* Leiste über dem Inhalt */
.viewbar {
  grid-area: bar;
  display: flex; align-items: center; gap: 4px;
  padding: 0 12px; background: var(--bg); min-width: 0;
}
.viewbar .crumb { font-size: 13px; color: var(--text-2); display: flex; gap: 6px; align-items: center; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-left: 6px; }
.viewbar .crumb a { color: var(--text-2); text-decoration: none; }
.viewbar .crumb a:hover { color: var(--text); text-decoration: underline; }
.viewbar .bar-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.viewbar .bar-actions .btn-ghost { font-size: 13px; }
.viewbar .nav-btn { width: 26px; height: 26px; }
.viewbar .show-collapsed { display: none; }
.app.sidebar-hidden .viewbar .show-collapsed { display: inline-flex; }

/* ---------- Sidebar ---------- */
.sidebar {
  grid-area: side;
  background: var(--bg-sidebar);
  overflow-y: auto;
  padding: 10px 10px 24px;
  display: flex; flex-direction: column;
}
.side-head { display: flex; align-items: center; gap: 2px; padding: 2px 0 8px; }
.profile { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 6px; font-weight: 600; margin-right: auto; min-width: 0; }
.profile:hover { background: var(--bg-hover); }
.profile svg { width: 14px; height: 14px; color: var(--text-2); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex: none; }
.side-add {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 8px; border-radius: 6px; color: var(--accent); font-weight: 600; margin-bottom: 4px;
}
.side-add:hover { background: var(--bg-hover); }
.side-add .plus-circle { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.side-add .plus-circle svg { width: 15px; height: 15px; stroke-width: 2.4; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 6px; min-height: 34px;
  color: var(--text); text-decoration: none; cursor: pointer;
  position: relative; user-select: none; width: 100%; text-align: left;
}
.nav-item .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: var(--bg-hover); }
.nav-item.active { background: var(--bg-active); color: var(--accent); }
.nav-item.active .count { color: var(--accent); }
.nav-item .count { margin-left: auto; color: var(--text-3); font-size: 12px; }
.nav-item .count.alert { color: var(--overdue); }
.nav-item .more { margin-left: auto; opacity: 0; width: 24px; height: 24px; }
.nav-item:hover .more { opacity: 1; }
.nav-item:hover .more + .count { display: none; }
.nav-item .more ~ .count { margin-left: 0; }
.nav-item .ico { display: inline-flex; color: var(--text-2); flex: none; }
.nav-item.active .ico { color: var(--accent); }
.nav-item .ico.hash svg { stroke-width: 2.1; }
.mini-ring { width: 18px; height: 18px; transform: rotate(-90deg); }
.mini-ring .ring-bg { stroke: var(--border); stroke-width: 4; fill: none; }
.mini-ring .ring-fg { stroke: var(--accent); stroke-width: 4; fill: none; stroke-dasharray: 94.25; transition: stroke-dashoffset .4s; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin: 0 4px; }
.nav-section { margin-top: 16px; }
.nav-section-head {
  display: flex; align-items: center; gap: 2px;
  padding: 2px 4px 2px 8px; color: var(--text-2); font-weight: 600; font-size: 13px; min-height: 32px; border-radius: 6px; cursor: pointer;
}
.nav-section-head:hover { background: var(--bg-hover); }
.nav-section-head .label { margin-right: auto; }
.nav-section-head .icon-btn { width: 24px; height: 24px; opacity: 0; }
.nav-section-head:hover .icon-btn { opacity: 1; }
.nav-section-head .chev svg { transition: transform .15s; width: 16px; height: 16px; }
.nav-section.collapsed .chev svg { transform: rotate(-90deg); }
.nav-section.collapsed .nav-section-body { display: none; }
.side-foot { margin-top: auto; padding-top: 16px; }

.scrim { display: none; }

/* ---------- Main ---------- */
.main { grid-area: main; overflow-y: auto; outline: none; }
.view { max-width: 860px; margin: 0 auto; padding: 8px 56px 160px; }
.view.wide { max-width: none; padding-left: 56px; padding-right: 24px; }
.view-head { margin: 18px 0 22px; }
.view-head h1 { font-size: 26px; line-height: 1.25; margin: 0; font-weight: 700; word-break: break-word; display: flex; align-items: center; gap: 8px; }
.view-head .sub { margin-top: 6px; font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.view-head .sub svg { width: 15px; height: 15px; }
.view-head .sub code { font-size: 12px; background: var(--bg-hover); padding: 1px 6px; border-radius: 4px; }

.group { margin-bottom: 36px; }
.group-head {
  display: flex; align-items: center; gap: 6px;
  border-bottom: 1px solid var(--border);
  padding: 6px 0 8px; margin-bottom: 0; font-weight: 700; font-size: 14px; position: relative;
}
.group-head .collapse { color: var(--text-3); width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; position: absolute; left: -28px; opacity: 0; }
.group-head:hover .collapse, .group.collapsed .collapse { opacity: 1; }
.group-head .collapse:hover { background: var(--bg-hover); }
.group-head .collapse svg { width: 14px; height: 14px; transition: transform .15s; }
.group.collapsed .collapse svg { transform: rotate(-90deg); }
.group.collapsed .group-body { display: none; }
.group-head .count { color: var(--text-3); font-weight: 400; font-size: 12px; }
.group-head .right { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.group-head .link { color: var(--accent); font-weight: 600; font-size: 13px; padding: 2px 6px; border-radius: 4px; }
.group-head .link:hover { background: var(--accent-soft); }
.group-head.overdue-head { color: var(--text); }
.group-head.drop-target { border-bottom: 2px solid var(--accent); }

/* ---------- Task ---------- */
.task-list { list-style: none; margin: 0; padding: 0; }
.task {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 0 8px; border-bottom: 1px solid var(--border);
  position: relative; cursor: pointer; background: var(--bg);
}
.task:hover .task-actions { opacity: 1; }
.task.dragging { opacity: .4; }
.task.drop-before::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--accent); }
.task.drop-child { box-shadow: inset 24px 0 0 -22px var(--accent); }
.task .drag {
  position: absolute; left: -26px; top: 10px; color: var(--text-3); cursor: grab; opacity: 0;
  width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
}
.task:hover .drag { opacity: 1; }
.task .drag svg { width: 14px; height: 14px; }
.subtasks { list-style: none; margin: 0; padding: 0 0 0 30px; }
.task-toggle {
  position: absolute; left: -48px; top: 10px; color: var(--text-3);
  width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; border-radius: 4px;
}
.task-toggle:hover { background: var(--bg-hover); }
.task-toggle svg { width: 14px; height: 14px; transition: transform .15s; }
.task-toggle.closed svg { transform: rotate(-90deg); }

.check {
  width: 18px; height: 18px; border-radius: 50%; flex: none; margin-top: 2px;
  border: 1px solid var(--p4); display: flex; align-items: center; justify-content: center;
  color: transparent; transition: background .12s;
}
.check svg { width: 11px; height: 11px; stroke-width: 3; }
.check:hover { color: var(--p4); }
.check.p1 { border-color: var(--p1); background: color-mix(in srgb, var(--p1) 12%, transparent); border-width: 2px; }
.check.p2 { border-color: var(--p2); background: color-mix(in srgb, var(--p2) 12%, transparent); border-width: 2px; }
.check.p3 { border-color: var(--p3); background: color-mix(in srgb, var(--p3) 12%, transparent); border-width: 2px; }
.check.p1:hover { color: var(--p1); } .check.p2:hover { color: var(--p2); } .check.p3:hover { color: var(--p3); }
.check.done { background: var(--p4); color: #fff; }
.check.done.p1 { background: var(--p1); } .check.done.p2 { background: var(--p2); } .check.done.p3 { background: var(--p3); }
.task.completing .content { text-decoration: line-through; color: var(--text-3); }

.task-body { flex: 1; min-width: 0; }
.task .content { word-wrap: break-word; }
.task.is-done .content { text-decoration: line-through; color: var(--text-3); }
.task .desc { color: var(--text-2); font-size: 12.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 3px; font-size: 12px; color: var(--text-2); align-items: center; }
.meta span { display: inline-flex; align-items: center; gap: 4px; }
.meta svg { width: 13px; height: 13px; }
.meta .due.overdue { color: var(--overdue); }
.meta .due.today { color: var(--today); }
.meta .due.tomorrow { color: var(--tomorrow); }
.meta .due.week { color: var(--week); }
.meta .label { color: var(--text-2); }
.meta .project { margin-left: auto; color: var(--text-2); }
.meta .project .hash svg { width: 13px; height: 13px; stroke-width: 2.2; }
.task-actions { display: flex; gap: 2px; opacity: 0; }
.task-actions .icon-btn { width: 26px; height: 26px; }
@media (hover: none) { .task-actions { opacity: 1; } .task .drag { display: none; } }

.add-task {
  display: flex; align-items: center; gap: 10px; color: var(--text-2);
  padding: 8px 0; width: 100%; text-align: left;
}
.add-task .plus { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--accent); }
.add-task .plus svg { width: 16px; height: 16px; }
.add-task:hover { color: var(--accent); }
.add-task:hover .plus { background: var(--accent); color: #fff; }

.add-section {
  display: flex; align-items: center; gap: 10px; color: var(--accent); font-weight: 600;
  width: 100%; padding: 6px 0; opacity: 0; transition: opacity .15s; font-size: 13px;
}
.add-section::before, .add-section::after { content: ""; flex: 1; height: 1px; background: var(--accent); }
.add-section:hover, .add-section:focus { opacity: 1; }

/* ---------- Editor ---------- */
.editor {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-elev); margin: 8px 0;
}
.editor:focus-within { border-color: var(--text-3); }
.editor .fields { padding: 10px 12px 4px; }
.editor .title-wrap { position: relative; }
.editor .title {
  width: 100%; border: 0; outline: none; background: transparent;
  font-weight: 600; font-size: 15px; padding: 0;
}
.editor .notes {
  width: 100%; border: 0; outline: none; background: transparent; resize: none;
  font-size: 13px; color: var(--text-2); padding: 4px 0; min-height: 22px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 12px 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px;
  font-size: 12.5px; color: var(--text-2); background: var(--bg-elev); position: relative;
}
.chip:hover { background: var(--bg-hover); }
.chip svg { width: 14px; height: 14px; }
.chip.set { color: var(--text); border-color: var(--text-3); }
.chip .x { margin-left: 2px; opacity: .6; }
.chip .x:hover { opacity: 1; }
.chip.parsed { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.editor .footer {
  display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); padding: 8px 12px;
}
.editor .footer .spacer { flex: 1; }
.select-chip { appearance: none; border: 1px solid var(--border); background: var(--bg-elev); border-radius: 6px; padding: 4px 8px; font-size: 12.5px; max-width: 200px; }
.hint { color: var(--text-3); font-size: 12px; }
.parsed-preview { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 12px; border-radius: 6px; font-weight: 600; font-size: 13px;
  background: var(--bg-hover); color: var(--text);
}
.btn:hover { filter: brightness(.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 6px; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

/* ---------- Board ---------- */
.board { display: flex; gap: 16px; align-items: flex-start; overflow-x: auto; padding-bottom: 24px; }
.column { width: 272px; flex: none; }
.column-head { display: flex; align-items: center; gap: 6px; font-weight: 700; padding: 4px 4px 10px; min-height: 36px; }
.column-head .count { color: var(--text-3); font-weight: 400; font-size: 12px; }
.column-head .right { margin-left: auto; }
.column-body { min-height: 60px; border-radius: var(--radius); padding: 2px; }
.column-body.drop-target { background: var(--accent-soft); }
.card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px; margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 8px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.card .card-subs { flex-basis: 100%; margin: 2px 0 0; padding: 0; list-style: none; }
.card .card-subs li { display: flex; gap: 8px; align-items: center; padding: 6px 0 0 0; border-top: 1px solid var(--border); margin-top: 6px; font-size: 13px; }
.card .card-subs .check { width: 16px; height: 16px; margin-top: 0; }
.card:hover { border-color: var(--text-3); }
.card.dragging { opacity: .4; }
.card .meta .project { margin-left: 0; }

/* ---------- Upcoming ---------- */
.week-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.week-nav .month { font-weight: 700; }
.week-nav .spacer { flex: 1; }
.day-strip { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.day-strip button { padding: 6px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--text-2); border-bottom: 2px solid transparent; }
.day-strip button b { font-size: 15px; color: var(--text); }
.day-strip button.today b { color: var(--accent); }
.day-strip button.selected { border-bottom-color: var(--accent); }
.day-strip button.past { opacity: .45; }
.day-strip button .has { width: 4px; height: 4px; border-radius: 50%; background: var(--text-3); }

/* ---------- Empty ---------- */
.empty { text-align: center; color: var(--text-2); padding: 40px 20px; }
.empty svg { width: 120px; height: 120px; stroke-width: 1.2; color: var(--accent); opacity: .8; }
.empty h3 { color: var(--text); margin: 12px 0 4px; }

/* ---------- Modal ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(10, 20, 18, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 10vh 16px 16px; z-index: 50; animation: fade .12s ease-out;
}
.overlay.center { align-items: center; padding-top: 16px; }
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--bg-elev); border-radius: 12px; box-shadow: var(--shadow);
  width: min(560px, 100%); max-height: 84vh; overflow: auto;
}
.modal.large { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 16px; margin: 0; }
.modal-head .right { margin-left: auto; display: flex; gap: 2px; }
.modal-body { padding: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.modal .editor { margin: 0; border: 0; }
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-row label { font-weight: 600; font-size: 13px; }
.input { border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; background: var(--bg); outline: none; width: 100%; }
.input:focus { border-color: var(--accent); }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(26px, 1fr)); gap: 6px; }
.color-grid button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; }
.color-grid button.sel { border-color: var(--text); box-shadow: inset 0 0 0 2px var(--bg-elev); }
.toggle-row { display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { padding: 6px 12px; font-size: 13px; }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* Task detail */
.detail { display: grid; grid-template-columns: 1fr 260px; min-height: 460px; }
.detail-main { padding: 18px 20px; border-right: 1px solid var(--border); min-width: 0; }
.detail-side { padding: 10px 16px; background: var(--bg-sidebar); border-radius: 0 0 12px 0; }
.detail-side .field { border-bottom: 1px solid var(--border); padding: 10px 0; }
.detail-side .field:last-child { border-bottom: 0; }
.detail-side .field > label { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.detail-side .field > label .icon-btn { width: 22px; height: 22px; margin: -4px 0; }
.detail-side .chip { border: 0; padding: 3px 4px; background: transparent; }
.detail-side .chip:hover { background: var(--bg-hover); }
.detail-side select.input { border: 0; background: transparent; padding: 3px 2px; }
.detail-side select.input:hover { background: var(--bg-hover); }
.detail-side .input, .detail-side select { font-size: 13px; padding: 5px 8px; }
.detail-title-row { display: flex; gap: 10px; align-items: flex-start; }
.detail-title { font-size: 20px; font-weight: 700; border: 0; outline: none; width: 100%; background: transparent; resize: none; padding: 0; line-height: 1.35; }
.detail-desc { width: 100%; border: 0; outline: none; background: transparent; resize: vertical; min-height: 60px; color: var(--text-2); padding: 6px 0; }
.detail h4 { font-size: 13px; margin: 18px 0 6px; display: flex; align-items: center; gap: 6px; }
.detail h4 .count { color: var(--text-3); font-weight: 400; }
.comment { padding: 8px 0; border-bottom: 1px solid var(--border); }
.comment .when { font-size: 11.5px; color: var(--text-3); display: flex; justify-content: space-between; }
.comment .text { white-space: pre-wrap; word-wrap: break-word; }
.comment-form { display: flex; gap: 8px; margin-top: 8px; }
.comment-form textarea { flex: 1; min-height: 36px; resize: vertical; }
.breadcrumb { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.label-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.label-pick button { font-size: 12px; border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; }
.label-pick button.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.prio-pick { display: flex; gap: 4px; }
.prio-pick button { flex: 1; border: 1px solid var(--border); border-radius: 6px; padding: 4px 0; display: flex; justify-content: center; }
.prio-pick button.on { background: var(--bg-active); border-color: var(--accent); }

/* ---------- Menu / popover ---------- */
.menu {
  position: fixed; z-index: 70; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow); padding: 6px; min-width: 220px; max-width: 300px;
  animation: fade .1s ease-out;
}
.menu button.item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 6px; text-align: left; }
.menu button.item:hover, .menu button.item.focus { background: var(--bg-hover); }
.menu button.item.danger { color: var(--danger); }
.menu button.item .kbd { margin-left: auto; color: var(--text-3); font-size: 11px; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.menu .menu-title { font-size: 12px; color: var(--text-3); padding: 4px 10px; }
.menu .quick-dates { display: grid; gap: 2px; }
.menu .date-input { margin: 6px 4px 2px; display: flex; gap: 6px; }
.menu .date-input input { flex: 1; min-width: 0; }
.menu .prio-row { display: flex; gap: 4px; padding: 4px 6px; }
.menu .prio-row button { flex: 1; padding: 6px 0; display: flex; justify-content: center; border-radius: 6px; }
.menu .prio-row button:hover, .menu .prio-row button.on { background: var(--bg-hover); }
.flag-p1 { color: var(--p1); } .flag-p2 { color: var(--p2); } .flag-p3 { color: var(--p3); } .flag-p4 { color: var(--p4); }

/* ---------- Toast ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #222826; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px; pointer-events: auto; animation: rise .18s ease-out; max-width: calc(100vw - 32px);
}
.toast button { color: #c4b5fd; font-weight: 700; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Misc ---------- */
.kbd-key { display: inline-block; min-width: 20px; padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; font-size: 12px; text-align: center; background: var(--bg); }
.shortcut-table { width: 100%; border-collapse: collapse; }
.shortcut-table td { padding: 6px 0; border-bottom: 1px solid var(--border); }
.shortcut-table td:last-child { text-align: right; }
.list-card { border: 1px solid var(--border); border-radius: var(--radius); }
.list-card .row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.list-card .row:last-child { border-bottom: 0; }
.list-card .row:hover { background: var(--bg-hover); }
.list-card .row .count { margin-left: auto; color: var(--text-3); font-size: 12px; }
.query-help { font-size: 12px; color: var(--text-2); line-height: 1.6; }
.query-help code { background: var(--bg-hover); padding: 0 4px; border-radius: 4px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0 16px; }
.stat { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; text-align: center; }
.stat b { display: block; font-size: 22px; color: var(--accent); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 90px; margin-top: 8px; }
.bars div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--text-3); height: 100%; justify-content: flex-end; }
.bars i { display: block; width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.done-day { margin-bottom: 18px; }
.done-item { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.done-item .when { color: var(--text-3); font-size: 12px; margin-left: auto; white-space: nowrap; }
mark { background: color-mix(in srgb, var(--accent) 25%, transparent); color: inherit; border-radius: 2px; }

.task-list li.task-wrap { list-style: none; }
.task.drop-after::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); }
.card { position: relative; }
.card.drop-before::before, .card.drop-after::after { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); }
.card.drop-before::before { top: -5px; }
.card.drop-after::after { bottom: -5px; }
.card.completing .content { text-decoration: line-through; color: var(--text-3); }
.card.is-done .content { text-decoration: line-through; color: var(--text-3); }
.board .add-section { opacity: 1; justify-content: flex-start; padding: 6px 4px; }
.board .add-section::before, .board .add-section::after { display: none; }
.board .add-task { padding: 6px 4px; }
.board .editor { margin-top: 0; }
.nav-item.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; }
.icon-btn:disabled { opacity: .35; cursor: default; background: none; }
.day-strip button:disabled { cursor: default; }
.group-head > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.view-head h1 small code { font-size: 12px; }
.done-item .check { cursor: pointer; }
.done-item .check:disabled { cursor: default; }
.chip .x { cursor: pointer; }

/* Suche */
.search-modal { width: min(640px, 100%); }
.search-row { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.search-row svg { color: var(--text-2); }
.search-input { flex: 1; border: 0; outline: none; background: transparent; font-size: 15px; }
.search-results { padding: 6px; max-height: 60vh; overflow: auto; }
.search-results .result { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 6px; text-align: left; }
.search-results .result:hover { background: var(--bg-hover); }
.search-results .result .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results .result .check { width: 16px; height: 16px; margin: 0; }
.search-results .result .due { font-size: 12px; }
.search-results .result .due.overdue { color: var(--overdue); }
.search-results .result .due.today { color: var(--today); }
.search-results .result.all { color: var(--accent); margin-top: 4px; }

/* Board: „Abschnitt hinzufügen“ als graue Spalte */
.board .add-section {
  opacity: 1; justify-content: flex-start; gap: 8px; padding: 9px 12px;
  background: var(--bg-sidebar); color: var(--text-2); font-weight: 400; border-radius: 6px; width: 100%;
}
.board .add-section:hover { color: var(--accent); background: var(--bg-hover); }
.board .add-section::before { content: "+"; display: inline; flex: none; height: auto; background: none; font-size: 16px; line-height: 1; }
.board .add-section::after { display: none; }

/* Details: Unteraufgabe hinzufügen */
.sub-form { align-items: center; color: var(--text-2); }
.sub-form .input { border-color: transparent; padding-left: 4px; }
.sub-form .input:focus { border-color: var(--border); }
.detail h4 { color: var(--text-2); }

/* ---------- Menüs (Todoist-Aufbau) ---------- */
.menu { padding: 6px; min-width: 250px; max-width: 320px; }
.menu button.item { gap: 10px; padding: 6px 10px; font-size: 13.5px; color: var(--text); }
.menu button.item > svg { width: 17px; height: 17px; color: var(--text-2); }
.menu button.item.danger, .menu button.item.danger > svg { color: var(--danger); }
.menu button.item .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu button.item .kbd { margin-left: 12px; }
.menu button.item .chev-r { display: inline-flex; margin-left: 6px; color: var(--text-3); }
.menu button.item .chev-r svg { width: 14px; height: 14px; }
.menu .no-ico { width: 17px; flex: none; }
.menu .menu-title { display: flex; justify-content: space-between; align-items: center; font-weight: 600; color: var(--text-2); padding: 6px 10px 2px; }
.menu.sub { z-index: 71; }
.menu .prio-row button > svg { width: 18px; height: 18px; }
.menu-profile { align-items: center; }
.menu-profile .lbl { display: flex; flex-direction: column; line-height: 1.3; }
.menu-profile small { color: var(--text-3); font-size: 12px; }
.menu-foot { font-size: 12px; color: var(--text-3); padding: 6px 10px 4px; }
.qd-today, .menu .qd-today > svg { color: #15803d; }
.qd-tomorrow, .menu .qd-tomorrow > svg { color: #b45309; }
.qd-later, .menu .qd-later > svg { color: #2563eb; }
.qd-weekend, .menu .qd-weekend > svg { color: #0284c7; }
.qd-next, .menu .qd-next > svg { color: var(--accent); }
.qd-none, .menu .qd-none > svg { color: var(--text-2); }
.menu .dp-quick button.item { color: var(--text); }
.link { color: var(--accent); font-weight: 600; font-size: 13px; padding: 2px 6px; border-radius: 4px; }
.link:hover { background: var(--accent-soft); }

/* Datumsauswahl */
.menu.dp { width: 272px; padding: 0; max-width: none; }
.dp-input { padding: 8px 8px 4px; }
.dp-input .input { font-weight: 600; }
.dp-preview { font-size: 12px; color: var(--accent); padding: 0 12px 4px; }
.dp-preview[hidden] { display: none; }
.dp-quick { padding: 2px 6px 6px; border-bottom: 1px solid var(--border); }
.dp-cal { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.dp-month { display: flex; align-items: center; gap: 2px; margin-bottom: 6px; font-size: 13px; }
.dp-month .spacer { flex: 1; }
.dp-month .icon-btn { width: 24px; height: 24px; }
.dot-today { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid currentColor; display: inline-block; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.dp-grid.heads span { font-size: 11px; color: var(--text-3); padding: 2px 0; }
.dp-grid .day { position: relative; height: 30px; border-radius: 50%; font-size: 12.5px; }
.dp-grid .day:hover { background: var(--bg-hover); }
.dp-grid .day.is-past { color: var(--text-3); }
.dp-grid .day.is-today { color: var(--accent); font-weight: 700; }
.dp-grid .day.is-sel { background: var(--accent); color: #fff; font-weight: 700; }
.dp-grid .day i { position: absolute; left: 50%; bottom: 3px; width: 3px; height: 3px; margin-left: -1.5px; border-radius: 50%; background: currentColor; opacity: .6; }
.dp-foot { display: flex; gap: 6px; padding: 8px; }
.dp-btn { flex: 1; display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; font-size: 12.5px; color: var(--text-2); min-width: 0; }
.dp-btn input, .dp-btn select { border: 0; background: transparent; outline: none; font-size: 12.5px; min-width: 0; flex: 1; color: var(--text); }
.dp-btn svg { width: 15px; height: 15px; flex: none; }

/* Anzeige-Menü */
.menu.vm { width: 300px; max-width: calc(100vw - 16px); padding: 10px 12px 12px; }
.vm-label, .vm-sec { font-size: 12.5px; font-weight: 700; color: var(--text); margin: 6px 0 8px; }
.vm-sec { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.layout-tiles { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg-hover); border-radius: 8px; padding: 3px; }
.layout-tiles button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; font-size: 12px; border-radius: 6px; color: var(--text-2); }
.layout-tiles button.on { background: var(--bg-elev); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.vm-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 13px; }
.vm-row select.input { width: 150px; padding: 4px 6px; font-size: 13px; }
.vm-toggle { margin-top: 10px; }
.vm-reset { color: var(--accent); font-size: 13px; margin-top: 12px; font-weight: 600; }
.switch { appearance: none; -webkit-appearance: none; width: 32px; height: 18px; border-radius: 999px; background: var(--border); position: relative; cursor: pointer; flex: none; transition: background .15s; margin: 0; border: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(14px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Kalender-Layout */
.cal-nav { display: flex; align-items: center; gap: 4px; margin-bottom: 10px; }
.cal-nav .spacer { flex: 1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-grid.heads span { font-size: 12px; color: var(--text-2); padding: 4px 6px; font-weight: 600; }
.cal-grid:not(.heads) { border-top: 1px solid var(--border); border-left: 1px solid var(--border); margin-bottom: 28px; }
.cal-cell { min-height: 112px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-cell.out { background: var(--bg-sidebar); }
.cal-cell.out .cal-day { color: var(--text-3); }
.cal-cell.is-today .cal-day { background: var(--accent); color: #fff; font-weight: 700; }
.cal-cell.drop-target { background: var(--accent-soft); }
.cal-day { font-size: 12px; align-self: flex-end; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.cal-task { font-size: 12px; padding: 2px 6px; border-radius: 4px; background: var(--bg-hover); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border-left: 3px solid var(--p4); }
.cal-task.p1 { border-left-color: var(--p1); } .cal-task.p2 { border-left-color: var(--p2); } .cal-task.p3 { border-left-color: var(--p3); }
.cal-task:hover { background: var(--bg-active); }
.cal-task.is-done { text-decoration: line-through; color: var(--text-3); }
.cal-more { font-size: 11px; color: var(--text-3); padding-left: 4px; }

/* Flache Listen (Filter & Labels, Meine Projekte) */
.list-card.flat { border: 0; border-radius: 0; }
.list-card.flat .row { padding: 8px 4px; border-radius: 0; }
.list-card.flat .row .icon-btn, .list-card.flat .row .btn-ghost { opacity: 0; }
.list-card.flat .row:hover .icon-btn, .list-card.flat .row:hover .btn-ghost { opacity: 1; }
@media (hover: none) { .list-card.flat .row .icon-btn, .list-card.flat .row .btn-ghost { opacity: 1; } }
.banner { display: flex; align-items: center; gap: 10px; background: var(--accent-soft); padding: 10px 12px; border-radius: 8px; margin: 14px 0 0; }
.banner .btn { margin-left: auto; }
.nav-section-head a.label { color: inherit; text-decoration: none; }
.nav-section-head a.label:hover { text-decoration: underline; }

/* Einstellungen */
.modal.settings { width: min(920px, 100%); height: min(640px, 86vh); max-height: none; display: grid; grid-template-columns: 230px 1fr; overflow: hidden; }
.set-nav { background: var(--bg-sidebar); padding: 14px 10px; overflow: auto; border-right: 1px solid var(--border); }
.set-nav-title { font-weight: 700; font-size: 15px; padding: 2px 8px 10px; }
.set-search { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; margin: 0 0 8px; background: var(--bg); }
.set-search input { border: 0; outline: none; background: transparent; width: 100%; }
.set-search svg { width: 15px; height: 15px; color: var(--text-3); }
.set-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.set-head { display: flex; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.set-head h2 { margin: 0; font-size: 16px; flex: 1; }
.set-body { padding: 4px 20px 20px; overflow: auto; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.set-row > span { display: flex; flex-direction: column; gap: 2px; }
.set-row small { color: var(--text-3); font-size: 12px; font-weight: 400; }
.set-row select.input { width: auto; min-width: 190px; }
.theme-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding-top: 14px; }
.theme-tiles button { border: 2px solid var(--border); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; text-align: left; }
.theme-tiles button.on { border-color: var(--accent); }
.tile-prev { height: 70px; border-radius: 6px; display: flex; overflow: hidden; border: 1px solid var(--border); }
.tile-prev i { width: 32%; }
.tile-prev em { flex: 1; }
.tile-prev.light i { background: #faf9f7; } .tile-prev.light em { background: #fff; }
.tile-prev.dark i { background: #262a29; } .tile-prev.dark em { background: #1b1e1d; }
.tile-prev.system i { background: linear-gradient(180deg, #faf9f7 50%, #262a29 50%); } .tile-prev.system em { background: linear-gradient(180deg, #fff 50%, #1b1e1d 50%); }
.tile-prev::after { content: ""; }
.modal.settings .stat-grid { margin-top: 16px; }

@media print {
  .sidebar, .viewbar, .toasts, #menuRoot, .task-actions, .add-task, .add-section { display: none !important; }
  .app { display: block; height: auto; }
  .main { overflow: visible; }
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .app, .app.sidebar-hidden { grid-template-columns: 0 1fr; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: min(var(--sidebar-w), 86vw);
    z-index: 40; transform: translateX(-100%); transition: transform .2s ease; visibility: visible !important;
    box-shadow: var(--shadow);
  }
  .app.sidebar-open .sidebar { transform: none; }
  .app.sidebar-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 39; }
  .viewbar .show-collapsed { display: inline-flex; }
  .viewbar .nav-btn { display: none; }
  .view, .view.wide { padding: 4px 16px 120px 34px; }
  .view-head h1 { font-size: 22px; }
  .detail { grid-template-columns: 1fr; }
  .detail-main { border-right: 0; }
  .detail-side { border-radius: 0 0 12px 12px; }
  .overlay { padding-top: 16px; }
  .task-toggle { left: -26px; }
  .viewbar .bar-actions .btn-ghost span { display: none; }
  .modal.settings { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: 86vh; }
  .set-nav { border-right: 0; border-bottom: 1px solid var(--border); padding: 8px; overflow-x: auto; }
  .set-nav-title, .set-search { display: none; }
  .set-nav [data-set-list] { display: flex; gap: 4px; }
  .set-nav .nav-item { width: auto; white-space: nowrap; }
  .theme-tiles { grid-template-columns: 1fr; }
  .cal-cell { min-height: 70px; }
  .cal-task { font-size: 11px; padding: 1px 3px; }
}

/* Todoist-Anbindung */
.td-status .name { font-size: 13px; color: var(--text-2); }
.td-status.err .ico, .td-status.err .name { color: var(--overdue); }
.td-pill { font-size: 12px; color: var(--text-2); background: var(--bg-hover); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.td-err { color: var(--overdue); }
.td-connect { display: flex; gap: 8px; padding: 12px 0 6px; }
.td-connect .input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.td-load .spinner { display: inline-block; width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: td-spin .8s linear infinite; }
.td-load .td-load-ico svg { width: 48px; height: 48px; stroke-width: 1.6; color: var(--overdue); opacity: 1; }
.td-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
@keyframes td-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .td-load .spinner { animation-duration: 2.4s; } }
