/* Alle Stile der App. Bausteine: Gerüst, Navigation, Knöpfe, Felder, Explorer (Listen), Blatt (Dialog), Fakten. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.55 var(--sans); min-height: 100dvh; overflow-x: clip; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--akzent); color: var(--auf-akzent); }
:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Gerüst und Navigation (Handy unten, Desktop links) ---------- */
.app { display: flex; flex-direction: column; min-height: 100dvh; }
.inhalt { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; min-width: 0; padding: var(--s5) var(--s4) calc(var(--nav-hoehe) + var(--s6) + env(safe-area-inset-bottom)); }
.kopf { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.kopf > div { min-width: 0; }
.kopf h1 { font: 700 30px/1.05 var(--display); letter-spacing: -.025em; margin: 0; overflow-wrap: anywhere; }
.unter { color: var(--text-3); font: 400 13px var(--mono); margin-top: var(--s2); }
.marke { display: none; }
.nav { position: fixed; inset: auto 0 0 0; z-index: 20; background: rgba(5,5,5,.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--linie); display: flex; justify-content: space-around; padding: 0 var(--s2) env(safe-area-inset-bottom); }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: var(--nav-hoehe);
  text-decoration: none; color: var(--text-3); font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.nav a svg { width: 22px; height: 22px; }
.nav a[aria-current="page"] { color: var(--text); }
@media (min-width: 960px) {
  .app { flex-direction: row; }
  .nav { position: sticky; inset: auto; top: 0; flex-direction: column; justify-content: flex-start; width: 220px; height: 100dvh; flex: none;
    border-top: 0; border-right: 1px solid var(--linie); padding: var(--s5) var(--s3); gap: 2px; }
  .nav a { flex: 0; flex-direction: row; justify-content: flex-start; gap: var(--s3); min-height: 42px; padding: 0 var(--s3); border-radius: var(--r); font-size: 12px; }
  .nav a:hover { color: var(--text); }
  .nav a[aria-current="page"] { background: var(--flaeche-2); }
  .marke { display: block; font: 700 22px/1 var(--display); letter-spacing: -.02em; padding: 0 var(--s3) var(--s6); }
  .inhalt { padding: var(--s6); }
  .kopf h1 { font-size: 40px; }
}

/* ---------- Knöpfe, Felder ---------- */
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s5);
  border-radius: var(--rund); border: 1px solid var(--linie-2); background: var(--flaeche); color: var(--text); font: 600 14px var(--sans);
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.knopf:hover { border-color: var(--text-3); background: var(--flaeche-2); }
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: var(--auf-akzent); }
.knopf.primaer:hover { background: #dcdde0; }
.knopf.klein { min-height: 36px; padding: 0 var(--s4); font-size: 13px; }
.knopf.warnung { color: var(--fehler); border-color: #5a2a2a; }
.knopf svg { width: 16px; height: 16px; }
.knopf[disabled] { opacity: .45; cursor: default; }
.aktionen { display: flex; flex-wrap: wrap; gap: var(--s2); }

.formular { display: grid; gap: var(--s4); }
.feld { display: grid; gap: var(--s1); }
.feld label, .feld-titel { font: 400 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.feld small { color: var(--text-3); font-size: 13px; }
input:not([type="checkbox"]), select, textarea { width: 100%; min-height: 44px; padding: var(--s2) var(--s3); font-size: 16px;
  border: 1px solid var(--linie); border-radius: var(--r); background: var(--flaeche); color: var(--text); }
input[readonly] { color: var(--text-2); }
textarea { min-height: 96px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--text-3); }
.haken { display: flex; align-items: center; gap: var(--s3); min-height: 44px; cursor: pointer; }
.haken input { width: 20px; height: 20px; accent-color: var(--akzent); flex: none; }

/* ---------- Abschnitte, Zustände ---------- */
.abschnitt { margin-top: var(--s6); }
.abschnitt > h2 { display: flex; align-items: center; gap: var(--s2); font: 700 18px/1.15 var(--display); letter-spacing: -.02em; margin: 0 0 var(--s3); }
.abschnitt > h2 .zahl { font: 400 12px var(--mono); color: var(--text-3); }
.abschnitt > h2 .knopf { margin-left: auto; }
.leer { padding: var(--s4) 0; color: var(--text-3); }
.lade { color: var(--text-3); padding: var(--s5) 0; font: 400 13px var(--mono); }
.fehlerbox { padding: var(--s3) var(--s4); border-radius: var(--r); border: 1px solid #5a2a2a; background: #1a0d0d; color: var(--fehler); font-size: 15px; }
.hinweis { color: var(--text-2); font-size: 15px; margin: 0; }
.mono { font: 400 13px var(--mono); overflow-wrap: anywhere; color: var(--text-2); }
.zurueck { display: inline-flex; align-items: center; gap: var(--s1); min-height: 44px; color: var(--text-3); text-decoration: none; font: 400 12px var(--mono);
  letter-spacing: .12em; text-transform: uppercase; margin-bottom: var(--s2); }
.zurueck:hover { color: var(--text); }
.zurueck svg { width: 16px; height: 16px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-hoehe) + var(--s4) + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  background: var(--akzent); color: var(--auf-akzent); padding: var(--s3) var(--s4); border-radius: var(--rund); font: 600 14px var(--sans); max-width: calc(100% - 32px); }

/* ---------- Anmelden ---------- */
.anmelden { max-width: 400px; margin: 12dvh auto 0; }
.anmelden h1 { font: 700 44px/1 var(--display); letter-spacing: -.025em; margin: 0 0 var(--s2); }
.anmelden .hinweis { margin-bottom: var(--s5); }

/* ---------- Fakten (Kopfdaten eines Projekts) ---------- */
.fakten { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); padding: var(--s4); margin: 0 0 var(--s4);
  border: 1px solid var(--linie); background: var(--flaeche); border-radius: var(--r-gross); }
@media (min-width: 640px) { .fakten { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.fakten dt { font: 400 11px var(--mono); color: var(--text-3); letter-spacing: .14em; text-transform: uppercase; margin-bottom: 2px; }
.fakten dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.beschreibung { white-space: pre-wrap; color: var(--text-2); max-width: 68ch; margin: 0 0 var(--s4); }

/* ---------- Explorer: eine Listenform für alles ---------- */
.ex { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ex li { position: relative; display: flex; min-width: 0; }
.ex-k { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); min-height: 56px;
  border: 1px solid var(--linie); border-radius: var(--r); background: var(--flaeche); color: var(--text); text-decoration: none; text-align: left; font: inherit; cursor: pointer; }
.ex-k:hover { border-color: var(--linie-2); background: var(--flaeche-2); }
.ex-bild { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 6px; color: var(--text-2); background: var(--flaeche-2);
  font: 600 14px var(--display); }
.ex-bild svg { width: 22px; height: 22px; }
.ex-text { min-width: 0; display: grid; }
.ex-text b { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-text small { font: 400 12px var(--mono); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex .aus .ex-k { opacity: .5; }
.ex li > .icon-knopf { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.ex li:has(> .icon-knopf) .ex-k { padding-right: 56px; }
.icon-knopf { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--rund); border: 1px solid var(--linie); background: var(--flaeche);
  color: var(--text-2); cursor: pointer; }
.icon-knopf:hover { color: var(--text); border-color: var(--linie-2); }
.icon-knopf svg { width: 18px; height: 18px; }

/* ---------- Blatt (Dialog: Handy von unten, Desktop mittig) ---------- */
.blatt-hg { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; }
.blatt { background: var(--flaeche); border: 1px solid var(--linie); border-bottom: 0; width: 100%; max-width: 520px; max-height: 88dvh; overflow-y: auto;
  border-radius: var(--r-gross) var(--r-gross) 0 0; padding: var(--s5) var(--s4) calc(var(--s5) + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.blatt h2 { font: 700 24px/1.1 var(--display); letter-spacing: -.02em; margin: 0 0 var(--s4); }
.blatt input:not([type="checkbox"]), .blatt select, .blatt textarea { background: var(--bg); }
@media (min-width: 960px) { .blatt-hg { align-items: center; } .blatt { border-radius: var(--r-gross); border-bottom: 1px solid var(--linie); } }
.wahl { display: flex; width: 100%; align-items: center; gap: var(--s3); min-height: 52px; padding: 0 var(--s2); background: none; border: 0;
  border-bottom: 1px solid var(--linie); color: var(--text); text-align: left; cursor: pointer; font: 500 15px var(--sans); }
.wahl:hover { background: var(--flaeche-2); }
.wahl small { color: var(--text-3); font: 400 12px var(--mono); margin-left: auto; }
.abstand-oben { margin-top: var(--s5); }
