/* Quest (lokal) – Stylesheet (eigenes Design, dunkel/hell) */
:root, [data-theme="dark"] {
  --bg: #0c0c0e;
  --surface: #151518;
  --surface-2: #1c1c20;
  --surface-3: #24242a;
  --line: #26262c;
  --line-strong: #3a3a42;
  --text: #ececee;
  --text-2: #c4c4c9;
  --muted: #85858d;
  --accent: #e8b04b;
  --accent-ink: #1a1305;
  --danger: #e5675f;
  --today-bg: rgba(232, 176, 75, 0.06);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f1f0ec;
  --surface-3: #e8e6e0;
  --line: #e4e2dc;
  --line-strong: #cbc8c0;
  --text: #1d1c1a;
  --text-2: #3d3b37;
  --muted: #7d7a73;
  --accent: #c98a16;
  --accent-ink: #fffaf0;
  --danger: #c9443c;
  --today-bg: rgba(201, 138, 22, 0.07);
  --shadow: 0 18px 50px rgba(30, 25, 10, 0.16), 0 2px 8px rgba(30, 25, 10, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg { width: 16px; height: 16px; flex: none; }
a { color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }
kbd {
  font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 3px 6px; border-radius: 5px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--muted); display: inline-block; min-width: 18px; text-align: center;
}
kbd + kbd { margin-left: 3px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }
.hidden { display: none !important; }
.eyebrow { font-size: 11px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); display: inline-block; flex: none; }
.dot.hollow { background: transparent; border: 1.5px solid var(--line-strong); }
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }

/* ---------- Kopfzeile ---------- */
.topbar {
  height: 54px; flex: none; display: flex; align-items: center; gap: 18px; padding: 0 18px;
  border-bottom: 1px solid var(--line); background: var(--bg); z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 650; color: var(--text); }
.brand svg { width: 20px; height: 20px; color: var(--accent); }
.nav { display: flex; gap: 2px; }
.nav a { text-decoration: none; color: var(--muted); padding: 6px 11px; border-radius: 8px; font-weight: 500; transition: background .15s, color .15s; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.on { color: var(--text); background: var(--surface-2); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.search-btn {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px 0 10px; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); min-width: 220px;
}
.search-btn:hover { border-color: var(--line-strong); color: var(--text-2); }
.search-btn span { flex: 1; text-align: left; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--surface-3); color: var(--text);
  display: inline-grid; place-items: center; font-weight: 600; font-size: 13px; flex: none;
}
.avatar.lg { width: 52px; height: 52px; font-size: 20px; }
.run-pill {
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line); max-width: 280px;
}
.run-pill[hidden] { display: none; }
.rp-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.rp-time { font-variant-numeric: tabular-nums; color: var(--text); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 0 var(--c); animation: pulse 1.6s infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 60%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.save-dot { display: none; }
body.focus-mode .topbar { display: none; }

/* ---------- Seiten ---------- */
.main { flex: 1; overflow: auto; position: relative; }
.boot { padding: 40px; }
.page { padding: 26px 30px 40px; max-width: 1480px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.head-left, .head-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.head-left h1 { margin-right: 6px; }
.range { min-width: 120px; text-align: center; color: var(--text-2); font-variant-numeric: tabular-nums; }
.head-stats { display: flex; align-items: center; gap: 22px; }
.big-stat .v { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.bar { height: 5px; border-radius: 9px; background: var(--surface-3); overflow: hidden; width: 160px; }
.bar.wide { width: 200px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 9px; transition: width .3s; }
.week-meter { display: grid; gap: 6px; }

/* ---------- Buttons & Eingaben ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font-weight: 500; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-3); border-color: var(--line-strong); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn.full { width: 100%; justify-content: center; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.danger.primary, .btn.danger:not(.ghost):not(.sm) { background: var(--danger); border-color: var(--danger); color: #fff; }
.icon-btn { width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.icon-btn.xs { width: 22px; height: 22px; }
.icon-btn.xs svg { width: 13px; height: 13px; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); padding: 6px 2px; font-size: 13px; }
.link-btn:hover { color: var(--text); }
.link-btn.danger { color: var(--danger); }
.link-btn svg { width: 14px; height: 14px; }
.input {
  height: 36px; padding: 0 11px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); width: 100%; outline: none;
}
.input:focus { border-color: color-mix(in srgb, var(--accent) 70%, var(--line)); }
.input.num { width: 72px; text-align: center; }
.input.static { display: flex; align-items: center; color: var(--muted); }
select.input { padding-right: 6px; }
.ghost-input { background: transparent; border-color: transparent; padding: 0; height: 28px; font-weight: 600; font-size: 16px; }
.ghost-input:focus { border-color: transparent; border-bottom: 1px solid var(--line-strong); border-radius: 0; }
.lbl { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); gap: 2px; }
.seg button { padding: 5px 11px; border-radius: 7px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface-3); color: var(--text); }
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; }
.seg.small button { font-size: 12px; padding: 4px 8px; }
.switch { width: 38px; height: 22px; border-radius: 99px; background: var(--surface-3); position: relative; transition: background .15s; }
.switch span { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text); transition: transform .15s; }
.switch.on { background: var(--accent); }
.switch.on span { transform: translateX(16px); background: var(--accent-ink); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); font-size: 12px; max-width: 170px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
button.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.static { cursor: default; }
.chip.small { height: 20px; font-size: 11px; }

/* ---------- Home ---------- */
/* Kalender 500px breit (in kleineren Fenstern bis min. 260px), Aufgaben bekommen den Rest */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 500px); gap: 28px; align-items: start; }
.home-lists section { margin-bottom: 26px; }
.sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; min-height: 30px; }
.hidden-note { padding: 6px 2px; }
.home-time { position: sticky; top: 0; }
.home-time .tg-scroll { height: calc(100vh - 54px - 150px); min-height: 360px; }
.list-empty { color: var(--muted); padding: 14px 4px; font-size: 13px; }

/* Eingabezeile */
.add-row {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 6px 0 10px; border-radius: 10px;
  background: var(--surface); border: 1px dashed var(--line-strong); margin-bottom: 10px;
}
.add-row:focus-within { border-style: solid; border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.add-row.small { height: 34px; padding: 0 4px 0 9px; margin-bottom: 8px; }
.add-input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; height: 100%; color: var(--text); }
.add-input::placeholder { color: var(--muted); }
.pos-toggle { display: flex; gap: 2px; opacity: .8; }
.pos-toggle button { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 7px; border-radius: 6px; font-size: 11.5px; color: var(--muted); }
.pos-toggle button svg { width: 13px; height: 13px; }
.pos-toggle button.on { background: var(--surface-3); color: var(--text); }
.add-quest { flex: none; }

/* ---------- Aufgabenkarte ---------- */
.task-list { display: flex; flex-direction: column; gap: 8px; min-height: 6px; }
.task {
  position: relative; border-radius: 10px; background: var(--surface); border: 1px solid var(--line);
  padding: 10px 10px 9px 14px; cursor: pointer; transition: border-color .15s, background .15s, opacity .15s;
}
.task::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--qc); }
.task:hover { border-color: var(--line-strong); }
.task.running { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent); }
.task.done { opacity: .5; }
.task.done .task-title { text-decoration: line-through; text-decoration-color: var(--muted); }
.task.dragging { opacity: .3; }
.task-top { display: flex; align-items: flex-start; gap: 6px; }
.task-title { flex: 1; min-width: 0; font-weight: 500; overflow-wrap: anywhere; outline: none; border-radius: 4px; }
.task-title[contenteditable=true] { background: var(--surface-2); box-shadow: 0 0 0 4px var(--surface-2); cursor: text; }
.task-more { width: 24px; height: 24px; opacity: 0; margin: -3px -3px 0 0; }
.task:hover .task-more { opacity: 1; }
.task-meta { display: flex; align-items: center; gap: 7px; margin-top: 8px; }
.check {
  width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center;
  color: transparent; flex: none; transition: all .15s;
}
.check svg { width: 12px; height: 12px; }
.check:hover { border-color: var(--text-2); color: var(--muted); }
.check.on { background: var(--qc, var(--accent)); border-color: var(--qc, var(--accent)); color: var(--bg); }
.task:not([style*="--qc:#"]) .check.on { background: var(--accent); border-color: var(--accent); }
.meta-ico { color: var(--muted); display: inline-flex; }
.meta-ico svg { width: 13px; height: 13px; }
.task-time { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--text-2); }
.task-time.live { color: var(--accent); }
.play { width: 26px; height: 26px; }
.play svg { width: 13px; height: 13px; }
.task.running .play { color: var(--accent); }
.drop-line { height: 3px; border-radius: 3px; background: var(--accent); margin: -2px 0; }

/* ---------- Plan ---------- */
.page.plan { max-width: none; padding-right: 0; display: flex; flex-direction: column; height: 100%; }
.page.plan .page-head { padding-right: 30px; }
.month-label { color: var(--text-2); min-width: 120px; text-align: right; }
.plan-board { display: flex; gap: 12px; overflow-x: auto; padding: 0 30px 14px 0; flex: 1; align-items: stretch; scroll-snap-type: x proximity; }
.plan-col {
  flex: 0 0 var(--colw); display: flex; flex-direction: column; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--line); padding: 10px 9px; min-height: 0; scroll-snap-align: start;
  background: color-mix(in srgb, var(--surface) 55%, var(--bg));
}
.plan-col.today { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: color-mix(in srgb, var(--today-bg) 100%, var(--bg)); }
.plan-col.past { opacity: .62; }
.plan-col.past:hover { opacity: 1; }
.plan-col-head { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 4px 9px; margin-bottom: 9px; border-bottom: 1px solid var(--line); color: var(--muted); }
.plan-col-head b { color: var(--text); font-weight: 600; }
.plan-col.today .plan-col-head { border-bottom: 2px solid var(--accent); color: var(--text); }
.plan-col.today .plan-col-head b { color: var(--accent); }
.plan-col-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-bottom: 20px; min-height: 80px; }
.plan-col .task { padding: 9px 8px 8px 12px; }
.plan-col .chip { max-width: 120px; }
.other-group { display: flex; flex-direction: column; gap: 8px; }
.group-toggle { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; padding: 4px 2px; }
.group-toggle svg { width: 13px; height: 13px; }
.group-toggle:hover { color: var(--text); }

/* ---------- Zeitraster ---------- */
.tg { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.tg-head { display: grid; grid-template-columns: 56px repeat(var(--cols), 1fr); border-bottom: 1px solid var(--line); }
.tg-dayhead { padding: 9px 8px; text-align: center; border-left: 1px solid var(--line); color: var(--muted); }
.tg-dayhead .num { color: var(--text); font-weight: 600; }
.tg-dayhead.today { background: var(--today-bg); }
.tg-dayhead.today .num { color: var(--accent); }
.tg-scroll { overflow-y: auto; height: calc(100vh - 54px - 190px); min-height: 380px; position: relative; }
.tg-body { display: grid; grid-template-columns: 56px repeat(var(--cols), 1fr); position: relative; }
.tg.compact .tg-body { grid-template-columns: 50px 1fr; }
.tg-gutter { position: relative; }
.tg-hour { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tg-col { position: relative; border-left: 1px solid var(--line); cursor: crosshair; }
.tg-col.today { background: var(--today-bg); }
.tg-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); pointer-events: none; opacity: .7; }
.tg-entry {
  position: absolute; border-radius: 6px; padding: 3px 6px; overflow: hidden; cursor: grab; z-index: 2;
  background: color-mix(in srgb, var(--c) 22%, var(--surface));
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--c) 10%, transparent) 6px 12px);
  border-left: 3px solid var(--c); font-size: 11.5px; line-height: 1.3; user-select: none;
}
.tg-entry:hover { filter: brightness(1.12); }
.tg-entry.live { box-shadow: 0 0 0 1px var(--c); }
.tg-entry-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-entry-time { color: var(--text-2); opacity: .85; font-variant-numeric: tabular-nums; }
.tg-entry.short .tg-entry-time { display: none; }
.tg-entry.short { padding-top: 1px; }
.tg-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; cursor: ns-resize; }
.tg-ghost { position: absolute; left: 3px; right: 3px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 22%, transparent); border: 1px dashed var(--accent); pointer-events: none; z-index: 3; }
.tg-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); z-index: 4; pointer-events: none; }
.tg-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.tg-done { position: absolute; right: 4px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--c); background: var(--surface); z-index: 3; }
.cal-wrap .tg-scroll { height: calc(100vh - 54px - 175px); }

/* ---------- Fokus ---------- */
.page.focus { height: 100%; display: flex; flex-direction: column; max-width: none; }
.focus-top { display: flex; justify-content: space-between; align-items: center; }
.focus-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding-bottom: 60px; }
.focus-title { font-size: 24px; font-weight: 500; max-width: 720px; }
.focus-clock { font-size: clamp(80px, 14vw, 168px); font-weight: 500; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.focus-actions { display: flex; gap: 10px; margin-top: 10px; }
.focus-next { margin-top: 34px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.focus-next-item { color: var(--muted); font-size: 13px; padding: 3px 8px; border-radius: 6px; }
.focus-next-item:hover { color: var(--text); background: var(--surface-2); }
.page.focus.empty { justify-content: center; align-items: center; }
.focus-empty { text-align: center; }
.focus-empty h2 { font-weight: 500; margin: 0 0 8px; }

/* ---------- Ziele ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 24px; }
.stat { background: var(--surface); padding: 18px 20px; display: grid; gap: 6px; }
.stat .muted svg { width: 13px; height: 13px; vertical-align: -2px; color: var(--accent); }
.stat-v { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-v.accent { color: var(--accent); }
.tabs-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.quest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 14px; }
.quest-card {
  border-radius: 14px; background: var(--surface); border: 1px solid var(--line); padding: 18px; min-height: 170px;
  display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; position: relative; overflow: hidden;
  transition: border-color .15s, transform .15s; outline: none; text-align: left;
}
.quest-card::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--c); opacity: .8; }
.quest-card:hover, .quest-card:focus-visible { border-color: var(--line-strong); transform: translateY(-1px); }
.quest-card:focus-visible { box-shadow: 0 0 0 2px var(--c); }
.quest-card.completed { opacity: .72; }
.quest-card.dragging { opacity: .35; }
.quest-card.new { border-style: dashed; align-items: center; justify-content: center; gap: 8px; color: var(--muted); }
.quest-card.new::after { display: none; }
.quest-card.new svg { width: 20px; height: 20px; }
.qc-head { display: flex; align-items: center; gap: 12px; }
.qc-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 16%, var(--surface-2)); color: var(--c); flex: none; }
.qc-icon svg { width: 19px; height: 19px; }
.emoji { font-size: 19px; line-height: 1; }
.qc-title { font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.qc-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.qc-v { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.qc-spark { text-align: right; }
.spark { width: 110px; height: 30px; display: block; }

/* Ziel-Dialog */
.quest-dialog { padding: 0 !important; overflow: hidden; }
.qd-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 12px 22px; border-bottom: 1px solid var(--line); }
.qd-body { display: grid; grid-template-columns: 1fr 230px; min-height: 300px; }
.qd-main { padding: 18px 22px; }
.qd-side { padding: 18px; border-left: 1px solid var(--line); background: var(--surface-2); display: flex; flex-direction: column; gap: 12px; }
.qd-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.qd-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 15%, var(--surface-2)); flex: none; }
.qd-icon svg { width: 20px; height: 20px; }
.qd-title { flex: 1; background: transparent; border: 0; outline: none; font-size: 22px; font-weight: 600; color: var(--text); min-width: 0; }
.qd-title::placeholder { color: var(--muted); font-weight: 500; }
.quest-dialog .dialog-actions { padding: 12px 18px; border-top: 1px solid var(--line); margin: 0; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; background: var(--c); position: relative; display: grid; place-items: center; }
.swatch.on { box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 4px var(--text-2); }
.swatch.custom { border: 1.5px dashed var(--line-strong); color: var(--muted); cursor: pointer; }
.swatch.custom svg { width: 13px; height: 13px; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Icon-Auswahl */
.icon-picker { width: 300px; padding: 12px; }
.ip-head { display: grid; gap: 2px; margin-bottom: 10px; }
.ip-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; max-height: 260px; overflow-y: auto; }
.ip-grid.emoji { grid-template-columns: repeat(6, 1fr); }
.ip-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 4px; border-radius: 9px; color: var(--accent); border: 1px solid transparent; }
.ip-item span { font-size: 11px; color: var(--muted); }
.ip-item svg { width: 20px; height: 20px; }
.ip-item:hover { background: var(--surface-2); }
.ip-item.sel { border-color: var(--line-strong); background: var(--surface-2); }
.emoji-item { font-size: 20px; padding: 6px; }

/* ---------- Rückblick ---------- */
.review-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.review-side { display: grid; gap: 14px; align-content: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.card.span-2 { grid-column: span 2; }
.bars { display: flex; align-items: flex-end; gap: 14px; height: 250px; padding-top: 14px; position: relative; }
.bars.weeks { height: 220px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.bar-val { font-size: 11.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.bar-track { flex: 1; width: 100%; max-width: 44px; display: flex; align-items: flex-end; }
.bar-fill { width: 100%; border-radius: 6px 6px 3px 3px; background: var(--line-strong); min-height: 2px; transition: height .3s; }
.bar-col.today .bar-fill { background: var(--accent); }
.bar-col.today .bar-lbl { color: var(--accent); }
.bar-lbl { font-size: 12px; color: var(--muted); }
.trend { margin-top: 14px; display: grid; gap: 6px; }
.trend-row { display: grid; grid-template-columns: repeat(8, 1fr); gap: 14px; justify-items: center; }
.trend-row.tracks { height: 160px; position: relative; align-items: end; }
.trend-track { height: 100%; width: 100%; max-width: 44px; display: flex; align-items: flex-end; position: relative; z-index: 1; }
.trend-track.today .bar-fill { background: var(--accent); }
.bar-lbl.today { color: var(--accent); }
.target-line { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--accent); opacity: .6; pointer-events: none; z-index: 2; }
.target-line span { position: absolute; right: 0; top: -18px; font-size: 11px; color: var(--accent); }
.hq-row { display: grid; grid-template-columns: 10px minmax(0, 1.2fr) 1fr auto; align-items: center; gap: 10px; margin-top: 12px; }
.hq-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hq-bar { height: 6px; border-radius: 9px; background: var(--surface-3); overflow: hidden; }
.hq-bar span { display: block; height: 100%; border-radius: 9px; }
.hq-v { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 13px; }
.split-bar { height: 26px; border-radius: 7px; background: var(--surface-3); overflow: hidden; margin: 14px 0 10px; }
.split-bar .q { display: block; height: 100%; background: var(--accent); }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Einstellungen ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.eyebrow.sec { display: block; margin: 22px 0 10px; }
.eyebrow.sec:first-child { margin-top: 0; }
.profile { display: flex; align-items: center; gap: 14px; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.set-title { font-weight: 500; }
.set-ctrl { flex: none; }
.num-unit { display: flex; align-items: center; gap: 6px; }

/* ---------- Overlays ---------- */
#overlay-root { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
#overlay-root > * { pointer-events: auto; }
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-start; justify-content: center; padding: 9vh 20px 20px; animation: fade .12s ease-out; }
[data-theme="light"] .backdrop { background: rgba(40, 35, 20, .28); }
.dialog {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  width: 520px; max-width: 100%; max-height: 84vh; overflow: auto; padding: 20px 22px; animation: pop .14s ease-out;
}
.dialog h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; align-items: center; }
.confirm p { margin: 6px 0 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } }
.popover {
  position: fixed; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow);
  max-height: 80vh; overflow: auto; animation: pop .12s ease-out; z-index: 60;
}
.popover.wide { width: 300px; }
.menu { padding: 6px; min-width: 220px; }
.menu-label { font-size: 11px; color: var(--muted); padding: 6px 8px 4px; text-transform: uppercase; letter-spacing: .08em; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 9px; border-radius: 7px; text-align: left; color: var(--text-2); }
.menu-item:hover { background: var(--surface-2); color: var(--text); }
.menu-item.sel { color: var(--text); }
.menu-item svg { width: 15px; height: 15px; color: var(--muted); }
.menu-empty { color: var(--muted); padding: 10px; font-size: 13px; }
.profile-menu { min-width: 250px; }
.pm-head { display: flex; align-items: center; gap: 10px; padding: 8px 9px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }

/* Aufgabenmenü */
.task-menu { padding: 12px; }
.task-menu .lbl:first-of-type { margin-top: 12px; }
.tm-title { font-weight: 500; }
.tm-scope { margin-bottom: 10px; }
.row-btn { display: flex; align-items: center; gap: 8px; width: 100%; height: 36px; padding: 0 10px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }
.row-btn span { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-btn:hover { border-color: var(--line-strong); }
.tm-quests { display: flex; flex-direction: column; gap: 1px; max-height: 170px; overflow-y: auto; }
.tm-time-head { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.tm-time-head .lbl { margin: 0; }
.tm-entries { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.tm-entry { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.tm-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.tm-status { opacity: 0; transition: opacity .2s; }
.tm-status.on { opacity: 1; }

/* Rich-Text */
.rte { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.rte-bar { display: flex; align-items: center; gap: 2px; padding: 5px 6px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rte-bar button { min-width: 26px; height: 26px; border-radius: 6px; color: var(--muted); font-size: 12.5px; padding: 0 5px; }
.rte-bar button:hover { background: var(--surface-2); color: var(--text); }
.rte-block { height: 26px; border-radius: 6px; background: transparent; border: 0; color: var(--muted); font-size: 12.5px; }
.rte-sep { width: 1px; height: 16px; background: var(--line); margin: 0 4px; }
.rte-body { min-height: 160px; padding: 10px 12px; outline: none; overflow-wrap: anywhere; }
.rte.compact .rte-body { min-height: 70px; max-height: 220px; overflow-y: auto; }
.rte.compact .rte-bar button { min-width: 22px; }
.rte-body:empty::before { content: attr(data-placeholder); color: var(--muted); }
.rte-body h1 { font-size: 20px; margin: 6px 0; } .rte-body h2 { font-size: 17px; margin: 6px 0; } .rte-body h3 { font-size: 15px; margin: 6px 0; }
.rte-body p { margin: 4px 0; }
.rte-body blockquote { border-left: 3px solid var(--line-strong); margin: 6px 0; padding-left: 10px; color: var(--text-2); }
.rte-body pre { background: var(--surface-2); padding: 8px 10px; border-radius: 8px; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; white-space: pre-wrap; }
.rte-body ul, .rte-body ol { padding-left: 22px; margin: 4px 0; }
.rte-body ul.checklist { list-style: none; padding-left: 4px; }
.rte-body ul.checklist li { position: relative; padding-left: 24px; }
.rte-body ul.checklist li::before { content: ""; position: absolute; left: 0; top: 3px; width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--line-strong); cursor: pointer; }
.rte-body ul.checklist li.checked { color: var(--muted); text-decoration: line-through; }
.rte-body ul.checklist li.checked::before { background: var(--accent); border-color: var(--accent); }
.rte-body hr { border: 0; border-top: 1px solid var(--line-strong); margin: 10px 0; }
.rte-body a { color: var(--accent); }

/* Wiederholung */
.dlg-head-icon { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.badge-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, var(--surface-2)); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.rep-every { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: var(--surface-2); margin-bottom: 12px; }
.rep-every select { flex: 1; }
.wd-row { display: flex; gap: 6px; margin-bottom: 14px; }
.wd { flex: 1; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 12.5px; }
.wd.on { background: color-mix(in srgb, var(--accent) 20%, var(--surface-2)); border-color: var(--accent); color: var(--text); }
.form-grid { display: grid; grid-template-columns: 90px 1fr; gap: 10px 12px; align-items: center; }
.form-grid > label { color: var(--muted); font-size: 13px; }
.ends { display: flex; gap: 8px; }
.rec-list { display: flex; flex-direction: column; margin-top: 12px; }
.rec-item { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rec-main { flex: 1; min-width: 0; }
.rec-title { font-weight: 500; }
.empty-box { color: var(--muted); padding: 24px 6px; text-align: center; }

/* Zeit erfassen */
.log-dlg h3 { margin-bottom: 6px; }
.log-dlg .lbl:first-of-type { margin-top: 12px; }
.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; z-index: 5; max-height: 260px; overflow-y: auto; }
.combo-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border-radius: 7px; text-align: left; }
.combo-item svg { width: 14px; height: 14px; color: var(--muted); }
.combo-item:hover, .combo-item.on { background: var(--surface-2); }
.hint { margin-top: 6px; }
.log-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; }

/* Command-Menü */
.palette-dialog { padding: 0 !important; overflow: hidden; }
.pal-input { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 52px; border-bottom: 1px solid var(--line); color: var(--muted); }
.pal-input input { flex: 1; background: transparent; border: 0; outline: none; font-size: 15px; color: var(--text); }
.pal-list { max-height: 420px; overflow-y: auto; padding: 6px; }
.pal-group { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 10px 10px 4px; }
.pal-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; color: var(--text-2); }
.pal-item svg { color: var(--muted); }
.pal-item.on { background: var(--surface-2); color: var(--text); }

/* Tastenkürzel */
.sc-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.sc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 36px; }
.sc-group { display: grid; gap: 8px; align-content: start; }
.sc-row { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 10px; color: var(--text-2); font-size: 13px; }

/* Toast */
#toast-root { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80; }
.toast { display: flex; align-items: center; gap: 12px; padding: 9px 10px 9px 16px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); font-size: 13px; animation: pop .15s ease-out; transition: opacity .25s; }
.toast.out { opacity: 0; }
.toast-btn { padding: 4px 10px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--bg) 30%, transparent); font-weight: 600; }

/* Schmalere Fenster */
@media (max-width: 980px) {
  .home-grid, .review-grid, .settings-grid { grid-template-columns: 1fr; }
  .card.span-2 { grid-column: auto; }
  .home-time { position: static; }
  .search-btn span, .search-btn kbd { display: none; }
  .search-btn { min-width: 0; }
  .qd-body { grid-template-columns: 1fr; }
  .qd-side { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 720px) {
  .nav a { padding: 6px 7px; font-size: 13px; }
  .brand span { display: none; }
  .page { padding: 18px 14px 30px; }
  .stat-row { grid-template-columns: 1fr; }
  .sc-grid { grid-template-columns: 1fr; }
}

/* ---------- Subquests ---------- */
.qc-subs { display: flex; flex-direction: column; gap: 2px; margin: 12px 0 10px; }
.qc-sub { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 7px; color: var(--text-2); font-size: 13px; text-align: left; width: 100%; }
.qc-sub:hover { background: var(--surface-2); color: var(--text); }
.qc-sub .dot { background: var(--c); }
.qc-sub-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qc-sub-v { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }
.qc-sub.completed .qc-sub-title { text-decoration: line-through; color: var(--muted); }
.qc-sub.add { color: var(--muted); font-size: 12px; }
.qc-sub.add svg { width: 13px; height: 13px; }
.qd-side select.input { height: 34px; }
.qd-subs { display: flex; flex-direction: column; gap: 2px; }
.qd-sub { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; text-align: left; color: var(--text-2); font-size: 13px; }
.qd-sub:hover { background: var(--surface-3); color: var(--text); }
.qd-sub.completed span:not(.dot) { color: var(--muted); }
.menu-item.sub { padding-left: 26px; }
.menu-item .mi-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-hint { padding: 6px 9px 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.hq-row.sub { margin-top: 6px; padding-left: 16px; font-size: 12.5px; color: var(--text-2); }
.hq-row.sub .hq-bar { height: 4px; opacity: .8; }

/* ---------- Microsoft Planner ---------- */
.qc-planner { display: flex; align-items: center; gap: 7px; margin-top: 10px; padding: 5px 9px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); font-size: 12px; width: fit-content; }
.qc-planner:hover { border-color: var(--line-strong); color: var(--text); }
.qc-planner svg { width: 14px; height: 14px; color: var(--c); }
.pl-note { padding: 6px 0; }
.planner-dlg .lbl:first-of-type { margin-top: 10px; }
.pl-steps { margin: 4px 0 6px; padding-left: 18px; color: var(--text-2); font-size: 13px; display: grid; gap: 4px; }
.input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.pl-error { margin-top: 12px; padding: 9px 11px; border-radius: 9px; background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); font-size: 12.5px; overflow-wrap: anywhere; }
.pl-code-box { display: grid; gap: 8px; justify-items: start; padding: 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.pl-code-box a { color: var(--accent); font-weight: 500; }
.pl-code { font: 600 26px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; }
.pl-account { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.pl-account svg { color: var(--accent); }
.pl-row { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.pl-row .lbl { margin: 0; }
.pl-plans { display: grid; gap: 2px; margin-top: 6px; max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.pl-plan { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 7px; cursor: pointer; }
.pl-plan:hover { background: var(--surface-2); }
.pl-plan input { accent-color: var(--accent); width: 15px; height: 15px; }
.pl-toggle { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 13px; }
.pl-status { margin-top: 12px; line-height: 1.5; }

/* ---------- Fokus: Buttons & Notizen ---------- */
.page.focus .focus-center { justify-content: flex-start; padding-top: 7vh; }
.focus-actions .btn.lg { min-width: 150px; justify-content: center; }
.focus-actions .btn.ghost { color: var(--text-2); }
.focus-actions .btn.ghost:hover { color: var(--text); }
.focus-notes { width: min(880px, 92vw); margin-top: 34px; text-align: left; }
.focus-rte { border: 0; background: transparent; border-radius: 0; }
.focus-rte .rte-bar { border-bottom: 1px solid var(--line); padding: 6px 0; }
.focus-rte .rte-body { min-height: 150px; padding: 16px 2px; font-size: 15px; line-height: 1.6; }
.focus-rte.expanded .rte-body { min-height: 55vh; }
.rte-expand { margin-left: auto; }
/* Fokus: Formatierungsleiste nur beim Schreiben bzw. Darüberfahren zeigen */
.focus-rte .rte-bar { opacity: 0; border-bottom-color: transparent; transition: opacity .15s, border-color .15s; }
.focus-rte:focus-within .rte-bar, .focus-rte:hover .rte-bar { opacity: 1; border-bottom-color: var(--line); }
.focus-rte .rte-body { color: var(--text-2); }
.focus-rte .rte-body:focus { color: var(--text); }

/* ---------- Aufgaben-Dialog ---------- */
.task-dialog { padding: 0 !important; overflow: hidden; display: flex; flex-direction: column; max-height: 86vh; }
.td-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 14px 26px; border-bottom: 1px solid var(--line); }
.td-status { opacity: 0; transition: opacity .2s; }
.td-status.on { opacity: 1; }
.td-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; min-height: 480px; flex: 1; overflow: hidden; }
.td-main { padding: 26px 26px 20px; overflow-y: auto; }
.td-title-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.td-title-row .check { width: 26px; height: 26px; }
.td-title-row .check svg { width: 14px; height: 14px; }
.td-title { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; font-size: 24px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.td-notes .rte { border: 0; background: transparent; border-radius: 0; }
.td-notes .rte-bar { border-bottom: 1px solid var(--line); padding: 6px 0 8px; }
.td-notes .rte-body { min-height: 320px; padding: 16px 2px; font-size: 15px; line-height: 1.6; }
.td-side { padding: 18px 20px 22px; background: var(--surface-2); border-left: 1px solid var(--line); overflow-y: auto; }
.td-side .lbl:first-child, .td-side .td-scope + .lbl { margin-top: 4px; }
.td-scope { margin-bottom: 8px; }
.td-side .row-btn { background: transparent; border-color: transparent; padding-left: 4px; }
.td-side .row-btn:hover { background: var(--surface-3); }
.td-sep { height: 1px; background: var(--line); margin: 16px 0 6px; }
.td-note { display: flex; gap: 6px; align-items: flex-start; margin: 6px 0 8px; }
.td-note svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }
@media (max-width: 860px) { .td-body { grid-template-columns: 1fr; } .td-side { border-left: 0; border-top: 1px solid var(--line); } }

/* Fokus: Platzhalter im Notizfeld nur beim Darüberfahren zeigen */
.focus-rte .rte-body:empty::before { opacity: 0; transition: opacity .15s; }
.focus-rte:hover .rte-body:empty::before { opacity: .7; }
.focus-rte .rte-body:focus:empty::before { opacity: .5; }

/* ---------- Inbox ---------- */
.inbox-sec { margin-top: 4px; }
.sec-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); padding: 2px 0; }
.sec-toggle svg { width: 13px; height: 13px; }
.sec-toggle:hover, .sec-toggle:hover .eyebrow { color: var(--text); }
.inbox-hint { margin-left: 6px; }
.inbox-list .task { background: color-mix(in srgb, var(--surface) 70%, var(--bg)); border-style: dashed; }
.task .due { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.task .due.overdue { color: var(--danger); }
.task .to-today { width: 24px; height: 24px; }
.task .to-today svg { width: 13px; height: 13px; }

/* =====================================================================
   HANDY-ANSICHT (nur unter 760px Breite – Desktop bleibt unverändert)
   ===================================================================== */
.tabbar, .fab { display: none; }

@media (max-width: 760px) {
  html, body { height: 100%; }
  body { height: 100dvh; }

  /* --- Kopfzeile: nur Logo links, Suche rechts --- */
  .topbar { height: auto; min-height: 52px; padding: calc(env(safe-area-inset-top) + 6px) 16px 6px; border-bottom: 0; gap: 10px; background: var(--bg); }
  .topbar .nav, .topbar .run-pill, .topbar .avatar, .topbar .save-dot { display: none !important; }
  .brand span { display: inline !important; font-size: 17px; }
  .brand svg { width: 22px; height: 22px; }
  .search-btn { min-width: 0; width: 38px; height: 38px; padding: 0; justify-content: center; border-radius: 12px; }
  .search-btn span, .search-btn kbd { display: none; }

  /* --- Inhalt: Platz für die untere Leiste --- */
  .main { padding-bottom: calc(112px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
  .page { padding: 10px 16px 24px; }
  .page-head { margin-bottom: 16px; align-items: center; }
  .page-head h1 { font-size: 26px; }

  /* --- Home: einspaltig, ohne Zeitachse und Eingabezeilen (dafür Plus-Knopf) --- */
  .home-grid { grid-template-columns: 1fr; gap: 0; }
  .home-time, .home .inbox-sec, .home .add-row, .plan .add-row { display: none !important; }
  .head-stats { gap: 12px; }
  .big-stat .v { font-size: 20px; }
  .week-meter { display: none; }
  .home-lists section { margin-bottom: 22px; }

  /* --- Aufgabenkarten: größere Tippflächen, Aktionen immer sichtbar --- */
  .task { padding: 12px 12px 11px 16px; border-radius: 14px; }
  .task-title { font-size: 15px; }
  .task-more { opacity: 1; width: 32px; height: 32px; margin: -6px -6px 0 0; }
  .task .play { display: none; }
  .check { width: 24px; height: 24px; }
  .check svg { width: 13px; height: 13px; }
  .chip { height: 26px; font-size: 12.5px; max-width: 190px; }
  .task .to-today { width: 32px; height: 32px; }
  .task-list { gap: 10px; }

  /* --- Plan als senkrechte Liste --- */
  .m-day { margin-bottom: 22px; }
  .m-day-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px 8px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
  .m-day.today .m-day-head { border-bottom-color: var(--accent); }
  .m-day-name { font-weight: 600; font-size: 16px; }
  .m-day.today .m-day-name { color: var(--accent); }
  .m-day-date { margin-left: 8px; }
  .m-day-add { width: 34px; height: 34px; }
  .m-day-empty { color: var(--muted); font-size: 13px; padding: 4px 2px; }

  /* --- Inbox- und Mehr-Seite --- */
  .m-empty-state { display: grid; justify-items: center; gap: 6px; padding: 60px 20px; color: var(--text-2); text-align: center; }
  .m-empty-state svg { width: 34px; height: 34px; color: var(--muted); margin-bottom: 6px; }
  .m-group { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin-bottom: 18px; }
  .m-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; text-align: left; font-size: 15px; border-bottom: 1px solid var(--line); }
  .m-item:last-child { border-bottom: 0; }
  .m-item:active { background: var(--surface-2); }
  .m-item-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); }
  .m-item-chev { margin-left: auto; color: var(--muted); display: inline-flex; }
  .m-item .muted.ml-auto + .m-item-chev { margin-left: 6px; }

  /* --- Quests, Review, Settings einspaltig --- */
  .quest-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr 1fr; }
  .stat { padding: 12px; }
  .stat-v { font-size: 20px; }
  .tabs-row { flex-wrap: wrap; gap: 8px; }
  .review-grid, .settings-grid { grid-template-columns: 1fr; gap: 14px; }
  .card.span-2 { grid-column: auto; }
  .set-row { flex-wrap: wrap; }
  .seg { flex-wrap: wrap; }

  /* --- Dialoge als Blatt von unten --- */
  .backdrop { align-items: flex-end; padding: 0; }
  .dialog { width: 100% !important; max-width: 100%; max-height: 92dvh; border-radius: 22px 22px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); animation: sheet-up .22s cubic-bezier(.2, .9, .3, 1); }
  @keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
  .task-dialog, .quest-dialog, .palette-dialog { padding: 0 !important; }
  .td-body, .qd-body { grid-template-columns: 1fr; min-height: 0; }
  .td-side { border-left: 0; border-top: 1px solid var(--line); }
  .td-main { padding: 18px 18px 8px; }
  .td-title { font-size: 20px; }
  .td-notes .rte-body { min-height: 140px; }
  .td-notes .rte-bar { flex-wrap: nowrap; overflow-x: auto; }
  .td-head, .qd-head { padding: 14px 16px 12px 18px; }
  .popover { max-width: calc(100vw - 16px); }
  .popover.wide { width: calc(100vw - 16px); }
  #toast-root { bottom: calc(104px + env(safe-area-inset-bottom)); width: calc(100% - 32px); display: flex; justify-content: center; }
  .sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: -6px auto 12px; }

  /* --- Eingabeblatt (Plus-Knopf) --- */
  .add-sheet { display: grid; gap: 12px; }
  .as-title { width: 100%; background: transparent; border: 0; outline: none; font-size: 19px; font-weight: 500; color: var(--text); padding: 4px 2px 8px; border-bottom: 1px solid var(--line); }
  .as-row { display: flex; gap: 8px; flex-wrap: wrap; }
  .as-chip { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: 17px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); font-size: 14px; }
  .as-chip.on { background: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); border-color: var(--accent); color: var(--text); }
  .as-chip svg { width: 15px; height: 15px; }
  .as-chip input[type=date] { position: absolute; inset: 0; opacity: 0; width: 100%; }
  .as-add { height: 46px; font-size: 16px; margin-top: 4px; border-radius: 14px; }

  /* --- Aktionsblatt (⋯ auf einer Aufgabe) --- */
  .action-sheet { display: grid; gap: 14px; }
  .as-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
  .as-head-title { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
  .as-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .as-grid > * { position: relative; display: grid; justify-items: center; gap: 6px; padding: 12px 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); }
  .as-grid svg { width: 19px; height: 19px; color: var(--accent); }
  .as-pick input { position: absolute; inset: 0; opacity: 0; width: 100%; }
  .as-list { display: grid; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
  .as-list button { display: flex; align-items: center; gap: 12px; padding: 14px 14px; text-align: left; font-size: 15px; border-bottom: 1px solid var(--line); }
  .as-list button:last-child { border-bottom: 0; }
  .as-list button svg { width: 17px; height: 17px; color: var(--muted); }
  .as-list button.danger, .as-list button.danger svg { color: var(--danger); }

  /* --- Untere Leiste: Liquid Glass --- */
  .tabbar { display: block; position: fixed; left: 14px; right: 14px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40; }
  .tabbar-glass {
    position: relative; display: flex; justify-content: space-around; align-items: center; height: 66px; padding: 0 6px;
    border-radius: 33px; overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .05) 55%, rgba(255, 255, 255, .08)), rgba(28, 28, 34, .42);
    -webkit-backdrop-filter: blur(24px) saturate(185%); backdrop-filter: blur(24px) saturate(185%);
    border: 1px solid rgba(255, 255, 255, .18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -1px 1px rgba(255, 255, 255, .08), 0 12px 34px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .25);
  }
  .tabbar-glass::before { /* Glanzlicht oben */
    content: ""; position: absolute; left: 10%; right: 10%; top: 0; height: 45%; border-radius: 0 0 50% 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0)); pointer-events: none;
  }
  .tab { position: relative; isolation: isolate; flex: 1; display: grid; justify-items: center; gap: 3px; padding: 7px 0 6px; text-decoration: none; color: rgba(236, 236, 238, .72); font-size: 10.5px; font-weight: 500; border-radius: 24px; transition: color .2s; }
  .tab svg { width: 23px; height: 23px; }
  .tab.on { color: var(--accent); }
  .tab.on::before { /* Glasblase hinter dem aktiven Tab */
    content: ""; position: absolute; inset: 2px 4px; border-radius: 24px; z-index: -1;
    background: linear-gradient(180deg, rgba(255, 255, 255, .20), rgba(255, 255, 255, .06));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 0 0 1px rgba(255, 255, 255, .10);
  }
  .tab-ico { position: relative; display: inline-flex; }
  .tab-badge { position: absolute; top: -5px; right: -11px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
  .tab-badge[hidden] { display: none; }

  /* --- Plus-Knopf --- */
  .fab {
    display: grid; place-items: center; position: fixed; right: 20px; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 41;
    width: 58px; height: 58px; border-radius: 29px; color: var(--accent-ink);
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 85%, white), var(--accent));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 10px 26px rgba(0, 0, 0, .45);
  }
  .fab[hidden] { display: none; }
  .fab svg { width: 26px; height: 26px; stroke-width: 2.2; }

  [data-theme="light"] .tabbar-glass {
    background: linear-gradient(180deg, rgba(255, 255, 255, .75), rgba(255, 255, 255, .45)), rgba(246, 245, 242, .5);
    border-color: rgba(255, 255, 255, .7);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 12px 30px rgba(40, 35, 20, .18), 0 2px 6px rgba(40, 35, 20, .1);
  }
  [data-theme="light"] .tab { color: rgba(29, 28, 26, .62); }
  [data-theme="light"] .tab.on { color: var(--accent); }
  [data-theme="light"] .tab.on::before { background: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .6)); box-shadow: inset 0 1px 0 #fff, 0 1px 4px rgba(40, 35, 20, .12); }

  /* Fokus am Handy: kompakter */
  .focus-clock { font-size: 92px; }
  .focus-actions .btn.lg { min-width: 0; }
}

/* ---------- Quest-Schnellwahl mit „#“ ---------- */
.hash-menu { position: fixed; z-index: 70; max-height: 300px; overflow-y: auto; padding: 6px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow); animation: pop .1s ease-out; }
.hash-head { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 4px 8px 6px; }
.hash-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 9px; border-radius: 8px; text-align: left; color: var(--text-2); }
.hash-item.sub { padding-left: 24px; }
.hash-item.on { background: var(--surface-2); color: var(--text); }
.hash-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hash-parent { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.hash-chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 4px 0 8px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; color: var(--text-2); white-space: nowrap; flex: none; max-width: 180px; overflow: hidden; }
.hash-chip-x { width: 18px; height: 18px; border-radius: 9px; color: var(--muted); font-size: 14px; line-height: 1; display: grid; place-items: center; }
.hash-chip-x:hover { background: var(--surface-3); color: var(--text); }
.add-row.small .hash-chip { max-width: 110px; }

/* ---------- Home: heute erledigte Aufgaben (Stapel / Liste) ---------- */
.done-group { margin-top: 10px; }
.done-group .task .play { display: none; }
.done-stack { position: relative; }
.done-group.layers-1 .done-stack { padding-bottom: 9px; }
.done-group.layers-2 .done-stack { padding-bottom: 14px; }
.done-stack > .task { position: relative; z-index: 3; }
.stack-layer { position: absolute; height: 22px; border: 1px solid var(--line-strong); border-top: 0; border-radius: 0 0 11px 11px; background: var(--surface-2); }
.stack-layer.l1 { left: 7px; right: 7px; z-index: 2; }
.layers-1 .stack-layer.l1 { bottom: 0; }
.layers-2 .stack-layer.l1 { bottom: 6px; }
.stack-layer.l2 { left: 14px; right: 14px; bottom: 0; z-index: 1; opacity: .6; }
.done-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; padding: 4px 6px; border-radius: 7px; }
.done-toggle svg { width: 14px; height: 14px; }
.done-toggle:hover { color: var(--text); background: var(--surface-2); }
.done-toggle.on-stack { position: absolute; right: 10px; z-index: 4; }
.layers-1 .done-toggle.on-stack { bottom: 15px; }
.layers-2 .done-toggle.on-stack { bottom: 21px; }
.done-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0 10px; }
.done-divider::before { content: ""; flex: 1; height: 1px; background: var(--line); }
.done-stack .task-time { display: none; } /* Platz für „Show all“ */

/* =====================================================================
   Anmeldung, Account, Admin
   ===================================================================== */
body.auth-mode .topbar, body.auth-mode .tabbar, body.auth-mode .fab { display: none !important; }
body.auth-mode .main { padding-bottom: 0; }
.auth-wrap { min-height: 100%; display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px 26px 24px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 17px; margin-bottom: 18px; }
.auth-brand svg { width: 24px; height: 24px; color: var(--accent); }
.auth-card h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 6px; }
.auth-sub { margin: 0 0 6px; }
.auth-card form { display: grid; gap: 0; margin-top: 8px; }
.auth-card .input { height: 40px; }
.auth-submit { margin-top: 16px; height: 42px; justify-content: center; }
.auth-error { color: var(--danger); font-size: 13px; min-height: 0; margin-top: 10px; overflow-wrap: anywhere; }
.auth-error:empty { display: none; }
.auth-note { margin: 12px 0 4px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); font-size: 13px; line-height: 1.5; }
.auth-note.ok { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.auth-links { margin-top: 18px; font-size: 13px; display: flex; justify-content: space-between; }
.auth-links a { color: var(--accent); text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }
.auth-hint { margin-top: 6px; }

.menu-sep { height: 1px; background: var(--line); margin: 4px 0; }
.acting-bar { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; padding: calc(env(safe-area-inset-top) + 7px) 14px 7px; background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 500; z-index: 6; }
.acting-bar[hidden] { display: none; }
.acting-bar svg { width: 15px; height: 15px; vertical-align: -3px; margin-right: 7px; }
.acting-bar .btn { background: rgba(0, 0, 0, .14); border-color: rgba(0, 0, 0, .18); color: inherit; }
.acting-bar .btn:hover { background: rgba(0, 0, 0, .24); }
.ab-mail { opacity: .75; font-weight: 400; }
body.acting .topbar { border-top: 0; }
.profile-name { font-weight: 600; font-size: 16px; }

.acct-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; max-width: 1000px; }
.acct-form { display: grid; gap: 0; margin-top: 8px; }
.acct-form .btn { margin-top: 14px; justify-self: start; }
.acct-danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.card > .eyebrow { margin-bottom: 4px; }

.admin .card { margin-bottom: 16px; }
.ad-invite-form { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.ad-invite-form input { flex: 1 1 240px; width: auto; }
.ad-invite-form select { flex: 0 0 110px; width: 110px; }
.ad-link-box { margin-top: 14px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); display: grid; gap: 8px; }
.ad-link-row { display: flex; gap: 8px; }
.ad-link-row input { flex: 1; min-width: 0; font-size: 12px; }
.ad-sub { display: block; margin: 18px 0 6px; }
.ad-list { display: grid; }
.ad-row { display: flex; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; flex-wrap: wrap; }
.ad-row:last-child { border-bottom: 0; }
.ad-when { min-width: 140px; }
.audit { max-height: 360px; overflow-y: auto; }
.ad-table-wrap { overflow-x: auto; margin-top: 8px; }
.ad-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ad-table th { text-align: left; font-weight: 600; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ad-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ad-table tr:last-child td { border-bottom: 0; }
.ad-name { font-weight: 550; }
.ad-actions { white-space: nowrap; text-align: right; }
.ad-actions .btn + .btn { margin-left: 4px; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 600; margin-left: 4px; }
.badge.warn { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
select.input.sm { height: 30px; font-size: 13px; padding: 0 6px; width: auto; }

@media (max-width: 760px) {
  .acct-grid { grid-template-columns: 1fr; }
  .auth-wrap { place-items: start center; padding-top: 12vh; }
  .ad-invite-form select { flex: 1 1 100px; }
  .acting-bar { font-size: 12.5px; gap: 8px; }
}

@media (max-width: 760px) {
  /* Konten als Karten statt Tabelle */
  .ad-table, .ad-table tbody { display: block; }
  .ad-table thead { display: none; }
  .ad-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
  .ad-table tr:last-child { border-bottom: 0; }
  .ad-table td { display: block; padding: 0; border: 0; }
  .ad-table td:first-child, .ad-table td.ad-actions { grid-column: 1 / -1; }
  .ad-table td[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
  .ad-table td.ad-actions { display: flex; flex-wrap: wrap; gap: 6px; text-align: left; white-space: normal; margin-top: 4px; }
  .ad-actions .btn + .btn { margin-left: 0; }
}
