:root {
  --gross: 1.35rem;
  --rand: 14px;
  --primaer: #2f6f4f;
  --primaer-dunkel: #24583f;
  --gefahr: #a23b2d;
  --grau: #666;
  --linie: #d5d5d5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  line-height: 1.5;
  color: #222;
  background: #f5f3ee;
}

.screen { padding: 20px; max-width: 1200px; margin: 0 auto; }
.hidden { display: none !important; }

/* --- Buttons & Eingaben --------------------------------------------- */
button {
  font-family: inherit;
  font-size: var(--gross);
  padding: 14px 22px;
  border: 2px solid var(--primaer);
  border-radius: var(--rand);
  background: #fff;
  color: var(--primaer-dunkel);
  cursor: pointer;
}
button:hover:not(:disabled) { background: #eef4f0; }
button:disabled { opacity: .45; cursor: default; }

button.primaer { background: var(--primaer); color: #fff; }
button.primaer:hover { background: var(--primaer-dunkel); }
button.gefahr { border-color: var(--gefahr); color: var(--gefahr); }
button.gefahr:hover { background: #f7ebe9; }
.gross { font-size: var(--gross); }

input, textarea {
  font-family: inherit;
  font-size: var(--gross);
  padding: 12px 14px;
  border: 2px solid var(--linie);
  border-radius: var(--rand);
  background: #fff;
  width: 100%;
}
input:focus, textarea:focus { outline: 3px solid #bcd7c8; border-color: var(--primaer); }

.hinweis { color: var(--grau); }
.fehler-text { color: var(--gefahr); font-weight: bold; }

/* --- Login ---------------------------------------------------------- */
#login { display: flex; min-height: 90vh; align-items: center; justify-content: center; }
.login-box {
  background: #fff; padding: 40px; border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,.08); width: 100%; max-width: 420px; text-align: center;
}
.login-box h1 { margin-top: 0; font-size: 2.2rem; }
.login-box input { margin: 14px 0; text-align: center; }
.login-box button { width: 100%; }

/* --- Kopfzeile ------------------------------------------------------ */
.kopf {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 16px; margin-bottom: 16px; border-bottom: 2px solid var(--linie);
  flex-wrap: wrap;
}
.titel-eingabe { flex: 1; min-width: 200px; font-size: 1.8rem; font-weight: bold; border-style: dashed; }
.kopf-knoepfe { display: flex; gap: 10px; }
.detail-titel { font-size: 1.4rem; color: var(--grau); }

/* --- Upload --------------------------------------------------------- */
.upload-knoepfe { display: flex; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.upload-flaeche {
  flex: 1; min-width: 220px;
  display: block; text-align: center; padding: 28px;
  background: var(--primaer); color: #fff; border-radius: var(--rand);
  cursor: pointer; font-size: 1.5rem;
}
.upload-flaeche:hover { background: var(--primaer-dunkel); }

/* --- Raster --------------------------------------------------------- */
.raster {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.karte {
  background: #fff; border: 2px solid var(--linie); border-radius: var(--rand);
  overflow: hidden; display: flex; flex-direction: column;
}
.karte.zieht { opacity: .4; }
.karte.ueber { border-color: var(--primaer); border-style: dashed; }
.karte-bild {
  width: 100%; height: 240px; object-fit: cover; cursor: pointer; background: #eee;
  display: block;
}
.karte-fuss { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.karte-zeile { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.seiten-nr { font-weight: bold; }
.karte-datum { color: var(--grau); font-size: .95rem; }

.badge { padding: 4px 10px; border-radius: 20px; font-size: .9rem; white-space: nowrap; }
.badge.wartend { background: #eee; color: #555; }
.badge.laeuft  { background: #fde9c8; color: #8a5a00; }
.badge.fertig  { background: #d9efe1; color: #216b45; }
.badge.fehler  { background: #f7d9d4; color: var(--gefahr); }

.pfeile { display: flex; gap: 6px; }
.pfeile button { padding: 6px 12px; font-size: 1.1rem; }

.seiten-titel { font-size: 1.9rem; margin: 0; }
.doc-titel { font-weight: bold; font-size: 1.2rem; cursor: pointer; }
.doc-titel:hover { text-decoration: underline; }
.karte-bild.leer { display: flex; align-items: center; justify-content: center; font-size: 4rem; }
button.klein { padding: 7px 12px; font-size: 1rem; }

/* --- Detail --------------------------------------------------------- */
.detail-flaeche { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 800px) { .detail-flaeche { grid-template-columns: 1fr; } }

.foto-spalte { align-self: start; }
.foto-spalte img {
  width: 100%; border: 1px solid var(--linie); border-radius: var(--rand);
  cursor: zoom-in; background: #fff; display: block;
}
/* Gezoomtes Foto scrollt innerhalb seiner Spalte, statt herauszulaufen. */
.foto-spalte img.zoom { cursor: zoom-out; width: auto; max-width: none; }

/* Foto nur auf breiten Screens fixieren (zweispaltig). Einspaltig wuerde es
   sonst beim Scrollen ueber den Text laufen. */
@media (min-width: 801px) {
  .foto-spalte {
    position: sticky; top: 10px;
    max-height: 92vh; overflow: auto;
  }
}

.umschalter { display: flex; gap: 0; margin-bottom: 14px; }
.tab {
  flex: 1; border-radius: 0; border-right-width: 1px;
  background: #fff; color: var(--grau);
}
.tab:first-child { border-radius: var(--rand) 0 0 var(--rand); }
.tab:last-child  { border-radius: 0 var(--rand) var(--rand) 0; border-left-width: 1px; }
.tab.aktiv { background: var(--primaer); color: #fff; }

.feld-label { display: block; color: var(--grau); margin-bottom: 4px; }
.datum-eingabe { margin-bottom: 16px; }
.text-eingabe { min-height: 55vh; line-height: 1.7; white-space: pre-wrap; }

.speicher-zeile { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.speicher-status { color: var(--grau); min-width: 120px; }
.speicher-status.speichert { color: #8a5a00; }
.speicher-status.gespeichert { color: #216b45; }

/* --- PDF-Dialog ----------------------------------------------------- */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.dialog {
  background: #fff; padding: 30px; border-radius: 18px; width: 100%; max-width: 520px;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
}
.dialog h2 { margin-top: 0; }
.wahl { display: flex; gap: 0; margin-bottom: 18px; }
.wahl-btn {
  flex: 1 1 0; min-width: 0;           /* darf schrumpfen, statt zu ueberlaufen */
  padding: 14px 10px; font-size: 1.1rem;
  border-radius: 0; color: var(--grau); background: #fff;
}
.wahl-btn:first-child { border-radius: var(--rand) 0 0 var(--rand); }
.wahl-btn:last-child { border-radius: 0 var(--rand) var(--rand) 0; border-left-width: 1px; }
.wahl-btn.aktiv { background: var(--primaer); color: #fff; }
.dialog-knoepfe { display: flex; gap: 12px; justify-content: flex-end; margin-top: 10px; }
