:root {
  --hg: #f3f5f8;
  --flaeche: #ffffff;
  --text: #16202e;
  --leise: #5f6b7a;
  --linie: #dde2e9;
  --kopf: #0f1724;
  --kopf-text: #ffffff;
  --schatten: 0 1px 3px rgba(15, 23, 36, .08), 0 6px 18px rgba(15, 23, 36, .06);
  --radius: 18px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --hg: #0b111b;
    --flaeche: #161f2d;
    --text: #e9eef5;
    --leise: #9aa7b8;
    --linie: #263245;
    --kopf: #0f1724;
    --schatten: 0 1px 3px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--hg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }

/* Kopfzeile */
.kopf {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: var(--kopf);
  color: var(--kopf-text);
}
.kopf-logo { width: 36px; height: 36px; border-radius: 9px; flex: 0 0 auto; }
.kopf h1 { flex: 1; margin: 0; font-size: 1.2rem; font-weight: 700; }
.zurueck {
  border: 0;
  background: rgba(255, 255, 255, .12);
  color: inherit;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.benutzer {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  font-size: .8rem;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  white-space: nowrap;
}

.vorschau-band {
  display: none;
  padding: 8px 16px;
  background: #f5a623;
  color: #1b1300;
  font-size: .85rem;
  font-weight: 600;
  text-align: center;
}
body.vorschau .vorschau-band { display: block; }

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 96px);
}

/* Startseite */
.begruessung { margin: 8px 2px 16px; font-size: 1.5rem; }

.kacheln {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.kachel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 170px;
  padding: 18px 12px;
  border-radius: var(--radius);
  background: var(--flaeche);
  box-shadow: var(--schatten);
  border-top: 5px solid var(--farbe);
  text-decoration: none;
  text-align: center;
  transition: transform .12s ease;
}
a.kachel:active { transform: scale(.97); }
.kachel-logo { width: 100%; max-width: 130px; height: 70px; object-fit: contain; }
.logo-icon { display: grid; place-items: center; font-size: 2.6rem; }
.kachel-name { font-weight: 700; font-size: 1.05rem; }
.kachel-info { font-size: .8rem; color: var(--leise); }
.kachel-inaktiv { opacity: .55; }

/* Bereich */
.bereich-kopf {
  display: flex;
  justify-content: center;
  padding: 14px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  background: var(--flaeche);
  box-shadow: var(--schatten);
}
.bereich-logo { height: 80px; max-width: 100%; object-fit: contain; }

.reiter {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.reiter-knopf {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--linie);
  background: var(--flaeche);
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}
.reiter-knopf.aktiv {
  background: var(--farbe);
  border-color: var(--farbe);
  color: #1b1300;
}

.reiter-inhalt h2 { margin: 4px 2px 12px; font-size: 1.3rem; }
.leer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 48px 16px;
  border: 2px dashed var(--linie);
  border-radius: var(--radius);
  color: var(--leise);
  text-align: center;
}
.leer-icon { font-size: 2.4rem; }
.leer p { margin: 0; }

.hinweis { padding: 32px 4px; text-align: center; color: var(--leise); }
.hinweis a { font-weight: 600; color: var(--text); }

/* Fußzeile: feste Leiste unten, alle Felder exakt gleich breit */
.fussleiste {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(var(--anzahl, 5), minmax(0, 1fr));
  gap: 4px;
  padding: 6px 6px calc(env(safe-area-inset-bottom) + 6px);
  background: var(--kopf);
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.fuss-feld {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 56px;
  min-width: 0;
  border-radius: 12px;
  color: #c7d0dc;
  text-decoration: none;
}
.fuss-icon { font-size: 1.35rem; line-height: 1; }
.fuss-text {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .72rem;
  font-weight: 600;
}
.fuss-feld.aktiv { background: rgba(245, 166, 35, .18); color: #f5b83d; }
.fuss-feld.gesperrt { opacity: .4; }
@media (max-width: 340px) {
  .fuss-text { font-size: .64rem; }
  .fussleiste { gap: 2px; padding-left: 4px; padding-right: 4px; }
}

/* Anmeldung */
.laedt { padding: 48px 0; text-align: center; color: var(--leise); }
.anmeldung { max-width: 380px; margin: 24px auto 0; text-align: center; }
.anmelde-logo { width: 88px; height: 88px; border-radius: 22px; }
.anmeldung h2 { margin: 12px 0 20px; }
.anmelde-form {
  display: grid;
  gap: 6px;
  padding: 20px;
  text-align: left;
  border-radius: var(--radius);
  background: var(--flaeche);
  box-shadow: var(--schatten);
}
.anmelde-form label { margin-top: 8px; font-size: .9rem; font-weight: 600; }
.anmelde-form input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--linie);
  border-radius: 12px;
  background: var(--hg);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}
.haupt-knopf {
  min-height: 50px;
  margin-top: 14px;
  border: 0;
  border-radius: 12px;
  background: #f5a623;
  color: #1b1300;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}
.haupt-knopf:disabled { opacity: .6; }
.anmelde-fehler { min-height: 1.2em; margin: 6px 0 0; color: #d64545; font-weight: 600; }
.anmelde-hinweis { margin: 4px 0 0; color: var(--leise); font-size: .85rem; }
.hinweis .haupt-knopf { padding: 0 24px; }
.fussleiste[hidden] { display: none; }

/* Lager */
.leise { color: var(--leise); font-size: .85rem; }
.meldung { min-height: 1.2em; margin: 8px 0 0; font-weight: 600; }
.meldung.fehler { color: #d64545; }
.zweit-knopf {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--linie);
  border-radius: 12px;
  background: var(--flaeche);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.zweit-knopf.gefahr { color: #d64545; }
.aufgaben {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  padding: 14px;
  border-radius: 14px;
  background: var(--flaeche);
  box-shadow: var(--schatten);
}
.aufgaben { border-left: 5px solid #d64545; }
.aufgabe { display: grid; gap: 2px; padding-top: 6px; border-top: 1px solid var(--linie); }
.aufgabe a { font-weight: 700; color: var(--text); }
.lager-kopf { display: flex; gap: 8px; margin-bottom: 8px; }
.suche, .feld {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--linie);
  border-radius: 12px;
  background: var(--flaeche);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}
.suche { flex: 1; min-width: 0; }
.gruppe {
  margin: 18px 2px 6px;
  color: var(--leise);
  font-size: .78rem;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.lager-liste { display: grid; gap: 6px; }
.artikel {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 8px 12px 8px 8px;
  border: 1px solid var(--linie);
  border-radius: 14px;
  background: var(--flaeche);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.artikel.knapp { border-color: #d64545; }
.artikel-bild, .blatt-bild {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
}
.bild-leer { display: grid; place-items: center; font-size: 1.6rem; }
.artikel-text { display: grid; gap: 1px; min-width: 0; }
.artikel-name { font-weight: 700; overflow-wrap: anywhere; }
.artikel-bestand { display: grid; justify-items: end; font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.artikel-bestand small { font-size: .7rem; font-weight: 600; color: var(--leise); }
.artikel.knapp .artikel-bestand { color: #d64545; }

/* Blatt (Artikel-Details) */
.blatt {
  width: min(560px, 100vw);
  max-width: 100vw;
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 20px 20px 0 0;
  background: var(--hg);
  color: var(--text);
}
.blatt::backdrop { background: rgba(0, 0, 0, .45); }
.blatt-innen { display: grid; gap: 14px; padding: 16px 16px calc(env(safe-area-inset-bottom) + 20px); }
.blatt-kopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 1.1rem; }
.schliessen { width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--flaeche); color: var(--text); font-size: 1.1rem; cursor: pointer; }
.blatt-info { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: start; }
.blatt-info p { margin: 0 0 4px; }
.blatt-info a { font-weight: 700; color: var(--text); }
.blatt-bild { width: 96px; height: 96px; }
.gross-zahl { font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.buchen, .verlauf, .bearbeiten {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 14px;
  background: var(--flaeche);
}
.buchen .feld, .bearbeiten .feld { background: var(--hg); }
.buchen-felder { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; }
.buchen-knoepfe { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.knopf-minus, .knopf-plus {
  min-height: 50px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.knopf-minus { background: #d64545; color: #fff; }
.knopf-plus { background: #2f9e6a; color: #fff; }
.verlauf-zeile { display: grid; grid-template-columns: 88px 64px minmax(0, 1fr); gap: 8px; font-size: .9rem; }
.verlauf-zeile .minus { color: #d64545; font-weight: 700; }
.verlauf-zeile .plus { color: #2f9e6a; font-weight: 700; }
.zeile { display: grid; gap: 4px; font-size: .85rem; font-weight: 600; }
.zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bearbeiten .haupt-knopf { margin-top: 0; }

/* Projekte */
.bedarf { color: var(--leise); font-size: .8rem; font-weight: 600; }
.bedarf.minus { color: #d64545; }
.bestell { justify-self: start; font-size: .78rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.bestell.bestellt { background: #fff3c4; color: #7a5a00; }
.bestell.unterwegs { background: #d8f3dc; color: #1b6b34; }
.gruen { color: #2f9e6a; font-weight: 700; }
.umschalter { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.umschalter button, .seg button {
  min-height: 44px;
  border: 1px solid var(--linie);
  border-radius: 12px;
  background: var(--flaeche);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.umschalter button.an, .seg button.an { background: #f5a623; border-color: #f5a623; color: #1b1300; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { min-height: 40px; padding: 0 12px; }
.projekt-liste { display: grid; gap: 8px; }
.projekt-karte {
  display: grid;
  gap: 3px;
  padding: 14px;
  border: 1px solid var(--linie);
  border-radius: 14px;
  background: var(--flaeche);
  color: var(--text);
  text-decoration: none;
}
.abschnitt { margin-bottom: 10px; border-radius: 14px; background: var(--flaeche); box-shadow: var(--schatten); }
.abschnitt > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 0 16px;
  font-weight: 700;
  font-size: 1.05rem;
  list-style: none;
  cursor: pointer;
}
.abschnitt > summary::-webkit-details-marker { display: none; }
.abschnitt > summary::after { content: "+"; font-size: 1.4rem; color: #f5a623; }
.abschnitt[open] > summary::after { content: "–"; }
.abschnitt-innen { display: grid; gap: 10px; padding: 0 16px 16px; }
.abschnitt .feld { background: var(--hg); }
.neues-projekt, .formular { display: grid; gap: 8px; }
.drei { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 520px) { .drei { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.projekt-leiste { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.zurueck-link { font-weight: 700; color: var(--text); }
.speicher-status { color: var(--leise); font-size: .85rem; font-weight: 600; }
.projekt-kopf { display: grid; gap: 6px; margin-bottom: 12px; }
.projekt-kopf h2 { margin: 0; font-size: 1.3rem; overflow-wrap: anywhere; }
.projekt-kopf a { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.projekt-kopf p { margin: 0; }
.knopf-reihe { display: flex; flex-wrap: wrap; gap: 8px; }
.datei-liste { display: grid; gap: 6px; }
.datei { display: flex; gap: 6px; align-items: center; }
.datei-name {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--linie);
  border-radius: 12px;
  background: var(--hg);
  color: var(--text);
  font: inherit;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.mini { width: 44px; height: 44px; border: 1px solid var(--linie); border-radius: 12px; background: var(--hg); font: inherit; cursor: pointer; }
.mini.gefahr { color: #d64545; }
.hinweis-kasten { padding: 10px 12px; border-left: 4px solid #f5a623; border-radius: 10px; background: var(--hg); font-size: .9rem; }
.hinweis-kasten ul { margin: 6px 0 0; padding-left: 18px; }
.mat-zeile {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 64px 86px;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--linie);
}
.mat-zeile > div:nth-child(2) { display: grid; gap: 1px; min-width: 0; }
.mat-zeile.fertig { background: rgba(47, 158, 106, .12); border-radius: 10px; padding-left: 6px; }
.mat-soll { display: grid; justify-items: end; font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.mat-soll small, .mat-g small { font-size: .7rem; font-weight: 600; color: var(--leise); }
.mat-g { display: grid; gap: 2px; }
.mat-g .feld { text-align: right; padding: 8px; }
.flaeche { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--linie); border-radius: 12px; }
.flaeche p { margin: 0; }
.regeln summary { cursor: pointer; color: var(--leise); font-weight: 600; padding: 6px 0; }
.summe { display: flex; flex-wrap: wrap; gap: 14px; font-size: 1rem; }
.summe b { font-size: 1.4rem; }
.plan { overflow-x: auto; }
.plan-gross { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
.plan-gross .blatt-kopf { padding: 12px 16px; position: sticky; left: 0; }
.plan-gross-innen { overflow: auto; padding: 0 12px 24px; }

/* Protokolle */
.string { display: grid; gap: 4px; }
.string-felder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 6px; align-items: end; }
.string-felder > .feld { grid-column: 1 / 3; font-weight: 700; }
.string-felder > .mini.gefahr { grid-column: 3; grid-row: 1; }
.string-felder > .mini.kamera { grid-column: 3; grid-row: 2; align-self: end; }
.string-wert { display: grid; gap: 2px; }
.string-wert small { font-size: .75rem; font-weight: 600; color: var(--leise); }
.string-felder .feld { padding: 8px 10px; }
.string-pruefung { font-size: .85rem; font-weight: 600; color: var(--leise); }
.string-pruefung.ok { color: #2f9e6a; }
.string-pruefung.warn, .warn { color: #d64545; font-weight: 600; }
.punkte { display: grid; gap: 4px; }
.punkt { display: grid; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--linie); }
.sig { display: grid; gap: 6px; align-content: start; }
.sig-vorschau { width: 100%; max-height: 90px; object-fit: contain; border-radius: 8px; background: #fff; }
.sig-vorschau:not([src]) { display: none; }
textarea.feld { min-height: 80px; resize: vertical; }
.als-link { display: inline-grid; place-items: center; padding: 0 18px; text-decoration: none; }
.knopf-reihe .haupt-knopf { margin-top: 0; padding: 0 16px; }
.string { padding: 6px; border: 2px solid transparent; border-radius: 12px; }
.string.richtig { border-color: rgba(47, 158, 106, .45); }
.string.falsch {
  border-color: #d64545;
  background: rgba(214, 69, 69, .12);
  box-shadow: 0 0 0 3px rgba(214, 69, 69, .25);
  animation: rot-leuchten 1.6s ease-in-out infinite;
}
.string.falsch .string-pruefung { font-weight: 800; }
@keyframes rot-leuchten { 50% { box-shadow: 0 0 0 7px rgba(214, 69, 69, .15); } }
@media (prefers-reduced-motion: reduce) { .string.falsch { animation: none; } }

/* Fotos */
.foto-fab {
  position: fixed;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom) + 84px);
  z-index: 25;
  width: 68px;
  height: 68px;
  border: 0;
  border-radius: 50%;
  background: #f5a623;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
  font-size: 1.9rem;
  cursor: pointer;
}
.foto-fab:active { transform: scale(.94); }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 160px);
  z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 14px;
  background: #16202e;
  color: #fff;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity .2s, transform .2s;
}
.toast.sichtbar { opacity: 1; transform: translate(-50%, 0); }
.toast.fehler { background: #d64545; }
.foto-raster { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.foto { position: relative; display: grid; gap: 2px; }
.foto-bild { padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: var(--hg); aspect-ratio: 1; cursor: pointer; }
.foto-bild img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-info { font-size: .7rem; color: var(--leise); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini.kamera { background: #f5a623; border-color: #f5a623; font-size: 1.2rem; }
.string-unten { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.string-bild { flex: 0 0 auto; width: 52px; height: 52px; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: var(--hg); cursor: pointer; }
.string-bild[hidden] { display: none; }
.string-bild img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Projektgalerie */
.galerie { display: grid; gap: 10px; }
.galerie-leiste { position: sticky; top: 72px; z-index: 5; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 8px 0; background: var(--flaeche); }
.galerie-leiste button { min-height: 42px; margin-top: 0; padding: 0 8px; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.galerie-leiste .haupt-knopf { grid-column: 1 / -1; }
.foto, .foto-info { min-width: 0; }
.foto-bild { aspect-ratio: 3 / 4; }
.foto.markiert .foto-bild { outline: 4px solid #f5a623; outline-offset: -4px; }
.foto-haken {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 36px;
  height: 36px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(0, 0, 0, .35);
  color: #1b1300;
  font-weight: 900;
  font-size: 1.1rem;
  cursor: pointer;
}
.foto.markiert .foto-haken { background: #f5a623; border-color: #f5a623; }
.ansicht { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; background: #000; color: #fff; }
.ansicht[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.ansicht .blatt-kopf { padding: 12px 16px; font-size: .9rem; }
.ansicht .schliessen { background: rgba(255, 255, 255, .15); color: #fff; }
.ansicht-bild { width: 100%; height: 100%; object-fit: contain; touch-action: pan-y; }
.ansicht-knoepfe { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 8px; padding: 12px 16px calc(env(safe-area-inset-bottom) + 16px); }
.ansicht-knoepfe .haupt-knopf { margin-top: 0; }
.abschnitt-innen > * { min-width: 0; }
.galerie, .abschnitt-innen { grid-template-columns: minmax(0, 1fr); }

/* Termine in der Projektliste */
.termin-marke {
  justify-self: start;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .06em;
}
.termin-marke.heute { background: #2f9e6a; color: #fff; }
.termin-marke.morgen { background: #f5c518; color: #1b1300; }
.projekt-karte.status-heute {
  gap: 5px;
  padding: 18px 16px;
  border: 2px solid #2f9e6a;
  box-shadow: 0 4px 16px rgba(47, 158, 106, .25);
}
.projekt-karte.status-heute b { font-size: 1.2rem; }
.projekt-karte.status-morgen { border: 2px solid #f5c518; }
.projekt-karte.status-spaeter, .projekt-karte.status-ohne, .projekt-karte.status-vorbei { padding: 10px 12px; font-size: .92rem; }
.projekt-karte.status-vorbei { opacity: .75; }
.projekt-kopf .termin-marke { font-size: .9rem; }

/* Team und Zuweisung */
.team, .team-liste, .zuweisung { display: grid; gap: 8px; }
.team-person { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 6px; align-items: center; }
.team-person .leise { grid-column: 1 / -1; }
.truppe-kopf { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.anleitung { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--linie);
  border-radius: 999px;
  background: var(--hg);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.chip.gross { min-height: 46px; padding: 0 18px; }
.chip.an { background: #2f9e6a; border-color: #2f9e6a; color: #fff; }
.zuweisung-info { font-size: .82rem; font-weight: 600; color: #2f9e6a; }
.zuweisung-info.offen { color: #d64545; }
.haken-liste { display: grid; gap: 6px; }
.haken-zeile {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 52px;
  padding: 6px 12px;
  border: 1px solid var(--linie);
  border-radius: 12px;
  background: var(--hg);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.haken-zeile .haken {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid var(--linie);
  border-radius: 8px;
  background: var(--flaeche);
  font-weight: 900;
}
.haken-zeile.an { border-color: #2f9e6a; background: rgba(47, 158, 106, .1); }
.haken-zeile.an .haken { background: #2f9e6a; border-color: #2f9e6a; color: #fff; }
/* Formulare nie breiter als der Bildschirm */
.zwei { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.neues-projekt, .formular, .zuweisung, .haken-liste, .bearbeiten, .buchen { grid-template-columns: minmax(0, 1fr); }
.feld, .zeile, .haken-zeile { min-width: 0; max-width: 100%; }
.ki-zeile { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.ki-zeile[hidden] { display: none; }
.ki-zeile input { width: 24px; height: 24px; }
.projekt-kopf .knopf-reihe .haupt-knopf { margin-top: 0; min-height: 44px; padding: 0 16px; }
.blatt { overflow-y: auto; overscroll-behavior: contain; }
.ansicht { overflow: hidden; }

/* KI-Kasten auf der Projektseite */
.ki-kasten { margin: 10px 0; }
.ki-kasten-kopf { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ki-kasten .meldung { margin: 6px 0 0; }
.meldung.ok { color: #2e9d5b; }

/* Belege (Buchhaltung & Finanzen) */
.beleg-start { display: grid; gap: 8px; margin-bottom: 14px; }
.beleg-start .haupt-knopf { margin-top: 0; min-height: 60px; font-size: 1.15rem; }
.beleg-start .zweit-knopf { white-space: normal; min-height: 48px; }
.belege .chips { margin-bottom: 6px; }
.beleg-monat-kopf { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 16px; }
.beleg-monat-kopf .gruppe { margin: 0; }
.beleg-monat-kopf .klein { min-height: 34px; padding: 0 10px; margin-left: auto; font-size: .85rem; }
.beleg-liste { display: grid; gap: 6px; margin-top: 6px; }
.beleg-karte {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 8px 12px 8px 8px;
  border: 1px solid var(--linie);
  border-radius: 14px;
  background: var(--flaeche);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.beleg-karte.pruefen { border-left: 5px solid #f5c518; }
.beleg-bild { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--hg); }
.beleg-bild.leer { display: grid; place-items: center; font-size: 1.6rem; }
.beleg-text { display: grid; gap: 2px; min-width: 0; }
.beleg-text b, .beleg-text .leise { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.beleg-marken { display: flex; flex-wrap: wrap; gap: 4px; }
.marke { padding: 1px 8px; border-radius: 999px; background: var(--hg); font-size: .72rem; font-weight: 700; }
.marke.gelb { background: #f5c518; color: #1b1300; }
.marke.rot { background: #d64545; color: #fff; }
.beleg-betrag { font-weight: 800; white-space: nowrap; }
.beleg-dateien { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.beleg-datei-box { position: relative; flex: none; }
.beleg-datei {
  display: grid;
  place-items: center;
  flex: none;
  width: 86px;
  height: 110px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--linie);
  border-radius: 12px;
  background: var(--flaeche);
  color: var(--text);
  font: inherit;
  font-size: 1.6rem;
  cursor: pointer;
}
.beleg-datei img { width: 100%; height: 100%; object-fit: cover; }
.beleg-datei span { font-size: .9rem; font-weight: 700; }
.beleg-datei.neu { gap: 0; border-style: dashed; }
.beleg-datei.neu small { font-size: .75rem; font-weight: 600; }
.beleg-datei.laedt { font-size: 1.2rem; }
.beleg-datei-weg {
  position: absolute; top: 4px; right: 4px;
  width: 26px; height: 26px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .6); color: #fff; font-size: .8rem; cursor: pointer;
}
.beleg-sprache { display: grid; gap: 10px; padding: 12px; border-radius: 14px; background: var(--flaeche); }
.beleg-blatt .feld { background: var(--flaeche); }
.beleg-sprache .feld { background: var(--hg); }
textarea.feld { min-height: 80px; resize: vertical; line-height: 1.4; }
.sprache { display: grid; gap: 6px; }
.sprach-knopf {
  min-height: 56px;
  border: 0;
  border-radius: 14px;
  background: #4a9ff5;
  color: #fff;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
}
.sprach-knopf.aktiv { background: #d64545; animation: sprach-puls 1.2s ease-in-out infinite; }
.sprach-knopf:disabled { opacity: .6; }
@keyframes sprach-puls { 50% { box-shadow: 0 0 0 8px rgba(214, 69, 69, .25); } }
@media (prefers-reduced-motion: reduce) { .sprach-knopf.aktiv { animation: none; } }
.sprach-status { margin: 0; }
.sprach-status:empty { display: none; }
.sprach-live { margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--hg); font-style: italic; }
.sprach-liste { display: grid; gap: 8px; }
.sprach-liste:empty { display: none; }
.sprach-eintrag { display: grid; gap: 4px; padding: 8px; border-radius: 10px; background: var(--hg); }
.sprach-kopf { display: flex; justify-content: space-between; align-items: center; }
.sprach-eintrag audio { width: 100%; height: 40px; }
.sprach-text { margin: 0; font-size: .9rem; }
.schliessen.klein { width: 30px; height: 30px; font-size: .85rem; background: transparent; }
.beleg-blatt .haupt-knopf { margin-top: 0; }
.ki-kasten.laeuft, .ki-kasten.ok, .ki-kasten.fehler { margin: 0; padding: 10px 12px; border-radius: 12px; font-weight: 600; }
.ki-kasten.laeuft { background: rgba(74, 159, 245, .15); }
.ki-kasten.ok { background: rgba(47, 158, 106, .15); color: #2e9d5b; }
.ki-kasten.fehler { background: rgba(214, 69, 69, .12); color: #d64545; }
.positionen summary { font-weight: 600; cursor: pointer; }
.positionen ul { margin: 6px 0 0; padding-left: 20px; font-size: .9rem; }

/* Belege zuschneiden */
.beleg-fotos { display: grid; gap: 8px; }
.beleg-datei-schere, .beleg-datei-arbeit {
  position: absolute; left: 4px; bottom: 4px;
  min-width: 34px; height: 30px; padding: 0 6px; border: 0; border-radius: 10px;
  background: rgba(0, 0, 0, .65); color: #fff; font-size: .85rem; font-weight: 700; cursor: pointer;
  display: grid; place-items: center;
}
.beleg-datei-arbeit { animation: sprach-puls 1.2s ease-in-out infinite; }
.zuschnitt-blatt .blatt-innen { gap: 10px; }
.zuschnitt-flaeche {
  position: relative;
  justify-self: center;
  width: fit-content;
  max-width: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.zuschnitt-bild { display: block; max-width: 100%; max-height: 62vh; border-radius: 6px; pointer-events: none; }
.zuschnitt-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.zuschnitt-schatten { fill: rgba(0, 0, 0, .5); }
.zuschnitt-rahmen { fill: none; stroke: #f5a623; stroke-width: 3px; vector-effect: non-scaling-stroke; }
.zuschnitt-griff {
  position: absolute;
  width: 44px; height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  touch-action: none;
  cursor: grab;
}
.zuschnitt-griff::after {
  content: ""; position: absolute; inset: 10px;
  border: 3px solid #fff; border-radius: 50%;
  background: #f5a623; box-shadow: 0 1px 4px rgba(0, 0, 0, .5);
}
.zuschnitt-griff.aktiv::after { inset: 4px; background: rgba(245, 166, 35, .5); }

/* Lager-Fotos in der Materialliste */
.mat-bild-knopf { padding: 0; border: 0; background: none; cursor: zoom-in; }
.mat-bild { display: block; width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--hg); }
.mat-bild.bild-leer { font-size: 1.3rem; }
.mat-bild-gross { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 12px; background: #fff; }
.mat-zeile b { overflow-wrap: anywhere; hyphens: auto; }
@media (max-width: 420px) {
  .mat-zeile { grid-template-columns: 38px minmax(0, 1fr) 46px 68px; gap: 6px; }
  .mat-bild { width: 38px; height: 38px; border-radius: 8px; }
  .mat-soll { font-size: 1.25rem; }
}

/* KI-Assistent (js/assistent.js) */
.ki-assistent-knopf {
  position: fixed;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom) + 84px);
  z-index: 25;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--kopf);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
  cursor: pointer;
}
.ki-verlauf { display: grid; gap: 8px; max-height: 50dvh; overflow-y: auto; }
.ki-blase { margin: 0; padding: 10px 12px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 92%; }
.ki-blase.nutzer { justify-self: end; background: var(--kopf); color: #fff; }
.ki-blase.ki { justify-self: start; background: var(--flaeche); border: 1px solid var(--linie); }
.ki-blase.laedt { opacity: .7; font-style: italic; }
