/* buschat — ein Stylesheet, keine Abhängigkeiten. Hell/dunkel nach System. */

:root {
  --grund: #f6f5f2;
  --flaeche: #ffffff;
  --flaeche-2: #eeece7;
  --text: #1b1b1f;
  --text-2: #6b6a72;
  --text-3: #9b9aa2;
  --linie: rgba(20, 20, 30, 0.09);
  --akzent: #2f5bd3;
  --akzent-knopf: #2f5bd3;
  --akzent-weich: #e7edfb;
  --auf-akzent: #ffffff;
  --gruen: #1f9d55;
  --warn: #9a5a00;
  --warn-rand: #e9b65a;
  --warn-weich: #fdf4e3;
  --rot: #c62828;
  --code-grund: #f1efea;
  --schatten: 0 1px 2px rgba(20, 20, 30, 0.06), 0 4px 16px rgba(20, 20, 30, 0.05);
  --radius: 18px;
  --tipp: 44px;
  --app-hoehe: 100dvh;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --grund: #121214;
    --flaeche: #1c1c20;
    --flaeche-2: #26262b;
    --text: #ececef;
    --text-2: #a09fa8;
    --text-3: #6f6e77;
    --linie: rgba(255, 255, 255, 0.09);
    --akzent: #8aa6ff;
    --akzent-knopf: #3d66dc;
    --akzent-weich: #1d2540;
    --gruen: #3ecf7a;
    --warn: #f0b85a;
    --warn-rand: #7a5a1e;
    --warn-weich: #2a2214;
    --rot: #ff6b6b;
    --code-grund: #17171a;
    --schatten: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: var(--app-hoehe);
  background: var(--grund);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#app { height: 100%; }

a { color: var(--akzent); text-decoration: none; }
button { font: inherit; color: inherit; }
code, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.86em; }

.sym {
  width: 24px; height: 24px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.sym-klein { width: 16px; height: 16px; }
.sym-knopf { width: 22px; height: 22px; }

/* --- Gerüst ------------------------------------------------------------- */

.ansicht { display: flex; flex-direction: column; height: 100%; }

.kopf {
  flex: none;
  display: flex; align-items: center; gap: 10px;
  min-height: 52px;
  padding: calc(env(safe-area-inset-top) + 6px) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--grund) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
  border-bottom: 1px solid var(--linie);
  position: relative; z-index: 2;
}
.kopf-titel { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; flex: 1; }
.kopf-titel-klein { font-size: 17px; font-weight: 600; letter-spacing: 0; line-height: 1.2; }
.kopf-mitte { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.kopf-mitte .kopf-titel { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kopf-unterzeile { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kopf-zurueck, .kopf-knopf {
  display: grid; place-items: center;
  width: var(--tipp); height: var(--tipp); margin: 0 -8px;
  color: var(--akzent); border-radius: 50%;
}
.kopf-zurueck .sym { width: 28px; height: 28px; }
.kopf-zurueck:active, .kopf-knopf:active { background: var(--flaeche-2); }

.verbindung:empty { display: none; }
.verbindung {
  font-size: 12px; font-weight: 600; color: var(--warn);
  background: var(--warn-weich); border-radius: 999px; padding: 3px 9px;
}

.inhalt {
  flex: 1; min-height: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 12px max(16px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.leer { color: var(--text-2); text-align: center; padding: 32px 16px; margin: 0; }

.abschnitt {
  font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-2); margin: 8px 4px 8px;
}

/* --- Knöpfe ------------------------------------------------------------- */

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px;
  border: 0; border-radius: 14px;
  font-weight: 600; font-size: 16px; cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.knopf:active:not(:disabled) { transform: scale(0.97); }
.knopf:disabled { opacity: 0.5; }
.knopf-haupt { background: var(--akzent-knopf); color: var(--auf-akzent); }
.knopf-zweit { background: var(--flaeche-2); color: var(--text); }
.knopf-klein { min-height: 36px; padding: 0 14px; font-size: 15px; border-radius: 10px; }
.knopf-block { display: flex; width: 100%; }

.textknopf {
  background: none; border: 0; padding: 8px 4px; min-height: var(--tipp);
  color: var(--akzent); font-weight: 600; font-size: 14px; cursor: pointer;
}

/* --- Liste der Rollen --------------------------------------------------- */

.push-hinweis {
  display: flex; align-items: center; gap: 12px;
  background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten);
  padding: 12px 14px; margin-bottom: 16px;
}
.push-hinweis > .sym { color: var(--akzent); }
.push-text { flex: 1; font-size: 14px; color: var(--text-2); }

.freigaben-liste:empty { display: none; }
.freigaben-liste { margin-bottom: 20px; display: flex; flex-direction: column; gap: 12px; }

.rollen {
  list-style: none; margin: 0; padding: 0;
  background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten);
  overflow: hidden;
}
.rolle + .rolle .rolle-link::before {
  content: ""; position: absolute; top: 0; right: 0; left: 72px; border-top: 1px solid var(--linie);
}
.rolle-link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; min-height: 68px; color: inherit;
}
.rolle-link:active { background: var(--flaeche-2); }
.rolle-mitte { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rolle-zeile { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rolle-name { flex: 1; font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rolle-zeit { font-size: 13px; color: var(--text-3); flex: none; }
.rolle-vorschau { flex: 1; font-size: 15px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rolle.abwesend .rolle-name { color: var(--text-2); }
.rolle.abwesend .avatar { opacity: 0.55; }

.avatar {
  position: relative; flex: none;
  display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 50%;
  font-weight: 700; font-size: 19px; color: #fff;
}
.avatar-klein { width: 34px; height: 34px; font-size: 15px; }
.avatar-klein.abwesend { opacity: 0.55; }
.punkt {
  position: absolute; right: -1px; bottom: -1px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-3); border: 2.5px solid var(--flaeche);
}
.punkt.an { background: var(--gruen); }

.farbe-0 { background: #2f5bd3; } .farbe-1 { background: #0f8a6e; }
.farbe-2 { background: #b4482b; } .farbe-3 { background: #7b4fc9; }
.farbe-4 { background: #b07d0b; } .farbe-5 { background: #c2366f; }
.farbe-6 { background: #3d7a2a; } .farbe-7 { background: #4b5563; }

.marke {
  flex: none; min-width: 22px; height: 22px; padding: 0 7px;
  display: inline-grid; place-items: center;
  border-radius: 999px; background: var(--akzent-knopf); color: var(--auf-akzent);
  font-size: 13px; font-weight: 700;
}
.marke-freigabe { background: var(--warn-weich); color: var(--warn); padding: 0 4px; }
.sym-marke { width: 15px; height: 15px; }

.fuss:empty { display: none; }
.textknopf-leise { color: var(--text-2); font-weight: 500; }
.fuss { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 16px 0 0; font-size: 14px; color: var(--text-2); }

/* --- Freigabe-Karte ----------------------------------------------------- */

.freigabe-karte {
  background: var(--warn-weich);
  border: 1px solid var(--warn-rand);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.freigabe-karte.erledigt { background: var(--flaeche); border-color: var(--linie); }
.freigabe-kopf { display: flex; align-items: center; gap: 8px; }
.sym-schild { width: 20px; height: 20px; color: var(--warn); }
.freigabe-karte.erledigt .sym-schild, .freigabe-karte.erledigt .freigabe-zeit { color: var(--text-3); }
.freigabe-titel { flex: 1; font-size: 15px; }
.freigabe-titel .tool {
  font-weight: 600; background: rgba(0, 0, 0, 0.06); padding: 1px 6px; border-radius: 6px;
}
@media (prefers-color-scheme: dark) { .freigabe-titel .tool { background: rgba(255, 255, 255, 0.08); } }
.freigabe-zeit { font-size: 13px; color: var(--warn); font-variant-numeric: tabular-nums; flex: none; }
.freigabe-beschreibung { margin: 0; font-size: 15px; }
.freigabe-befehl {
  margin: 0; padding: 10px 12px; max-height: 9.5em; overflow: auto;
  background: var(--code-grund); border-radius: 10px;
  white-space: pre-wrap; word-break: break-word;
}
.freigabe-mehr { display: inline-flex; align-items: center; gap: 2px; font-size: 14px; font-weight: 600; align-self: flex-start; padding: 4px 0; }
.freigabe-knoepfe { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.freigabe-status { margin: 0; font-size: 15px; color: var(--text-2); }

.angaben {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 14px;
  margin: 16px 4px; font-size: 15px;
}
.angaben dt { color: var(--text-2); }
.angaben dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.roh { margin: 0 4px; }
.roh summary { color: var(--akzent); font-weight: 600; font-size: 14px; padding: 10px 0; cursor: pointer; }
.inhalt-freigabe .knopf-block { margin-top: 12px; }
.inhalt-freigabe .freigabe-karte + .knopf-block { margin-top: 16px; }

/* --- Gespräch ----------------------------------------------------------- */

.inhalt-gespraech { padding-bottom: 12px; }
.verlauf { display: flex; flex-direction: column; gap: 8px; max-width: 760px; margin: 0 auto; }

.tag {
  align-self: center; margin: 10px 0 2px;
  font-size: 12px; font-weight: 600; color: var(--text-3);
}

.zeile { display: flex; }
.zeile.rechts { justify-content: flex-end; }
.blase {
  max-width: 84%; padding: 9px 13px 6px;
  border-radius: 20px; overflow-wrap: anywhere;
}
.blase-aus { background: var(--akzent-knopf); color: var(--auf-akzent); border-bottom-right-radius: 6px; }
.blase-aus code { background: rgba(255, 255, 255, 0.18); }
.blase-ein {
  background: var(--flaeche); box-shadow: var(--schatten);
  border-bottom-left-radius: 6px;
  border-left: 3px solid var(--akzent);
}
.blase-terminal { background: var(--flaeche-2); border-bottom-right-radius: 6px; }
.blase.sendet { opacity: 0.65; }
.blase.fehlerhaft { background: var(--flaeche); color: var(--text); border: 1px solid var(--rot); }
.blase-marke { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); margin-bottom: 2px; }
.blase-text p { margin: 0 0 6px; }
.blase-text p:last-child { margin-bottom: 0; }
.blase-fuss { font-size: 11px; text-align: right; opacity: 0.7; margin-top: 2px; }
.blase-fehler { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; color: var(--rot); margin-top: 4px; }

/* Mitlesen: leiser als der Chat, damit Nachrichten an Dominik herausstechen. */
.mit-antwort { padding: 2px 2px; font-size: 15.5px; overflow-wrap: anywhere; }
.mit-antwort p, .mit-inhalt p { margin: 0 0 8px; }
.mit-antwort p:last-child { margin-bottom: 0; }
.mit-antwort ul, .mit-antwort ol, .blase-text ul, .blase-text ol { margin: 0 0 8px; padding-left: 22px; }
.md-kopf { font-weight: 700; }
.md-code, .mit-code {
  margin: 4px 0 8px; padding: 10px 12px;
  background: var(--code-grund); border-radius: 10px;
  white-space: pre-wrap; word-break: break-word; overflow-x: auto;
}
.blase-aus .md-code { background: rgba(0, 0, 0, 0.18); }
:not(pre) > code { background: var(--code-grund); padding: 1px 5px; border-radius: 5px; }

details.mit { border-radius: 12px; }
details.mit > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  min-height: 36px; padding: 6px 10px;
  border-radius: 12px; font-size: 14px; color: var(--text-2);
  background: var(--flaeche-2);
}
details.mit > summary::-webkit-details-marker { display: none; }
details.mit > summary::after {
  content: "›"; margin-left: auto; font-size: 18px; line-height: 1; color: var(--text-3);
  transition: transform 0.15s ease;
}
details.mit[open] > summary::after { transform: rotate(90deg); }
details.mit > :not(summary) { margin: 6px 4px 0; }
.mit-tool { font-weight: 600; color: var(--text); flex: none; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
.mit-kopf { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.mit-marke { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; flex: none; }
.mit-werkzeug.laeuft > summary .sym { color: var(--akzent); }
.mit-ergebnis { color: var(--text-2); border-left: 3px solid var(--linie); }
.mit-peer > summary { background: var(--akzent-weich); }
.mit-peer .mit-marke { color: var(--akzent); }
.mit-unbekannt > summary { background: var(--warn-weich); color: var(--warn); }
.mit-system { align-self: center; text-align: center; font-size: 12.5px; color: var(--text-3); max-width: 90%; }
.trenner { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12px; margin: 10px 0; }
.trenner::before, .trenner::after { content: ""; flex: 1; border-top: 1px solid var(--linie); }
.aeltere { align-self: center; }

.unten {
  flex: none;
  padding: 8px max(12px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--grund) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--linie);
}
.gespraech-freigaben:empty { display: none; }
.gespraech-freigaben { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; max-height: 55vh; overflow-y: auto; }
.freigabe-karte.kompakt { padding: 10px 12px; gap: 8px; border-radius: 16px; }
.freigabe-karte.kompakt .freigabe-kopf { color: inherit; }
.freigabe-karte.kompakt .freigabe-beschreibung {
  font-size: 14px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.freigabe-karte.kompakt .freigabe-befehl { max-height: 4.6em; padding: 8px 10px; font-size: 13px; }
.freigabe-karte.kompakt .knopf { min-height: 44px; }

.eingabe-leiste { display: flex; align-items: flex-end; gap: 8px; max-width: 760px; margin: 0 auto; }
.eingabe {
  flex: 1; display: block; width: 100%;
  min-height: 44px; padding: 10px 16px;
  border: 1px solid var(--linie); border-radius: 22px;
  background: var(--flaeche); color: var(--text);
  font: inherit; font-size: 16px; /* unter 16px zoomt iOS beim Fokus */
  line-height: 1.4; resize: none; outline: none;
}
.eingabe:focus { border-color: var(--akzent); }
.eingabe::placeholder { color: var(--text-3); }
.senden {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0;
  display: grid; place-items: center;
  background: var(--akzent-knopf); color: var(--auf-akzent); cursor: pointer;
  transition: transform 0.12s ease, opacity 0.15s ease;
}
.senden:disabled { opacity: 0.35; }
.senden:active:not(:disabled) { transform: scale(0.92); }
.senden .sym { stroke-width: 2.5; }

.eingabe-grund { border-radius: 14px; background: var(--flaeche); }

/* --- Rundruf ------------------------------------------------------------ */

.rundruf { display: flex; flex-direction: column; gap: 16px; }
.auswahl {
  list-style: none; margin: 0; padding: 0;
  background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten); overflow: hidden;
}
.auswahl li + li { border-top: 1px solid var(--linie); }
.auswahl-zeile { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px; cursor: pointer; }
.auswahl-zeile input { width: 22px; height: 22px; accent-color: var(--akzent-knopf); margin: 0; }
.auswahl-name { flex: 1; font-weight: 600; }
.auswahl-host { font-size: 14px; color: var(--text-2); }
.auswahl-zeile.abwesend .auswahl-name { color: var(--text-2); font-weight: 500; }
.eingabe-rundruf { border-radius: 14px; }

/* --- Anmelden / Einrichten ---------------------------------------------- */

.inhalt-zugang {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 12px; max-width: 420px; margin: 0 auto; width: 100%;
  padding-top: calc(env(safe-area-inset-top) + 24px);
}
.zugang-zeichen img { display: block; border-radius: 18px; box-shadow: var(--schatten); }
.zugang-titel { margin: 8px 0 0; font-size: 28px; letter-spacing: -0.02em; }
.zugang-text { margin: 0 0 16px; color: var(--text-2); }
.zugang-fehler { color: var(--rot); margin: 0; min-height: 1.4em; }

/* --- Meldungen ---------------------------------------------------------- */

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px);
  background: var(--text); color: var(--grund);
  padding: 10px 16px; border-radius: 14px; font-size: 14px; font-weight: 500;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
  transition: opacity 0.2s ease, transform 0.2s ease; z-index: 10;
}
.toast.zeigen { opacity: 1; transform: translate(-50%, 0); }
.toast.fehler { background: var(--rot); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

@media (min-width: 700px) {
  .ansicht-liste .inhalt, .ansicht-rundruf .inhalt, .inhalt-freigabe { max-width: 640px; margin: 0 auto; width: 100%; }
}

/* Markdown aus den Sessions: Tabellen, Zitate, Links, Ueberschriften */
.md-kopf { margin: 10px 0 4px !important; }
.md-h1, .md-h2 { font-size: 1.08em; }
.md-tabelle { overflow-x: auto; margin: 0 0 8px; -webkit-overflow-scrolling: touch; }
.md-tabelle table { border-collapse: collapse; font-size: 0.92em; min-width: 100%; }
.md-tabelle th, .md-tabelle td {
  border-bottom: 1px solid var(--linie); padding: 5px 8px; text-align: left; vertical-align: top;
}
.md-tabelle th { font-weight: 600; border-bottom-width: 2px; white-space: nowrap; }
.md-tabelle .md-rechts { text-align: right; }
.md-tabelle .md-mitte { text-align: center; }
.mit-antwort blockquote, .blase-text blockquote {
  margin: 0 0 8px; padding: 2px 0 2px 10px; border-left: 3px solid var(--linie); opacity: 0.85;
}
.mit-antwort hr, .blase-text hr { border: 0; border-top: 1px solid var(--linie); margin: 10px 0; }
.mit-antwort a, .blase-text a { color: var(--akzent); text-decoration: underline; text-underline-offset: 2px; }
.blase-aus a { color: inherit; }
.mit-antwort li > ul, .mit-antwort li > ol, .blase-text li > ul, .blase-text li > ol { margin: 2px 0 2px; }
.mit-antwort li, .blase-text li { margin: 1px 0; }
