:root {
  --bg: #F6F4EF;
  --bg-raised: #FFFFFF;
  --ink: #1B1E24;
  --ink-soft: #5B6169;
  --line: #DEDAD0;
  --line-strong: #C7C2B4;
  --slate: #22313F;
  --rust: #C4622D;
  --ok: #3F7A4F;
  --ok-bg: #E5EFE4;
  --warn: #B4791F;
  --warn-bg: #F5E9D4;
  --open: #7A5C9E;
  --open-bg: #ECE4F2;
  --danger: #B4432E;
  --danger-bg: #F5E1DB;
  --focus: #2C6C9E;
  --radius: 10px;
  --shadow-card: 0 1px 2px rgba(27,30,36,.04), 0 6px 16px rgba(27,30,36,.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171A1F; --bg-raised: #20242B; --ink: #EDEBE4; --ink-soft: #9AA0A8;
    --line: #333841; --line-strong: #454B55; --ok-bg: #223226; --warn-bg: #332a17;
    --open-bg: #2a2333; --danger-bg: #3a231f;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'IBM Plex Sans', system-ui, sans-serif; }
h1, h2, .disp { font-family: 'Space Grotesk', sans-serif; letter-spacing: -0.01em; }
button, input, textarea, select { font-family: inherit; font-size: 1rem; color: inherit; }
a { color: inherit; text-decoration: none; }

#app { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; padding: 14px 18px 16px;
  background: var(--slate); color: #fff; display: flex; align-items: center; gap: 12px;
  border-bottom: 2px solid var(--rust);
}
.brand { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px;
  background: #101114; color: #fff; overflow: hidden;
  display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0;
}
.topbar h1 { font-size: 1.1rem; margin: 0; font-weight: 600; }
.sub { font-size: .74rem; color: #C9D2DA; margin-top: 1px; }
.who { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.1); border-radius: 999px; padding: 4px 10px; flex-shrink: 0; }
.who-name { font-size: .78rem; font-weight: 500; }
.who-link { border: none; background: rgba(255,255,255,.14); color: #fff; border-radius: 50%; width: 26px; height: 26px; cursor: pointer; font-size: .85rem; }
.role-chip { font-size: .66rem; padding: 2px 7px; border-radius: 999px; font-weight: 600; }
.role-chip.planer { background: var(--rust); color: #fff; }
.role-chip.monteur { background: rgba(255,255,255,.18); color: #fff; }

main { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 18px 16px 100px; }

.filterbar { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 18px; }
.chip { flex-shrink: 0; padding: 8px 15px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--bg-raised); color: var(--ink-soft); font-size: .84rem; font-weight: 600; }
.chip.active { background: var(--slate); color: #fff; border-color: var(--slate); }

.proj-row {
  position: relative; display: block; width: 100%; text-align: left;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px 15px 20px; margin-bottom: 11px; box-shadow: var(--shadow-card);
}
.proj-row::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 3px; background: var(--line-strong); }
.proj-row.done { border-color: var(--ok); background: var(--ok-bg); }
.proj-row.done::before { background: var(--ok); }
.proj-row.defect { border-color: var(--danger); background: var(--danger-bg); }
.proj-row.defect::before { background: var(--danger); }
.proj-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.proj-title { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 1.04rem; }
.proj-meta { color: var(--ink-soft); font-size: .84rem; margin-top: 3px; }
.status-badge { font-size: .72rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.status-offen { background: var(--open-bg); color: var(--open); }
.status-in_arbeit { background: var(--warn-bg); color: var(--warn); }
.status-fertig { background: var(--ok-bg); color: var(--ok); }
.proj-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.photo-count { font-size: .78rem; color: var(--ink-soft); }
.stack { display: flex; }
.stack .mini-av { width: 21px; height: 21px; border-radius: 50%; border: 2px solid var(--bg-raised); margin-left: -7px; }
.stack .mini-av:first-child { margin-left: 0; }

.empty { text-align: center; padding: 56px 24px; color: var(--ink-soft); }
.empty svg { width: 56px; height: 56px; margin-bottom: 14px; opacity: .55; }
.empty .disp { font-size: 1.12rem; color: var(--ink); margin-bottom: 6px; font-weight: 600; }

.fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 30;
  background: linear-gradient(155deg, #D77440, var(--rust) 60%, #A44E22); color: #fff; border: none; border-radius: 999px;
  padding: 15px 21px; font-weight: 600; font-size: .92rem; cursor: pointer;
  box-shadow: 0 8px 22px rgba(196,98,45,.4);
}

.backbtn { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: .88rem; padding: 4px 0 14px; font-weight: 500; }
.del-btn { background: none; border: none; color: var(--danger); font-size: .84rem; font-weight: 600; cursor: pointer; padding: 4px 0 14px; }
.pdf-btn { background: var(--bg-raised); border: 1.5px solid var(--line-strong); color: var(--slate); border-radius: 999px; font-size: .8rem; font-weight: 600; cursor: pointer; padding: 6px 13px; }
.detail-head { margin-bottom: 4px; }
.detail-title { font-family: 'Space Grotesk', sans-serif; font-size: 1.4rem; font-weight: 700; }
.detail-meta { color: var(--ink-soft); font-size: .9rem; margin-top: 4px; }

.status-row { display: flex; margin: 18px 0 6px; background: var(--bg-raised); border: 1.5px solid var(--line-strong); border-radius: var(--radius); padding: 4px; gap: 3px; }
.status-opt { flex: 1; text-align: center; padding: 9px 6px; border-radius: 7px; border: none; font-size: .82rem; font-weight: 600; background: transparent; color: var(--ink-soft); cursor: pointer; }
.status-opt.sel.offen { background: var(--open); color: #fff; }
.status-opt.sel.in_arbeit { background: var(--warn); color: #fff; }
.status-opt.sel.fertig { background: var(--ok); color: #fff; }
.status-opt.locked { cursor: not-allowed; opacity: .5; }

.archive-prompt { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--ok-bg); border: 1px solid var(--ok); border-left: 4px solid var(--ok); border-radius: var(--radius); padding: 12px 14px; margin: 16px 0 4px; font-size: .86rem; color: var(--ok); }
.archive-prompt button { background: var(--ok); color: #fff; border: none; border-radius: 999px; padding: 8px 15px; font-weight: 600; font-size: .82rem; cursor: pointer; }
.archive-prompt.defect { background: var(--danger-bg); border-color: var(--danger); border-left-color: var(--danger); color: var(--danger); }
.archive-prompt.defect button { background: var(--danger); }
.archive-banner { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 16px 0 4px; font-size: .86rem; color: var(--ink-soft); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.archive-banner button { background: none; border: 1px solid var(--line-strong); border-radius: 999px; padding: 7px 13px; font-weight: 600; font-size: .8rem; cursor: pointer; color: var(--ink); }

details summary { list-style: none; }
details summary::-webkit-details-marker { display: none; }

.section-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 700; margin: 26px 0 10px; }
.assignee-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 4px; }
.assignee-pill { display: flex; align-items: center; gap: 7px; background: var(--bg-raised); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: .82rem; }
.pill-edit { border: none; background: none; color: var(--ink-soft); cursor: pointer; font-size: .8rem; }
.color-swatches { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; display: inline-block; }
.swatch.sel { border-color: var(--ink); box-shadow: 0 0 0 2px var(--bg-raised), 0 0 0 4px var(--ink); }
.add-assignee { border: 1.5px dashed var(--line-strong); background: none; border-radius: 999px; padding: 7px 13px; font-size: .82rem; font-weight: 600; color: var(--ink-soft); cursor: pointer; }

.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 6px; }
.photo-tile { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--line); display: block; box-shadow: var(--shadow-card); }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile .cmt-badge { position: absolute; bottom: 5px; right: 5px; background: rgba(10,12,14,.72); color: #fff; font-size: .66rem; padding: 2px 7px; border-radius: 999px; font-weight: 600; }
.photo-tile .defect-badge { position: absolute; top: 5px; left: 5px; background: var(--danger); color: #fff; font-size: .7rem; width: 19px; height: 19px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; }

.comment { display: flex; gap: 9px; margin-bottom: 10px; }
.comment-body { background: var(--bg-raised); border: 1px solid var(--line); border-radius: 12px; padding: 9px 13px; flex: 1; }
.comment-name { font-size: .78rem; font-weight: 700; margin-bottom: 2px; }
.comment-text { font-size: .9rem; line-height: 1.45; }
.comment-time { font-size: .68rem; color: var(--ink-soft); margin-top: 3px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.field input, .field textarea { width: 100%; border: 1.5px solid var(--line-strong); border-radius: 7px; padding: 10px 12px; background: var(--bg-raised); color: var(--ink); }
.field input:focus, .field textarea:focus { outline: 2px solid var(--focus); }

.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.btn { flex: 1; padding: 13px; border-radius: 999px; border: none; font-weight: 600; font-size: .92rem; cursor: pointer; text-align: center; display: inline-flex; align-items: center; justify-content: center; }
.btn-primary { background: linear-gradient(155deg, #D77440, var(--rust) 65%); color: #fff; }
.btn-ghost { background: var(--bg-raised); border: 1.5px solid var(--line-strong); color: var(--ink); }

.notice { background: var(--bg-raised); border: 1px solid var(--line); border-left: 3px solid var(--slate); border-radius: var(--radius); padding: 14px 16px; font-size: .88rem; color: var(--ink-soft); margin-bottom: 16px; }

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); margin: 0; font-family: 'IBM Plex Sans', system-ui, sans-serif; color: var(--ink); }
.login-card { background: var(--bg-raised); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; width: 100%; max-width: 360px; box-shadow: var(--shadow-card); }
