:root {
  --farbe: #0f766e; --farbe-hell: #ccfbf1; --text: #111827; --grau: #6b7280; --linie: #e5e7eb; --flaeche: #f3f4f6;
  --weiss: #fff; --rot: #dc2626; --gelb: #fef3c7; --gelb-text: #92400e; --schatten: 0 4px 16px rgba(0,0,0,.12);
  --tabs-h: 60px; --kopf-h: 52px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --text: #f3f4f6; --grau: #9ca3af; --linie: #374151; --flaeche: #111827; --weiss: #1f2937; --farbe-hell: #134e4a;
    --farbe: #14b8a6; --gelb: #422006; --gelb-text: #fde68a; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--flaeche);
  -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; background: var(--weiss); border: 1px solid var(--linie); border-radius: 8px;
  padding: 9px 10px; width: 100%; min-width: 0; }
textarea { resize: vertical; }
label { display: block; font-size: 13px; color: var(--grau); margin: 12px 0 4px; }
a { color: var(--farbe); }
code { font-size: 13px; background: var(--flaeche); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
.klein { font-size: 13px; color: var(--grau); }
.umbruch { word-break: break-all; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--linie); background: var(--weiss);
  border-radius: 8px; padding: 9px 14px; text-decoration: none; color: inherit; }
.btn.primaer { background: var(--farbe); border-color: var(--farbe); color: #fff; }
.btn.gefahr { color: var(--rot); border-color: var(--rot); }
.btn:disabled { opacity: .5; }
.klein-btn { padding: 5px 10px; font-size: 13px; }
.icon { border: 0; background: none; font-size: 22px; width: 40px; height: 40px; border-radius: 50%; line-height: 1; flex: 0 0 auto; }
.icon:hover { background: var(--flaeche); }
.knoepfe { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.knoepfe .links { margin-right: auto; }

/* Anmeldung */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-box { background: var(--weiss); padding: 32px 24px; border-radius: 16px; box-shadow: var(--schatten); text-align: center; width: 100%; max-width: 340px; }
.login-box h1 { margin: 8px 0; }
.login-box form { display: grid; gap: 8px; margin-top: 12px; }

/* Grundgerüst */
#app { min-height: 100%; }
.kopf { position: sticky; top: 0; z-index: 20; height: calc(var(--kopf-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0;
  display: flex; align-items: center; gap: 4px; background: var(--weiss); border-bottom: 1px solid var(--linie); }
.kopf h1 { font-size: 18px; margin: 0 0 0 8px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inhalt { max-width: 1100px; margin: 0 auto; padding: 12px 16px calc(var(--tabs-h) + 90px + env(safe-area-inset-bottom)); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); display: flex;
  padding-bottom: env(safe-area-inset-bottom); background: var(--weiss); border-top: 1px solid var(--linie); }
.tabs button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 12px; color: var(--grau); position: relative; }
.tabs button span { font-size: 20px; line-height: 1; }
.tabs button.aktiv { color: var(--farbe); font-weight: 600; }
.tabs .zahl { position: absolute; top: 6px; left: calc(50% + 6px); background: var(--rot); color: #fff; border-radius: 999px; font-size: 11px;
  min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; font-weight: 600; }
.fab { position: fixed; right: 16px; bottom: calc(var(--tabs-h) + 16px + env(safe-area-inset-bottom)); z-index: 25; width: 56px; height: 56px;
  border-radius: 50%; border: 0; background: var(--farbe); color: #fff; font-size: 30px; box-shadow: var(--schatten); }
@media (min-width: 900px) {
  :root { --tabs-h: 0px; }
  .tabs { top: 8px; bottom: auto; left: 50%; right: auto; transform: translateX(-50%); height: 36px; border: 0; padding: 0; gap: 4px; background: none; }
  .tabs button { flex-direction: row; font-size: 14px; padding: 6px 12px; border-radius: 8px; gap: 6px; }
  .tabs button span { font-size: 15px; }
  .tabs button.aktiv { background: var(--farbe-hell); }
  .tabs .zahl { position: static; }
  .fab { bottom: 24px; right: 24px; }
}

/* Karten */
.karten { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .karten { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .karten { grid-template-columns: repeat(3, 1fr); } }
.karte { display: flex; gap: 12px; text-align: left; background: var(--weiss); border: 1px solid var(--linie); border-radius: 12px; padding: 10px; min-width: 0; }
.karte:hover { border-color: var(--farbe); }
.karte .bild { flex: 0 0 88px; height: 88px; border-radius: 8px; overflow: hidden; background: var(--flaeche); display: grid; place-items: center; }
.karte .bild img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.karte .art { font-size: 34px; }
.karte .info { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.karte b { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.karte .klein { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { font-size: 12px; align-self: flex-start; padding: 1px 8px; border-radius: 999px; background: var(--gelb); color: var(--gelb-text); }
.status.fehler { background: #fee2e2; color: #991b1b; }
.auszug { margin: 2px 0 0; font-size: 13px; color: var(--grau); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
mark { background: #fde68a; color: inherit; border-radius: 2px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tags i { font-style: normal; font-size: 12px; background: var(--farbe-hell); border-radius: 999px; padding: 0 7px; }
.leer { text-align: center; color: var(--grau); padding: 40px 16px; }

/* Archiv */
.brot { font-size: 14px; margin: 0 0 10px; color: var(--grau); }
.brot a { text-decoration: none; }
.ordner-liste { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 14px; }
.ordner { display: flex; align-items: center; gap: 8px; background: var(--weiss); border: 1px solid var(--linie); border-radius: 10px; padding: 10px 12px; text-align: left; min-width: 0; }
.ordner b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ordner span:first-child { font-size: 20px; }
.ordner.neu { border-style: dashed; color: var(--grau); }
.ordner.neu b { font-weight: 400; }
.abschnitt { font-size: 14px; color: var(--grau); margin: 16px 0 8px; font-weight: 600; }
.suchfeld { position: sticky; top: calc(var(--kopf-h) + env(safe-area-inset-top)); z-index: 5; padding: 4px 0 10px; background: var(--flaeche); }
.suchfeld input { font-size: 16px; padding: 11px 12px; }

/* Dialog */
.dialog { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.dialog-box { background: var(--weiss); width: 100%; max-width: 560px; max-height: 92vh; border-radius: 16px 16px 0 0; display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom); }
.dialog-box.gross { max-width: 900px; height: 96vh; max-height: 96vh; }
.dialog-kopf { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--linie); }
.dialog-kopf h2 { font-size: 17px; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog-inhalt { overflow: auto; padding: 12px 16px 20px; -webkit-overflow-scrolling: touch; }
@media (min-width: 700px) { .dialog { align-items: center; } .dialog-box { border-radius: 16px; } .dialog-box.gross { height: 92vh; } }
.meta { display: grid; gap: 3px; font-size: 14px; }
.hinweis { background: var(--gelb); color: var(--gelb-text); border-radius: 8px; padding: 8px 12px; margin: 10px 0; word-break: break-word; }
.hinweis.fehler { background: #fee2e2; color: #991b1b; }
.hinweis .knoepfe { margin-top: 8px; }
.reiter { display: flex; gap: 4px; margin: 14px 0 8px; overflow-x: auto; border-bottom: 1px solid var(--linie); }
.reiter button { border: 0; background: none; padding: 8px 12px; border-bottom: 2px solid transparent; white-space: nowrap; color: var(--grau); }
.reiter button.aktiv { color: var(--farbe); border-bottom-color: var(--farbe); font-weight: 600; }
.reiter-inhalt { min-height: 80px; }
.screenshot { max-height: 60vh; overflow: auto; border: 1px solid var(--linie); border-radius: 8px; background: #fff; }
.screenshot img { width: 100%; display: block; }
img.voll { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; border-radius: 6px; }
.lesetext { max-height: 60vh; overflow: auto; border: 1px solid var(--linie); border-radius: 8px; padding: 4px 14px; font-size: 14px; line-height: 1.55; }
.felder { margin-top: 10px; }
details { margin-top: 12px; }
summary { cursor: pointer; }
.pruef table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.pruef td { border-top: 1px solid var(--linie); padding: 6px 4px; vertical-align: top; }
.hash { font-family: ui-monospace, Consolas, monospace; font-size: 11px; word-break: break-all; }

/* Mehr */
.mehr { display: grid; gap: 12px; max-width: 700px; margin: 0 auto; }
.mehr section { background: var(--weiss); border: 1px solid var(--linie); border-radius: 12px; padding: 4px 16px 14px; }
.mehr h3 { font-size: 16px; margin: 12px 0 8px; }
.mehr p { margin: 6px 0; }
.stat { border-collapse: collapse; width: 100%; font-size: 14px; }
.stat td, .stat th { border-top: 1px solid var(--linie); padding: 6px 4px; text-align: left; vertical-align: top; }
.anleitung li { margin: 6px 0; line-height: 1.5; }
.kopierzeile { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.kopierzeile code { flex: 1; }

.meldung { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabs-h) + 20px + env(safe-area-inset-bottom)); z-index: 60;
  background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--schatten); max-width: calc(100% - 32px); }
