:root {
  --navy: #1a365d; --navy2: #2c5282; --rot: #e53e3e; --hell: #90cdf4;
  --bg: #f4f6fa; --karte: #ffffff; --text: #1a202c; --leise: #64748b; --linie: #e2e8f0;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {   /* Nachtdienst */
  :root { --bg: #0d1726; --karte: #16233a; --text: #e6edf7; --leise: #94a3b8; --linie: #263a59; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(48px + env(safe-area-inset-bottom));
}
a { color: inherit; }
code { font-size: .85em; word-break: break-all; }

.kopf {
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(180deg, var(--navy2), var(--navy)); color: #fff;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.kopf-zeile { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.logo img { width: 30px; height: 30px; border-radius: 8px; }
.zahnrad { text-decoration: none; font-size: 1.4rem; }
body:not(.angemeldet) #suche, body:not(.angemeldet) .zahnrad { display: none; }
#suche {
  width: 100%; font-size: 1.05rem; padding: 10px 14px; border: 0; border-radius: 12px;
  background: rgba(255,255,255,.95); color: #1a202c;
}

main { padding: 14px; max-width: 760px; margin: 0 auto; }
h2 { margin: .3em 0 .5em; font-size: 1.4rem; }
h3 { margin: 1.4em 0 .5em; font-size: 1rem; color: var(--leise); text-transform: uppercase; letter-spacing: .04em; }
.leise { color: var(--leise); }
.mitte { text-align: center; margin-top: 3em; }
.kurz { color: var(--leise); font-weight: 500; font-size: .85em; }

.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kachel {
  background: var(--karte); border-radius: var(--radius); padding: 14px; text-decoration: none;
  display: flex; flex-direction: column; gap: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.08);
  border-left: 4px solid var(--navy2); font-weight: 600;
}
.kachel small { color: var(--leise); font-weight: 400; }
.k-icon { font-size: 1.6rem; }

.liste { display: flex; flex-direction: column; gap: 8px; }
.zeile {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none;
  background: var(--karte); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.z-icon { font-size: 1.5rem; }
.z-text { flex: 1; display: flex; flex-direction: column; }
.z-text small { color: var(--leise); }
.pfeil { color: var(--leise); font-size: 1.5rem; }

.karte, .eintrag { background: var(--karte); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.badge {
  display: inline-block; background: var(--navy); color: #fff; padding: 3px 10px;
  border-radius: 99px; font-size: .8rem; text-decoration: none;
}
.abschnitt { border-top: 1px solid var(--linie); padding-top: 10px; margin-top: 12px; }
.abschnitt h4 { margin: 0 0 4px; color: var(--navy2); font-size: .95rem; text-transform: uppercase; letter-spacing: .03em; }
@media (prefers-color-scheme: dark) { .abschnitt h4 { color: var(--hell); } }
.abschnitt p { margin: .3em 0; }
.abschnitt ul { margin: .3em 0; padding-left: 1.2em; }
.abschnitt a[href^="tel:"] { color: var(--rot); font-weight: 600; }
.meta { margin-top: 16px; font-size: .8rem; color: var(--leise); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 12px; border-radius: 99px; background: var(--linie); text-decoration: none; font-size: .9rem; }

.aktionen { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
button, .primaer, .sekundaer, .gefahr {
  font: inherit; border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer;
  text-decoration: none; display: inline-block; text-align: center;
}
.primaer { background: var(--navy2); color: #fff; font-weight: 600; }
.sekundaer { background: var(--linie); color: var(--text); }
.gefahr { background: #fde2e2; color: #9b1c1c; }
.link { background: none; color: var(--leise); text-decoration: underline; padding: 6px 0; }
.breit { display: block; margin: 14px 0; }
#vorlesen { font-size: 1.1rem; min-width: 150px; }

label { display: block; margin: 10px 0; font-weight: 600; font-size: .95rem; }
label small { font-weight: 400; color: var(--leise); }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; font: inherit; font-weight: 400;
  padding: 9px 11px; border-radius: 10px; border: 1px solid var(--linie);
  background: var(--bg); color: var(--text);
}
input[type=range] { padding: 0; }
.abschnitt-edit { border: 1px solid var(--linie); border-radius: 12px; padding: 8px; margin: 10px 0; }
.ae-kopf { display: flex; gap: 6px; }
.ae-kopf input { margin: 0; font-weight: 600; }
.ae-kopf button { padding: 6px 10px; background: var(--linie); color: var(--text); }
.datei { cursor: pointer; margin: 0; font-weight: 400; }

.info { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; }
.info dt { color: var(--leise); }
.info dd { margin: 0; }
.info.klein { font-size: .85rem; }
.changelog { white-space: pre-wrap; font-size: .8rem; background: var(--bg); padding: 10px; border-radius: 10px; max-height: 240px; overflow: auto; }

.fuss {
  position: fixed; bottom: 0; left: 0; right: 0; text-align: center; font-size: .75rem;
  color: var(--leise); background: var(--bg); padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--linie);
}
.update { display: block; width: 100%; border-radius: 0; background: var(--rot); color: #fff; font-weight: 600; }
.update[hidden] { display: none; }
.toast {
  position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%) translateY(20px);
  background: #1a202c; color: #fff; padding: 10px 18px; border-radius: 12px; opacity: 0;
  transition: .25s; pointer-events: none; max-width: 90%; z-index: 20;
}
.toast.sichtbar { opacity: 1; transform: translateX(-50%); }
.toast.fehler { background: #9b1c1c; }
.login { max-width: 420px; margin: 2em auto; }
