:root {
  --bg: #f4f6f8;
  --card: #fff;
  --text: #1d2430;
  --muted: #6b7482;
  --line: #e3e7ec;
  --accent: #2f6fdb;
  --ok: #2e9e5b;
  --okbg: #e6f6ec;
  --warn: #d98c1b;
  --warnbg: #fff4e0;
  --err: #c93b3b;
  --errbg: #fdecec;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.35rem; margin: 0 0 .25rem; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
h3 { font-size: .95rem; margin: .9rem 0 .3rem; color: var(--muted); }
.muted { color: var(--muted); font-weight: normal; font-size: .9em; }
.tag { display: inline-block; background: #e8eefb; color: var(--accent); font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; vertical-align: middle; font-weight: 600; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem 1rem;
}
.brand { font-weight: 700; color: var(--text); }
.topbar nav a { margin-left: .9rem; font-weight: 500; }
.topbar nav a.on { border-bottom: 2px solid var(--accent); padding-bottom: .15rem; }

.wrap { max-width: 720px; margin: 0 auto; padding: .8rem .8rem 3rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; margin-bottom: .8rem; }
.card.narrow { max-width: 400px; margin: 2rem auto; }
.card.head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.card.danger { border-color: #f1c4c4; }
.sub { margin: 0; color: var(--muted); font-size: .9rem; }
.rowbetween { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.row { display: flex; align-items: center; gap: .6rem; margin-top: .5rem; }

.progress { text-align: center; min-width: 5.5rem; }
.progress .num { font-size: 1.6rem; font-weight: 700; color: var(--ok); line-height: 1; }
.progress .lbl { font-size: .75rem; color: var(--muted); }

.daynav { display: flex; align-items: center; justify-content: center; gap: .6rem; margin: .2rem 0 .8rem; }
.datepick input, .datepick select { font: inherit; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }

.btn {
  display: inline-block; font: inherit; padding: .5rem .9rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer;
  text-align: center; line-height: 1.2;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn:disabled { opacity: .5; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: .2rem .4rem; }
.link:hover { color: var(--err); }

/* Item-Zeilen */
.item {
  display: grid; grid-template-columns: 1.6rem 1fr auto; gap: .6rem; align-items: center;
  padding: .6rem 0; border-top: 1px solid var(--line);
}
.item:first-of-type { border-top: 0; }
.item .check {
  width: 1.3rem; height: 1.3rem; border-radius: 50%; border: 2px solid var(--line); position: relative;
}
.item.done .check { background: var(--ok); border-color: var(--ok); }
.item.done .check::after {
  content: ""; position: absolute; left: .38rem; top: .14rem; width: .3rem; height: .6rem;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.item.over .check { background: var(--warn); border-color: var(--warn); }
.item.free .check { border-style: dashed; }
.item.free.done .check, .item.free .check { background: transparent; }
.item .name { font-weight: 600; }
.item.done .name { color: var(--ok); }
.item.over .name { color: var(--warn); }
.item .hint { font-size: .8rem; color: var(--muted); }
.ctrl { display: flex; align-items: center; gap: .3rem; }
.ctrl .btn { width: 2.4rem; height: 2.4rem; padding: 0; font-size: 1.3rem; font-weight: 600; }
.ctrl .plus { background: var(--accent); color: #fff; border-color: var(--accent); }
.ctrl .qty { min-width: 5.5rem; text-align: center; font-variant-numeric: tabular-nums; font-size: .9rem; white-space: nowrap; }

/* Formulare */
.form label { display: block; margin-bottom: .8rem; font-weight: 600; font-size: .9rem; }
.form input { display: block; width: 100%; margin-top: .25rem; font: inherit; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; }
.form .btn { width: 100%; margin-top: .3rem; }
.inline { display: flex; gap: .5rem; flex-wrap: wrap; }
.inline input { flex: 1 1 10rem; font: inherit; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; }
textarea { width: 100%; font: inherit; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.alert { background: var(--errbg); color: var(--err); padding: .6rem .8rem; border-radius: 8px; font-size: .9rem; }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: var(--text); color: #fff; padding: .6rem 1rem; border-radius: 8px; z-index: 9; font-size: .9rem; }
.toast.err { background: var(--err); }

/* Protokoll */
.log { width: 100%; border-collapse: collapse; font-size: .9rem; }
.log td { padding: .4rem .3rem; border-top: 1px solid var(--line); vertical-align: top; }
.log .time { color: var(--muted); width: 3.2rem; font-variant-numeric: tabular-nums; }
.log .num { text-align: right; white-space: nowrap; }
.log .del { width: 2rem; text-align: right; }

/* Verlauf */
.tablewrap { overflow-x: auto; }
.matrix { border-collapse: collapse; font-size: .85rem; width: 100%; }
.matrix th { text-align: left; font-weight: 600; padding: .4rem .35rem; border-bottom: 2px solid var(--line); vertical-align: bottom; white-space: nowrap; }
.matrix td { padding: .4rem .35rem; border-bottom: 1px solid var(--line); text-align: center; font-variant-numeric: tabular-nums; }
.matrix td.date { text-align: left; white-space: nowrap; }
.matrix td.num { text-align: right; color: var(--muted); }
.matrix td.ok { background: var(--okbg); color: var(--ok); font-weight: 600; }
.matrix td.part { background: var(--warnbg); color: var(--warn); }
.matrix td.none { color: #b8bec8; }
.noteico { color: var(--accent); margin-left: .3rem; cursor: help; }

ul.plain { margin: 0; padding-left: 1.1rem; }
ul.plain li { margin: .2rem 0; }

.foot { text-align: center; color: var(--muted); font-size: .78rem; padding: 1rem; }

@media (max-width: 480px) {
  .item { grid-template-columns: 1.4rem 1fr; }
  .item .ctrl { grid-column: 2; justify-content: flex-start; }
  .card.head { flex-direction: column; align-items: flex-start; }
  .topbar nav a { margin-left: .6rem; font-size: .92rem; }
}
