:root {
  --bg: #f4f1ea;
  --card: #fffdf8;
  --ink: #23221f;
  --muted: #77736a;
  --line: #e2ddd1;
  --accent: #2f6b5a;
  --accent-ink: #ffffff;
  --ok: #2f6b5a;
  --ok-bg: #e2efe9;
  --bad: #a3402b;
  --bad-bg: #f6e3dd;
  --warn: #8a6410;
  --warn-bg: #f5ead0;
  --radius: 10px;
  color-scheme: light;
}
/* Dunkel: automatisch nach Gerät, außer jemand hat Hell gewählt; oder fest Dunkel */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1b1c1a;
    --card: #242522;
    --ink: #ebe8e1;
    --muted: #9b978d;
    --line: #36372f;
    --accent: #6fb39c;
    --accent-ink: #12221c;
    --ok: #8fd0b8;
    --ok-bg: #20352d;
    --bad: #f0a08d;
    --bad-bg: #3d2520;
    --warn: #e6c27a;
    --warn-bg: #3a3020;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1b1c1a;
    --card: #242522;
    --ink: #ebe8e1;
    --muted: #9b978d;
    --line: #36372f;
    --accent: #6fb39c;
    --accent-ink: #12221c;
    --ok: #8fd0b8;
    --ok-bg: #20352d;
    --bad: #f0a08d;
    --bad-bg: #3d2520;
    --warn: #e6c27a;
    --warn-bg: #3a3020;
}
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
a.active { font-weight: 600; text-decoration: none; }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: .92em; word-break: break-all; }

.top {
  display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: .01em; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.top nav a { text-decoration: none; color: var(--ink); }
.top nav a:hover { color: var(--accent); }

main { max-width: 860px; margin: 0 auto; padding: 18px 16px 48px; }
h1 { font-size: 1.5rem; margin: .3em 0 .6em; }
h1 small { font-size: .9rem; font-weight: 400; color: var(--muted); display: block; }
h2 { font-size: 1.1rem; margin: 0 0 .6em; }
h3 { font-size: 1rem; margin: 0 0 .3em; }
.small-h { font-size: .95rem; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 0 0 14px;
}
.card.mine { border-color: var(--accent); }
.narrow { max-width: 420px; margin: 40px auto; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

.flash { padding: 10px 12px; border-radius: 8px; margin: 0 0 14px; background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--bad-bg); color: var(--bad); }

form { margin: 0; }
label { display: block; margin: 0 0 10px; font-size: .92rem; }
label.check { display: inline-flex; gap: 6px; align-items: center; margin: 0 12px 6px 0; }
input, select, button {
  font: inherit; color: inherit; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); padding: 8px 10px;
}
input:not([type=checkbox]):not([type=radio]):not([type=file]), select { width: 100%; margin-top: 3px; }
input[type=checkbox], input[type=radio] { width: 1.05em; height: 1.05em; accent-color: var(--accent); }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button { cursor: pointer; background: var(--bg); }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.ghost { background: transparent; }
button.small { padding: 4px 10px; font-size: .86rem; }
input.num { width: 5em !important; }
.linkbox { font-family: ui-monospace, monospace; font-size: .85rem; }

.row { display: flex; gap: 8px; align-items: center; }
.row > input, .row > select { margin-top: 0; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row .grow, .grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.stack input { margin-top: 0 !important; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; margin-top: 10px; }
.grid .span2 { grid-column: span 2; }

.weeknav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.weeknav h1 { text-align: center; margin: .2em 0; }
.weeknav a { text-decoration: none; white-space: nowrap; }

ul.tasks, ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: 0; }
.task {
  display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.task:last-child { border-bottom: 0; }
.task.st-done .tt { text-decoration: line-through; color: var(--muted); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.person { padding: 8px 0; }
.person + .person { border-top: 1px solid var(--line); }

.tag { display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
td.bad { color: var(--bad); font-weight: 600; }

.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .82rem; }
tr.muted td { opacity: .6; }
.qr { display: block; margin: 10px 0; border-radius: 8px; background: #fff; padding: 6px; }

@media (max-width: 560px) {
  .weeknav a { font-size: .85rem; }
  .grid .span2 { grid-column: auto; }
  .row:not(.wrap):not(.between) { flex-direction: column; align-items: stretch; }
}

/* ---------- Abhak-Effekt ---------- */
.task.just-done { animation: done-glow 1.1s ease-out; border-radius: 8px; }
.task.just-done .tick { display: inline-block; animation: tick-pop .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes done-glow {
  0% { background: var(--ok-bg); box-shadow: 0 0 0 0 var(--ok); }
  40% { background: var(--ok-bg); box-shadow: 0 0 0 4px var(--ok-bg); }
  100% { background: transparent; box-shadow: 0 0 0 0 transparent; }
}
@keyframes tick-pop { 0% { transform: scale(0); } 70% { transform: scale(1.5); } 100% { transform: scale(1); } }

.alldone { animation: tick-pop .6s cubic-bezier(.3,1.6,.5,1); text-align: center; font-weight: 600; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.confetti i {
  position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; opacity: 0;
  background: var(--accent); animation: confetti-fall 2.4s ease-in forwards;
}
.confetti i:nth-child(4n+1) { background: #e0a33a; }
.confetti i:nth-child(4n+2) { background: #c4573f; }
.confetti i:nth-child(4n+3) { background: #5a8fd6; width: 7px; height: 7px; border-radius: 50%; }
@keyframes confetti-fall {
  0% { opacity: 1; transform: translate3d(0, 0, 0) rotate(0deg); }
  100% { opacity: 0; transform: translate3d(var(--dx, 30px), 105vh, 0) rotate(var(--rot, 540deg)); }
}
.confetti i:nth-child(1) { left: 1.1%; animation-delay: 0.11s; animation-duration: 2.45s; --dx: -62px; --rot: -360deg; }
.confetti i:nth-child(2) { left: 3.7%; animation-delay: 0.41s; animation-duration: 2.71s; --dx: -26px; --rot: 360deg; }
.confetti i:nth-child(3) { left: 7.3%; animation-delay: 0.29s; animation-duration: 2.04s; --dx: 61px; --rot: -540deg; }
.confetti i:nth-child(4) { left: 10.7%; animation-delay: 0.4s; animation-duration: 2.75s; --dx: 80px; --rot: -360deg; }
.confetti i:nth-child(5) { left: 17.9%; animation-delay: 0.4s; animation-duration: 2.2s; --dx: -24px; --rot: 360deg; }
.confetti i:nth-child(6) { left: 19.9%; animation-delay: 0.09s; animation-duration: 2.22s; --dx: 58px; --rot: 360deg; }
.confetti i:nth-child(7) { left: 23.5%; animation-delay: 0.39s; animation-duration: 2.48s; --dx: -54px; --rot: -360deg; }
.confetti i:nth-child(8) { left: 27.1%; animation-delay: 0.13s; animation-duration: 1.9s; --dx: -64px; --rot: -360deg; }
.confetti i:nth-child(9) { left: 28.6%; animation-delay: 0.14s; animation-duration: 2.48s; --dx: 29px; --rot: 720deg; }
.confetti i:nth-child(10) { left: 33.8%; animation-delay: 0.65s; animation-duration: 2.16s; --dx: -17px; --rot: 540deg; }
.confetti i:nth-child(11) { left: 38.3%; animation-delay: 0.17s; animation-duration: 2.37s; --dx: 54px; --rot: -540deg; }
.confetti i:nth-child(12) { left: 42.6%; animation-delay: 0.51s; animation-duration: 2.09s; --dx: -62px; --rot: 360deg; }
.confetti i:nth-child(13) { left: 44.7%; animation-delay: 0.12s; animation-duration: 2.14s; --dx: 45px; --rot: -540deg; }
.confetti i:nth-child(14) { left: 46.4%; animation-delay: 0.47s; animation-duration: 2.56s; --dx: 66px; --rot: 720deg; }
.confetti i:nth-child(15) { left: 51.1%; animation-delay: 0.25s; animation-duration: 2.3s; --dx: 36px; --rot: 360deg; }
.confetti i:nth-child(16) { left: 56.7%; animation-delay: 0.66s; animation-duration: 2.27s; --dx: -64px; --rot: 360deg; }
.confetti i:nth-child(17) { left: 59.9%; animation-delay: 0.22s; animation-duration: 2.38s; --dx: 34px; --rot: 720deg; }
.confetti i:nth-child(18) { left: 63.4%; animation-delay: 0.62s; animation-duration: 2.15s; --dx: 38px; --rot: 720deg; }
.confetti i:nth-child(19) { left: 64.7%; animation-delay: 0.08s; animation-duration: 1.86s; --dx: -7px; --rot: 540deg; }
.confetti i:nth-child(20) { left: 70.6%; animation-delay: 0.28s; animation-duration: 2.72s; --dx: 47px; --rot: 360deg; }
.confetti i:nth-child(21) { left: 71.9%; animation-delay: 0.28s; animation-duration: 2.08s; --dx: -45px; --rot: -540deg; }
.confetti i:nth-child(22) { left: 78.2%; animation-delay: 0.19s; animation-duration: 2.22s; --dx: 11px; --rot: -540deg; }
.confetti i:nth-child(23) { left: 82.2%; animation-delay: 0.11s; animation-duration: 1.98s; --dx: -21px; --rot: 540deg; }
.confetti i:nth-child(24) { left: 82.0%; animation-delay: 0.58s; animation-duration: 1.98s; --dx: -8px; --rot: 360deg; }
.confetti i:nth-child(25) { left: 86.1%; animation-delay: 0.37s; animation-duration: 2.41s; --dx: 1px; --rot: 540deg; }
.confetti i:nth-child(26) { left: 91.8%; animation-delay: 0.36s; animation-duration: 2.42s; --dx: -67px; --rot: -540deg; }
.confetti i:nth-child(27) { left: 96.2%; animation-delay: 0.55s; animation-duration: 2.67s; --dx: 63px; --rot: -540deg; }
.confetti i:nth-child(28) { left: 97.8%; animation-delay: 0.28s; animation-duration: 2.28s; --dx: 22px; --rot: 360deg; }

@media (prefers-reduced-motion: reduce) {
  .task.just-done, .task.just-done .tick, .alldone { animation: none; }
  .confetti { display: none; }
}

/* ---------- Tausch ---------- */
.swapbox { border: 1px dashed var(--accent); border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; }
.swapbox p { margin: 0 0 8px; }
.swapbox.out { border-color: var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.swapbox.out p { margin: 0; }
a.btnlink { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px;
  text-decoration: none; color: var(--ink); background: transparent; font-size: .86rem; }
a.btnlink:hover { border-color: var(--accent); }
fieldset.plainset { border: 0; padding: 0; margin: 0 0 12px; }
fieldset.plainset legend { font-size: .92rem; margin-bottom: 6px; }
label.choice { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); margin: 0; }
label.choice input { margin-top: 4px; }
details summary { cursor: pointer; }

/* ---------- Info-Seite und Fußzeile ---------- */
.foot { max-width: 860px; margin: 0 auto; padding: 0 16px 32px; text-align: center; font-size: .82rem; }
.foot a { color: var(--muted); }
.prose h2 { margin-top: 1.4em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin: .3em 0; }

a.btnlink.disabled, span.btnlink.disabled { color: var(--muted); border-style: dashed; cursor: default; }
span.btnlink { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: .86rem; }
