:root {
  --bg: #f5f6f8; --card: #fff; --text: #1d2330; --muted: #6b7385; --line: #e2e5ec;
  --accent: #2f6fed; --accent-text: #fff; --danger: #c93a3a; --ok: #2e9e5b;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #12151c; --card: #1b202b; --text: #e8ebf2; --muted: #9aa3b5; --line: #2b3242; --accent: #5b92ff; --accent-text: #0b1220; --danger: #ef6b6b; --ok: #4cc084; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#app { max-width: 720px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
header.top { display: flex; align-items: center; gap: 8px; padding: 12px 16px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
header.top h1 { font-size: 1.15rem; margin: 0; flex: 1; }
main { padding: 0 16px 16px; }
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
nav.tabs button { flex: 1; border: 0; background: none; color: var(--muted); padding: 12px 4px; font: inherit; font-size: .85rem; min-height: 56px; }
nav.tabs button[aria-current="true"] { color: var(--accent); font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
button, select, input, textarea { font: inherit; color: inherit; }
button.btn { background: var(--accent); color: var(--accent-text); border: 0; border-radius: 10px; padding: 10px 14px; min-height: 44px; cursor: pointer; }
button.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
button.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
button.icon { background: none; border: 0; color: var(--accent); font-size: 1.3rem; min-width: 44px; min-height: 44px; cursor: pointer; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], select, textarea {
  width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); min-height: 44px;
}
label { display: block; font-size: .85rem; color: var(--muted); margin: 10px 0 4px; }
label.inline { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 1rem; margin: 6px 0; }
label.inline input { width: 20px; height: 20px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.muted { color: var(--muted); font-size: .9rem; }
.error { color: var(--danger); margin: 8px 0; }

/* Kalender */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 8px; }
.cal-head strong { font-size: 1.1rem; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.grid .dow { text-align: center; font-size: .75rem; color: var(--muted); padding: 4px 0; }
.day { aspect-ratio: 1 / 1; border: 0; border-radius: 10px; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 6px; gap: 3px; cursor: pointer; }
.day.other { opacity: .45; }
.day.today .n { background: var(--accent); color: var(--accent-text); border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; }
.day.sel { outline: 2px solid var(--accent); }
.dots { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: block; }
.ev { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: flex-start; cursor: pointer; }
.ev:last-child { border-bottom: 0; }
.ev .t { min-width: 58px; color: var(--muted); font-size: .9rem; }
.ev .title { font-weight: 600; }

/* Aufgaben */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; }
.chip { white-space: nowrap; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px; padding: 8px 14px; min-height: 40px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task input[type=checkbox] { width: 24px; height: 24px; margin-top: 2px; flex: none; }
.task .body { flex: 1; cursor: pointer; min-width: 0; }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.task .meta { font-size: .85rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.task .meta .late { color: var(--danger); font-weight: 600; }
.av { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: .7rem; font-weight: 700; }

/* Formular-Sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop[hidden] { display: none; }
.sheet { background: var(--card); width: 100%; max-width: 720px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet h2 { margin: 0 0 4px; font-size: 1.1rem; }
.sheet .actions { display: flex; gap: 8px; margin-top: 16px; }
.sheet .actions .btn { flex: 1; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 80px; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30; }
#toast.show { opacity: 1; }
.auth { padding: 32px 16px; max-width: 420px; margin: 0 auto; }
