@font-face { font-family: "Montserrat"; font-weight: 600; font-display: swap;
  src: url("fonts/montserrat-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 700; font-display: swap;
  src: url("fonts/montserrat-latin-700-normal.woff2") format("woff2"); }

/* Farben aus dem Logo der Taubenhilfe Ludwigsburg */
:root {
  --bg: #f3f6fb; --card: #ffffff; --ink: #14213d; --muted: #5f6b80; --line: #dfe5ef;
  --brand: #21498a; --brand-dark: #173665; --brand-ink: #ffffff; --brand-soft: #e6edf8;
  --head: #21498a; --head-ink: #ffffff;
  --red: #c4372c; --red-soft: #fbe6e3; --amber: #b26b00; --amber-soft: #fdf1dc;
  --green: #22804f; --green-soft: #e1f3e8; --grey: #8a93a3;
  --radius: 16px; --shadow: 0 1px 2px rgba(20,33,61,.06), 0 4px 14px rgba(20,33,61,.06);
  --display: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1626; --card: #182238; --ink: #e9eef7; --muted: #9eabc2; --line: #2a3754;
    --brand: #8fb3ef; --brand-dark: #c3d5f6; --brand-ink: #0f1626; --brand-soft: #1f2e4d;
    --head: #173665; --head-ink: #ffffff;
    --red: #f07d70; --red-soft: #3d2222; --amber: #f0b45a; --amber-soft: #3a2d17;
    --green: #6fcf97; --green-soft: #183325; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
a { color: var(--brand); }
img { max-width: 100%; }
h1 { font: 700 1.35rem/1.25 var(--display); margin: 0 0 12px; color: var(--brand-dark); }
h2 { font: 700 .78rem/1.2 var(--display); margin: 24px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.wrap { max-width: 760px; margin: 0 auto; padding: 16px; }

/* Kopfzeile */
.top { position: sticky; top: 0; z-index: 1000; background: var(--head); color: var(--head-ink);
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px; display: flex; align-items: center; gap: 10px; }
.top a { color: inherit; text-decoration: none; }
.top .logo { display: flex; align-items: center; gap: 10px; }
.top .logo img { width: 38px; height: 38px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.9); }
.top .logo b { display: block; font: 700 1.02rem/1.1 var(--display); letter-spacing: .02em; }
.top .logo small { display: block; font: 600 .62rem/1.2 var(--display); letter-spacing: .18em; text-transform: uppercase; opacity: .8; }
.top .sp { flex: 1; }
.top .me { font-size: .82rem; display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,.14);
  padding: 6px 10px; border-radius: 999px; }
.top .me svg { width: 16px; height: 16px; }

/* Navigation unten */
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000; background: var(--card);
  border-top: 1px solid var(--line); display: flex; padding-bottom: env(safe-area-inset-bottom); }
.nav a { flex: 1; text-align: center; padding: 8px 2px 9px; font-size: .72rem; color: var(--muted);
  text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.nav a svg { width: 26px; height: 26px; }
.nav a.on { color: var(--brand); font-weight: 600; }

/* Karten und Listen */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.item .thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--brand-soft); flex: none;
  display: flex; align-items: center; justify-content: center; color: var(--brand); font-weight: 700; }
.item .thumb svg { width: 30px; height: 30px; }
.item .main { flex: 1; min-width: 0; }
.item .t { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { color: var(--muted); font-size: .85rem; }
.item .r { text-align: right; font-size: .85rem; color: var(--muted); flex: none; }
.empty { color: var(--muted); text-align: center; padding: 28px 10px; }

/* Startseite */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow); min-height: 104px; }
.tile .ic { width: 54px; height: 54px; border-radius: 16px; background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.tile svg { width: 30px; height: 30px; color: var(--brand); }
.tile b { font: 700 1rem/1.25 var(--display); color: var(--brand-dark); }
.tile span { font-size: .82rem; color: var(--muted); }
.tile.alarm { grid-column: 1 / -1; background: var(--red); border-color: var(--red); color: #fff;
  flex-direction: row; align-items: center; gap: 14px; min-height: 0; padding: 18px 16px; box-shadow: 0 6px 18px rgba(196,55,44,.28); }
.tile.alarm .ic { background: rgba(255,255,255,.18); margin: 0; flex: none; }
.tile.alarm svg { color: #fff; }
.tile.alarm b { color: #fff; font-size: 1.1rem; }
.tile.alarm span { color: rgba(255,255,255,.88); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 8px; text-align: center;
  text-decoration: none; color: inherit; }
.stat b { display: block; font: 700 1.45rem/1.1 var(--display); color: var(--brand-dark); }
.stat span { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.stat.warn b { color: var(--red); }

/* Schaltflächen */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px;
  padding: 12px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--brand); color: var(--brand-ink); min-height: 48px; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.sec { background: var(--brand-soft); color: var(--brand); }
.btn.red { background: var(--red); color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.btns .btn { flex: 1; }

/* Formulare */
label.f { display: block; margin: 10px 0 4px; font-weight: 600; font-size: .9rem; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local],
select, textarea { width: 100%; font: inherit; padding: 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); min-height: 48px; }
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.msg { padding: 10px 12px; border-radius: 10px; background: var(--brand-soft); margin-bottom: 12px; }
.msg.err { background: var(--red-soft); color: var(--red); }
.msg.warn { background: var(--amber-soft); color: var(--amber); }

/* Abzeichen */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.badge.rot, .badge.Kritisch, .badge.Lebensgefahr { background: var(--red-soft); color: var(--red); }
.badge.gelb, .badge.Geschwächt { background: var(--amber-soft); color: var(--amber); }
.badge.gruen, .badge.Stabil { background: var(--green-soft); color: var(--green); }
.badge.grau { background: var(--line); color: var(--muted); }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.dot.rot { background: var(--red); } .dot.gelb { background: var(--amber); }
.dot.gruen { background: var(--green); } .dot.grau { background: var(--grey); }

/* Detailseiten */
dl.kv { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .88rem; }
dl.kv dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 8px 0; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; cursor: zoom-in; }
.timeline .card { position: relative; }
.timeline .when { font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.chart { width: 100%; height: 170px; }
.chart .ax { stroke: var(--line); }
.chart .ln { fill: none; stroke: var(--brand); stroke-width: 2.5; }
.chart .pt { fill: var(--brand); }
.chart text { fill: var(--muted); font-size: 11px; }
.minimap { height: 180px; border-radius: 12px; margin: 8px 0; z-index: 0; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; }
.tabs a { padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line);
  text-decoration: none; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.tabs a.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.row { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.row h1 { margin: 0; }
.wz-head .row { margin-bottom: 0; }

/* Zugangsdaten zum Weitergeben */
.zugang { border: 2px solid var(--brand); }
.zugang pre { margin: 0; padding: 12px; border-radius: 10px; background: var(--brand-soft); color: var(--ink);
  font: 600 .92rem/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; white-space: pre-wrap; user-select: all; }
.item .r .von { font-size: .78rem; }

/* Löschen */
.del { margin-top: 28px; text-align: center; }
.btn.danger { background: transparent; color: var(--red); border: 1px solid var(--red-soft); }
.del-link { border: 0; background: none; padding: 0; font: inherit; font-size: .82rem; color: var(--red); cursor: pointer; float: right; }

/* Lightbox */
.lb { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 3000; display: none; align-items: center; justify-content: center; }
.lb.on { display: flex; }
.lb img { max-width: 100%; max-height: 100%; }

/* Fragebogen-Assistent */
.wz { max-width: 640px; margin: 0 auto; padding: 0 16px 16px; }
.wz-head { position: sticky; top: 0; z-index: 900; background: var(--bg); padding: 12px 0 8px; }
.wz-ctx { font-size: .85rem; color: var(--muted); }
.wz-bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.wz-bar i { display: block; height: 100%; background: var(--brand); transition: width .2s; }
.wz-q { font-size: 1.25rem; font-weight: 700; margin: 16px 0 4px; }
.wz-help { color: var(--muted); font-size: .9rem; margin-bottom: 12px; }
.opts { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.opt { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; padding: 14px 16px; min-height: 54px;
  border-radius: 12px; border: 2px solid var(--line); background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.opt .box { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line); flex: none; display: flex;
  align-items: center; justify-content: center; }
.opt.radio .box { border-radius: 50%; }
.opt.on { border-color: var(--brand); background: var(--brand-soft); }
.opt.on .box { background: var(--brand); border-color: var(--brand); }
.opt.on .box::after { content: ""; width: 6px; height: 11px; border: solid var(--brand-ink); border-width: 0 3px 3px 0;
  transform: rotate(45deg) translate(-1px, -1px); }
.opt.radio.on .box::after { width: 8px; height: 8px; border: 0; border-radius: 50%; background: var(--brand-ink); transform: none; }
.yn { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.yn .opt { justify-content: center; font-weight: 600; }
.wz-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100; background: var(--card); border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
.wz-nav .in { max-width: 640px; margin: 0 auto; display: flex; gap: 10px; }
.wz-nav .btn { flex: 1; }
.wz-nav .btn.ghost { flex: 0 0 auto; }
.ph-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.ph-grid .ph { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--line); }
.ph-grid .ph img { width: 100%; height: 100%; object-fit: cover; }
.ph-grid .ph button { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.6); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.ph-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; aspect-ratio: 1;
  border: 2px dashed var(--line); border-radius: 10px; color: var(--brand); font-size: .8rem; font-weight: 600; cursor: pointer; background: var(--card); }
.ph-add svg { width: 30px; height: 30px; }
.wz-map { height: 300px; border-radius: 12px; margin-top: 12px; z-index: 0; }
.loc-info { font-size: .88rem; color: var(--muted); margin-top: 8px; }
.sum dl.kv { margin-bottom: 4px; }
.sum .edit { font-size: .82rem; }
.spot { cursor: pointer; }
.spot.on { outline: 2px solid var(--brand); }

/* Karte */
.mapfull { position: fixed; top: calc(54px + env(safe-area-inset-top)); left: 0; right: 0;
  bottom: calc(60px + env(safe-area-inset-bottom)); }
.map-filter { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 800; display: flex; gap: 6px;
  background: var(--card); padding: 6px; border-radius: 999px; box-shadow: 0 2px 10px rgba(0,0,0,.2); max-width: calc(100% - 24px); overflow-x: auto; }
.map-filter label { display: flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 999px; font-size: .82rem; cursor: pointer; white-space: nowrap; }
.map-filter input { margin: 0; }
.map-legend { position: absolute; bottom: 12px; left: 12px; z-index: 800; background: var(--card); padding: 8px 10px; border-radius: 10px;
  font-size: .75rem; box-shadow: 0 2px 10px rgba(0,0,0,.2); }
.map-legend div { display: flex; align-items: center; gap: 6px; }
.pop img { width: 100%; max-height: 120px; object-fit: cover; border-radius: 8px; margin-bottom: 6px; }
.pop b { display: block; }
.pop .btn { min-height: 38px; padding: 8px 12px; margin-top: 8px; color: #fff; width: 100%; }
.pin { width: 32px; height: 32px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; }
.pin span { transform: rotate(45deg); display: flex; color: #fff; }
.pin svg { width: 17px; height: 17px; }
.pin.nest-gruen { background: #2e7d4f; } .pin.nest-gelb { background: #d39b2a; } .pin.nest-rot { background: #b83a2e; }
.pin.nest-grau { background: #8a8f8e; } .pin.notfall { background: #7b2cbf; } .pin.notfall-zu { background: #b9a3cf; }
.pin.fundort { background: #21498a; } .pin.futter { background: #a0522d; }
.leaflet-container { font: inherit; }

@media (min-width: 700px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .tile.alarm { grid-column: span 3; }
}

/* Offline-Hinweis */
.outbox { position: sticky; top: calc(54px + env(safe-area-inset-top)); z-index: 950; background: var(--amber-soft); color: var(--amber);
  padding: 10px 16px; font-size: .9rem; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.outbox.ok { background: var(--green-soft); color: var(--green); }
.outbox button { border: 0; border-radius: 8px; padding: 6px 12px; font: inherit; font-weight: 600; background: var(--amber); color: #fff; cursor: pointer; flex: none; }
.outbox[hidden] { display: none; }

/* Startseite: Kopfbereich im Logo-Blau */
.hero { background: var(--head); color: var(--head-ink); margin: -16px -16px 0; padding: 18px 20px 54px;
  border-radius: 0 0 28px 28px; display: flex; align-items: center; gap: 14px; }
.hero .hi { font: 700 1.3rem/1.2 var(--display); }
.hero .sub { font-size: .9rem; opacity: .85; margin-top: 2px; }
.hero + .stats { margin-top: -40px; position: relative; }
.stats .stat { box-shadow: var(--shadow); }
.section-gap { height: 4px; }

/* Anmeldeseite */
.login-hero { text-align: center; margin: 4vh auto 18px; }
.login-hero img { width: 150px; height: 150px; border-radius: 50%; box-shadow: 0 10px 30px rgba(33,73,138,.25); }
.login-hero h1 { margin-top: 14px; }
.login-hero p { color: var(--muted); }
