:root {
  --grund: #f4f6f8;
  --flaeche: #ffffff;
  --text: #1a2228;
  --leise: #5b6770;
  --rand: #d6dde3;
  --akzent: #1d4e6b;
  --akzent-text: #ffffff;
  --ja: #1f7a4a;
  --nein: #9a3a2e;
  --pruefen: #8a6410;
  --warn-grund: #fff4d6;
  --warn-text: #5c4300;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #11171c;
    --flaeche: #1a2229;
    --text: #e6ebef;
    --leise: #9aa7b1;
    --rand: #2e3a44;
    --akzent: #6fb3d6;
    --akzent-text: #0c1a22;
    --ja: #5cc48c;
    --nein: #ef8a7c;
    --pruefen: #e2b54e;
    --warn-grund: #3a2f12;
    --warn-text: #f3dc9b;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
button {
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--rand);
  border-radius: 10px;
  background: var(--flaeche);
  cursor: pointer;
}
button.haupt { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); font-weight: 600; }
button.leise { border: 0; background: none; color: var(--leise); text-decoration: underline; }
[hidden] { display: none !important; }

#anmeldung { max-width: 420px; margin: 0 auto; padding: 48px 16px; }
#anmeldung h1 { font-size: 1.5rem; margin: 0 0 24px; }
#anmeldeformular { display: grid; gap: 12px; }
input[type="password"] {
  min-height: 52px; padding: 0 14px; border: 1px solid var(--rand); border-radius: 10px; background: var(--flaeche);
}
.fehler { color: var(--nein); min-height: 1.4em; margin: 0; }

header { position: sticky; top: 0; z-index: 2; background: var(--grund); border-bottom: 1px solid var(--rand); }
.reiter { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 8px 8px 0; }
.reiter button {
  min-height: 56px; padding: 4px 6px; border: 0; border-radius: 10px 10px 0 0; background: none;
  font-size: 0.9rem; line-height: 1.2; color: var(--leise); border-bottom: 3px solid transparent;
}
.reiter button[aria-selected="true"] { color: var(--text); font-weight: 600; border-bottom-color: var(--akzent); }
.zahl {
  display: inline-block; min-width: 1.6em; padding: 0 6px; margin-left: 2px; border-radius: 99px;
  background: var(--rand); color: var(--text); font-size: 0.85em; font-weight: 600;
}

main { max-width: 720px; margin: 0 auto; padding: 12px 12px 32px; }
.leiste { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; color: var(--leise); font-size: 0.9rem; }
.leer, .fuss { text-align: center; color: var(--leise); }

.karte {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 14px;
  padding: 14px; margin-bottom: 14px; overflow-wrap: anywhere;
}
.karte.speichert { opacity: 0.6; }
.kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--leise); }
.kategorie, .prio, .anlegen select {
  min-height: 40px; padding: 0 8px; border: 1px solid var(--rand); border-radius: 8px; background: var(--grund);
}
.prio { font-weight: 700; color: var(--text); }
.karte .kopf { flex-wrap: nowrap; gap: 6px; }
.karte .kopf .prio { flex: none; padding: 0 4px; }
.karte .kopf .kategorie { flex: 1 1 auto; min-width: 0; padding: 0 4px; }
.bearbeiten-schalter { flex: none; margin-left: auto; min-height: 40px; padding: 0 10px; font-size: 0.85rem; color: var(--akzent); white-space: nowrap; }
.bearbeiten-schalter[aria-expanded="true"] { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); }
.status { margin-left: auto; font-weight: 600; }
.original { margin: 10px 0 0; font-size: 0.9rem; color: var(--leise); font-style: italic; }
.bearbeiten { margin-top: 8px; }
.titel { font-size: 1.08rem; line-height: 1.35; margin: 10px 0 6px; }
.quelle { margin: 0 0 6px; }
.quelle a { color: var(--akzent); display: inline-block; padding: 6px 0; }
.cluster { margin: 0 0 6px; padding: 6px 10px; border-radius: 8px; background: var(--warn-grund); color: var(--warn-text); font-size: 0.9rem; }
details { margin: 6px 0; }
summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--akzent); }
details.lang p { white-space: pre-line; margin: 4px 0 8px; }
details.lang h3 { font-size: 0.8rem; margin: 10px 0 2px; color: var(--leise); text-transform: uppercase; letter-spacing: 0.03em; }
details.lang p.orig { font-size: 0.92rem; }
details.lang a { color: var(--akzent); }
.knoepfe { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.knoepfe button { min-height: 52px; font-weight: 600; }
.knoepfe button[data-status="ja"][aria-pressed="true"] { background: var(--ja); border-color: var(--ja); color: var(--flaeche); }
.knoepfe button[data-status="nein"][aria-pressed="true"] { background: var(--nein); border-color: var(--nein); color: var(--flaeche); }
.knoepfe button[data-status="prüfen"][aria-pressed="true"] { background: var(--pruefen); border-color: var(--pruefen); color: var(--flaeche); }
.bearbeiten label { display: grid; gap: 4px; margin: 8px 0; font-size: 0.9rem; color: var(--leise); }
textarea { width: 100%; padding: 10px; border: 1px solid var(--rand); border-radius: 10px; background: var(--grund); resize: vertical; }
.bearbeiten .speichern { width: 100%; }
.anlegen { margin-bottom: 14px; background: var(--flaeche); border: 1px solid var(--rand); border-radius: 14px; padding: 14px; }
.anlegen form { display: grid; gap: 10px; }
#neu-schalter[aria-expanded="true"] { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); }
.anlegen label { display: grid; gap: 4px; font-size: 0.9rem; color: var(--leise); }
.anlegen input { min-height: 48px; padding: 0 12px; border: 1px solid var(--rand); border-radius: 10px; background: var(--grund); }
.anlegen .zeile { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.anlegen .zeile select { width: 100%; min-width: 0; }
.intro-text { white-space: pre-line; margin-top: 8px; }
.intro .status { margin-left: 8px; }
.quellen summary { min-height: 40px; font-size: 0.9rem; }
.quellen h3 { font-size: 0.85rem; margin: 10px 0 2px; color: var(--leise); }
.quellen p { white-space: pre-line; margin: 0 0 8px; font-size: 0.92rem; }
.quellen a { color: var(--akzent); }
.konflikt { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--warn-grund); color: var(--warn-text); }

.hinweis.offline { position: sticky; top: 0; z-index: 3; padding: 10px 16px; background: var(--warn-grund); color: var(--warn-text); text-align: center; }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 10px; background: var(--text); color: var(--grund); z-index: 5;
}
