:root {
  --bg: #f6f4ef; --card: #ffffff; --ink: #22211e; --muted: #77736b; --line: #e4e0d7;
  --accent: #2f6f5e; --accent-ink: #ffffff; --hover: #f0ede6; --danger: #b2402f;
  --r: #d9534f; --y: #e0b62f; --g: #5fb85a; --shadow: 0 1px 2px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1a18; --card: #252421; --ink: #ecebe6; --muted: #a29e95; --line: #383631;
    --accent: #6cbfa6; --accent-ink: #10201b; --hover: #2e2d29; --danger: #e5806f; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 860px; margin: 0 auto; padding: 20px 16px 80px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }

/* Kopf */
.top { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.top h1 { font-size: 22px; margin: 0; flex: 1 1 auto; }
.top .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.status-off { color: var(--danger); }
.btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 8px;
  padding: 6px 12px; line-height: 1.3;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 3px 9px; font-size: 13px; }
.link { border: 0; background: none; padding: 0; color: var(--muted); text-decoration: underline; font-size: 13px; }

/* Neues Thema */
.newtopic { display: flex; gap: 8px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; margin-bottom: 18px; }
.newtopic input { flex: 1 1 220px; }

/* Filter */
.filter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 4px 12px; font-size: 14px; }
.chip:hover { background: var(--hover); }
.chip.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }
.chip .n { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* Abschnitte */
.prio-h { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 26px 0 10px; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; flex: none; }
.dot.r { background: var(--r); } .dot.y { background: var(--y); } .dot.g { background: var(--g); }

/* Themenkarte */
.topic { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 12px; box-shadow: var(--shadow); }
.t-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; user-select: none; border-radius: 10px; }
.t-head:hover { background: var(--hover); }
.topic.open .t-head { padding-bottom: 6px; border-radius: 10px 10px 0 0; }
.chev { width: 12px; flex: none; color: var(--muted); font-size: 13px; text-align: center; }
.t-head .count { flex: none; min-width: 22px; text-align: center; font-size: 12px; color: var(--muted);
  background: var(--bg); border-radius: 999px; padding: 1px 7px; font-variant-numeric: tabular-nums; }
.chip.fold { margin-left: auto; }
.prios { display: flex; gap: 3px; flex: none; }
.prios button { width: 22px; height: 22px; border-radius: 50%; border: 0; background: none;
  display: grid; place-items: center; padding: 0; }
.prios button .dot { opacity: .22; }
.prios button.on .dot { opacity: 1; width: 13px; height: 13px; }
.prios button:hover .dot { opacity: .7; }
.t-title { flex: 1 1 auto; font-weight: 600; font-size: 16px; min-width: 0; }
.iconbtn { border: 0; background: none; color: var(--muted); border-radius: 6px; padding: 2px 7px; font-size: 16px; line-height: 1; }
.iconbtn:hover { background: var(--hover); color: var(--ink); }
.t-menu { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 12px 8px 12px; }
.note { padding: 0 12px 6px 46px; font-size: 13px; color: var(--muted); cursor: text; white-space: pre-wrap; }
.note.empty { font-style: italic; }

/* Einträge */
.entries { list-style: none; margin: 0; padding: 0 0 4px; }
.label { padding: 10px 12px 2px 46px; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.label .txt { flex: 1 1 auto; cursor: text; }
.item { display: flex; align-items: flex-start; gap: 10px; padding: 4px 12px 4px 14px; }
.item:hover { background: var(--hover); }
.item input[type=checkbox] { width: 18px; height: 18px; margin: 2px 0 0 4px; flex: none; accent-color: var(--accent); cursor: pointer; }
.item .txt { flex: 1 1 auto; cursor: text; min-width: 0; overflow-wrap: anywhere; }
.item .iconbtn, .label .iconbtn { opacity: .55; }
.item:hover .iconbtn, .label:hover .iconbtn { opacity: 1; }
@media (hover: none) { .item .iconbtn, .label .iconbtn { opacity: 1; } }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 2px 12px 8px 46px; }
.actions select { max-width: 240px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); font-size: 13px; }

/* Eingaben */
.edit, .add input, .newtopic input, .newtopic select, .login input, textarea {
  border: 1px solid var(--line); background: var(--card); border-radius: 6px; padding: 5px 8px; width: 100%;
}
.edit:focus, .add input:focus, textarea:focus, .newtopic input:focus, .login input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.add { display: flex; gap: 6px; padding: 4px 12px 12px 46px; }
.add input { flex: 1 1 auto; }
textarea { min-height: 60px; resize: vertical; }

/* Erledigt */
details.done { margin-top: 30px; }
details.done summary { cursor: pointer; font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); }
.done-list { list-style: none; padding: 0; margin: 10px 0 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.done-list li { display: flex; gap: 10px; align-items: baseline; padding: 6px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.done-list li:first-child { border-top: 0; }
.done-list .date { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; flex: none; }
.done-list .txt { flex: 1 1 200px; text-decoration: line-through; text-decoration-color: var(--line); }

/* Anmeldung */
.login { max-width: 340px; margin: 12vh auto 0; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 22px; display: grid; gap: 12px; }
.login h1 { margin: 0; font-size: 20px; }
.err { color: var(--danger); font-size: 13px; min-height: 1em; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  border-radius: 8px; padding: 8px 12px; display: flex; gap: 12px; align-items: center; font-size: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,.2); max-width: calc(100% - 32px); }
.toast[hidden] { display: none; }
.toast button { border: 0; background: none; color: inherit; text-decoration: underline; font-weight: 600; }
