:root {
  --green: #1f6f5c; --green-d: #17574a; --green-l: #e5f3ee;
  --red: #c0392b; --orange: #e67e22; --orange-l: #fff1e3;
  --ink: #1d2327; --muted: #67737a; --line: #dde3e6; --bg: #f4f6f7; --card: #fff;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink); background: var(--bg);
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
}
a { color: var(--green); }
h1 { font-size: 1.45rem; margin: .4rem 0 .6rem; }
h2 { font-size: 1.15rem; margin: 1.1rem 0 .5rem; }
h3.day { font-size: .95rem; color: var(--muted); margin: .9rem 0 .35rem; text-transform: uppercase; letter-spacing: .03em; }
.muted { color: var(--muted); font-weight: normal; }
.small { font-size: .85rem; color: var(--muted); }
.center { text-align: center; }
.wrap { max-width: 640px; margin: 0 auto; padding: 10px 14px 24px; }

/* Kopfzeile */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  background: var(--green); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
}
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.top-actions form { margin: 0; }
.chip {
  display: inline-block; border: 1px solid rgba(255,255,255,.55); background: transparent; color: #fff;
  border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .9rem; text-decoration: none; cursor: pointer;
}

/* Untere Navigation */
.bottom {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; background: #fff;
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.bottom a {
  flex: 1; text-align: center; padding: 8px 2px 9px; color: var(--muted); text-decoration: none; font-size: .78rem;
}
.bottom a span { display: block; font-size: 1.45rem; line-height: 1.2; }
.bottom a.on { color: var(--green); font-weight: 700; }

/* Tabs */
.tabs { display: flex; gap: 6px; margin: 4px 0 6px; }
.tabs a {
  flex: 1; text-align: center; padding: 10px 4px; border-radius: 10px; background: #fff; border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-size: .95rem;
}
.tabs a.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }

/* Karten / Listeneinträge */
.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin: 12px 0; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.card h2:first-child { margin-top: 0; }
.item {
  display: flex; gap: 10px; justify-content: space-between; background: #fff; border-radius: var(--radius);
  padding: 13px 14px; margin: 8px 0; color: var(--ink); text-decoration: none;
  border-left: 6px solid var(--orange); box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.item.done { border-left-color: var(--green); background: #fbfdfc; }
.item.done .apt { color: var(--muted); }
.item.changeover { border-left-color: var(--red); background: #fff8f6; }
.apt { font-weight: 700; font-size: 1.08rem; margin-bottom: 2px; }
.meta { font-size: .93rem; }
.item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 84px; }
.nr {
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.7em; height: 1.7em;
  border-radius: 8px; background: var(--green); color: #fff; font-size: .9em; font-weight: 700; margin-right: 4px;
}
.status { border-radius: 999px; padding: 3px 10px; font-size: .85rem; font-weight: 700; white-space: nowrap; }
.status.ok { background: var(--green-l); color: var(--green-d); }
.status.todo { background: var(--orange-l); color: #a0520c; }
.badge { display: inline-block; margin-top: 6px; border-radius: 8px; padding: 3px 9px; font-size: .88rem; font-weight: 700; }
.badge.hot { background: var(--red); color: #fff; }
.badge.soft { background: #f3e1de; color: var(--red); }
.badge.sm { margin: 0 6px 0 0; padding: 2px 8px; font-size: .82rem; }
.sum { padding: 12px 14px; margin: 8px 0 4px; }
.sum .kpi { margin: 2px 0 4px; }
h3.day a, h2 a.muted { color: inherit; text-decoration: none; }
.empty { color: var(--muted); background: #fff; border-radius: var(--radius); padding: 14px; text-align: center; }
.section.overdue h2 { color: var(--red); }
.flash { background: var(--green-l); color: var(--green-d); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.flash.warn { background: #fdecea; color: var(--red); }
.back { display: inline-block; padding: 6px 0; text-decoration: none; font-size: 1rem; }

/* Detailseite */
.head.open { border-top: 6px solid var(--orange); }
.head.done { border-top: 6px solid var(--green); }
.head h1 { margin-top: 0; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.done-box { background: var(--green-l); color: var(--green-d); border-radius: 10px; padding: 14px; font-size: 1.1rem; margin-bottom: 10px; }

/* Knöpfe */
.btn {
  display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 12px;
  padding: 12px 16px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; text-align: center;
}
.btn.big { display: block; width: 100%; padding: 18px 16px; font-size: 1.2rem; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:active { background: var(--green-d); }
.btn.secondary { background: var(--green-l); border-color: #bfe0d5; color: var(--green-d); }
.btn.ghost { background: transparent; }
.btn.danger { background: #fff; border-color: #f0b9b3; color: var(--red); }
form .btn { margin-top: 10px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.row-btns .btn { flex: 1; margin: 0; }

/* Formulare */
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input[type=text], input[type=date], input[type=password], select, textarea {
  width: 100%; font: inherit; padding: 13px 12px; border: 1px solid #c8d0d4; border-radius: 10px; background: #fff;
}
textarea { resize: vertical; }
.pin { font-size: 1.6rem; letter-spacing: .3em; text-align: center; }
.login { margin-top: 30px; }

/* Foto-Upload & Galerie */
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 100px; }
.upload-status { margin-top: 8px; color: var(--muted); }
.upload-status:empty { display: none; }
.upload .btn.big { margin-top: 0; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.gallery figure { position: relative; margin: 0; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #e9eef0; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery form { position: absolute; top: 4px; right: 4px; margin: 0; }
.gallery .x {
  width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff;
  font-size: .95rem; cursor: pointer;
}

/* Tabellen */
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table thead th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.table tfoot th { font-size: 1.05rem; border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.row-open td { background: #fffaf3; }
.kpi { font-size: 1.6rem; font-weight: 700; color: var(--green-d); margin-bottom: 6px; }
.monthnav { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 1.1rem; text-transform: capitalize; }
.monthnav .btn { padding: 8px 18px; font-size: 1.3rem; }
.stats { list-style: none; padding: 0; margin: 0; }
.stats li { padding: 4px 0; }
.errors { color: var(--red); font-size: .9rem; }
.code { background: #263238; color: #e0f2f1; padding: 12px; border-radius: 10px; font-size: .75rem; overflow-x: auto; white-space: pre; }
