:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #eceef4;
  --surface-3: #e2e5ee;
  --text: #13151b;
  --muted: #646b7b;
  --border: #dde1ea;
  --accent: #6b5cff;
  --accent-2: #19b6dc;
  --accent-soft: rgba(107, 92, 255, .12);
  --on-accent: #ffffff;
  --ok: #1f9d68;
  --warn: #c98200;
  --danger: #d93b45;
  --danger-soft: rgba(217, 59, 69, .1);
  --code-bg: #eef0f6;
  --shadow: 0 8px 30px rgba(20, 22, 30, .12);
  --radius: 18px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f13;
    --surface: #16181e;
    --surface-2: #1d2028;
    --surface-3: #262a34;
    --text: #eceef4;
    --muted: #8f96a6;
    --border: #262a33;
    --accent: #8072ff;
    --accent-2: #22c3ee;
    --accent-soft: rgba(128, 114, 255, .16);
    --ok: #3ccf8e;
    --warn: #f5b13d;
    --danger: #ff5c66;
    --danger-soft: rgba(255, 92, 102, .12);
    --code-bg: #111318;
    --shadow: 0 10px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e0f13; --surface: #16181e; --surface-2: #1d2028; --surface-3: #262a34; --text: #eceef4;
  --muted: #8f96a6; --border: #262a33; --accent: #8072ff; --accent-2: #22c3ee; --accent-soft: rgba(128, 114, 255, .16);
  --ok: #3ccf8e; --warn: #f5b13d; --danger: #ff5c66; --danger-soft: rgba(255, 92, 102, .12); --code-bg: #111318;
  --shadow: 0 10px 40px rgba(0, 0, 0, .5); color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

#app { display: flex; flex-direction: column; height: 100dvh; max-width: 820px; margin: 0 auto; }

/* ---------- Kopfzeile */
.top {
  display: flex; align-items: center; gap: 6px;
  padding: calc(env(safe-area-inset-top) + 8px) 10px 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 5;
}
.icon-btn { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--text); }
.icon-btn:active { background: var(--surface-2); }
.title { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 6px; border-radius: 12px; text-align: left; }
.title:active { background: var(--surface-2); }
.logo-dot { width: 30px; height: 30px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 4px 14px var(--accent-soft); flex: none; }
.title-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.name { font-weight: 700; font-size: 17px; }
.status { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.status b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.status[data-s="online"] i { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.status[data-s="loading"] i, .status[data-s="connecting"] i { background: var(--warn); animation: pulse 1.2s infinite; }
.status[data-s="offline"] i { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- Verlauf */
main { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 14px 8px; scroll-behavior: auto; }
#messages { display: flex; flex-direction: column; gap: 14px; }

.empty { text-align: center; padding: 8vh 6px 10px; }
.empty[hidden] { display: none; }
.hero-logo { width: 68px; height: 68px; margin: 0 auto 14px; border-radius: 22px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.hero-logo svg { width: 38px; height: 38px; }
.empty h1 { font-size: 22px; margin: 0 0 6px; letter-spacing: -.01em; }
.sub { color: var(--muted); margin: 0 auto 22px; max-width: 420px; font-size: 14.5px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chips button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 14px; }
.chips button svg { width: 17px; height: 17px; color: var(--accent); }
.chips button:active { transform: scale(.97); }

.user { align-self: flex-end; max-width: 86%; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.user .bubble { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--accent-2))); color: var(--on-accent); padding: 10px 14px; border-radius: var(--radius) var(--radius) 6px var(--radius); white-space: pre-wrap; overflow-wrap: anywhere; }
.user .imgs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.user .imgs img { width: 120px; height: 120px; object-fit: cover; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); }

.turn { display: flex; flex-direction: column; gap: 8px; max-width: 100%; }
.turn .md { overflow-wrap: anywhere; }
.typing { display: inline-flex; gap: 5px; padding: 12px 4px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

/* Markdown */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .7em; }
.md h3, .md h4, .md h5 { margin: 1em 0 .4em; line-height: 1.3; }
.md h3 { font-size: 1.15em; } .md h4 { font-size: 1.05em; } .md h5 { font-size: 1em; }
.md ul, .md ol { margin: 0 0 .7em; padding-left: 1.3em; }
.md li { margin: .15em 0; }
.md a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-soft); }
.md code { font: 13.5px/1.4 ui-monospace, "Cascadia Code", Consolas, monospace; background: var(--code-bg); padding: .12em .35em; border-radius: 6px; }
.md pre { position: relative; background: var(--code-bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px; overflow-x: auto; margin: 0 0 .8em; }
.md pre code { background: none; padding: 0; font-size: 13px; white-space: pre; }
.md blockquote { margin: 0 0 .7em; padding: 2px 12px; border-left: 3px solid var(--accent); color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1em 0; }
.md table { border-collapse: collapse; margin: 0 0 .8em; font-size: 14px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 9px; text-align: left; }
.md th { background: var(--surface-2); }
.copy-code { position: absolute; top: 6px; right: 6px; padding: 4px 8px; font-size: 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); }

/* Gedanken */
.think { border: 1px dashed var(--border); border-radius: 14px; background: var(--surface); font-size: 14px; }
.think summary { display: flex; align-items: center; gap: 8px; padding: 9px 12px; color: var(--muted); list-style: none; cursor: pointer; }
.think summary::-webkit-details-marker { display: none; }
.think summary svg { width: 17px; height: 17px; }
.think .tbody { padding: 0 12px 10px; color: var(--muted); white-space: pre-wrap; max-height: 260px; overflow-y: auto; }

/* Werkzeuge */
.tool { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; font-size: 14px; }
.tool summary { display: flex; align-items: center; gap: 9px; padding: 9px 12px; list-style: none; cursor: pointer; min-width: 0; }
.tool summary::-webkit-details-marker { display: none; }
.tool .ic { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.tool .ic svg { width: 17px; height: 17px; }
.tool .tname { font-weight: 600; white-space: nowrap; }
.tool .targ { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.tool .tstate { flex: none; width: 20px; height: 20px; display: grid; place-items: center; }
.tool .tstate svg { width: 18px; height: 18px; }
.tool.ok .tstate { color: var(--ok); }
.tool.fail .tstate { color: var(--danger); }
.tool.wait { border-color: color-mix(in srgb, var(--warn) 60%, var(--border)); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tdetail { border-top: 1px solid var(--border); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.tdetail .lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tdetail pre { margin: 0; padding: 9px 10px; background: var(--code-bg); border-radius: 10px; font: 12.5px/1.45 ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 280px; overflow-y: auto; }

.approval { padding: 10px 12px 12px; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--warn) 7%, var(--surface)); display: flex; flex-direction: column; gap: 9px; }
.approval .why { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; }
.approval .why svg { color: var(--warn); width: 19px; height: 19px; margin-top: 1px; }
.approval pre { margin: 0; padding: 9px 10px; background: var(--code-bg); border-radius: 10px; font: 12.5px/1.45 ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 240px; overflow-y: auto; }
.approval .btns { display: flex; gap: 8px; }
.approval .btns button { flex: 1; padding: 11px; border-radius: 12px; font-weight: 600; }
.approval .deny { background: var(--surface-2); }
.approval .allow { background: var(--accent); color: var(--on-accent); }
.approval .note { color: var(--muted); font-size: 13px; }

.status-line { color: var(--muted); font-size: 13.5px; font-style: italic; }
.err { display: flex; gap: 9px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: var(--danger-soft); color: var(--danger); font-size: 14.5px; }
.err svg { width: 19px; height: 19px; margin-top: 1px; }
.turn-foot { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.turn-foot button { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
.turn-foot button:active { background: var(--surface-2); }
.turn-foot svg { width: 17px; height: 17px; }
.turn-foot .stats { margin-left: 4px; }

/* ---------- Eingabe */
.composer { padding: 8px 10px calc(env(safe-area-inset-bottom) + 10px); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.bar { display: flex; align-items: flex-end; gap: 4px; padding: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow); }
.bar:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
textarea { flex: 1; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; padding: 9px 4px; height: 42px; max-height: 160px; min-height: 42px; min-width: 0; }
textarea::placeholder { color: var(--muted); }
.send { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); flex: none; transition: transform .1s, opacity .2s; }
.send:disabled { opacity: .35; }
.send:active { transform: scale(.94); }
.send.stop { background: var(--text); color: var(--bg); }
#btnMic.rec { color: var(--danger); background: var(--danger-soft); }
.composer-top { display: flex; align-items: flex-end; gap: 8px; padding: 0 2px 8px; min-width: 0; }
.mode-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 13.5px; font-weight: 600; color: var(--muted); flex: none; }
.mode-chip svg { width: 16px; height: 16px; }
.mode-chip.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); color: var(--accent); }
.attachments { display: flex; gap: 8px; padding: 6px 4px 0; overflow-x: auto; min-width: 0; }
.attachments:empty { display: none; }

.work-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0 12px; }
@media (max-width: 420px) { .work-grid { grid-template-columns: repeat(2, 1fr); } }
.work-grid button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 11px 12px; border-radius: 14px; background: var(--surface-2); border: 1.5px solid transparent; text-align: left; }
.work-grid button b { font-size: 15.5px; }
.work-grid button small { color: var(--muted); font-size: 12px; }
.work-grid button.sel { border-color: var(--accent); background: var(--accent-soft); }
.custom-time { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; font-size: 14.5px; }
.custom-time > span:first-child { color: var(--muted); margin-right: 4px; }
.custom-time input { width: 62px; padding: 8px 9px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; }

.work-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 3px 9px; border-radius: 999px; }
.work-badge svg { width: 14px; height: 14px; }
.work-card { border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border)); background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.wc-top { display: flex; align-items: center; gap: 8px; }
.wc-top svg { width: 19px; height: 19px; color: var(--accent); }
.wc-top b { flex: 1; }
.wc-left { font-variant-numeric: tabular-nums; font-weight: 700; }
.wc-bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.wc-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: inherit; transition: width 1s linear; }
.wc-meta { font-size: 12.5px; color: var(--muted); }
.wc-notes { font-size: 13px; }
.wc-notes summary { cursor: pointer; color: var(--muted); }
.wc-notes pre { margin: 6px 0 0; white-space: pre-wrap; font: 12.5px/1.45 ui-monospace, Consolas, monospace; background: var(--code-bg); padding: 8px 10px; border-radius: 10px; max-height: 220px; overflow-y: auto; }
.work-card.finished { border-color: var(--border); background: var(--surface); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg button { display: flex; flex-direction: column; gap: 1px; padding: 10px 8px; border-radius: 14px; background: var(--surface-2); border: 1.5px solid transparent; text-align: center; }
.seg button b { font-size: 14.5px; }
.seg button small { color: var(--muted); font-size: 11.5px; line-height: 1.25; }
.seg button.sel { border-color: var(--accent); background: var(--accent-soft); }
.model-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.model-row:last-child { border-bottom: 0; }
.model-row .pick { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--surface-3); flex: none; display: grid; place-items: center; }
.model-row.sel .pick { border-color: var(--accent); }
.model-row.sel .pick::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.model-row .mi { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; }
.model-row .mi small { color: var(--muted); font-size: 12.5px; }
.model-row .act { font-size: 13px; padding: 7px 11px; }
.model-row.off { opacity: .55; }
.conv .phone { font-size: 11px; font-weight: 700; color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 14%, transparent); padding: 2px 7px; border-radius: 99px; margin-left: 6px; }
.status[data-s="phone"] i { background: var(--accent-2); }
.file-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.file-card .fi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.file-card .fn { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-card .fn b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14.5px; }
.file-card .fn small { color: var(--muted); font-size: 12px; }
.file-card .btn { padding: 8px 12px; font-size: 13px; }
.shot { max-width: 100%; border-radius: 14px; border: 1px solid var(--border); display: block; }
.att.doc { display: flex; align-items: center; gap: 6px; padding: 8px 30px 8px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; max-width: 180px; }
.att.doc span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.action-card { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 16px; text-align: left;
  background: linear-gradient(135deg, var(--accent-soft), transparent 80%), var(--surface); border: 1.5px solid color-mix(in srgb, var(--accent) 45%, var(--border)); }
.action-card .ai { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); flex: none; }
.action-card .at { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.action-card .at b { font-size: 15px; }
.action-card .at small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.action-card .go { font-weight: 700; color: var(--accent); font-size: 14px; flex: none; }
.action-card:active { transform: scale(.98); }
#btnTalk.on { color: var(--on-accent); background: var(--danger); animation: pulse 1.4s infinite; }
.routine-row { display: flex; align-items: center; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.routine-row:last-child { border-bottom: 0; }
.routine-row span { flex: 1; }
.routine-row small { display: block; color: var(--muted); font-size: 12.5px; }
.routine-row button { color: var(--muted); width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; }
.routine-row button svg { width: 17px; height: 17px; }
.conv-search { width: 100%; padding: 10px 12px; margin-bottom: 8px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 14.5px; }
.conv-search:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.remote { position: fixed; inset: 0; z-index: 35; background: #000; display: flex; flex-direction: column; color: #fff; }
.remote[hidden] { display: none; }
.r-top { display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top) + 6px) 8px 6px; background: #111; }
.r-top .icon-btn { color: #fff; }
.r-top b { font-size: 15px; }
.r-info { flex: 1; font-size: 12px; color: #9aa; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-chip { padding: 6px 10px; border-radius: 999px; background: #222; color: #ddd; font-size: 12.5px; font-weight: 600; }
.r-chip.on { background: #e5484d; color: #fff; }
.r-wrap { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; touch-action: pan-x pan-y pinch-zoom; }
.r-wrap.zoomed { display: block; }
.r-wrap img { width: 100%; height: auto; display: block; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.r-wrap.zoomed img { width: 220%; max-width: none; }
.r-keys { display: flex; gap: 6px; padding: 8px; overflow-x: auto; background: #111; }
.r-keys button { flex: none; padding: 8px 11px; border-radius: 10px; background: #262a33; color: #eee; font-size: 13px; font-weight: 600; }
.r-keys button:active, .r-chip:active { transform: scale(.95); }
.r-type { display: flex; gap: 6px; padding: 6px 8px calc(env(safe-area-inset-bottom) + 8px); background: #111; }
.r-type input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 12px; border: 1px solid #333; background: #1b1d23; color: #fff; font: inherit; }
.conv .live { font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 2px 7px; border-radius: 99px; margin-left: 6px; }
.att { position: relative; flex: none; }
.att img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); display: block; }
.att button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; }
.att button svg { width: 13px; height: 13px; stroke-width: 2.5; }

/* ---------- Seitenleiste */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; }
.scrim.show { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(84vw, 330px); background: var(--surface); border-right: 1px solid var(--border); z-index: 21; transform: translateX(-102%); transition: transform .22s ease; display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top) + 8px) 10px calc(env(safe-area-inset-bottom) + 10px); }
.drawer.open { transform: none; box-shadow: var(--shadow); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 6px 8px; font-weight: 700; font-size: 18px; }
.new-chat, .drawer-foot { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; font-weight: 600; }
.new-chat { background: var(--accent-soft); color: var(--accent); margin-bottom: 8px; }
.drawer-foot { border-top: 1px solid var(--border); border-radius: 0; margin-top: 6px; padding-top: 14px; }
.conv-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.conv { display: flex; align-items: center; gap: 6px; border-radius: 12px; }
.conv.active { background: var(--surface-2); }
.conv .open { flex: 1; min-width: 0; text-align: left; padding: 10px 10px; }
.conv .t { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .d { display: block; font-size: 12px; color: var(--muted); }
.conv .del { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
.conv .del svg { width: 18px; height: 18px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ---------- Einstellungen */
.sheet { border: 0; padding: 0; margin: auto 0 0; width: 100%; max-width: 100%; max-height: 92dvh; background: var(--surface); color: var(--text); border-radius: 22px 22px 0 0; box-shadow: var(--shadow); }
@media (min-width: 700px) { .sheet { margin: auto; max-width: 560px; border-radius: 22px; } }
.sheet::backdrop { background: rgba(0, 0, 0, .45); }
.sheet-inner { padding: 14px 16px calc(env(safe-area-inset-bottom) + 18px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet h2 { margin: 0; font-size: 20px; }
.sheet h3 { margin: 18px 4px 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.group { background: var(--surface-2); border-radius: 16px; padding: 4px 14px; }
.switch { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch > span { flex: 1; display: flex; flex-direction: column; }
.switch small { color: var(--muted); font-size: 13px; line-height: 1.35; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { width: 46px; height: 28px; border-radius: 999px; background: var(--surface-3); position: relative; transition: background .2s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch input:checked + i { background: var(--accent); }
.switch.danger input:checked + i { background: var(--danger); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.info .row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.info .row b { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0; }
.btn { padding: 9px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); font-weight: 600; font-size: 14px; }
.btn.ghost-danger { color: var(--danger); }
.mem { display: flex; align-items: flex-start; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.mem:last-child { border-bottom: 0; }
.mem span { flex: 1; }
.mem button { color: var(--muted); width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; }
.mem button svg { width: 17px; height: 17px; }
.group > .muted { padding: 10px 0; margin: 0; font-size: 14px; }

/* ---------- Koppeln */
.pair { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: grid; place-items: center; padding: 24px 16px; overflow-y: auto; }
.pair[hidden] { display: none; }
.pair-card { max-width: 420px; text-align: center; }
.pair h1 { font-size: 22px; margin: 0 0 14px; }
.pair ol { text-align: left; padding-left: 1.4em; line-height: 1.6; margin: 0; }
.pair li { margin-bottom: 8px; }

.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 92px); transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 40; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
