:root {
  --grund: #f4f6f5; --flaeche: #ffffff; --text: #17201f; --leise: #5c6b69; --linie: #dbe2e0;
  --akzent: #1f4d4a; --akzent-text: #ffffff; --ich: #dcebe8; --fehler: #a32020;
}
@media (prefers-color-scheme: dark) {
  :root { --grund: #101615; --flaeche: #18201f; --text: #e8eeed; --leise: #9aa9a6; --linie: #2a3533;
    --akzent: #6fb7ae; --akzent-text: #0c1413; --ich: #24403c; --fehler: #ff9c9c; }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--grund); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0; }
p { margin: 0; }
.leise { color: var(--leise); font-size: .875rem; }
.fehler { color: var(--fehler); min-height: 1.4em; }
button { font: inherit; border: 0; border-radius: 10px; padding: .7rem 1.1rem; background: var(--akzent); color: var(--akzent-text); cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
button.schlicht { background: none; color: var(--akzent); padding: .4rem .6rem; }
button.rund { border-radius: 50%; width: 2.9rem; height: 2.9rem; padding: 0; flex: none; background: var(--flaeche); color: var(--fehler); border: 1px solid var(--linie); }
button.rund.laeuft { background: var(--fehler); color: #fff; }
input, textarea { font: inherit; color: inherit; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; padding: .7rem .8rem; width: 100%; }
:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; }

#anmeldung { min-height: 100%; display: grid; place-items: center; padding: 16px; }
#anmeldeformular { width: 100%; max-width: 22rem; display: grid; gap: .9rem; background: var(--flaeche); padding: 1.5rem; border-radius: 16px; border: 1px solid var(--linie); }
label { display: grid; gap: .3rem; font-size: .9rem; color: var(--leise); }

#app { height: 100%; display: grid; grid-template-columns: 19rem 1fr; }
#liste { border-right: 1px solid var(--linie); background: var(--flaeche); overflow-y: auto; }
#liste header, #chat header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .9rem 1rem; border-bottom: 1px solid var(--linie); padding-top: calc(.9rem + env(safe-area-inset-top)); }
#chat header { justify-content: flex-start; background: var(--flaeche); }
#agenten { list-style: none; margin: 0; padding: 0; }
#agenten button { width: 100%; text-align: left; background: none; color: inherit; border-radius: 0; border-bottom: 1px solid var(--linie); padding: .8rem 1rem; display: grid; }
#agenten button[aria-current="true"] { background: var(--ich); }
#agenten button.aus { color: var(--leise); }
#chat { display: grid; grid-template-rows: auto 1fr auto auto; min-height: 0; height: 100%; }
#zurueck { display: none; font-size: 1.6rem; line-height: 1; }
#verlauf { list-style: none; margin: 0; padding: 1rem; overflow-y: auto; display: flex; flex-direction: column; gap: .6rem; }
#verlauf li { max-width: min(42rem, 88%); padding: .6rem .85rem; border-radius: 14px; background: var(--flaeche); border: 1px solid var(--linie); white-space: pre-wrap; overflow-wrap: anywhere; }
#verlauf li.ich { align-self: flex-end; background: var(--ich); }
#verlauf li.system { align-self: center; background: none; border: 0; color: var(--leise); font-size: .875rem; }
#eingabe { display: flex; gap: .5rem; align-items: flex-end; padding: .7rem 1rem; border-top: 1px solid var(--linie); background: var(--flaeche); }
#text { resize: none; max-height: 9rem; }
#hinweis { padding: 0 1rem calc(.5rem + env(safe-area-inset-bottom)); background: var(--flaeche); min-height: 1.6em; }

@media (max-width: 720px) {
  #app { grid-template-columns: 1fr; }
  #app.im-chat #liste, #app:not(.im-chat) #chat { display: none; }
  #zurueck { display: block; }
}
