:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1a1d21;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #1f6feb;
  --done: #16a34a;
  --done-bg: #ecfdf3;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

/* Header */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--brand);
  color: #fff;
  padding-top: env(safe-area-inset-top);
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.15);
}
.top-inner { max-width: 720px; margin: 0 auto; padding: 12px 16px 14px; }
.top h1 { margin: 0 0 8px; font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.progress { display: flex; align-items: center; gap: 10px; }
.progress-bar {
  flex: 1; height: 8px; border-radius: 99px;
  background: rgba(255, 255, 255, 0.28); overflow: hidden;
}
.progress-bar span {
  display: block; height: 100%; width: 0%;
  background: #fff; border-radius: 99px; transition: width 0.35s ease;
}
.progress-label { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; opacity: 0.95; }

/* Layout */
.app { max-width: 720px; margin: 0 auto; padding: 14px 12px 8px; }

.room { margin-bottom: 16px; }
.room-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow);
  cursor: pointer; user-select: none;
}
.room-head h2 { margin: 0; font-size: 16px; font-weight: 650; flex: 1; }
.room-count {
  font-size: 12px; font-variant-numeric: tabular-nums;
  color: var(--muted); background: var(--bg);
  border-radius: 99px; padding: 3px 9px; white-space: nowrap;
}
.room.done .room-head { background: var(--done-bg); }
.room.done .room-count { color: var(--done); }

.tasks {
  background: var(--card);
  border: 1px solid var(--line); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Checkbox rows */
.task, .room-check {
  display: flex; align-items: flex-start; gap: 13px;
  padding: 13px 14px; cursor: pointer;
}
.task { border-top: 1px solid var(--line); }
.task:active { background: #f9fafb; }

.box {
  flex: none; margin-top: 1px;
  width: 24px; height: 24px; border-radius: 7px;
  border: 2px solid #cbd5e1; background: #fff;
  display: grid; place-items: center;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.box svg { width: 15px; height: 15px; stroke: #fff; stroke-width: 3.4; fill: none; opacity: 0; transition: opacity 0.12s ease; }
.checked .box { background: var(--done); border-color: var(--done); }
.checked .box svg { opacity: 1; }
.indeterminate .box { background: var(--brand); border-color: var(--brand); }
.indeterminate .box::after { content: ""; width: 11px; height: 3px; border-radius: 2px; background: #fff; position: absolute; }
.room-check .box { position: relative; }

.task-body { flex: 1; min-width: 0; }
.task-text { display: block; }
.checked .task-text { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(107,114,128,.5); }
.task-note { display: block; margin-top: 3px; font-size: 13px; color: var(--muted); }
.room-check { font-weight: 600; }
.room-check .hint-small { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 6px; }

.room-note {
  padding: 10px 14px; font-size: 13px; color: var(--muted);
  background: #fbfbfc; border-top: 1px dashed var(--line);
}

/* Photos */
.photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.photos figure { margin: 0; }
.photos img {
  width: 76px; height: 76px; object-fit: cover;
  border-radius: 9px; border: 1px solid var(--line);
  cursor: zoom-in; background: #eee; display: block;
}
.photo-impressie { position: relative; }
.photo-impressie::after {
  content: "impressie"; position: absolute; left: 4px; bottom: 4px;
  font-size: 10px; font-weight: 600; color: #fff;
  background: rgba(31,111,235,.92); padding: 1px 6px; border-radius: 99px;
}

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.9); display: grid; place-items: center;
  padding: 20px;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 82vh; border-radius: 10px; }
.lightbox-caption { color: #fff; margin-top: 12px; font-size: 14px; text-align: center; max-width: 640px; }
.lightbox-close {
  position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 16px;
  width: 44px; height: 44px; border: none; border-radius: 50%;
  background: rgba(255,255,255,.15); color: #fff; font-size: 26px; line-height: 1; cursor: pointer;
}

/* Footer */
.foot { max-width: 720px; margin: 0 auto; padding: 4px 16px 30px; text-align: center; }
.status { font-size: 12px; color: var(--muted); min-height: 16px; display: block; }
.status.saving { color: var(--brand); }
.status.error { color: #dc2626; }
.hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --card: #181b20; --ink: #e6e8eb; --muted: #9aa4b2;
    --line: #2a2f37; --done-bg: #12261a;
  }
  .task:active { background: #1e222a; }
  .room-note { background: #14171c; }
  .box { border-color: #3a4250; background: #0f1115; }
}
