/* Farben und Schriften */
:root {
  --bg: #eef1f2; --surface: #ffffff; --surface-2: #f6f8f9; --ink: #17232c; --muted: #5d6b75; --line: #d5dce0;
  --accent: #0b6a73; --accent-ink: #ffffff; --accent-soft: #dcf0f1;
  --ok: #1f7a4d; --ok-soft: #dff3e8; --warn: #9a5a06; --warn-soft: #fbedd3; --bad: #b3261e; --bad-soft: #fbe3e1;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f171c; --surface: #172229; --surface-2: #1d2a32; --ink: #e8eef1; --muted: #9aa9b2; --line: #2b3a43;
    --accent: #4fb8c1; --accent-ink: #072a2e; --accent-soft: #143037;
    --ok: #5fc592; --ok-soft: #13291f; --warn: #e6a649; --warn-soft: #33260f; --bad: #f08a82; --bad-soft: #3a1917;
    color-scheme: dark;
  }
}
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); margin: 0; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  padding-inline: 0;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
.shell {
  max-width: 1080px;
  margin: 0 auto;
  padding-block: 16px 72px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
h1, h2, h3 { margin: 0; text-wrap: balance; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.label {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.lg { gap: 20px; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 16px; }
.brand { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand .label { color: var(--accent); }

.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 500; min-height: 44px; padding: 0 16px; border-radius: 10px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { border-color: var(--accent); }
.btn:focus-visible, .field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible, .tab:focus-visible, .seg button:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.card.flat { background: var(--surface-2); }
.card > .head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; text-align: left;
  width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; font: inherit; color: inherit; cursor: pointer; min-height: 64px;
}
.item:hover { border-color: var(--accent); }
.item .title { font-weight: 600; }
.item .sub { grid-column: 1; color: var(--muted); font-size: 0.9rem; }
.item .chips { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.empty { text-align: center; padding: 40px 16px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.empty p { max-width: 46ch; color: var(--muted); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button {
  appearance: none; border: 0; background: transparent; color: var(--ink); font: inherit; font-weight: 500;
  min-height: 44px; padding: 0 16px; cursor: pointer; border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; -webkit-overflow-scrolling: touch; }
.tab {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 500;
  min-height: 44px; padding: 0 16px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.tab[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.grid .wide { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.field input, .field select, .field textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; min-height: 44px; width: 100%; min-width: 0;
}
.field textarea { min-height: 88px; resize: vertical; }
.field input[type="number"], .field input.num { font-family: var(--font-mono); }

.room { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.room:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.photo { position: relative; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo button {
  position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,0.65); color: #fff; font-size: 18px; line-height: 1; cursor: pointer;
}
.photo.busy::after { content: "lädt…"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,0.45); color: #fff; font-size: 0.85rem; }
.maengel { border-left: 3px solid var(--warn); padding-left: 12px; display: flex; flex-direction: column; gap: 12px; }

.sigbox { display: flex; flex-direction: column; gap: 8px; }
.sigbox canvas { width: 100%; height: 170px; background: #fff; border: 1px dashed var(--line); border-radius: 10px; touch-action: none; display: block; }
.sigbox img { width: 100%; height: 170px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 10px; display: block; }

.steps { display: flex; gap: 8px; flex-wrap: wrap; }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 0.92rem; }
.notice.info { background: var(--accent-soft); color: var(--accent); }
.copybox { font-family: var(--font-mono); font-size: 0.85rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow-wrap: anywhere; white-space: pre-wrap; user-select: all; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 20; max-width: calc(100vw - 32px);
}
.photo button.keep { top: auto; bottom: 4px; right: auto; left: 4px; width: auto; height: 30px; border-radius: 15px; padding: 0 12px; font-size: 12px; font-family: inherit; }
.logo { display: block; max-height: 44px; max-width: 220px; width: auto; height: auto; object-fit: contain; background: #fff; border-radius: 6px; padding: 4px 8px; }
.logo.big { max-height: 90px; max-width: 100%; }
.toggle { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.toggle input { width: 22px; height: 22px; accent-color: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .btn, .item, .tab { transition: border-color 0.12s ease, background 0.12s ease; }
}

/* Auswahlvorschläge Raumzustand */
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opts button { font: inherit; padding: 9px 14px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.opts button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.opts button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
