:root {
  --bg: #12151a;
  --surface: #1b1f26;
  --surface-2: #242933;
  --border: #333a46;
  --text: #e6e8eb;
  --text-dim: #9aa3b0;
  --accent: #6f9aab;
  --accent-text: #0d1114;
  --status-gefunden: #e0a458;
  --status-entfernt: #5fae6f;
  --danger: #d9695f;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
}

/* --- Kopfleiste --- */

header.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}

header.app-header h1 {
  font-size: 1.05rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.intro-text {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: var(--text-dim);
  max-width: 32ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.counter-bar {
  display: flex;
  gap: 0.9rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.counter-bar strong {
  color: var(--text);
}

.nav-link {
  font-size: 0.85rem;
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  white-space: nowrap;
}

/* --- Karte --- */

#map {
  flex: 1;
  min-height: 0;
  background: var(--bg);
}

.leaflet-tile-pane {
  filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--surface);
  color: var(--text);
}

.leaflet-popup-content {
  margin: 0.75rem;
  max-width: 220px;
}

.popup-photos {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.popup-photos img {
  width: 100%;
  border-radius: 4px;
  object-fit: cover;
  aspect-ratio: 1;
}

.popup-meta {
  font-size: 0.85rem;
  line-height: 1.4;
}

.popup-status {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.popup-status.gefunden {
  background: color-mix(in srgb, var(--status-gefunden) 25%, transparent);
  color: var(--status-gefunden);
}

.popup-status.entfernt {
  background: color-mix(in srgb, var(--status-entfernt) 25%, transparent);
  color: var(--status-entfernt);
}

/* --- Footer --- */

footer.app-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.5rem 0.9rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-dim);
  z-index: 1000;
}

footer.app-footer a {
  color: var(--text-dim);
}

/* --- Formulare / Mitgliederbereich --- */

main.app-main {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.field {
  margin-bottom: 0.9rem;
}

.field label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.field input[type="password"],
.field input[type="text"],
.field select,
.field textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}

.field textarea {
  resize: vertical;
  min-height: 3.5rem;
}

input[type="file"] {
  color: var(--text-dim);
}

.photo-buttons {
  display: flex;
  gap: 0.5rem;
}

.photo-buttons .btn {
  width: auto;
  flex: 1;
}

.photo-selected-name {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: 0.4rem 0 0;
  min-height: 1.1em;
}

.btn {
  display: inline-block;
  padding: 0.7rem 1.1rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: center;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-small {
  width: auto;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.warning {
  background: color-mix(in srgb, var(--status-gefunden) 18%, var(--surface));
  border: 1px solid var(--status-gefunden);
  color: var(--status-gefunden);
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 0.9rem;
}

.error-text {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
  line-height: 1.4;
}

#pin-map {
  height: 220px;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.6rem;
}

.accuracy-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
}

.accuracy-bar .btn {
  width: auto;
  flex-shrink: 0;
}

.queue-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.open-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.open-entry:last-child {
  border-bottom: none;
}

.open-entry .meta {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.banner {
  text-align: center;
  padding: 1.5rem 1rem;
}

.banner h2 {
  margin-top: 0;
}

.hidden {
  display: none !important;
}
