:root {
  --bg: #1a1d21;
  --bg-elevated: #23272c;
  --border: #34393f;
  --text: #ededea;
  --text-muted: #9aa0a6;
  --accent: #5b8cff;
  --ok: #4caf6d;
  --warn: #e0a22c;
  --bad: #d9534f;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header.app-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

header.app-header h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

header.app-header .sub {
  font-size: 13px;
  color: var(--text-muted);
}

main {
  flex: 1;
  padding: 20px;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

.view { display: none; }
.view.active { display: block; }

label {
  display: block;
  font-size: 14px;
  color: var(--text-muted);
  margin: 18px 0 6px;
}

label:first-of-type { margin-top: 0; }

input[type="text"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 14px 14px;
  font-size: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
}

textarea { resize: vertical; min-height: 70px; }

input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  padding: 15px 18px;
  cursor: pointer;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #0d1117;
  margin-top: 22px;
}

.btn-secondary {
  width: 100%;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  margin-top: 10px;
}

.btn-primary:active, .btn-secondary:active { opacity: 0.75; }

/* Dreier-Auswahl entfällt/ja/nein als grosse Tap-Ziele statt Dropdown-Fummelei */
.tri-choice {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.tri-choice button {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
  padding: 12px 6px;
}

.tri-choice button.selected[data-val="ja"] { background: var(--ok); color: #0d1117; border-color: var(--ok); }
.tri-choice button.selected[data-val="nein"] { background: var(--bad); color: #fff; border-color: var(--bad); }
.tri-choice button.selected[data-val="entfällt"] { background: var(--warn); color: #0d1117; border-color: var(--warn); }

.checkliste-feld {
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.checkliste-feld.versteckt {
  display: none;
}

.checkliste-feld .feld-titel {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
}

/* Suchergebnisse */
.such-treffer {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
}

.such-treffer .bezeichnung { font-weight: 700; font-size: 16px; }
.such-treffer .details { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

.signal-kopf {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.signal-kopf .bezeichnung { font-size: 22px; font-weight: 700; }
.signal-kopf .details { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.neubau-bestand {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  margin-top: 8px;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid currentColor;
}

.neubau-bestand:empty { display: none; }

/* Fotos */
.foto-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.foto-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.foto-upload-btn {
  display: block;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--text-muted);
  margin-top: 14px;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 14px;
  display: none;
}

.toast.show { display: block; }
.toast.ok { border-color: var(--ok); }
.toast.bad { border-color: var(--bad); }

.offline-banner {
  background: var(--warn);
  color: #0d1117;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 8px;
  display: none;
}

.offline-banner.show { display: block; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  padding: 8px 0;
  text-align: left;
}

.foto-grid img {
  cursor: pointer;
}

.foto-grid {
  position: relative;
}

.foto-kachel {
  position: relative;
}

.foto-kachel .auswahl-haekchen {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
}

.foto-kachel.auswahl-modus .auswahl-haekchen {
  display: flex;
}

.foto-kachel.ausgewaehlt .auswahl-haekchen {
  background: var(--accent);
  border-color: var(--accent);
}

.foto-kachel.ausgewaehlt img {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.foto-aktionen {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.foto-aktionen .btn-secondary,
.foto-aktionen .btn-primary {
  flex: 1;
  margin-top: 0;
}

.foto-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.foto-modal.show {
  display: flex;
}

.foto-modal-inner {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.foto-modal-inner img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: var(--radius);
  object-fit: contain;
}

.foto-modal-aktionen {
  display: flex;
  gap: 8px;
}

.foto-modal-aktionen .btn-secondary {
  flex: 1;
  margin-top: 0;
  text-align: center;
  text-decoration: none;
  display: block;
}
