/*
 * Social — Freunde, Direktnachrichten, Gruppen, Profil (js/social/ui.mjs).
 *
 * Nur die gemeinsamen Gestaltungswerte (--bg, --surface-*, --fg-*, --line,
 * --accent, --r-*): Dieselbe Datei liegt im Kundenbereich
 * (license/konto/css/social.css), ein Test haelt beide gleich. So sieht das
 * Social-Fenster in der App und im Browser gleich aus, hell wie dunkel.
 */

.so {
  --so-links: 248px;
  --so-rechts: 300px;
  display: grid;
  grid-template-columns: var(--so-links) minmax(0, 1fr) 0;
  height: 100%;
  min-height: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 14px;
  overflow: hidden;
}
.so.mit-rechts { grid-template-columns: var(--so-links) minmax(0, 1fr) var(--so-rechts); }
/* Einrichtung: nur die Mitte. Die Spalten links und rechts sind weg (display:
   none) — die Mitte ist dann das einzige Kind und muss die einzige Spalte sein,
   sonst landet sie in der ersten (0 px breit). */
.so.einrichtung { grid-template-columns: minmax(0, 1fr); }
.so.einrichtung .so-links, .so.einrichtung .so-rechts { display: none; }
.so button { font: inherit; color: inherit; }
.so input, .so textarea, .so select { font: inherit; color: var(--fg); }

/* ----------------------------------------------------------------- Links */
.so-links {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--bg-sunken); border-right: var(--rand, 1px) solid var(--line);
}
.so-suche { padding: 10px; border-bottom: 1px solid var(--line); }
.so-suche input {
  width: 100%; height: 30px; padding: 0 10px; border-radius: var(--r-knopf);
  background: var(--surface); border: 1px solid var(--line); outline: none;
}
.so-suche input:focus { border-color: var(--accent); }
.so-liste { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.so-abschnitt {
  display: flex; align-items: center; justify-content: space-between;
  margin: 14px 4px 4px 8px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-3);
}
.so-eintrag {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 5px 8px;
  border: 0; border-radius: var(--r-knopf); background: none; text-align: left; cursor: pointer; color: var(--fg-2);
}
.so-eintrag:hover { background: var(--surface); color: var(--fg); }
.so-eintrag.an { background: var(--surface-2); color: var(--fg); }
.so-eintrag.ungelesen .so-eintrag-name { color: var(--fg); font-weight: 600; }
.so-eintrag:focus-visible { outline: var(--fokus, 2px solid var(--accent)); outline-offset: -2px; }
.so-eintrag-zeichen { display: grid; place-items: center; width: 32px; height: 32px; }
.so-eintrag-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.so-eintrag-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-eintrag-unter { font-size: 12px; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-freunde-eintrag { font-weight: 600; }
.so-eintrag-zu { opacity: 0; width: 22px; height: 22px; }
.so-eintrag:hover .so-eintrag-zu, .so-eintrag:focus-within .so-eintrag-zu { opacity: 1; }
.so-liste-leer { padding: 12px 8px; font-size: 13px; color: var(--fg-3); }
.so-zahl {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pille);
  display: inline-grid; place-items: center; background: var(--err); color: #fff; font-size: 11px; font-weight: 700;
}

.so-ich {
  display: flex; align-items: center; gap: 4px; padding: 8px; border-top: 1px solid var(--line); background: var(--bg-sunken);
}
.so-ich-knopf {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; padding: 4px 6px; border: 0; border-radius: var(--r-knopf); background: none; cursor: pointer; text-align: left;
}
.so-ich-knopf:hover { background: var(--surface); }
.so-ich-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.so-ich-text b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-ich-text span { font-size: 12px; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* -------------------------------------------------------- Bild und Status */
.so-bild { position: relative; display: inline-grid; place-items: center; flex: none; border-radius: 50%; }
.so-bild > img, .so-bild-ersatz {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: grid; place-items: center;
}
.so-bild-ersatz { background: var(--accent); color: var(--auf-akzent); font-weight: 700; user-select: none; }
.so-punkt {
  position: absolute; right: -2px; bottom: -2px; width: 34%; height: 34%; min-width: 9px; min-height: 9px; max-width: 16px; max-height: 16px;
  border-radius: 50%; border: 3px solid var(--bg-sunken); background: var(--fg-4); box-sizing: content-box;
}
.so-punkt.frei { position: static; display: inline-block; width: 10px; height: 10px; min-width: 0; min-height: 0; border: 0; }
.so-punkt.online { background: var(--ok); }
.so-punkt.abwesend { background: var(--warn); }
.so-punkt.beschaeftigt { background: var(--err); }
.so-punkt.offline { background: var(--fg-4); }
.so-haupt .so-punkt, .so-rechts .so-punkt, .so-pop .so-punkt { border-color: var(--bg); }
.so-gruppen-bild {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--accent); color: var(--auf-akzent);
}
.so-gruppen-bild.klein { width: 24px; height: 24px; }
.so-gruppen-bild.gross { width: 80px; height: 80px; }
.so-at { color: var(--fg-3); font-weight: 400; }

/* --------------------------------------------------------------- Knoepfe */
.so-knopf {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
  border: 0; border-radius: var(--r-knopf); background: none; color: var(--fg-3); cursor: pointer;
}
.so-knopf:hover { background: var(--surface-2); color: var(--fg); }
.so-knopf:disabled { opacity: .4; cursor: default; }
.so-knopf.klein { width: 24px; height: 24px; }
.so-knopf.rund { width: 36px; height: 36px; border-radius: 50%; background: var(--surface); }
.so-knopf.rund:hover { background: var(--surface-3); }
.so-knopf.gut:hover { color: var(--ok); }
.so-knopf.gefahr:hover { color: var(--err); }
.so-tat {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: var(--r-knopf); border: 1px solid var(--line-mid); background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap;
}
.so-tat:hover { background: var(--surface-2); }
.so-tat.haupt { background: var(--accent); border-color: var(--accent); color: var(--auf-akzent); }
.so-tat.haupt:hover { background: var(--accent-strong, var(--accent)); }
.so-tat.haupt:disabled { opacity: .5; cursor: default; }
.so-tat.still { background: none; }
.so-tat.gefahr { background: var(--err); border-color: var(--err); color: #fff; }
.so-tat.breit { width: 100%; }
.so-hinweis { font-size: 13px; color: var(--fg-3); }

/* ------------------------------------------------------------------ Haupt */
.so-haupt { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.so-kopf {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px; border-bottom: 1px solid var(--line); flex: none;
}
.so-kopf:empty { display: none; }
.so-kopf-titel { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.so-kopf-titel b { font-size: 15px; cursor: default; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-kopf-status { color: var(--fg-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-kopf-trenner { width: 1px; height: 24px; background: var(--line); }
.so-kopf-aktionen { display: flex; gap: 4px; }
.so-grow { flex: 1; }
.so-reiterleiste { display: flex; gap: 6px; flex-wrap: wrap; }
.so-reiter {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 0; border-radius: var(--r-knopf);
  background: none; color: var(--fg-2); cursor: pointer; font-weight: 500;
}
.so-reiter:hover { background: var(--surface); color: var(--fg); }
.so-reiter.an { background: var(--surface-2); color: var(--fg); }
.so-reiter.hinzu { background: var(--accent); color: var(--auf-akzent); }
.so-reiter.hinzu.an { background: none; color: var(--accent); }
.so-inhalt { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.so-inhalt.ziehen::after {
  content: ''; position: absolute; inset: 12px; border: 2px dashed var(--accent); border-radius: var(--r-box); pointer-events: none;
  background: color-mix(in oklab, var(--accent) 8%, transparent);
}
.so-laedt, .so-leer { display: grid; place-items: center; gap: 10px; padding: 48px 24px; color: var(--fg-3); text-align: center; }
.so-leer b { color: var(--fg); }

/* ---------------------------------------------------------------- Freunde */
.so-freunde, .so-hinzu { flex: 1; overflow-y: auto; padding: 16px 24px; }
.so-suchfeld {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; margin-bottom: 12px;
  border-radius: var(--r-knopf); background: var(--surface); border: 1px solid var(--line); color: var(--fg-3);
}
.so-suchfeld input { flex: 1; border: 0; background: none; outline: none; height: 100%; }
.so-zaehler { margin: 6px 0 8px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-3); }
.so-freund {
  display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-top: 1px solid var(--line); border-radius: var(--r-knopf); cursor: pointer;
}
.so-freund:hover { background: var(--surface); border-top-color: transparent; }
.so-freund:hover + .so-freund { border-top-color: transparent; }
.so-freund-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.so-freund-name { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.so-freund-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-freund-unter { font-size: 12.5px; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-freund-aktionen { display: flex; gap: 8px; align-items: center; }
.so-hinzu h2 { margin: 4px 0 6px; font-size: 16px; text-transform: uppercase; letter-spacing: .02em; }
.so-unter { margin: 0 0 14px; color: var(--fg-3); font-size: 13.5px; line-height: 1.45; }
.so-hinzu-feld {
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: var(--r-box);
  background: var(--bg-sunken); border: 1px solid var(--line-mid);
}
.so-hinzu-feld:focus-within { border-color: var(--accent); }
.so-hinzu-feld input { flex: 1; min-width: 0; height: 34px; border: 0; background: none; outline: none; font-size: 15px; }
.so-meldung { min-height: 20px; margin: 8px 2px; font-size: 13px; }
.so-meldung.gut, .so-klein.gut { color: var(--ok); }
.so-meldung.fehler, .so-klein.fehler { color: var(--err); }
.so-ergebnisse { margin-top: 8px; }

/* ------------------------------------------------------------ Unterhaltung */
.so-raum { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.so-verlauf { flex: 1; overflow-y: auto; padding: 16px 0 8px; outline: none; overflow-anchor: none; }
.so-anfang { padding: 16px 16px 24px; display: flex; flex-direction: column; gap: 6px; }
.so-anfang h2 { margin: 8px 0 0; font-size: 26px; font-family: var(--font-serif, inherit); }
.so-anfang p { margin: 4px 0 0; color: var(--fg-3); }
.so-tag { display: flex; align-items: center; margin: 14px 16px 6px; color: var(--fg-3); font-size: 12px; font-weight: 600; }
.so-tag::before, .so-tag::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.so-tag span { padding: 0 8px; }
.so-neu-linie { display: flex; align-items: center; margin: 8px 16px; color: var(--err); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.so-neu-linie::before { content: ''; flex: 1; height: 1px; background: var(--err); }
.so-neu-linie span { padding-left: 6px; }

.so-nachricht {
  position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 14px;
  padding: 3px 48px 3px 16px; margin-top: 14px;
}
.so-nachricht.folge { margin-top: 0; padding-top: 1px; padding-bottom: 1px; }
.so-nachricht:hover { background: color-mix(in oklab, var(--surface) 70%, transparent); }
.so-nachricht.wartet { opacity: .55; }
.so-nachricht.blitz { animation: so-blitz 1.6s var(--ease, ease); }
@keyframes so-blitz { 0%, 60% { background: color-mix(in oklab, var(--accent) 18%, transparent); } 100% { background: transparent; } }
.so-nachricht-bild { grid-row: 1 / span 9; align-self: start; padding: 0; border: 0; background: none; cursor: pointer; margin-top: 2px; }
.so-bezug ~ .so-nachricht-bild { grid-row: 2 / span 9; }
.so-nachricht-koerper { min-width: 0; grid-column: 2; }
.so-nachricht-kopf { display: flex; align-items: baseline; gap: 8px; }
.so-autor { padding: 0; border: 0; background: none; font-weight: 600; cursor: pointer; color: var(--fg); }
.so-autor:hover { text-decoration: underline; }
.so-nachricht time { font-size: 11.5px; color: var(--fg-3); }
.so-zeit-links { grid-column: 1; text-align: right; opacity: 0; font-size: 10.5px; padding-top: 3px; }
.so-nachricht.folge:hover .so-zeit-links { opacity: 1; }
.so-text { line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg); }
.so-text.gross { font-size: 44px; line-height: 1.15; }
.so-text.weg { color: var(--fg-3); font-style: italic; }
.so-bearbeitet { font-size: 11px; color: var(--fg-3); white-space: nowrap; }
.so-bezug {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0 0 2px 22px; font-size: 13px; color: var(--fg-3); cursor: pointer;
}
.so-bezug:hover { color: var(--fg); }
.so-bezug-linie { width: 28px; height: 10px; margin-top: 8px; border-left: 2px solid var(--line-mid); border-top: 2px solid var(--line-mid); border-top-left-radius: 6px; flex: none; }
.so-bezug b { color: var(--fg-2); flex: none; }
.so-bezug span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-leiste {
  position: absolute; right: 16px; top: -14px; display: none; gap: 0; padding: 2px; border-radius: var(--r-knopf);
  background: var(--surface); border: 1px solid var(--line-mid); box-shadow: 0 4px 14px rgba(0, 0, 0, .18); z-index: 2;
}
.so-nachricht:hover .so-leiste, .so-nachricht:focus-within .so-leiste { display: flex; }
.so-leiste .so-knopf { width: 30px; height: 30px; }
.so-system { display: flex; align-items: center; gap: 10px; padding: 4px 16px 4px 28px; margin-top: 10px; color: var(--fg-3); font-size: 13.5px; }
.so-system svg { color: var(--ok); }
.so-system time { font-size: 11.5px; }

/* Markdown */
.so-md-code { padding: 1px 4px; border-radius: 4px; background: var(--surface-2); font-family: var(--font-mono); font-size: .88em; }
.so-md-block {
  margin: 6px 0; padding: 10px 12px; border-radius: var(--r-knopf); background: var(--bg-sunken); border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 12.5px; white-space: pre-wrap; overflow-x: auto; max-width: 100%;
}
.so-md-zitat { margin: 2px 0; padding: 0 0 0 10px; border-left: 4px solid var(--line-mid); }
.so-md-link { color: var(--accent); text-decoration: none; }
.so-md-link:hover { text-decoration: underline; }
.so-md-spoiler { border-radius: 4px; background: var(--fg-4); color: transparent; cursor: pointer; }
.so-md-spoiler * { visibility: hidden; }
.so-md-spoiler.offen { background: var(--surface-2); color: inherit; cursor: auto; }
.so-md-spoiler.offen * { visibility: visible; }
.so-md-h1 { font-size: 22px; font-weight: 700; margin: 6px 0 2px; }
.so-md-h2 { font-size: 18px; font-weight: 700; margin: 6px 0 2px; }
.so-md-h3 { font-size: 15.5px; font-weight: 700; margin: 4px 0 2px; }

/* Anhaenge */
.so-dateien { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 4px; }
.so-bild-anhang { padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: var(--r-knopf); overflow: hidden; max-width: 100%; }
.so-bild-anhang img { display: block; max-width: min(360px, 100%); max-height: 360px; height: auto; object-fit: contain; background: var(--surface); }
.so-video { max-width: min(420px, 100%); max-height: 320px; border-radius: var(--r-knopf); background: #000; }
.so-datei {
  display: flex; align-items: center; gap: 10px; width: min(400px, 100%); padding: 10px 12px; border-radius: var(--r-knopf);
  background: var(--surface); border: 1px solid var(--line); color: var(--fg-2); text-decoration: none;
}
.so-datei:hover { border-color: var(--line-mid); color: var(--fg); }
.so-datei-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.so-datei-text b { color: var(--accent); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-datei-text span { font-size: 12px; color: var(--fg-3); }

/* Reaktionen */
.so-reaktionen { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.so-reaktion {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 7px; border-radius: var(--r-knopf);
  border: 1px solid transparent; background: var(--surface); cursor: pointer;
}
.so-reaktion:hover { border-color: var(--line-mid); }
.so-reaktion.ich { background: color-mix(in oklab, var(--accent) 16%, transparent); border-color: var(--accent); }
.so-reaktion-zahl { font-size: 12.5px; font-weight: 600; color: var(--fg-2); }
.so-reaktion-plus { width: 26px; height: 26px; opacity: 0; }
.so-nachricht:hover .so-reaktion-plus { opacity: 1; }

/* Eingabe */
.so-eingabe { padding: 0 16px 6px; flex: none; }
.so-antwort-leiste {
  display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; border-radius: var(--r-box) var(--r-box) 0 0;
  background: var(--surface-2); font-size: 13px; color: var(--fg-2);
}
.so-antwort-leiste[hidden] { display: none; }
.so-anhaenge { display: flex; gap: 10px; padding: 12px; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r-box) var(--r-box) 0 0; }
.so-anhaenge[hidden] { display: none; }
.so-anhang-chip {
  position: relative; display: flex; flex-direction: column; gap: 4px; width: 150px; flex: none; padding: 8px; border-radius: var(--r-knopf);
  background: var(--bg-sunken); border: 1px solid var(--line); overflow: hidden;
}
.so-anhang-chip.fehler { border-color: var(--err); }
.so-anhang-chip img { width: 100%; height: 90px; object-fit: cover; border-radius: 6px; }
.so-anhang-symbol { display: grid; place-items: center; height: 90px; color: var(--fg-3); }
.so-anhang-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-anhang-groesse { font-size: 11.5px; color: var(--fg-3); }
.so-fortschritt { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); }
.so-anhang-weg { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; background: var(--surface); }
.so-eingabe-box {
  display: flex; align-items: flex-end; gap: 4px; padding: 6px; border-radius: var(--r-box);
  background: var(--surface); border: 1px solid var(--line);
}
.so-antwort-leiste:not([hidden]) + .so-anhaenge, .so-antwort-leiste:not([hidden]) ~ .so-eingabe-box,
.so-anhaenge:not([hidden]) + .so-eingabe-box { border-top-left-radius: 0; border-top-right-radius: 0; }
.so-eingabe-box:focus-within { border-color: var(--line-mid); }
.so-feld {
  flex: 1; min-width: 0; min-height: 32px; max-height: 260px; padding: 6px 6px; border: 0; resize: none; outline: none; background: none; line-height: 1.4;
}
.so-feld.bearbeiten { width: 100%; padding: 8px 10px; border-radius: var(--r-knopf); background: var(--surface-2); }
.so-bearbeiten { display: flex; flex-direction: column; gap: 4px; }
.so-senden { color: var(--accent); }
.so-tippt { display: flex; align-items: center; gap: 6px; min-height: 22px; padding: 2px 4px; font-size: 12.5px; color: var(--fg-2); }
.so-tippt-punkte { display: inline-flex; gap: 3px; }
.so-tippt-punkte i { width: 5px; height: 5px; border-radius: 50%; background: var(--fg-2); animation: so-tippt 1.2s infinite ease-in-out; }
.so-tippt-punkte i:nth-child(2) { animation-delay: .15s; }
.so-tippt-punkte i:nth-child(3) { animation-delay: .3s; }
@keyframes so-tippt { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .so-tippt-punkte i, .so-nachricht.blitz { animation: none; } }

/* ------------------------------------------------------------------ Rechts */
.so-rechts { min-height: 0; overflow-y: auto; border-left: 1px solid var(--line); background: var(--bg-sunken); }
.so:not(.mit-rechts) .so-rechts { display: none; }
.so-mitglieder { padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.so-mitglied {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 0; border-radius: var(--r-knopf); background: none; cursor: pointer; text-align: left;
}
.so-mitglied:hover { background: var(--surface); }
.so-mitglied.weg { opacity: .5; }
.so-mitglied > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-mitglied-weg { opacity: 0; }
.so-mitglied:hover .so-mitglied-weg { opacity: 1; }
.so-krone { font-size: 12px; }

/* Profilkarte */
.so-karte { position: relative; background: var(--bg-sunken); }
.so-pop .so-karte { border-radius: var(--r-box); overflow: hidden; }
.so-karte-banner { height: 60px; background: var(--accent); }
.so-karte.gross .so-karte-banner { height: 110px; }
.so-karte-bild { position: absolute; left: 16px; top: 22px; padding: 5px; border-radius: 50%; background: var(--bg-sunken); }
.so-karte.gross .so-karte-bild { top: 64px; }
.so-karte-bild .so-punkt { border-color: var(--bg-sunken); }
.so-karte-inhalt { margin: 48px 12px 12px; padding: 12px; border-radius: var(--r-box); background: var(--bg); display: flex; flex-direction: column; gap: 4px; }
.so-karte.gross .so-karte-inhalt { margin-top: 56px; }
.so-karte-name { display: flex; flex-direction: column; }
.so-karte-name b { font-size: 18px; }
.so-karte-status { font-size: 13.5px; color: var(--fg-2); }
.so-karte-abschnitt { margin-top: 10px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-2); }
.so-karte-text { font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg-2); }
.so-karte-aktionen { margin-top: 8px; display: flex; gap: 8px; }
.so-karte-aktionen .so-tat { flex: 1; }
.so-gemeinsam { display: flex; flex-direction: column; gap: 2px; }
.so-klein { font-size: 12px; color: var(--fg-3); }

/* ------------------------------------------------------- Popover, Dialoge */
.so-pop {
  position: fixed; z-index: 1000; min-width: 200px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow: auto;
  border-radius: var(--r-box); background: var(--surface); border: 1px solid var(--line-mid); box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
  color: var(--fg); font-family: var(--font-ui); font-size: 14px;
}
.so-menue { display: flex; flex-direction: column; padding: 6px; }
.so-menue-punkt {
  display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 0 10px; border: 0; border-radius: var(--r-knopf);
  background: none; color: var(--fg-2); cursor: pointer; text-align: left; font: inherit;
}
.so-menue-punkt:hover { background: var(--surface-2); color: var(--fg); }
.so-menue-punkt span:nth-child(2) { flex: 1; }
.so-menue-punkt.gefahr { color: var(--err); }
.so-menue-punkt.gefahr:hover { background: var(--err); color: #fff; }
.so-menue-trenner { height: 1px; margin: 4px 6px; background: var(--line); }
.so-emoji { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; }
.so-emoji button { height: 34px; border: 0; border-radius: var(--r-knopf); background: none; font-size: 21px; cursor: pointer; }
.so-emoji button:hover { background: var(--surface-2); }
.so-neu { display: flex; flex-direction: column; gap: 8px; padding: 14px; }
.so-neu input:not([type=checkbox]) {
  height: 32px; padding: 0 10px; border-radius: var(--r-knopf); background: var(--bg-sunken); border: 1px solid var(--line); outline: none;
}
.so-neu input:focus { border-color: var(--accent); }
.so-neu-liste { display: flex; flex-direction: column; max-height: 260px; overflow-y: auto; }
.so-wahl { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--r-knopf); cursor: pointer; }
.so-wahl:hover { background: var(--surface-2); }
.so-wahl > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-wahl input { width: 18px; height: 18px; accent-color: var(--accent); }

.so-dialog-hinter {
  position: fixed; inset: 0; z-index: 999; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, .55); font-family: var(--font-ui); color: var(--fg); font-size: 14px;
}
.so-dialog {
  width: min(440px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 18px;
  border-radius: var(--r-box); background: var(--surface); border: 1px solid var(--line-mid); box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.so-dialog.breit { width: min(760px, 100%); }
.so-dialog h3 { margin: 0 0 8px; font-size: 17px; }
.so-dialog p { margin: 0 0 14px; color: var(--fg-2); line-height: 1.45; }
.so-dialog-kopf { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.so-dialog-kopf h3 { margin: 0; }
.so-dialog-knoepfe { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.so-formular { display: flex; flex-direction: column; gap: 10px; }
.so-feldzeile { display: flex; flex-direction: column; gap: 6px; }
.so-feldzeile > span:first-child { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-2); }
.so-feldzeile input:not([type=color]):not([type=file]), .so-feldzeile textarea, .so-feldzeile select, .so-formular > input {
  width: 100%; min-height: 36px; padding: 6px 10px; border-radius: var(--r-knopf); background: var(--bg-sunken); border: 1px solid var(--line); outline: none; resize: vertical;
}
.so-feldzeile input:focus, .so-feldzeile textarea:focus, .so-feldzeile select:focus, .so-formular > input:focus { border-color: var(--accent); }
.so-feldzeile input[type=color] { width: 48px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: var(--r-knopf); background: none; cursor: pointer; }
.so-zeile { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.so-profil-form { display: flex; flex-direction: column; }
.so-profil-spalten { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
.so-profil-felder { display: flex; flex-direction: column; gap: 14px; }
.so-profil-vorschau { display: flex; flex-direction: column; gap: 6px; }
.so-profil-vorschau .so-karte { border-radius: var(--r-box); overflow: hidden; border: 1px solid var(--line); }
@media (max-width: 720px) { .so-profil-spalten { grid-template-columns: 1fr; } }

.so-lichtkasten {
  position: fixed; inset: 0; z-index: 1001; display: grid; place-items: center; padding: 32px; background: rgba(0, 0, 0, .85); cursor: zoom-out;
}
.so-lichtkasten img { max-width: 100%; max-height: calc(100vh - 96px); border-radius: var(--r-knopf); }
.so-original { position: absolute; bottom: 20px; color: #fff; opacity: .8; font-size: 13px; }

/* ------------------------------------------------------------- Einrichtung */
.so-einrichtung { flex: 1; display: grid; place-items: center; padding: 24px; overflow-y: auto; }
.so-einrichtung-karte {
  width: min(440px, 100%); padding: 28px; border-radius: var(--r-box); background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 6px;
}
.so-einrichtung-karte h2 { margin: 6px 0 0; font-size: 22px; font-family: var(--font-serif, inherit); }
.so-einrichtung-zeichen { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: color-mix(in oklab, var(--accent) 16%, transparent); color: var(--accent); }
.so-at-feld { display: flex; align-items: center; border-radius: var(--r-knopf); background: var(--bg-sunken); border: 1px solid var(--line); padding-left: 10px; }
.so-at-feld:focus-within { border-color: var(--accent); }
.so-at-feld span { color: var(--fg-3); }
.so-at-feld input { border: 0 !important; background: none !important; }

/* ----------------------------------------------------------------- Schmal */
@media (max-width: 860px) {
  .so, .so.mit-rechts { grid-template-columns: 76px minmax(0, 1fr) 0; }
  .so .so-rechts { display: none; }
  .so-suche, .so-abschnitt span, .so-eintrag-text, .so-eintrag-zu, .so-eintrag-name, .so-ich-text { display: none; }
  .so-eintrag { justify-content: center; padding: 5px; }
  .so-eintrag .so-zahl { position: absolute; top: 2px; right: 6px; }
  .so-abschnitt { justify-content: center; margin: 10px 0 4px; }
  .so-ich { flex-direction: column; }
  .so-nachricht { padding-right: 16px; }
}
