:root {
  --bg: #ffffff;
  --side: #f4f5f7;
  --line: #e4e6ea;
  --text: #1d1d1f;
  --muted: #8a8d93;
  --faint: #c3c6cc;
  --hover: #f1f2f4;
  --accent: #1a73e8;
  --select: #dce9fc;
  --danger: #e5484d;
  --p1: #3b82f6;
  --p2: #f59e0b;
  --p3: #e5484d;
  --today: #f2b400;
  --card: #ffffff;
  --shadow: 0 10px 30px rgba(15, 20, 30, .12), 0 1px 3px rgba(15, 20, 30, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1e1f22; --side: #26272b; --line: #34353a; --text: #ececef;
    --muted: #8e9097; --faint: #55575d; --hover: #2a2b30; --accent: #4b93ff;
    --select: #23395c; --card: #2a2b30;
    --shadow: 0 10px 30px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
kbd {
  font-size: 11px; line-height: 1; padding: 2px 5px; border-radius: 4px;
  border: 1px solid var(--line); background: var(--side); color: var(--muted);
}

.app { display: flex; height: 100vh; }

/* ================= Sidebar ================= */
.sidebar {
  width: 260px; flex-shrink: 0; background: var(--side);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.sidebar__top { height: 44px; flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding-left: 18px; }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot--r { background: #ff5f57; } .dot--y { background: #febc2e; } .dot--g { background: #28c840; }
.sidebar__scroll { flex: 1; overflow-y: auto; padding: 0 10px 16px; }

.nav-item, .side-proj, .side-head {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 10px; border-radius: 7px; min-height: 30px;
  white-space: nowrap; cursor: default;
}
.nav-item { font-weight: 500; margin-bottom: 14px; }
.nav-item:hover, .side-proj:hover, .side-head:hover { background: var(--hover); }
.nav-item.is-active, .side-proj.is-active, .side-head.is-active { background: var(--select); }
.nav-item svg { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }

.side-group { margin-bottom: 12px; }
.side-head { font-weight: 600; }
.side-head svg { width: 17px; height: 17px; color: var(--muted); flex-shrink: 0; }
.side-head--plain {
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); min-height: 24px;
}
.side-head--plain:hover { background: none; }
#sideAreas .side-head { cursor: grab; }

.side-projects { list-style: none; margin: 0; padding: 0; min-height: 6px; }
.side-projects:empty { min-height: 14px; }
.side-proj { padding-left: 18px; }
.side-proj .ring { width: 14px; height: 14px; }
.name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.sidebar__bottom { border-top: 1px solid var(--line); padding: 8px 10px; display: flex; justify-content: space-between; }
.btn-plain {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; padding: 6px 8px; border-radius: 7px;
  color: var(--muted); cursor: pointer; font-size: 13px;
}
.btn-plain:hover { color: var(--text); background: var(--hover); }
.btn-plain svg { width: 15px; height: 15px; }

/* ================= Main ================= */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.main__inner { flex: 1; overflow-y: auto; padding: 56px 24px 60px; }
.main__inner > * { max-width: 720px; margin-left: auto; margin-right: auto; }
.main__inner > .done-toggle { width: 100%; text-align: left; }

.head { display: flex; align-items: center; gap: 12px; }
.head__icon { width: 30px; height: 30px; color: var(--accent); flex-shrink: 0; }
.head__icon.ring { width: 26px; height: 26px; margin: 2px; }
.head h1 {
  margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.01em;
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.head .inline-input { font-size: 28px; font-weight: 700; flex: 1; }
.head__more { margin-left: auto; }
.sub {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  color: var(--muted); margin-top: 6px; margin-bottom: 26px; padding-left: 42px; font-size: 13px;
}
.pill-select {
  appearance: none; border: 1px solid var(--line); background: var(--bg);
  border-radius: 999px; padding: 3px 24px 3px 10px; font-size: 12px; color: var(--muted); cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a8d93' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 9px;
}
.pill-select:hover { color: var(--text); border-color: var(--faint); }

/* Auf-/Zuklappen */
.chev {
  width: 16px; height: 16px; padding: 0; margin: 0 -4px 0 -6px; flex-shrink: 0;
  display: grid; place-items: center; border: 0; background: none; border-radius: 4px;
  color: var(--muted); cursor: pointer;
}
.chev:hover { background: rgba(127,127,127,.16); color: var(--text); }
.chev svg { width: 10px; height: 10px; transform: rotate(90deg); transition: transform .15s ease; }
.is-collapsed .chev svg { transform: rotate(0deg); }
.side-group.is-collapsed .side-projects,
.section.is-collapsed .list,
.section.is-collapsed .empty-hint { display: none; }
.section.is-collapsed { margin-bottom: 14px; }
.section.is-collapsed .section__head { border-bottom-color: transparent; }
.section__head .count { font-weight: 400; font-size: 12px; }
.section__head .chev { margin-left: -2px; }
.section__head .chev svg { width: 10px; height: 10px; color: var(--muted); }

/* Section (Übersicht) */
.section { margin-bottom: 26px; }
.section__head {
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line);
  font-weight: 700; font-size: 15px;
}
.section__head svg { width: 17px; height: 17px; color: var(--muted); }
.section__head a:hover { color: var(--accent); }
.section__head .icon-btn { margin-left: auto; opacity: 0; }
.section:hover .section__head .icon-btn { opacity: 1; }
.section__head--plain { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }

/* Rows (Projekte) */
.list { list-style: none; padding: 0; margin-top: 0; margin-bottom: 0; min-height: 8px; }
.row {
  display: flex; align-items: center; gap: 12px;
  height: 38px; padding: 0 8px 0 10px; border-radius: 8px;
  cursor: default; user-select: none; transition: background .12s;
}
.row:hover { background: var(--hover); }
.row.is-editing { background: var(--card); box-shadow: var(--shadow); height: 44px; margin: 4px -4px; padding: 0 14px; }
.row .count { min-width: 16px; text-align: right; }
.empty-hint { color: var(--faint); font-size: 13px; padding: 8px 10px; list-style: none; }

.ring { width: 16px; height: 16px; flex-shrink: 0; color: var(--accent); }
.inline-input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 0; height: 28px;
}
.inline-input::placeholder { color: var(--faint); }
.side-proj .inline-input, .side-head .inline-input { height: 20px; }

.row__actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.row:hover .row__actions { opacity: 1; }
.icon-btn {
  width: 26px; height: 26px; display: inline-grid; place-items: center; flex-shrink: 0;
  border: 0; background: none; border-radius: 6px; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: rgba(127,127,127,.14); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }
.icon-btn svg { width: 15px; height: 15px; }

/* ================= Tasks ================= */
.task {
  display: flex; align-items: center; gap: 10px;
  min-height: 36px; padding: 4px 8px 4px 10px; border-radius: 8px;
  user-select: none; cursor: default; transition: background .12s;
}
.task:hover { background: var(--hover); }
.task.is-selected { background: var(--select); }
.check {
  width: 16px; height: 16px; flex-shrink: 0; padding: 0;
  border: 1.5px solid var(--faint); border-radius: 4px; background: var(--bg);
  cursor: pointer; display: grid; place-items: center; transition: all .15s;
}
.check:hover { border-color: var(--accent); }
.check svg { width: 11px; height: 11px; color: #fff; opacity: 0; }
.task.is-done .check, .task.is-checking .check { background: var(--accent); border-color: var(--accent); }
.task.is-done .check svg, .task.is-checking .check svg { opacity: 1; }
.task.is-checking .task__title { color: var(--muted); }
.task.is-done .task__title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.task--p3 .check { border-color: var(--p3); }
.task--p2 .check { border-color: var(--p2); }

.task__main { flex: 1 1 38%; min-width: 120px; display: flex; align-items: center; gap: 6px; }
.task__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task__notes-icon { width: 13px; height: 13px; color: var(--faint); flex-shrink: 0; }
.task__meta { display: flex; align-items: center; gap: 6px; flex: 0 1 auto; flex-wrap: wrap; justify-content: flex-end; row-gap: 4px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--muted); padding: 1px 7px; border-radius: 5px;
  background: rgba(127,127,127,.09); white-space: nowrap;
}
.chip svg { width: 12px; height: 12px; }
.chip--today { color: #9a7200; background: rgba(242,180,0,.16); }
.chip--overdue { color: var(--danger); background: rgba(229,72,77,.1); }
.chip--p1 { color: var(--p1); background: rgba(59,130,246,.1); }
.chip--p2 { color: #b26e00; background: rgba(245,158,11,.14); }
.chip--p3 { color: var(--p3); background: rgba(229,72,77,.1); }
@media (prefers-color-scheme: dark) {
  .chip--today { color: var(--today); }
  .chip--p2 { color: var(--p2); }
}

/* Task editor (aufgeklappte Aufgabe) */
.task-editor {
  list-style: none; background: var(--card); border-radius: 10px;
  box-shadow: var(--shadow); margin: 10px -6px 14px; padding: 12px 16px 12px;
}
.te__top { display: flex; align-items: center; gap: 10px; }
.te__title { flex: 1; border: 0; outline: 0; background: none; font-size: 15px; font-weight: 500; padding: 4px 0; }
.te__title::placeholder, .te__notes::placeholder { color: var(--faint); }
.te__notes {
  display: block; width: 100%; border: 0; outline: 0; background: none; resize: none;
  padding: 4px 0 4px 26px; min-height: 42px; color: var(--text); line-height: 1.5;
}
.te__fields {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 18px;
  padding: 12px 0 4px 26px; border-top: 1px solid var(--line); margin-top: 4px;
}
.field { display: flex; flex-direction: column; gap: 5px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.field__row { display: flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 13px; color: var(--text); }
.input {
  height: 30px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg);
  padding: 0 8px; outline: none; min-width: 0; width: 100%;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26,115,232,.15); }
.input--num { width: 74px; }
.seg { display: flex; background: rgba(127,127,127,.1); border-radius: 7px; padding: 2px; }
.seg button {
  flex: 1; border: 0; background: none; border-radius: 5px; padding: 4px 6px;
  font-size: 12px; cursor: pointer; color: var(--muted); white-space: nowrap;
}
.seg button.is-on { background: var(--bg); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.seg button.is-on[data-p="1"] { color: var(--p1); }
.seg button.is-on[data-p="2"] { color: #b26e00; }
.seg button.is-on[data-p="3"] { color: var(--p3); }
.quick { border: 0; background: none; color: var(--accent); font-size: 12px; cursor: pointer; padding: 2px 4px; }
.quick:hover { text-decoration: underline; }
.te__hint { font-size: 12px; color: var(--muted); padding: 6px 0 0 26px; }
.te__foot { display: flex; align-items: center; gap: 8px; padding: 12px 0 0 26px; }
.te__foot .spacer { flex: 1; }
.btn-primary {
  background: var(--accent); color: #fff; border: 0;
  padding: 6px 14px; border-radius: 7px; font-weight: 500; cursor: pointer;
}
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost { background: none; border: 0; color: var(--muted); padding: 6px 10px; border-radius: 7px; cursor: pointer; }
.btn-ghost:hover { background: var(--hover); color: var(--danger); }

.done-toggle {
  display: block; margin: 18px auto 6px; padding: 4px 10px; border: 0; background: none;
  color: var(--muted); font-size: 12px; cursor: pointer; border-radius: 6px;
}
.done-toggle:hover { background: var(--hover); color: var(--text); }

/* Empty */
.empty { text-align: center; color: var(--muted); padding: 60px 0; }
.empty svg { width: 54px; height: 54px; color: var(--faint); }
.empty p { margin: 12px 0 18px; }

/* SortableJS */
.sortable-ghost { background: var(--select) !important; opacity: .5; }
.sortable-drag, .sortable-fallback { background: var(--card) !important; box-shadow: var(--shadow); opacity: 1 !important; border-radius: 8px; }

/* Toolbar */
.toolbar {
  height: 48px; flex-shrink: 0; display: flex; align-items: center; gap: 14px;
  padding: 0 16px; border-top: 1px solid var(--line);
}
.tool {
  height: 32px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px;
  border: 0; background: none; border-radius: 7px; color: var(--muted); cursor: pointer; font-size: 13px;
}
.tool:hover { background: var(--hover); color: var(--accent); }
.tool svg { width: 17px; height: 17px; }
.toolbar__hint { margin-left: auto; color: var(--muted); font-size: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* Menü */
.menu {
  position: fixed; z-index: 40; min-width: 180px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 9px; box-shadow: var(--shadow); padding: 5px;
}
.menu button {
  display: block; width: 100%; text-align: left;
  border: 0; background: none; padding: 6px 10px; border-radius: 5px; cursor: pointer;
}
.menu button:hover { background: var(--accent); color: #fff; }
.menu button.danger:hover { background: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 66px; transform: translateX(-50%);
  background: #2b2c30; color: #fff; border-radius: 10px;
  padding: 9px 10px 9px 16px; display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow); font-size: 13px; z-index: 50; max-width: calc(100vw - 32px);
}
.toast button {
  background: rgba(255,255,255,.12); border: 0; color: #fff;
  padding: 5px 10px; border-radius: 6px; cursor: pointer; font-weight: 500;
}
.toast button:hover { background: rgba(255,255,255,.22); }

/* Mobile */
.menu-btn, .scrim { display: none; }
@media (max-width: 780px) {
  .sidebar {
    position: fixed; z-index: 30; inset: 0 auto 0 0; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: var(--shadow);
  }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.25); }
  .menu-btn {
    display: grid; place-items: center; position: absolute; top: 10px; left: 10px; z-index: 5;
    width: 34px; height: 34px; border: 0; background: none; border-radius: 8px; color: var(--muted);
  }
  .menu-btn svg { width: 20px; height: 20px; }
  .main__inner { padding: 54px 16px 40px; }
  .sub, .proj-notes { padding-left: 0; }
  .toolbar__hint { display: none; }
  .task { flex-wrap: wrap; }
  .task__meta { width: 100%; padding-left: 26px; }
  .task__meta:empty { display: none; }
}

/* ================= Navigation: Eingang / Heute ================= */
.nav { margin-bottom: 14px; }
.nav .nav-item { margin-bottom: 1px; }
.nav-item .ic-inbox { color: var(--accent); }
.nav-item .ic-today { color: var(--today); }
.badge {
  margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px;
  background: var(--today); color: #fff; font-size: 11px; font-weight: 600;
  display: inline-grid; place-items: center; font-variant-numeric: tabular-nums;
}
.badge--overdue { background: var(--danger); }
.head__icon.ic-today { color: var(--today); }

/* Drop-Ziele in der Sidebar beim Ziehen einer Aufgabe */
body.is-dragging-task [data-drop] { outline: 1px dashed transparent; }
body.is-dragging-task .sidebar [data-drop]:hover,
[data-drop].is-drop { background: var(--accent) !important; color: #fff !important; }
[data-drop].is-drop svg, [data-drop].is-drop .count { color: #fff !important; }

/* ================= Vertraulich ================= */
.lock { width: 12px; height: 12px; color: var(--muted); flex-shrink: 0; }
.conf-badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px;
  padding: 2px 8px; border-radius: 999px; background: rgba(127,127,127,.1); color: var(--muted);
}
.conf-badge svg { width: 11px; height: 11px; }
/* Globaler Schalter in der Fußleiste: ausgeblendet = ruhig, eingeblendet = Akzentfarbe */
.tool--conf { color: var(--muted); }
.tool--conf.is-on { color: var(--accent); background: var(--hover); }
.tool--conf.is-on:hover { color: var(--danger); }
@media (max-width: 520px) { .tool--conf span { display: none; } }

/* ================= Aufgaben-Container + Unteraufgaben ================= */
.task-item { list-style: none; }
.task-item > .task-editor { margin: 10px -6px 14px; }
.subs { list-style: none; margin: 0 0 4px; padding: 0 0 0 36px; }
.st {
  display: flex; align-items: center; gap: 9px; min-height: 28px; padding: 2px 8px;
  border-radius: 6px; font-size: 13.5px; cursor: default;
}
.st:hover { background: var(--hover); }
.st__title { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: text; }
.st.is-done .st__title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.st__actions { display: flex; gap: 0; opacity: 0; margin-left: auto; }
.st:hover .st__actions { opacity: 1; }
.st__actions .icon-btn { width: 22px; height: 22px; }
.st__actions .icon-btn svg { width: 13px; height: 13px; }
/* Notiz-Symbol/Glocke an der Unteraufgabe + aufklappbare Details */
.st__ind { display: inline-flex; color: var(--faint); }
.st__ind svg { width: 11px; height: 11px; }
.st__actions .icon-btn.is-on { color: var(--accent); }
.st:has(+ .st-detail) .st__actions { opacity: 1; }
.st-detail { list-style: none; margin: 0 0 6px 23px; padding: 6px 10px 8px; border-left: 2px solid var(--line); }
.st-detail__notes {
  display: block; width: 100%; border: 0; outline: 0; background: none; resize: none;
  padding: 2px 0; min-height: 22px; color: var(--text); font-size: 13px; line-height: 1.5;
}
.st-detail__notes::placeholder { color: var(--faint); }
.st-detail__rems { display: flex; align-items: flex-start; gap: 8px; margin-top: 4px; color: var(--faint); }
.st-detail__rems > svg { width: 12px; height: 12px; margin-top: 9px; flex-shrink: 0; }
.st-detail__rems .rems { flex: 1; max-width: 280px; }
.st-detail__rems .input { color: var(--text); }

/* Mehrere Erinnerungen */
.rems { display: flex; flex-direction: column; gap: 5px; }
.rem { display: flex; align-items: center; gap: 2px; }
.rem .icon-btn { width: 24px; height: 24px; flex-shrink: 0; }
.rem .icon-btn svg { width: 13px; height: 13px; }
.rems .quick { white-space: nowrap; }
/* im Aufgaben-Editor über die ganze Breite: Erinnerungen nebeneinander */
.field--wide .rems { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.field--wide .rem, .field--wide .rems > .field__row:has(.input) { width: 236px; }

/* Projekt-Notiz unter dem Titel (wie bei Things) */
.proj-notes {
  display: block; width: 100%; border: 0; outline: 0; background: none; resize: none;
  margin: -18px auto 20px; padding: 4px 0 4px 42px; min-height: 28px; color: var(--text); line-height: 1.55;
}
.proj-notes::placeholder { color: var(--faint); }
.proj-notes:focus { box-shadow: inset 0 -1px 0 var(--line); }

.st--new .st__input { flex: 1; border: 0; outline: 0; background: none; font-size: 13.5px; height: 26px; }
.st--new .st__input::placeholder { color: var(--faint); }
.check--sm { width: 14px; height: 14px; border-radius: 3.5px; }
.check--sm svg { width: 9px; height: 9px; }
.st.is-done .check, .st.is-checking .check { background: var(--accent); border-color: var(--accent); }
.st.is-done .check svg, .st.is-checking .check svg { opacity: 1; }
.check--ghost { border-style: dashed; cursor: default; }
.chip--subs { cursor: pointer; border: 0; font: inherit; font-size: 12px; }
.chip--subs:hover { background: rgba(127,127,127,.18); color: var(--text); }
.chip--subs .chev-sm { width: 9px; height: 9px; transition: transform .15s; }
.chip--subs.is-open .chev-sm { transform: rotate(90deg); }
.chip--conf { padding: 1px 5px; }
.te__subs { padding: 4px 0 8px; margin-left: -10px; }
.te__subs .subs { padding-left: 26px; }
.te__subs-head { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 6px 0 4px 36px; }

/* Schalter "Vertraulich" */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 13px; color: var(--text); }
.switch input { display: none; }
.switch .knob {
  width: 30px; height: 18px; border-radius: 9px; background: var(--faint); position: relative; transition: background .15s;
}
.switch .knob::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,.2);
}
.switch input:checked + .knob { background: var(--accent); }
.switch input:checked + .knob::after { transform: translateX(12px); }

/* ================= Heute ================= */
.group { margin-bottom: 22px; }
.group__head {
  display: flex; align-items: center; gap: 8px; padding: 0 10px 6px; margin-bottom: 4px;
  border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px;
}
.group__head svg { width: 15px; height: 15px; }
.group__head a:hover { color: var(--accent); }
.group__head .ic-inbox { color: var(--accent); }

/* ================= Anmeldung ================= */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: var(--side);
}
.auth__card {
  width: 100%; max-width: 380px; background: var(--card); border-radius: 14px;
  box-shadow: var(--shadow); padding: 32px 28px 26px;
}
.auth__logo { width: 44px; height: 44px; color: var(--accent); margin-bottom: 12px; }
.auth h1 { margin: 0 0 4px; font-size: 22px; }
.auth p { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.form-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; font-size: 12px; font-weight: 600; color: var(--muted); }
.form-row .input { height: 36px; font-weight: 400; font-size: 14px; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: -4px 0 10px; }
.btn-primary.btn-block { width: 100%; height: 38px; font-size: 14px; }
.btn-primary:disabled { opacity: .6; cursor: default; }

/* ================= Einstellungen ================= */
.btn-icon { padding: 6px; }
.btn-icon svg { width: 17px; height: 17px; }
.modal {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.28);
  display: grid; place-items: start center; padding: 8vh 16px 16px; overflow-y: auto;
}
.modal__card {
  width: 100%; max-width: 560px; background: var(--card); border-radius: 14px;
  box-shadow: var(--shadow); padding: 22px 24px 24px;
}
.modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal__head h2 { margin: 0; font-size: 19px; }
.set-section { padding: 16px 0; border-top: 1px solid var(--line); }
.set-section:first-of-type { border-top: 0; }
.set-section h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.set-grid .form-row { margin: 0; }
.set-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.set-note { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; line-height: 1.5; }
.token-list { list-style: none; margin: 0 0 12px; padding: 0; }
.token-list li {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  background: rgba(127,127,127,.06); margin-bottom: 6px; font-size: 13px;
}
.token-list .meta { color: var(--muted); font-size: 12px; }
.token-list .name { font-weight: 500; }
.token-list button { margin-left: auto; }
.token-new {
  border: 1px solid var(--accent); border-radius: 10px; padding: 12px; margin-bottom: 12px;
  background: rgba(26,115,232,.06);
}
.token-new code {
  display: block; font: 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all; background: var(--bg); padding: 8px 10px; border-radius: 6px; margin: 8px 0;
  border: 1px solid var(--line); user-select: all;
}
.btn-secondary {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  padding: 6px 12px; border-radius: 7px; cursor: pointer;
}
.btn-secondary:hover { border-color: var(--faint); }
.btn-danger { color: var(--danger); }
@media (max-width: 560px) { .set-grid { grid-template-columns: 1fr; } }
.sidebar__bottom { gap: 2px; align-items: center; }
.sidebar__bottom .btn-plain { white-space: nowrap; padding: 6px 7px; }
.sidebar__bottom .btn-icon { margin-left: auto; }

/* ================= Planung: Wann / Abends / Irgendwann / Demnächst ================= */
.nav-item .ic-upcoming { color: #e5484d; }
.head__icon.ic-upcoming { color: #e5484d; }
.ic-evening { color: #5b6bd5; }
.field--wide { grid-column: 1 / -1; }
.when { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; text-transform: none; letter-spacing: 0; font-weight: 400; }
.when .seg { flex: 0 1 auto; }
.seg--when button { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; }
.seg--when button svg { width: 11px; height: 11px; }
.seg--when button[data-when="today"].is-on { color: #b88600; }
.seg--when button[data-when="evening"].is-on { color: #5b6bd5; }
.input--date { width: auto; min-width: 150px; }

.chip--when-today { color: #9a7200; background: rgba(242,180,0,.14); }
.chip--evening { color: #5b6bd5; background: rgba(91,107,213,.12); }
.chip--muted { color: var(--muted); background: transparent; border: 1px dashed var(--faint); }
.chip--deadline.chip--today { color: #b26e00; background: rgba(245,158,11,.14); }
.chip--project { background: transparent; color: var(--muted); padding-left: 0; padding-right: 2px; }
.task.is-someday .task__title { color: var(--muted); }
.task.is-someday .check { border-style: dashed; }
@media (prefers-color-scheme: dark) {
  .chip--when-today { color: var(--today); }
  .chip--evening, .ic-evening, .seg--when button[data-when="evening"].is-on { color: #8f9cf0; }
}

.group--evening .group__head { color: #5b6bd5; }
.group--date .group__head { align-items: baseline; gap: 8px; }
.group--date .day-num { font-size: 22px; font-weight: 700; min-width: 26px; }
.group--date .day-sub { color: var(--muted); font-weight: 400; font-size: 13px; }

/* ================= Tags ================= */
.tagbar { display: flex; gap: 6px; flex-wrap: wrap; margin-top: -8px; margin-bottom: 16px; }
.tagpill {
  --tc: #8a8d93;
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--tc) 45%, transparent);
  background: color-mix(in srgb, var(--tc) 10%, transparent);
  color: color-mix(in srgb, var(--tc) 80%, var(--text)); font-size: 12px; cursor: pointer; white-space: nowrap;
}
button.tagpill:hover { background: color-mix(in srgb, var(--tc) 18%, transparent); }
.tagpill.is-on { background: var(--tc); border-color: var(--tc); color: #fff; }
.chip.tagpill { height: auto; padding: 1px 7px; cursor: default; }
.tag--gray { --tc: #8a8d93; } .tag--red { --tc: #e5484d; } .tag--orange { --tc: #f08c00; }
.tag--yellow { --tc: #c9a000; } .tag--green { --tc: #2f9e44; } .tag--teal { --tc: #12a3a3; }
.tag--blue { --tc: #1a73e8; } .tag--purple { --tc: #7c4ddb; } .tag--pink { --tc: #d6409f; }
.tagpick { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; text-transform: none; letter-spacing: 0; font-weight: 400; }
.tag-new { border: 1px dashed var(--faint); border-radius: 999px; height: 22px; padding: 0 10px; font-size: 12px; background: none; outline: none; width: 120px; }
.tag-new:focus { border-color: var(--accent); border-style: solid; }

.tag-admin { list-style: none; margin: 0 0 12px; padding: 0; }
.tag-admin li { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.tag-admin .input { height: 32px; }
.tag-admin input.input { flex: 1; }
.tag-admin .meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.input--color { width: 92px; flex: 0 0 auto; color: var(--tc); font-weight: 600; }

/* ================= Suche ================= */
.modal--search { z-index: 70; padding-top: 12vh; }
.search__card { width: 100%; max-width: 620px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.search__bar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.search__bar svg { width: 19px; height: 19px; color: var(--muted); flex-shrink: 0; }
.search__bar input { flex: 1; border: 0; outline: 0; background: none; font-size: 17px; }
.search__results { max-height: 56vh; overflow-y: auto; padding: 6px; }
.search__hint { color: var(--muted); font-size: 13px; padding: 14px 12px; display: flex; gap: 6px; align-items: center; }
.sr {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; min-height: 38px;
}
.sr.is-sel, .sr:hover { background: var(--select); }
.sr > svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.sr .ring { color: var(--accent); }
.sr__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sr__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr__title.is-done { color: var(--muted); text-decoration: line-through; }
.sr__snip { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr__meta { font-size: 12px; color: var(--muted); white-space: nowrap; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
.sr mark { background: rgba(242,180,0,.35); color: inherit; border-radius: 2px; }
.check--static { width: 14px; height: 14px; border: 1.5px solid var(--faint); border-radius: 4px; display: grid; place-items: center; flex-shrink: 0; }
.check--static.is-on { background: var(--accent); border-color: var(--accent); }
.check--static svg { width: 9px; height: 9px; color: #fff; }

/* ================= Gewohnheiten ================= */
:root { --habit: #2f9e44; }
@media (prefers-color-scheme: dark) { :root { --habit: #40c057; } }
.ic-habits, .nav-item .ic-habits, .head__icon.ic-habits { color: var(--habit); }
.group--habits .group__head .ic-habits { color: var(--habit); }

/* Ansicht: Kopfzeile mit Wochentagen, Zeile je Gewohnheit (Kästchen rechtsbündig → Spalten passen übereinander) */
.habits-head { display: grid; grid-template-columns: 1fr repeat(7, 26px); gap: 0 6px; padding: 0 10px 4px; font-size: 11px; color: var(--muted); }
.habits-head span { text-align: center; line-height: 1.2; }
.habits-head small { display: block; font-size: 10px; color: var(--faint); }
.habits-head .is-today, .habits-head .is-today small { color: var(--habit); font-weight: 600; }
.habit {
  list-style: none; display: grid; align-items: center; gap: 0 6px; padding: 9px 10px; border-radius: 8px; cursor: pointer;
  grid-template-columns: 1fr auto; grid-template-areas: "main streak" "days days";
}
@media (min-width: 640px) { .habit { grid-template-columns: 1fr auto auto; grid-template-areas: "main streak days"; } }
.habit:hover { background: var(--hover); }
.habit__main { grid-area: main; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.habit__name { font-weight: 500; }
.habit__main > svg { width: 12px; height: 12px; color: var(--faint); }
.habit__meta { flex-basis: 100%; font-size: 12px; color: var(--muted); }
.habit__streak { grid-area: streak; font-size: 12px; color: var(--muted); white-space: nowrap; padding: 0 8px; }
.habit__streak b { font-size: 15px; color: var(--habit); }
.habit__days { grid-area: days; display: grid; grid-template-columns: repeat(7, 26px); gap: 6px; justify-content: end; margin-top: 8px; }
@media (min-width: 640px) { .habit__days { margin-top: 0; } }

.hday {
  width: 26px; height: 26px; border-radius: 7px; border: 1.5px solid var(--line);
  background: var(--bg); cursor: pointer; display: grid; place-items: center; padding: 0; position: relative;
}
.hday:hover { border-color: var(--habit); }
.hday svg { width: 12px; height: 12px; color: #fff; }
.hday.is-done { background: var(--habit); border-color: var(--habit); }
.hday.is-part { background: linear-gradient(to top, color-mix(in srgb, var(--habit) 45%, transparent) var(--p), var(--bg) var(--p)); }
.hday.is-missed { background: rgba(229,72,77,.08); border-color: rgba(229,72,77,.35); }
.hday.is-off { border-style: dashed; opacity: .45; }
.hday.is-paused { background: repeating-linear-gradient(135deg, var(--hover) 0 4px, var(--bg) 4px 8px); border-style: dashed; }
.hday.is-today { box-shadow: 0 0 0 2px color-mix(in srgb, var(--habit) 35%, transparent); }
.hday.has-note::after { content: ''; position: absolute; top: -3px; right: -3px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); border: 1.5px solid var(--bg); }

/* Editor */
.habit-editor .te__icon { width: 18px; height: 18px; flex-shrink: 0; }
.habit-editor .field__row { flex-wrap: wrap; }
.seg--wd { display: inline-flex; }
.seg--wd button { flex: 0 0 auto; min-width: 32px; }
.seg--wd button.is-on { color: var(--habit); }
.field__hint { font-size: 11px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); }
.pause { color: var(--text); }
.input--date { width: auto; }

/* Block in „Heute“ */
.htoday {
  list-style: none; display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 4px 8px; border-radius: 8px;
}
.htoday:hover { background: var(--hover); }
.htoday.is-done .check { background: var(--habit); border-color: var(--habit); }
.htoday.is-done .check svg { opacity: 1; }
.htoday.is-done .htoday__name { color: var(--muted); }
.htoday__name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.htoday__note { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.htoday .icon-btn { opacity: 0; }
.htoday:hover .icon-btn, .htoday .icon-btn:focus { opacity: 1; }
.hplus {
  flex-shrink: 0; height: 22px; min-width: 30px; padding: 0 6px; border-radius: 11px; border: 1.5px solid var(--habit);
  background: none; color: var(--habit); font-size: 11px; font-weight: 600; cursor: pointer;
}
.hplus:hover { background: var(--habit); color: #fff; }
.htoday.is-done .hplus { background: var(--habit); color: #fff; }
.hamount { border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 2px 4px; border-radius: 5px; white-space: nowrap; }
.hamount:hover { background: var(--hover); color: var(--text); }
.hbar { flex: 0 0 60px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.hbar span { display: block; height: 100%; background: var(--habit); }

/* Formular am Kästchen (im Menü) */
.hpop { display: flex; flex-direction: column; gap: 8px; padding: 6px; width: 260px; }
.hpop__title { font-size: 12px; font-weight: 600; color: var(--muted); }
.hpop__row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.hpop__foot { display: flex; justify-content: flex-end; }
.menu .hpop button { width: auto; }
.menu .hpop button.btn-primary:hover { background: var(--accent); }
@media (max-width: 520px) { .hbar { display: none; } }

/* ================= Woche ================= */
.main__inner.is-wide > * { max-width: none; }
.ic-week, .nav-item .ic-week, .head__icon.ic-week { color: #7c5cdb; }
@media (prefers-color-scheme: dark) { .ic-week, .nav-item .ic-week, .head__icon.ic-week { color: #9d85ee; } }
.wk-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.wk-nav .icon-btn { font-size: 20px; line-height: 1; width: 30px; height: 30px; }
.wk-nav .btn-plain { font-size: 13px; padding: 5px 10px; border-radius: 7px; }
.wk-nav .btn-plain.is-on { color: var(--muted); }
.wk-new { margin-bottom: 14px; }

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: start; }
.wk-day { min-height: 0; border-radius: 10px; padding: 8px 6px 10px; background: rgba(127,127,127,.04); }
.wk-day.is-today { background: color-mix(in srgb, var(--accent) 7%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.wk-day.is-past .wk-day__head { opacity: .6; }
.wk-day__head { display: flex; align-items: baseline; gap: 6px; padding: 0 4px 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.wk-day__wd { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.wk-day__num { font-size: 18px; font-weight: 700; }
.wk-day.is-today .wk-day__num, .wk-day.is-today .wk-day__wd { color: var(--accent); }
.wk-day__badge { margin-left: auto; font-size: 10px; font-weight: 600; color: var(--accent); }

.wk-tasks { list-style: none; margin: 0; padding: 0; min-height: 36px; }
.wk-task {
  display: flex; align-items: flex-start; gap: 7px; padding: 5px 5px; border-radius: 7px; cursor: pointer; font-size: 13px; line-height: 1.35;
}
.wk-task:hover { background: var(--hover); }
.wk-task .check { margin-top: 2px; flex-shrink: 0; }
.wk-task.is-done .check, .wk-task.is-checking .check { background: var(--accent); border-color: var(--accent); }
.wk-task.is-done .check svg, .wk-task.is-checking .check svg { opacity: 1; }
.wk-task.is-done .wk-task__title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.wk-task.task--p3 .check { border-color: var(--p3); }
.wk-task.task--p2 .check { border-color: var(--p2); }
.wk-task__body { min-width: 0; flex: 1; }
.wk-task__title { overflow-wrap: anywhere; }
.wk-task__body .lock, .wk-task__body .preview__ic { margin-left: 4px; vertical-align: -1px; }
.wk-task__meta { display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-task__meta .is-overdue { color: var(--danger); }
.wk-task.is-preview { color: var(--muted); opacity: .75; }
.wk-task.is-preview .wk-task__title { font-style: italic; }
.preview__ic { width: 11px; height: 11px; color: var(--muted); flex-shrink: 0; margin-top: 3px; }

.wk-habits { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--line); }
.wk-habit {
  display: flex; align-items: center; gap: 6px; border: 0; background: none; padding: 3px 5px; border-radius: 6px;
  font-size: 12px; color: var(--text); cursor: pointer; text-align: left; min-width: 0;
}
.wk-habit:hover:not(:disabled) { background: var(--hover); }
.wk-habit:disabled { cursor: default; color: var(--muted); opacity: .7; }
.wk-habit__box { width: 13px; height: 13px; border-radius: 4px; border: 1.5px solid var(--habit); flex-shrink: 0; display: grid; place-items: center; }
.wk-habit:disabled .wk-habit__box { border-style: dashed; border-color: var(--faint); }
.wk-habit.is-done .wk-habit__box { background: var(--habit); }
.wk-habit__box svg { width: 9px; height: 9px; color: #fff; }
.wk-habit__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.wk-habit small { color: var(--muted); font-size: 10px; }

/* Vorschau in Demnächst */
.preview-item { list-style: none; }
.task--preview { opacity: .6; cursor: pointer; }
.task--preview .task__title { font-style: italic; }
.task--preview .preview__ic { width: 14px; height: 14px; margin: 0 3px 0 2px; }

@media (max-width: 980px) {
  .week { grid-template-columns: 1fr; }
  .wk-day { min-height: 0; }
}

/* Google-Kalender in den Einstellungen */
.cal-admin { list-style: none; margin: 8px 0 0; padding: 0; }
.cal-admin li { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line, rgba(128,128,128,.15)); flex-wrap: wrap; }
.cal-admin .cal-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.cal-admin .cal-name { flex: 1; min-width: 160px; }
.cal-admin label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
a.btn-primary { text-decoration: none; display: inline-block; }

/* Google-Termine */
.evs { list-style: none; margin: 6px 0 10px; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.ev__in { display: flex; align-items: baseline; gap: 10px; padding: 5px 10px; border-left: 3px solid var(--ev);
  background: color-mix(in srgb, var(--ev) 10%, transparent); border-radius: 4px; color: inherit; text-decoration: none; font-size: 14px; }
a.ev__in:hover { background: color-mix(in srgb, var(--ev) 18%, transparent); }
.ev__time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 82px; }
.ev__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev__loc { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.ev--busy .ev__title { color: var(--muted); font-style: italic; }
.evs--week { margin: 4px 0 6px; }
.evs--week .ev__in { flex-direction: column; gap: 0; padding: 3px 6px; font-size: 12px; }
.evs--week .ev__time { min-width: 0; font-size: 11px; }
.evs--week .ev__title { white-space: normal; }
.evs--week .ev__loc { display: none; }
.evs--today { margin: 4px auto 22px; }

.field__hint { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Wochenansicht: Stundenraster 0–24 Uhr (breit); schmal bleibt die Liste je Tag */
/* Woche (breit): Seite scrollt nicht – Kopf + ganztägig oben, Raster in der Mitte scrollt, Aufgaben/Gewohnheiten unten */
.main__inner.is-wide { display: flex; flex-direction: column; padding-bottom: 12px; }
.main__inner.is-wide > * { flex: none; width: 100%; margin-left: 0; margin-right: 0; box-sizing: border-box; }
.wkg-heads, .wkg-allday { flex: none; }
.main__inner.is-wide > .wkg { flex: 1 1 auto; min-height: 220px; display: flex; flex-direction: column; }
.main__inner.is-wide > .wkg + .week { max-height: 32vh; overflow-y: auto; padding-top: 8px; }
.wkg .wkg-allday { max-height: 22vh; overflow-y: auto; }
.wkg { margin-bottom: 0; }
.wkg-heads, .wkg-allday, .wkg-body { display: grid; grid-template-columns: 44px repeat(7, minmax(0, 1fr)); gap: 0 8px; }
.wkg-head { display: flex; align-items: baseline; gap: 6px; padding: 0 4px 6px; border-bottom: 1px solid var(--line); }
.wkg-head.is-today .wk-day__num, .wkg-head.is-today .wk-day__wd { color: var(--accent); }
.wkg-head.is-past { opacity: .6; }
.wkg-allday { padding: 4px 0; border-bottom: 1px solid var(--line); min-height: 8px; }
.wkg-allday__label { font-size: 10px; color: var(--muted); text-align: right; padding-top: 6px; }
.wkg-allday .evs { margin: 0; }
.wkg-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; border-bottom: 1px solid var(--line); }
.wkg-body { position: relative; }
.wkg-hours { position: relative; }
.wkg-h { position: absolute; right: 0; font-size: 10px; color: var(--muted); transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.wkg-h:first-child { transform: none; }
.wkg-col { position: relative; background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 52px); }
.wkg-col.is-today { background-color: color-mix(in srgb, var(--accent) 5%, transparent); }
.wkg-ev { position: absolute; padding: 1px; box-sizing: border-box; height: var(--h); width: var(--w); }
/* Hover: kurzer Termin klappt auf und zeigt alles (Zeit, Titel, Ort) */
.wkg-ev:hover { z-index: 5; height: auto; min-height: var(--h); width: max(var(--w), 180px); }
.wkg-ev:hover .ev__in { box-shadow: var(--shadow); background: color-mix(in srgb, var(--ev) 22%, var(--bg)); }
.wkg-ev:hover .ev__loc { display: block; white-space: normal; max-width: none; }
.wkg-ev:hover .ev__title { overflow: visible; }
.wkg-ev .ev { height: 100%; min-height: calc(var(--h) - 2px); box-sizing: border-box; }
.wkg-ev .ev__in { height: 100%; box-sizing: border-box; flex-direction: column; gap: 0; padding: 3px 6px; font-size: 12px; overflow: hidden;
  background: color-mix(in srgb, var(--ev) 18%, var(--bg)); }
.wkg-ev .ev__time { min-width: 0; font-size: 10px; }
.wkg-ev .ev__title { white-space: normal; }
.wkg-ev .ev__loc { display: none; }
.wkg-now { position: absolute; left: 0; right: 0; height: 2px; background: #e5484d; z-index: 2; }
.wkg + .week { padding-left: 52px; }
.wkg + .week .wk-day__head, .evs--narrow { display: none; }
@media (max-width: 980px) {
  .main__inner.is-wide { display: block; padding-bottom: 60px; }
  .main__inner.is-wide > .wkg + .week { max-height: none; overflow: visible; }
  .wkg { display: none; }
  .wkg + .week { padding-left: 0; }
  .wkg + .week .wk-day__head { display: flex; }
  .evs--narrow { display: flex; }
}

/* Termin-Fenster + Ziehen im Raster (5b) */
.ev-card { max-width: 520px; display: flex; flex-direction: column; gap: 10px; }
.ev-title { font-size: 17px; font-weight: 600; }
.ev-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ev-lbl { width: 28px; color: var(--muted); font-size: 13px; }
.ev-check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.ev-desc { resize: vertical; min-height: 60px; font: inherit; }
.ev-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .ev-grid { grid-template-columns: 1fr; } }
.ev-scope { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; border-radius: 8px; background: rgba(127,127,127,.08); }
.ev-actions a.btn-plain { margin-left: auto; text-decoration: none; }
.evs .ev[data-ev-id] { cursor: pointer; }
.wkg-scroll { user-select: none; }
.wkg-col { cursor: cell; }
.wkg-ev .ev { position: relative; cursor: pointer; }
.wkg-ev .ev.is-drag { cursor: grab; }
.ev__resize { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; cursor: ns-resize; }
.wkg-ev.is-dragging { opacity: .85; z-index: 6; }
.wkg-ev.is-dragging .ev__in { box-shadow: var(--shadow); }
.wkg-ghost { position: absolute; left: 2px; right: 2px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 25%, transparent);
  border: 1px dashed var(--accent); font-size: 11px; padding: 2px 5px; color: var(--accent); pointer-events: none; z-index: 4; }
.ev-row > .input, .ev-row > select.input { width: auto; flex: 0 1 auto; }
.ev-row > .input[type=date] { min-width: 150px; }
.ev-row > .input[type=time] { min-width: 110px; }
.ev-row > .input--num { width: 64px; }

/* Zeitblöcke von Aufgaben (5c) */
.ev--task .ev__in { border-left-style: dashed; }
.wkg-ev .ev--task .ev__in { flex-direction: row; align-items: flex-start; gap: 5px; }
.ev--task .ev__txt { display: flex; flex-direction: column; min-width: 0; }
.ev--task .check { margin-top: 1px; position: relative; z-index: 2; flex: none; }
.ev--task.is-done .check { background: var(--accent); border-color: var(--accent); }
.ev--task.is-done .check svg { opacity: 1; }
.ev--task.is-done .ev__title { text-decoration: line-through; color: var(--muted); }
.chip--time { font-variant-numeric: tabular-nums; }
.sortable-fallback[data-drop]::after { content: attr(data-drop); position: absolute; top: -10px; right: -6px; padding: 2px 7px; border-radius: 6px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; box-shadow: var(--shadow); }

/* Auswertung Gewohnheiten (3b) – eine Farbe (--habit), Stufen hell → dunkel */
.htabs { margin-left: auto; }
.htabs { flex: none; }
.htabs a { text-decoration: none; padding: 3px 10px; border-radius: 5px; font-size: 13px; color: var(--muted); }
.htabs a.is-on { background: var(--bg); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.hs-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; margin-bottom: 18px; }
.hs-sel { width: auto; min-width: 200px; }
.hs-nav .wk-nav { margin-left: auto; }
.hs-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.hs-tile { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 10px; background: rgba(127,127,127,.06); }
.hs-tile__l { font-size: 12px; color: var(--muted); }
.hs-tile__v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hs-tile__s { font-size: 12px; color: var(--muted); }
.trend { font-variant-numeric: tabular-nums; color: var(--muted); }
.hs-tile .trend { font-size: 20px; color: var(--text); }
.trend.is-up::first-letter, .trend.is-down::first-letter { color: var(--muted); }
.hs-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 22px; }
.hs-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; white-space: nowrap; }
.hs-table th.is-asc::after { content: ' ↑'; } .hs-table th.is-desc::after { content: ' ↓'; }
.hs-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; font-variant-numeric: tabular-nums; }
.hs-table tbody tr { cursor: pointer; } .hs-table tbody tr:hover { background: var(--hover); }
.hs-table td small { display: block; font-size: 11px; color: var(--muted); }
.hs-rate { display: inline-flex; align-items: center; gap: 8px; }
.hs-rate__bar { width: 70px; height: 6px; border-radius: 3px; background: rgba(127,127,127,.15); overflow: hidden; }
.hs-rate__bar span { display: block; height: 100%; border-radius: 3px; background: var(--habit); }
.hs-chart { margin-top: 0; margin-bottom: 22px; }
.hs-chart figcaption { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.hs-bars { position: relative; display: flex; align-items: flex-end; gap: 6px; padding-left: 40px; }
.hs-grid span { position: absolute; left: 0; width: 100%; border-top: 1px solid var(--line); font-size: 10px; color: var(--muted); line-height: 0; padding-top: 0; }
.hs-grid span { transform: translateY(0); }
.hs-bar { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; z-index: 1; }
.hs-bar:hover { background: rgba(127,127,127,.06); border-radius: 4px; }
.hs-bar__fill { width: min(70%, 22px); border-radius: 4px 4px 0 0; background: var(--habit); }
.hs-bars__x { display: flex; gap: 6px; padding-left: 40px; margin-top: 4px; }
.hs-bars__x span { flex: 1; text-align: center; font-size: 10px; color: var(--muted); white-space: nowrap; }
.hm-wrap { display: flex; gap: 2px; overflow-x: auto; padding-bottom: 2px; }
.hm-days, .hm-col { display: flex; flex-direction: column; gap: 2px; }
.hm-days span { height: 10px; font-size: 9px; color: var(--muted); line-height: 10px; width: 18px; }
.hm-col small { font-size: 9px; color: var(--muted); height: 10px; white-space: nowrap; }
.hm { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.hm--none { background: rgba(127,127,127,.06); }
.hm--0 { background: rgba(127,127,127,.16); }
.hm--1 { background: color-mix(in srgb, var(--habit) 30%, transparent); }
.hm--2 { background: color-mix(in srgb, var(--habit) 55%, transparent); }
.hm--3 { background: color-mix(in srgb, var(--habit) 78%, transparent); }
.hm--4 { background: var(--habit); }
.hm.is-future { background: transparent; }
.hm-legend { display: flex; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); margin-top: 6px; }

/* Hinweis + Datenschutz-Link (Anmeldeseite; auch ohne JavaScript sichtbar) */
.legal { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px; text-align: center; font-size: 12px; color: var(--muted); }
.legal a { color: inherit; }
body:has(#app:not([hidden])) .legal { display: none; }
