:root {
  --holz-dunkel: #3f2d1e; --holz: #5a4030; --holz-hell: #8a6a4f;
  --creme: #f7f1e6; --papier: #fffdf7; --rand: #ddcfba;
  --gruen: #3d6b4f; --gruen-hell: #e9f0e9;
  --text: #2e261d; --grau: #7d715f; --rot: #a33c2e; --gelb: #f6e7c0;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.55 system-ui, sans-serif; color: var(--text); background: var(--creme);
  overflow-x: hidden; }
h1, h2, .logo { font-family: Georgia, 'Times New Roman', serif; }

header {
  display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; align-items: center;
  padding: .7rem 1rem; color: #f3ead9;
  background:
    repeating-linear-gradient(93deg, rgba(0,0,0,.10) 0 2px, transparent 2px 7px, rgba(255,255,255,.03) 7px 9px, transparent 9px 26px),
    linear-gradient(180deg, var(--holz) 0%, var(--holz-dunkel) 100%);
  border-bottom: 4px solid var(--holz-dunkel);
  box-shadow: 0 2px 8px rgba(63,45,30,.35);
}
header .logo { font-weight: 700; font-size: 1.25rem; color: #f7efdd; text-decoration: none;
  letter-spacing: .02em; display: flex; align-items: center; gap: .55rem; }
header .logo small { display: block; font-family: system-ui, sans-serif; font-size: .62rem;
  font-weight: 400; letter-spacing: .16em; text-transform: uppercase; color: #c9b391; margin-top: -.15rem; }
.logo-berg { width: 66px; height: auto; color: #e8d8b8; flex: none;
  filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.4)); }
header nav { display: flex; flex-wrap: wrap; gap: .15rem; }
header nav a { color: #eadfc8; text-decoration: none; padding: .25rem .6rem; border-radius: 6px; }
header nav a:hover { background: rgba(255,255,255,.13); color: #fff; }
/* Werkzeuge rechts im Kopf: Kalender und Suche gehoeren zusammen */
.kopf-rechts { margin-left: auto; display: flex; align-items: center; gap: .55rem; }
.suchbox input { border: 0; border-radius: 6px; padding: .4rem .7rem; min-width: 12rem; background: #f3ead9; }

/* Kalender: bewusst als Knopf, nicht als weiterer Navigationspunkt */
.kopf-knopf { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
  background: var(--gruen); color: #fbf7ee; text-decoration: none; font-weight: 600;
  font-size: .92rem; padding: .38rem .85rem; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.38); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.kopf-knopf:hover { background: #4c8161; border-color: rgba(255,255,255,.6); color: #fff; }

main { max-width: 1100px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
footer { text-align: center; color: var(--grau); padding: 0 0 1.2rem; font-size: .85rem; margin-top: 2.5rem; }
.footer-berg { display: block; height: 62px; width: auto; margin: 0 auto .5rem; opacity: .42; }
h1 { font-size: 1.6rem; margin: .3rem 0 1rem; color: var(--holz-dunkel); }
h2 { font-size: 1.2rem; margin: 1.6rem 0 .5rem; color: var(--holz); }
a { color: var(--gruen); }

.hero { position: relative; border-radius: 14px; overflow: hidden; margin-bottom: 1.2rem;
  border: 1px solid var(--rand); box-shadow: 0 3px 14px rgba(63,45,30,.18); }
.hero img { width: 100%; height: 260px; object-fit: cover; display: block; }
.hero .hero-titel { position: absolute; left: 0; right: 0; bottom: 0; padding: 2.6rem 1.2rem .8rem;
  background: linear-gradient(transparent, rgba(46,38,29,.78));
  color: #fdf8ec; font-family: Georgia, serif; font-size: 1.7rem; font-weight: 700;
  text-shadow: 0 1px 5px rgba(0,0,0,.55); line-height: 1.2; }
.hero .hero-titel small { display: block; font-family: system-ui, sans-serif; font-size: .72rem;
  font-weight: 400; letter-spacing: .13em; text-transform: uppercase; color: #e0d2b8;
  margin-top: .3rem; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.fotoleiste { display: flex; gap: .6rem; margin: .8rem 0 1.4rem; overflow-x: auto; padding-bottom: .2rem; }
.fotoleiste img { height: 92px; width: 130px; border-radius: 8px; border: 1px solid var(--rand);
  object-fit: cover; box-shadow: 0 1px 4px rgba(63,45,30,.14); }
.fotoleiste a:hover img { border-color: var(--holz-hell); }
/* Streifen mit Beschriftung (Bereichsseite): Bild und Text als Spalte */
.fotoleiste a { flex: 0 0 auto; display: flex; flex-direction: column; gap: .25rem;
  max-width: 130px; text-decoration: none; }
.fotoleiste a span { font-size: .74rem; line-height: 1.2; color: var(--holz-dunkel);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; }
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem; }
.galerie figure { margin: 0; background: var(--papier); border: 1px solid var(--rand);
  border-radius: 12px; overflow: hidden; box-shadow: 0 1px 5px rgba(63,45,30,.1); }
.galerie img { width: 100%; height: 165px; object-fit: cover; display: block; }
.galerie figcaption { padding: .5rem .7rem; font-size: .88rem; }

table { border-collapse: collapse; width: 100%; background: var(--papier);
  border: 1px solid var(--rand); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--rand); vertical-align: top; }
th { background: #efe6d3; font-weight: 600; color: var(--holz-dunkel); }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #f6efe1; }

.flash { background: var(--gruen-hell); border: 1px solid var(--gruen); border-radius: 8px;
  padding: .5rem .8rem; margin-bottom: 1rem; }
.karten { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .7rem; }
.karte { background: var(--papier); border: 1px solid var(--rand); border-radius: 12px; padding: .8rem;
  text-decoration: none; color: var(--text); display: block; box-shadow: 0 1px 4px rgba(63,45,30,.08); }
.karte:hover { border-color: var(--holz-hell); box-shadow: 0 3px 10px rgba(63,45,30,.16); }
.karte .icon { font-size: 1.6rem; }
.zweispaltig { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 800px) {
  .zweispaltig { grid-template-columns: 1fr; }
  header { flex-direction: column; align-items: stretch; gap: .5rem; }
  /* Navigation als Raster: alle Punkte immer sichtbar, kein Querscrollen moeglich */
  /* minmax(0,1fr): Spalten duerfen unter die Textbreite schrumpfen, sonst wuerde
     das Raster den Header breiter als den Bildschirm machen */
  header nav { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .2rem; }
  header nav a { text-align: center; padding: .4rem .15rem; font-size: .88rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    background: rgba(255,255,255,.08); border-radius: 5px; }
  /* Kalenderknopf und Suche bleiben nebeneinander, die Suche nimmt den Rest */
  .kopf-rechts { width: 100%; margin-left: 0; }
  .suchbox { flex: 1 1 auto; min-width: 0; }
  .suchbox input { width: 100%; min-width: 0; }
  .hero img { height: 190px; }
  .hero .hero-titel { font-size: 1.35rem; padding-top: 2rem; }
  table, th, td { font-size: .95rem; }
}

form.formular { display: grid; gap: .7rem; max-width: 44rem; background: var(--papier);
  border: 1px solid var(--rand); border-radius: 12px; padding: 1rem; }
form.formular label { display: grid; gap: .2rem; font-size: .9rem; color: var(--grau); }
form.formular input, form.formular select, form.formular textarea, .werkzeuge input, .werkzeuge select {
  font: inherit; padding: .45rem .6rem; border: 1px solid var(--rand); border-radius: 6px;
  color: var(--text); background: #fff; }
form.formular textarea { min-height: 8rem; }
button, .knopf { font: inherit; background: var(--gruen); color: #fff; border: 0;
  border-radius: 6px; padding: .45rem .9rem; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .knopf:hover { background: #33593f; }
button.klein, .knopf.klein { padding: .15rem .55rem; font-size: .85rem; }
button.neben, .knopf.neben { background: var(--papier); color: var(--gruen); border: 1px solid var(--gruen); }
button.neben:hover, .knopf.neben:hover { background: var(--gruen-hell); }
button.loeschen { background: var(--papier); color: var(--rot); border: 1px solid var(--rot); }
button.loeschen:hover { background: #f7e2dd; }

.badge { display: inline-block; font-size: .75rem; border-radius: 99px; padding: .05rem .55rem;
  background: var(--gruen-hell); color: var(--gruen); }
.badge.warn { background: #f7e2dd; color: var(--rot); }
.badge.gelb { background: var(--gelb); color: #7d5c17; }
.gedimmt { color: var(--grau); font-size: .88rem; }
.frist-ueberfaellig { color: var(--rot); font-weight: 600; }
mark { background: var(--gelb); }
.infobox { background: var(--papier); border: 1px solid var(--rand); border-left: 4px solid var(--holz-hell);
  border-radius: 10px; padding: .2rem 1rem; margin-bottom: 1rem; }
.werkzeuge { display: flex; gap: .6rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }

/* Anhaenge einer Notiz */
.anhaenge { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: .8rem; margin-bottom: 1rem; }
.anhang { background: var(--papier); border: 1px solid var(--rand); border-radius: 10px;
  overflow: hidden; box-shadow: 0 1px 5px rgba(63,45,30,.1); }
.anhang img { width: 100%; height: 120px; object-fit: cover; display: block; }
.anhang-datei { display: flex; align-items: center; justify-content: center;
  height: 120px; font-size: 2.6rem; text-decoration: none; background: #efe6d3; }
.anhang-fuss { padding: .45rem .6rem; font-size: .85rem; display: flex;
  justify-content: space-between; align-items: center; gap: .4rem; }
.anhang-fuss a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anhang-fuss form { margin: 0; }
.inline-form { display: inline; }
/* bearbeiten/löschen nebeneinander; margin-top ersetzt den frueheren Absatz */
.knopfzeile { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center;
  margin: .3rem 0 .6rem; }
.knopfzeile form { margin: 0; }
.herkunft { font-size: .85rem; }
/* Stufe 3: Original bleibt daheim - deutlich abgesetzt */
.infobox.stufe3 { border-left-color: var(--rot); background: #fdf6f4; }
/* Sicherheitsberichte: Lage auf einen Blick */
.infobox.stufe-ruhig   { border-left-color: var(--gruen); background: var(--gruen-hell); }
.infobox.stufe-hinweis { border-left-color: #c69026; background: #fdf7e8; }
.infobox.stufe-achtung { border-left-color: var(--rot); background: #fdf1ee; }
/* Breite Tabellen im Fließtext scrollen in sich, statt am Handy abgeschnitten zu werden */
.tabelle-scroll { overflow-x: auto; margin-bottom: 1rem; }
.tabelle-scroll table { margin-bottom: 0; min-width: max-content; }

/* ---------- Kalender ---------- */
table.monat { table-layout: fixed; min-width: 44rem; }
table.monat th { text-align: center; font-size: .82rem; }
table.monat td { width: 14.28%; height: 5.6rem; vertical-align: top; padding: .25rem .3rem;
  border-right: 1px solid var(--rand); }
table.monat td:last-child { border-right: 0; }
table.monat td.fremd { background: #f4eee0; color: #a8987e; }
table.monat td.wochenende { background: #f7f1e4; }
table.monat td.fremd.wochenende { background: #f0e9da; }
table.monat td.heute { box-shadow: inset 0 0 0 2px var(--gruen); }
.tagzahl { font-size: .8rem; font-weight: 600; color: var(--holz-dunkel); margin-bottom: .18rem; }
td.fremd .tagzahl { font-weight: 400; color: inherit; }

.tag-termin { font-size: .72rem; line-height: 1.25; background: #f6e2c8;
  border-left: 3px solid var(--holz-hell); border-radius: 3px;
  padding: .08rem .25rem; margin-bottom: .12rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-termin.erledigt { opacity: .5; text-decoration: line-through; }

/* Aufenthalte: durchgehender Balken, Ränder nur am ersten und letzten Tag */
.tag-person { font-size: .72rem; line-height: 1.3; color: #fff; background: var(--farbe);
  padding: .08rem .3rem; margin-bottom: .12rem; border-radius: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-person.beginn { border-top-left-radius: 7px; border-bottom-left-radius: 7px; }
.tag-person.ende { border-top-right-radius: 7px; border-bottom-right-radius: 7px; }

.person-punkt { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%;
  margin-right: .4rem; vertical-align: baseline; }

/* Schnellzugriff: schwebender Knopf, Menue und Dialoge */
.fab { position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 60;
  width: 3.5rem; height: 3.5rem; border-radius: 50%; padding: 0;
  font-size: 2rem; line-height: 1; font-weight: 300;
  background: var(--gruen); color: #fff; border: 2px solid rgba(255,255,255,.5);
  box-shadow: 0 4px 14px rgba(63,45,30,.4); transition: transform .18s ease, background .18s ease; }
.fab:hover { transform: scale(1.06); }
.fab.offen { transform: rotate(45deg); background: var(--holz); }

.fab-menue { position: fixed; right: 1.1rem; bottom: 5.2rem; z-index: 60;
  display: flex; flex-direction: column; gap: .4rem;
  opacity: 0; pointer-events: none; transform: translateY(.6rem);
  transition: opacity .16s ease, transform .16s ease; }
.fab-menue.offen { opacity: 1; pointer-events: auto; transform: none; }
.fab-punkt { display: flex; align-items: center; gap: .6rem; text-align: left;
  background: var(--papier); color: var(--text); border: 1px solid var(--rand);
  border-radius: 10px; padding: .55rem .85rem; font-size: .95rem; min-width: 15rem;
  box-shadow: 0 3px 12px rgba(63,45,30,.22); }
.fab-punkt:hover { background: #fff; border-color: var(--holz-hell); }
.fab-punkt small { display: block; color: var(--grau); font-size: .78rem; }
.fab-punkt .fab-icon { font-size: 1.25rem; flex: none; }
.fab-punkt.gesperrt { background: var(--papier); color: var(--grau); cursor: default; }
.fab-punkt.gesperrt .fab-icon { opacity: .45; }
.fab-punkt.gesperrt:hover { background: var(--papier); border-color: var(--rand); }

dialog.dlg { border: 1px solid var(--rand); border-radius: 14px; padding: 1.1rem 1.2rem 1.2rem;
  width: min(30rem, calc(100vw - 1.6rem)); background: var(--creme); color: var(--text);
  box-shadow: 0 12px 40px rgba(46,38,29,.4); }
dialog.dlg::backdrop { background: rgba(46,38,29,.5); }
.dlg-kopf { display: flex; align-items: center; justify-content: space-between; margin-bottom: .8rem; }
.dlg-kopf h2 { margin: 0; font-size: 1.2rem; }
.dlg-kopf .dialog-zu { background: none; color: var(--grau); font-size: 1.6rem; line-height: 1;
  padding: 0 .3rem; border: 0; }
.dlg-kopf .dialog-zu:hover { color: var(--text); background: none; }
.dlg-feld { display: grid; gap: .2rem; font-size: .88rem; color: var(--grau); margin-bottom: .6rem; }
.dlg-feld input, .dlg-feld textarea { font: inherit; color: var(--text); background: #fff;
  padding: .45rem .6rem; border: 1px solid var(--rand); border-radius: 6px; width: 100%; }
.dlg-feld textarea { min-height: 5.5rem; resize: vertical; }
.dlg-zeile { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.dlg-zeile > * { flex: 1 1 8rem; min-width: 0; font: inherit; padding: .45rem .6rem;
  border: 1px solid var(--rand); border-radius: 6px; background: #fff; color: var(--text); }
.dlg-dateiknopf { cursor: pointer; text-align: center; flex: 1 1 8rem; padding: .55rem .6rem; }
.datei-anzeige { margin: .1rem 0 .7rem; word-break: break-all; }
.dlg-fuss { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .9rem; }
.dlg button[type=submit]:disabled { background: var(--grau); cursor: not-allowed; }

@media (max-width: 800px) {
  body { padding-bottom: 4.5rem; }
  .fab-punkt { min-width: 13rem; }
}

/* Sprachnotizen */
.aufnahme-box { background: var(--papier); border: 1px solid var(--rand); border-left: 4px solid var(--gruen);
  border-radius: 12px; padding: .9rem 1rem; margin-bottom: 1.2rem; }
.aufnahme-kopf { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.aufnahme-knopf { display: inline-flex; align-items: center; gap: .55rem; font-size: 1.02rem;
  padding: .6rem 1.1rem; border-radius: 99px; }
.aufnahme-knopf .punkt { width: .8rem; height: .8rem; border-radius: 50%; background: #fff; flex: none; }
.aufnahme-knopf.laeuft { background: var(--rot); }
.aufnahme-knopf.laeuft .punkt { animation: pulsieren 1.1s infinite; }
.aufnahme-knopf:disabled { background: var(--grau); cursor: not-allowed; }
@keyframes pulsieren { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.75); } }
.aufnahme-zeit { font-variant-numeric: tabular-nums; font-size: 1.1rem; color: var(--rot); font-weight: 600; }
.pruef-karte { border-left-color: var(--gruen); }
.pruef-karte textarea { font: inherit; padding: .5rem .6rem; border: 1px solid var(--rand);
  border-radius: 6px; background: #fff; color: var(--text); }
