/* Workflow-Kapsel – Oberfläche. Farben als Tokens, hell/dunkel über prefers-color-scheme. */
:root {
  --grund: #f6f7f9;
  --flaeche: #ffffff;
  --flaeche-2: #eef1f5;
  --linie: #d9dee6;
  --text: #1b2330;
  --text-leise: #5b6676;
  --akzent: #2f63c9;
  --akzent-text: #ffffff;
  --akzent-hell: #e6eefc;
  --ok: #1d7a46;
  --ok-hell: #e3f4ea;
  --warn: #8a5a00;
  --warn-hell: #fdf3dc;
  --fehler: #b42318;
  --fehler-hell: #fde7e5;
  --ich: #2f63c9;
  --ich-text: #ffffff;
  --schatten: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --radius: 12px;
  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #0f141b;
    --flaeche: #171d26;
    --flaeche-2: #1f2733;
    --linie: #2c3644;
    --text: #e6eaf0;
    --text-leise: #9aa5b5;
    --akzent: #7aa2f7;
    --akzent-text: #0f141b;
    --akzent-hell: #1c2a45;
    --ok: #5cc98a;
    --ok-hell: #16301f;
    --warn: #f0c060;
    --warn-hell: #33290f;
    --fehler: #ff8a80;
    --fehler-hell: #3a1a18;
    --ich: #3b5fa8;
    --ich-text: #ffffff;
    --schatten: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--grund);
  color: var(--text);
  font: 16px/1.5 var(--schrift);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; line-height: 1.25; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
p { margin: 0 0 .75rem; }
a { color: var(--akzent); }
code, pre, .kbd { font-family: var(--mono); font-size: .9em; }
.unsichtbar { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.leise-text { color: var(--text-leise); font-size: .9rem; }
.ok-text { color: var(--ok); font-weight: 600; }
.fehlertext { color: var(--fehler); background: var(--fehler-hell); padding: .6rem .8rem; border-radius: 8px; margin: .75rem 0; white-space: pre-wrap; }
.abstand { margin-top: 1.25rem; }
.kbd { border: 1px solid var(--linie); border-radius: 4px; padding: 0 .3em; background: var(--flaeche-2); }

/* Kopfzeile */
.kopf {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .6rem 16px; padding-top: max(.6rem, env(safe-area-inset-top));
  background: var(--flaeche); border-bottom: 1px solid var(--linie);
}
.marke { display: flex; align-items: center; gap: .5rem; font-weight: 700; white-space: nowrap; }
.marke svg { width: 28px; height: 28px; }
.marke svg rect { fill: var(--akzent); }
.marke svg circle { fill: var(--flaeche); }
.kopf-rechts { display: flex; gap: .5rem; align-items: center; min-width: 0; }
.kopf-rechts select { max-width: 46vw; }
.kopf-rechts .knopf { white-space: nowrap; }
details > summary { cursor: pointer; }

main { max-width: 980px; margin: 0 auto; padding: 1.25rem 16px 2rem; }

/* Bausteine */
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; box-shadow: var(--schatten); }
.karte.schmal { max-width: 460px; margin: 3rem auto; }
.raster { display: grid; gap: 1rem; }
.raster.zwei { grid-template-columns: 1fr 1fr; }
.raster.zwei > .karte { margin-bottom: 0; }
.raster { margin-bottom: 1rem; }
.zeile { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.zeile > input { flex: 1 1 12rem; }
.stapel { display: flex; flex-direction: column; gap: .6rem; }
.feld { display: flex; flex-direction: column; gap: .25rem; }
.feld.zwei { flex-direction: row; gap: .5rem; }
.feld.zwei > div { flex: 1; display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.feld label, .label { font-size: .9rem; font-weight: 600; }
.haken { display: flex; gap: .5rem; align-items: baseline; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--flaeche);
  border: 1px solid var(--linie); border-radius: 8px; padding: .5rem .65rem; width: 100%; min-width: 0;
}
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--akzent); }
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, .ablage:focus-visible, a:focus-visible {
  outline: 2px solid var(--akzent); outline-offset: 2px;
}

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  background: var(--akzent); color: var(--akzent-text);
  border: 1px solid transparent; border-radius: 8px; padding: .5rem .9rem; min-height: 40px;
}
.knopf:disabled { opacity: .55; cursor: default; }
.knopf.leise { background: var(--flaeche-2); color: var(--text); border-color: var(--linie); }
.knopf.gefahr { background: transparent; color: var(--fehler); border-color: var(--fehler); }
.knopf.klein { min-height: 32px; padding: .25rem .6rem; font-size: .9rem; }
.knopf.rund { width: 44px; height: 44px; padding: 0; border-radius: 50%; flex: none; }
.knopf.rund svg { width: 20px; height: 20px; fill: currentColor; }
.link { background: none; border: none; color: var(--akzent); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }

.banner { background: var(--akzent-hell); border-radius: 8px; padding: .6rem .8rem; margin-bottom: .75rem; display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.banner.warnung { background: var(--warn-hell); color: var(--warn); }

/* Start */
.einleitung { text-align: center; max-width: 640px; margin: 1rem auto 1.5rem; }
.einleitung p { color: var(--text-leise); }
.ablage {
  border: 2px dashed var(--linie); border-radius: var(--radius); background: var(--flaeche);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem;
  text-align: center; padding: 1.5rem 1rem; cursor: pointer; color: var(--text-leise);
}
.ablage strong { color: var(--text); font-size: 1.05rem; }
.ablage.gross { min-height: 220px; max-width: 640px; margin: 0 auto; }
.ablage.gross strong { font-size: 1.25rem; }
.ablage svg { width: 40px; height: 40px; stroke: var(--akzent); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ablage.aktiv { border-color: var(--akzent); background: var(--akzent-hell); }
.einfuegen { max-width: 640px; margin: 1rem auto; }
.einfuegen summary { cursor: pointer; color: var(--akzent); }
.einfuegen textarea { margin: .5rem 0; font-family: var(--mono); font-size: .85rem; }
#start-fehler { max-width: 640px; margin-left: auto; margin-right: auto; }
.schritte-hilfe { max-width: 640px; margin: 1.5rem auto; padding: 0; list-style: none; display: grid; gap: .5rem; grid-template-columns: 1fr 1fr; }
.schritte-hilfe li { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; padding: .6rem .8rem; font-size: .92rem; }
.schritte-hilfe b { display: block; color: var(--akzent); }

/* Kapsel */
.kapsel-kopf { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.kapsel-kopf h1 { margin: 0; overflow-wrap: anywhere; }
.reiter { display: flex; gap: .25rem; overflow-x: auto; border-bottom: 1px solid var(--linie); scrollbar-width: none; }
.reiter button {
  font: inherit; background: none; border: none; color: var(--text-leise); cursor: pointer; white-space: nowrap;
  padding: .55rem .8rem; border-bottom: 2px solid transparent; margin-bottom: -1px; position: relative;
}
.reiter button[aria-selected=true] { color: var(--text); border-bottom-color: var(--akzent); font-weight: 600; }
.punkt { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); vertical-align: middle; }

/* Chat */
.tafel[data-tafel=chat] { display: flex; flex-direction: column; min-height: calc(100vh - 210px); }
.verlauf { flex: 1; display: flex; flex-direction: column; gap: .75rem; padding: .25rem 0 1rem; }
.blase { max-width: 85%; padding: .65rem .9rem; border-radius: 14px; overflow-wrap: anywhere; }
.blase.ich { align-self: flex-end; background: var(--ich); color: var(--ich-text); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.blase.bot { align-self: flex-start; background: var(--flaeche); border: 1px solid var(--linie); border-bottom-left-radius: 4px; }
.blase.fehler { align-self: flex-start; background: var(--fehler-hell); color: var(--fehler); border: 1px solid transparent; white-space: pre-wrap; }
.blase.bot p:last-child, .blase.bot ul:last-child, .blase.bot ol:last-child { margin-bottom: 0; }
.blase.bot pre { background: var(--flaeche-2); padding: .6rem; border-radius: 8px; overflow-x: auto; white-space: pre; }
.blase.bot code { background: var(--flaeche-2); padding: 0 .25em; border-radius: 4px; }
.blase.bot pre code { background: none; padding: 0; }
.blase.bot ul, .blase.bot ol { margin: 0 0 .75rem; padding-left: 1.3rem; }
.blase.bot h3, .blase.bot h4 { margin: .5rem 0 .4rem; font-size: 1rem; }
.blase.bot table { border-collapse: collapse; margin-bottom: .75rem; display: block; overflow-x: auto; }
.blase.bot td, .blase.bot th { border: 1px solid var(--linie); padding: .25rem .5rem; }
.denkt { color: var(--text-leise); font-style: italic; display: flex; gap: .5rem; align-items: center; }
.denkt::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--akzent); animation: puls 1s infinite ease-in-out; }
@keyframes puls { 50% { opacity: .25; transform: scale(.7); } }
@media (prefers-reduced-motion: reduce) { .denkt::before { animation: none; } }
.zusatz { margin-top: .6rem; font-size: .88rem; border-top: 1px solid var(--linie); padding-top: .4rem; }
.zusatz details { margin-top: .25rem; }
.zusatz summary { cursor: pointer; color: var(--text-leise); }
.schritt { border-left: 3px solid var(--linie); padding: .25rem .6rem; margin: .4rem 0; }
.schritt .titel { font-weight: 600; }
.schritt pre { margin: .25rem 0 0; white-space: pre-wrap; max-height: 16rem; overflow: auto; font-size: .82rem; background: var(--flaeche-2); padding: .4rem; border-radius: 6px; }
.quelle { background: var(--flaeche-2); border-radius: 8px; padding: .45rem .6rem; margin: .4rem 0; white-space: pre-wrap; }
.quelle .meta { color: var(--text-leise); font-size: .8rem; margin-bottom: .2rem; }
.warnungen { color: var(--warn); font-size: .85rem; margin-top: .4rem; }

.eingabe { position: sticky; bottom: 0; display: flex; gap: .5rem; align-items: flex-end; background: var(--grund); padding: .5rem 0; padding-bottom: max(.5rem, env(safe-area-inset-bottom)); }
.eingabe textarea { max-height: 40vh; border-radius: 22px; padding: .6rem 1rem; }
.eingabe-fuss { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; font-size: .85rem; }

/* Listen */
.liste { list-style: none; margin: 0; padding: 0; }
.liste li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .55rem 0; border-top: 1px solid var(--linie); flex-wrap: wrap; }
.liste li:first-child { border-top: none; }
.liste .haupt { min-width: 0; flex: 1 1 14rem; overflow-wrap: anywhere; }
.liste .leer { color: var(--text-leise); }
.chip { display: inline-block; font-size: .78rem; padding: .05rem .5rem; border-radius: 999px; background: var(--flaeche-2); color: var(--text-leise); white-space: nowrap; }
.chip.ok { background: var(--ok-hell); color: var(--ok); }
.chip.teilweise { background: var(--warn-hell); color: var(--warn); }
.chip.fehlt { background: var(--fehler-hell); color: var(--fehler); }
.status { background: var(--akzent-hell); border-radius: 8px; padding: .6rem .8rem; margin-bottom: 1rem; }
.mcp-test { width: 100%; font-size: .9rem; }
.mcp-test ul { margin: .25rem 0 .5rem; padding-left: 1.2rem; }
.mcp-test li { border: none; padding: .1rem 0; display: list-item; }

.segment { display: flex; gap: 1rem; flex-wrap: wrap; }
.segment label { display: flex; gap: .35rem; align-items: center; font-weight: 400; }

/* Zugänge */
.zugang { border: 1px solid var(--linie); border-radius: 10px; padding: .75rem; margin-bottom: .75rem; }
.zugang-kopf { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; flex-wrap: wrap; margin-bottom: .5rem; }
.zugang-kopf .name { font-weight: 600; }
.vorschlaege { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .25rem; }

/* Bericht */
.zahlen { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.zahl { background: var(--flaeche-2); border-radius: 10px; padding: .5rem .8rem; min-width: 7rem; }
.zahl b { display: block; font-size: 1.4rem; }
.hinweise { margin: 0; padding-left: 1.2rem; }
.hinweise li { margin-bottom: .35rem; }
.knoten { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.knoten li { display: flex; justify-content: space-between; gap: .5rem; align-items: center; padding: .45rem .6rem; background: var(--flaeche-2); border-radius: 8px; flex-wrap: wrap; }
.knoten .typ { color: var(--text-leise); font-size: .82rem; font-family: var(--mono); overflow-wrap: anywhere; }
.knoten li.aus { opacity: .6; }

/* Overlay, Toast */
.overlay { position: fixed; inset: 0; background: rgba(47, 99, 201, .18); display: flex; align-items: center; justify-content: center; z-index: 50; pointer-events: none; }
.overlay div { background: var(--flaeche); border: 2px dashed var(--akzent); padding: 2rem 3rem; border-radius: var(--radius); font-weight: 700; }
.toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); background: var(--text); color: var(--grund); padding: .6rem 1rem; border-radius: 8px; z-index: 60; max-width: calc(100% - 32px); }

/* Gehostete Webversion: Konto in der Kopfzeile, Datenschutzhinweis */
.konto-kopf { white-space: nowrap; font-size: .92rem; color: var(--text-leise); }
.konto-kopf #konto-name { color: var(--text); font-weight: 600; }
.datenschutz { max-width: 640px; margin: 2rem auto 0; text-align: center; font-size: .82rem; }
.karte.schmal .datenschutz-text { margin-top: 1rem; font-size: .82rem; }

@media (max-width: 680px) {
  body { font-size: 15.5px; }
  .raster.zwei, .schritte-hilfe { grid-template-columns: 1fr; }
  .blase { max-width: 94%; }
  .feld.zwei { flex-direction: column; }
  .marke span { display: none; }
  .konto-kopf { font-size: .85rem; }
  .tafel[data-tafel=chat] { min-height: calc(100vh - 190px); }
  .eingabe-fuss .leise-text { display: none; }
  /* Alle fünf Reiter sichtbar: umbrechen statt waagerecht scrollen (die Scrollleiste ist ausgeblendet) */
  .reiter { flex-wrap: wrap; overflow-x: visible; row-gap: 0; }
  .reiter button { padding: .5rem .6rem; }
}
