/*
  Feldwerkzeug, kein Schaufenster.
  Hoher Kontrast fuer Sonnenlicht, Touchziele ab 48px, Systemschrift
  (laedt auch bei schlechtem Netz sofort), Ziffern tabellarisch, weil
  Permitnummern verglichen werden. Rot ist ausschliesslich Gefahr —
  deshalb ist der Akzent petrol und nicht orange.
*/

:root {
  --grund: #e9eded;
  --flaeche: #ffffff;
  --linie: #c8d0cf;
  --text: #0e1413;
  --text-leise: #55605e;
  --akzent: #12403d;
  --akzent-hell: #1c605b;
  --gefahr: #a8231b;
  --gefahr-grund: #fdecea;

  --st-offen: #2f6fd0;
  --st-arbeit: #b08800;
  --st-wartend: #c26a12;
  --st-angenommen: #17752f;
  --st-abgelehnt: #a8231b;

  --radius: 10px;
  --luft: 16px;
}

* { box-sizing: border-box; }

/* Sonst ueberschreiben .blatt und .anmeldung mit display:flex/grid das hidden-Attribut. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--grund);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

button, input, select, textarea { font: inherit; color: inherit; }

/* ------------------------------------------------------------ Anmeldung */

.anmeldung {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--luft);
  background: var(--akzent);
}

.anmeldung-feld {
  width: 100%;
  max-width: 380px;
  background: var(--flaeche);
  border-radius: var(--radius);
  padding: 28px 22px;
}

.anmeldung-feld h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.02em;
}

.projektzeile {
  margin: 4px 0 24px;
  color: var(--text-leise);
}

.anmeldung-feld label {
  display: block;
  margin: 14px 0 6px;
  font-size: 15px;
  color: var(--text-leise);
}

.anmeldung-feld input {
  width: 100%;
  height: 50px;
  padding: 0 12px;
  border: 1.5px solid var(--linie);
  border-radius: 8px;
  background: #fff;
}

.anmeldung-feld input:focus-visible,
.kopf input:focus-visible,
.feld input:focus-visible,
.feld textarea:focus-visible,
.feld select:focus-visible {
  outline: 3px solid var(--akzent-hell);
  outline-offset: 1px;
}

.knopf-haupt {
  width: 100%;
  height: 52px;
  margin-top: 22px;
  border: 0;
  border-radius: 8px;
  background: var(--akzent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.knopf-haupt:active { background: var(--akzent-hell); }

.fehler {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--gefahr-grund);
  color: var(--gefahr);
  font-size: 15px;
}

/* ----------------------------------------------------------------- Kopf */

.kopf {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px var(--luft);
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--akzent);
}

.kopf input {
  flex: 1;
  height: 46px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: #fff;
}

.knopf-still {
  height: 46px;
  padding: 0 12px;
  border: 1.5px solid rgba(255,255,255,.45);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

main {
  padding: var(--luft);
  padding-bottom: 96px;
  max-width: 720px;
  margin: 0 auto;
}

/* ----------------------------------------------------------- Fussleiste */

.fussleiste {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 10px;
  padding: 10px var(--luft);
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--flaeche);
  border-top: 1px solid var(--linie);
}

.fuss-knopf {
  flex: 1;
  height: 52px;
  border: 1.5px solid var(--linie);
  border-radius: 8px;
  background: var(--flaeche);
  font-weight: 600;
  cursor: pointer;
}

.fuss-knopf.betont {
  background: var(--akzent);
  border-color: var(--akzent);
  color: #fff;
}

/* --------------------------------------------------------------- Listen */

.gruppe-titel {
  margin: 22px 0 8px;
  font-size: 15px;
  color: var(--text-leise);
}

.gruppe-titel:first-child { margin-top: 0; }

.zeile {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 13px 14px;
  margin-bottom: 8px;
  cursor: pointer;
}

.zeile:active { background: #f2f5f4; }

.zeile-kopf {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.nummer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 18px;
}

.zeile-unten {
  margin-top: 3px;
  color: var(--text-leise);
  font-size: 15px;
}

.chip {
  margin-left: auto;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}

.chip[data-status="OFFEN"] { background: var(--st-offen); }
.chip[data-status="IN_ARBEIT"] { background: var(--st-arbeit); }
.chip[data-status="WARTEND"] { background: var(--st-wartend); }
.chip[data-status="ANGENOMMEN"] { background: var(--st-angenommen); }
.chip[data-status="ABGELEHNT"] { background: var(--st-abgelehnt); }

.leer {
  padding: 40px 0;
  text-align: center;
  color: var(--text-leise);
}

/* ---------------------------------------------------------------- Warnung */

.warnband {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--gefahr);
  color: #fff;
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
  font-weight: 700;
}

.warnpunkt {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gefahr);
  flex: none;
}

/* ----------------------------------------------------------- Permitseite */

.karte {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.karte h2 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--text-leise);
  font-weight: 600;
}

.titelzeile {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.titelzeile .nummer { font-size: 27px; letter-spacing: -0.01em; }

.feld { margin-bottom: 14px; }
.feld:last-child { margin-bottom: 0; }

.feld label {
  display: block;
  margin-bottom: 5px;
  font-size: 15px;
  color: var(--text-leise);
}

.feld input[type="text"],
.feld input[type="date"],
.feld input[type="tel"],
.feld input[type="number"],
.feld select,
.feld textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1.5px solid var(--linie);
  border-radius: 8px;
  background: #fff;
}

.feld textarea { min-height: 120px; resize: vertical; }

.schalter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 6px 0;
  border-bottom: 1px solid var(--linie);
}

.schalter:last-child { border-bottom: 0; }

.schalter input[type="checkbox"] {
  width: 26px;
  height: 26px;
  flex: none;
  accent-color: var(--akzent);
}

.kaestchen {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
}

.kaestchen input { width: 24px; height: 24px; accent-color: var(--akzent); }

.knopfreihe {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.knopf-flach {
  min-height: 52px;
  border: 1.5px solid var(--akzent);
  border-radius: 8px;
  background: var(--flaeche);
  color: var(--akzent);
  font-weight: 600;
  cursor: pointer;
}

.knopf-flach:active { background: #e7eeed; }

.notizzeile {
  padding: 11px 0;
  border-bottom: 1px solid var(--linie);
  font-size: 15px;
}

.notizzeile:last-child { border-bottom: 0; }

.stern {
  background: none;
  border: 0;
  font-size: 30px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
  color: var(--linie);
}

.stern[aria-pressed="true"] { color: var(--akzent); }

/* ----------------------------------------------------------------- Blatt */

.blatt {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(14,20,19,.45);
  display: flex;
  align-items: flex-end;
}

.blatt-inhalt {
  width: 100%;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--grund);
  border-radius: 14px 14px 0 0;
  padding: 20px var(--luft);
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.blatt-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.blatt-kopf h2 { margin: 0; font-size: 20px; color: var(--text); }

@media (min-width: 700px) {
  .blatt { align-items: center; justify-content: center; }
  .blatt-inhalt { max-width: 620px; border-radius: 14px; }
}

/* --------------------------------------------------------------- Hinweis */

.hinweis {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  z-index: 40;
  max-width: 90vw;
  padding: 12px 18px;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  font-size: 15px;
  text-align: center;
}

.hinweis[data-art="fehler"] { background: var(--gefahr); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
