/* MetaEdge WebApp – ein Stylesheet, mobil zuerst, ohne Präprozessor */

/* ---------- Tokens ---------- */
:root {
	color-scheme: light dark;
	--bg: #f5f6f8;
	--surface: #ffffff;
	--surface-2: #eef0f4;
	--text: #16181d;
	--text-muted: #5d6472;
	--border: #dfe2e8;
	--accent: #4f46e5;
	--accent-text: #ffffff;
	--accent-soft: #e9e8fd;
	--danger: #c62f3c;
	--success: #19864f;
	--unread: #4f46e5;
	--shadow: 0 1px 2px rgb(16 18 24 / 6%), 0 4px 16px rgb(16 18 24 / 8%);
	--radius: 14px;
	--radius-sm: 10px;
	--bar-h: 52px;
	--tab-h: 58px;
	--content-w: 720px;
	--safe-top: env(safe-area-inset-top, 0px);
	--safe-bottom: env(safe-area-inset-bottom, 0px);
	--safe-left: env(safe-area-inset-left, 0px);
	--safe-right: env(safe-area-inset-right, 0px);
	--font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #0f1115;
		--surface: #181b21;
		--surface-2: #22262e;
		--text: #eceef2;
		--text-muted: #a0a7b4;
		--border: #2c313b;
		--accent: #8b8cf8;
		--accent-text: #0f1115;
		--accent-soft: #2a2b52;
		--danger: #ff6b76;
		--success: #4cc98a;
		--unread: #9c9dff;
		--shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 4px 16px rgb(0 0 0 / 35%);
	}
}

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	background: var(--bg);
	color: var(--text);
	font: 16px/1.5 var(--font);
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
	overscroll-behavior-y: none;
}
img { max-width: 100%; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.visually-hidden {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; padding: 0; border: 0;
}
.icon { display: block; flex: none; }
.muted { color: var(--text-muted); }
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Layout ---------- */
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.screen {
	flex: 1;
	width: 100%;
	max-width: var(--content-w);
	margin: 0 auto;
	padding: 0 calc(12px + var(--safe-right)) calc(var(--tab-h) + var(--safe-bottom) + 24px) calc(12px + var(--safe-left));
}
.screen--no-tabs { padding-bottom: calc(var(--safe-bottom) + 24px); }
.screen--composer { padding-bottom: calc(var(--composer-h, 72px) + var(--safe-bottom) + 16px); }
.screen--center { display: flex; flex-direction: column; justify-content: center; }

/* ---------- App-Leiste ---------- */
.app-bar {
	position: sticky;
	top: 0;
	z-index: 20;
	display: grid;
	grid-template-columns: 48px 1fr 48px;
	align-items: center;
	min-height: calc(var(--bar-h) + var(--safe-top));
	padding: var(--safe-top) calc(4px + var(--safe-right)) 0 calc(4px + var(--safe-left));
	background: color-mix(in srgb, var(--bg) 82%, transparent);
	-webkit-backdrop-filter: saturate(180%) blur(16px);
	backdrop-filter: saturate(180%) blur(16px);
	border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.app-bar__title { text-align: center; min-width: 0; }
.app-bar__title h1 { font-size: 17px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-bar__subtitle { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-bar__side { display: flex; align-items: center; }
.app-bar__side--end { justify-content: flex-end; }

/* ---------- Tab-Leiste ---------- */
.tab-bar {
	position: fixed;
	z-index: 30;
	left: 0;
	right: 0;
	bottom: 0;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	height: calc(var(--tab-h) + var(--safe-bottom));
	padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
	background: color-mix(in srgb, var(--surface) 88%, transparent);
	-webkit-backdrop-filter: saturate(180%) blur(16px);
	backdrop-filter: saturate(180%) blur(16px);
	border-top: 1px solid var(--border);
}
.tab-bar__item {
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
	color: var(--text-muted); text-decoration: none; font-size: 11px; font-weight: 550;
}
.tab-bar__item.is-active { color: var(--accent); }
.tab-bar__icon { position: relative; }
.badge {
	position: absolute; top: -4px; left: 16px;
	min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
	background: var(--unread); color: var(--accent-text);
	font-size: 11px; line-height: 18px; font-weight: 700; text-align: center;
}

/* ---------- Buttons ---------- */
.icon-button {
	display: inline-flex; align-items: center; justify-content: center;
	width: 44px; height: 44px; padding: 0; border: 0; border-radius: 22px;
	background: transparent; color: var(--accent); cursor: pointer;
}
.icon-button:active { background: var(--surface-2); }
.icon-button:disabled { color: var(--text-muted); opacity: .5; cursor: default; }
.icon-button--muted { color: var(--text-muted); }
.button {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 46px; padding: 0 18px; border: 1px solid var(--border); border-radius: 12px;
	background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; cursor: pointer;
}
.button--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.button--danger { color: var(--danger); }
.button--block { width: 100%; }
.button:disabled { opacity: .55; cursor: default; }
.text-button { border: 0; background: none; padding: 6px 4px; color: var(--accent); font-weight: 600; cursor: pointer; }
.fab {
	position: fixed; z-index: 25;
	right: calc(18px + var(--safe-right));
	bottom: calc(var(--tab-h) + var(--safe-bottom) + 18px);
	display: inline-flex; align-items: center; gap: 8px;
	height: 54px; padding: 0 20px 0 16px; border-radius: 27px;
	background: var(--accent); color: var(--accent-text); box-shadow: var(--shadow);
	font-weight: 650; text-decoration: none;
}

/* ---------- Hinweise ---------- */
.notice {
	display: flex; align-items: center; gap: 8px;
	margin: 10px 0; padding: 8px 12px; border-radius: var(--radius-sm);
	background: var(--surface-2); color: var(--text-muted); font-size: 13px;
}
.notice--error { color: var(--danger); }
.notice .text-button { margin-left: auto; }
.empty { padding: 48px 16px; text-align: center; color: var(--text-muted); }
.empty h2 { font-size: 17px; color: var(--text); margin-bottom: 6px; }
.spinner {
	width: 28px; height: 28px; margin: 40px auto; border-radius: 50%;
	border: 3px solid var(--border); border-top-color: var(--accent);
	animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Avatare ---------- */
.avatar {
	position: relative; flex: none; display: inline-grid; place-items: center; overflow: hidden;
	width: 44px; height: 44px; border-radius: 50%;
	background: var(--accent-soft); color: var(--accent); box-shadow: 0 0 0 2px var(--surface);
	font-size: 16px; font-weight: 700; line-height: 1;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 34px; height: 34px; font-size: 13px; }
.avatar--xs { width: 22px; height: 22px; font-size: 9px; box-shadow: 0 0 0 1.5px var(--surface); }
.avatar--lg { width: 88px; height: 88px; font-size: 32px; }
.avatar.is-unread { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--unread); }
.avatar--xs.is-unread { box-shadow: 0 0 0 1.5px var(--surface), 0 0 0 3px var(--unread); }

/* ---------- Konversationsliste ---------- */
.list { list-style: none; margin: 8px 0; padding: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list > li + li { border-top: 1px solid var(--border); }
.row {
	display: flex; gap: 12px; padding: 12px 14px;
	color: inherit; text-decoration: none;
}
.row:active { background: var(--surface-2); }
.row__body { flex: 1; min-width: 0; }
.row__top { display: flex; align-items: baseline; gap: 8px; }
.row__title { flex: 1; min-width: 0; font-size: 16px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.is-unread .row__title { font-weight: 750; }
.row__time { flex: none; font-size: 12px; color: var(--text-muted); }
.row.is-unread .row__time { color: var(--unread); font-weight: 650; }
.row__teaser {
	margin-top: 2px; font-size: 14px; color: var(--text-muted);
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.row__meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.row__people { display: flex; }
.row__people .avatar + .avatar { margin-left: -6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--unread); flex: none; align-self: center; }
.list-footer { display: flex; justify-content: center; padding: 16px; }
mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- Konversation ---------- */
.conversation-head { padding: 14px 4px 6px; }
.conversation-head h2 { font-size: 22px; font-weight: 750; }
.conversation-head .muted { font-size: 13px; margin-top: 4px; }
.conversation-head__actions { display: flex; gap: 4px; margin-top: 6px; }
.comments { list-style: none; margin: 0; padding: 0; }
.comment { display: flex; gap: 10px; padding: 12px 4px; }
.comment + .comment { border-top: 1px solid var(--border); }
.comment { scroll-margin-top: calc(var(--bar-h) + var(--safe-top) + 40px); }
.new-divider {
	display: flex; align-items: center; gap: 10px; margin: 6px 0 2px;
	color: var(--unread); font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em;
	scroll-margin-top: calc(var(--bar-h) + var(--safe-top) + 8px);
}
.new-divider::before, .new-divider::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: .5; }
.new-divider + .comment { border-top: 0; }
.comment__body { flex: 1; min-width: 0; }
.comment__meta { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.comment__name { font-weight: 650; }
.comment__time { color: var(--text-muted); background: none; border: 0; padding: 0; font-size: 13px; cursor: pointer; }
.comment__actions { margin-left: auto; display: flex; }
.comment__actions .icon-button { width: 34px; height: 34px; color: var(--text-muted); }
.comment__text { margin-top: 2px; overflow-wrap: anywhere; }
.comment__text blockquote { margin: 6px 0; padding: 2px 10px; border-left: 3px solid var(--border); color: var(--text-muted); }
.comment__text img { vertical-align: middle; }
.comment__text.is-emoji { font-size: 44px; line-height: 1.2; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; margin-top: 8px; max-width: 420px; }
.thumbs button { position: relative; aspect-ratio: 1; padding: 0; border: 0; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.embed { margin-top: 8px; max-width: 420px; border-radius: var(--radius-sm); overflow: hidden; background: #000; }
.embed__poster { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; border: 0; background: #000 center / cover no-repeat; color: #fff; cursor: pointer; }
.embed__poster .icon { position: absolute; inset: 0; margin: auto; width: 56px; height: 56px; padding: 14px; border-radius: 50%; background: rgb(0 0 0 / 60%); }
.embed iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; }

/* ---------- Eingabe (Composer) ---------- */
.composer {
	position: fixed; z-index: 30; left: 0; right: 0; bottom: var(--keyboard-offset, 0px);
	padding: 8px calc(10px + var(--safe-right)) calc(8px + var(--safe-bottom)) calc(10px + var(--safe-left));
	background: color-mix(in srgb, var(--surface) 94%, transparent);
	-webkit-backdrop-filter: saturate(180%) blur(16px);
	backdrop-filter: saturate(180%) blur(16px);
	border-top: 1px solid var(--border);
}
.composer__inner { max-width: var(--content-w); margin: 0 auto; }
.composer__row { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea {
	flex: 1; min-height: 44px; max-height: 40vh; padding: 10px 14px; resize: none;
	border: 1px solid var(--border); border-radius: 22px; background: var(--surface-2); line-height: 1.4;
}
.composer__hint { font-size: 12px; color: var(--text-muted); margin: 0 4px 6px; }

.spinner--sm { display: block; width: 20px; height: 20px; margin: 0; border-width: 2px; }
.comment--editing { display: block; }
.comment--editing .textarea { min-height: 96px; margin-bottom: 8px; }
.edit-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.spacer { flex: 1; }
.title-editor { margin-bottom: 4px; }
.conversation-head__actions .text-button { display: inline-flex; align-items: center; gap: 6px; padding-left: 0; }
.picker-wrap { min-width: 0; }

/* ---------- Formulare ---------- */
.form { display: grid; gap: 14px; margin-top: 16px; }
.field { display: grid; gap: 6px; }
.field label:not(.button):not(.icon-button), .field-legend { font-size: 14px; font-weight: 600; padding: 0; margin-bottom: 6px; }
.input, .textarea {
	width: 100%; min-height: 46px; padding: 10px 14px;
	border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.textarea { min-height: 140px; resize: vertical; }
.input:focus, .textarea:focus, .composer textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field__error, .form__error { color: var(--danger); font-size: 14px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
	min-height: 40px; padding: 0 16px; border-radius: 20px; border: 1px solid var(--border);
	background: var(--surface); font-weight: 600; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* ---------- Bildauswahl mit Sortierung ---------- */
.picker { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; margin: 0 0 6px; list-style: none; scroll-snap-type: x proximity; }
.picker__item { position: relative; flex: none; width: 92px; scroll-snap-align: start; }
.picker__thumb { width: 92px; height: 92px; border-radius: var(--radius-sm); object-fit: cover; display: block; background: var(--surface-2); }
.picker__item.is-locked .picker__thumb { opacity: .9; }
.picker__remove {
	position: absolute; top: 2px; right: 2px; width: 30px; height: 30px; padding: 4px; border: 0; border-radius: 15px;
	background: rgb(0 0 0 / 65%); color: #fff; cursor: pointer;
}
.picker__remove .icon { width: 22px; height: 22px; }
.picker__item.is-sortable { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.picker--sortable .is-sortable { cursor: grab; }
.picker__item.sortable-ghost { opacity: .35; }
.picker__item.sortable-chosen .picker__thumb { box-shadow: 0 0 0 3px var(--accent); }
.picker__progress { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 4px; border-radius: 2px; background: rgb(255 255 255 / 60%); overflow: hidden; }
.picker__progress span { display: block; height: 100%; background: var(--accent); }
.picker__note { font-size: 12px; color: var(--text-muted); margin: 0 2px 6px; }

/* ---------- Galerie (Vollbild) ---------- */
.gallery {
	position: fixed; inset: 0; z-index: 100; color: #fff;
	display: flex; flex-direction: column;
	background: rgb(0 0 0 / var(--gallery-bg, 1));
	/* horizontales Wischen (Bildwechsel) übernimmt der Browser, vertikales die Geste „nach unten schließen“ */
	touch-action: pan-x;
}
.gallery__bar { display: flex; align-items: center; justify-content: space-between; padding: calc(6px + var(--safe-top)) 8px 6px; }
.gallery__bar .icon-button { color: #fff; }
.gallery__track {
	flex: 1; min-height: 0; display: flex; overflow-x: auto; overflow-y: hidden;
	scroll-snap-type: x mandatory; scrollbar-width: none;
	transition: transform .2s ease-out;
}
.gallery.is-dragging .gallery__track { transition: none; }
.gallery__track::-webkit-scrollbar { display: none; }
/* Folie mit fester Fläche: das Bild hängt nicht von den eigenen Abmessungen ab (sonst auf iOS teils abgeschnitten,
   solange es noch lädt) und wird erst nach vollständigem Dekodieren eingeblendet */
.gallery__slide { position: relative; flex: none; width: 100%; height: 100%; scroll-snap-align: center; }
.gallery__slide img {
	position: absolute; inset: 0 0 var(--safe-bottom) 0; width: 100%; height: calc(100% - var(--safe-bottom));
	object-fit: contain; opacity: 0; transition: opacity .15s;
}
.gallery__slide img.is-loaded { opacity: 1; }
.gallery__spinner { position: absolute; inset: 0; margin: auto; border-color: rgb(255 255 255 / 25%); border-top-color: #fff; }
.gallery__error { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: #bbb; text-align: center; padding: 16px; }

/* ---------- Dialog ---------- */
.dialog-backdrop { position: fixed; inset: 0; z-index: 90; background: rgb(0 0 0 / 45%); display: flex; align-items: flex-end; justify-content: center; padding: 16px; padding-bottom: calc(16px + var(--safe-bottom)); }
.dialog { width: 100%; max-width: 420px; background: var(--surface); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.dialog h2 { font-size: 18px; margin-bottom: 8px; }
.dialog__actions { display: grid; gap: 8px; margin-top: 18px; }

/* ---------- Profil ---------- */
.profile { display: grid; justify-items: center; gap: 6px; padding: 24px 0 8px; text-align: center; }
.profile h2 { font-size: 20px; }
.menu { list-style: none; margin: 16px 0; padding: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.menu li + li { border-top: 1px solid var(--border); }
.menu a, .menu button {
	display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 0 16px;
	border: 0; background: none; color: var(--text); text-decoration: none; text-align: left; cursor: pointer;
}
.menu .is-danger { color: var(--danger); }
.version { font-size: 12px; color: var(--text-muted); text-align: center; }
.version a { color: inherit; }

/* ---------- Login ---------- */
.login-logo { width: 96px; height: 96px; margin: 0 auto 12px; display: block; }
.login h1 { text-align: center; font-size: 24px; margin-bottom: 4px; }
.login > p { text-align: center; color: var(--text-muted); }
.dev-server { margin-top: 16px; padding: 12px 16px; }
.dev-server summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-muted); min-height: 32px; display: flex; align-items: center; list-style: none; }
.dev-server summary::-webkit-details-marker { display: none; }
.dev-server summary::after { content: "›"; margin-left: auto; font-size: 22px; line-height: 1; transition: transform .15s; }
.dev-server[open] summary::after { transform: rotate(90deg); }
.dev-server .form { margin-top: 8px; }

/* ---------- Suche ---------- */
.search-field { position: relative; margin-top: 12px; }
.search-field .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-field .input { padding-left: 42px; border-radius: 23px; }
.section-title { margin: 18px 4px 6px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.recent { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------- Toast ---------- */
.toast {
	position: fixed; z-index: 110; left: 50%; transform: translateX(-50%);
	bottom: calc(var(--tab-h) + var(--safe-bottom) + 84px);
	max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 22px;
	background: var(--text); color: var(--bg); font-size: 14px; font-weight: 600; box-shadow: var(--shadow);
	animation: toast-in .2s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* Umzugs-Hinweis auf app.metaedge.de (js/ui/components/move-notice.js) */
.move-notice {
	position: fixed; z-index: 80; left: 12px; right: 12px;
	bottom: calc(var(--tab-h) + var(--safe-bottom) + 12px);
	max-width: 560px; margin: 0 auto; padding: 14px 16px; border-radius: var(--radius-sm);
	background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-size: 14px;
}
.move-notice h2 { font-size: 16px; margin-bottom: 4px; }
.move-notice p { color: var(--text-muted); }
.move-notice__actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.app--split .move-notice { left: calc(var(--sidebar-w) + 12px); bottom: calc(var(--safe-bottom) + 16px); }

/* ---------- Tablet-Ansicht: Seitenleiste + Detailbereich (Klasse app--split, siehe js/ui/layout.js) ---------- */
/* Der Detailbereich scrollt über das Fenster, die Seitenleiste ist fest und scrollt für sich. */
.app--split { --sidebar-w: clamp(280px, 34vw, 380px); padding-left: var(--sidebar-w); }
.sidebar {
	position: fixed; z-index: 20; top: 0; bottom: 0; left: 0;
	width: var(--sidebar-w); padding-left: var(--safe-left);
	display: flex; flex-direction: column;
	background: var(--bg); border-right: 1px solid var(--border);
}
.sidebar__bar {
	display: grid; grid-template-columns: 92px 1fr 92px; align-items: center;
	min-height: calc(var(--bar-h) + var(--safe-top)); padding: var(--safe-top) 4px 0;
}
.sidebar__title { text-align: center; font-size: 17px; font-weight: 650; }
.sidebar__actions { display: flex; justify-content: flex-end; }
.icon-button.is-active { background: var(--accent-soft); }
.segmented {
	display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
	margin: 2px 12px 6px; padding: 3px; border-radius: 12px; background: var(--surface-2);
}
.segmented button {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	min-height: 36px; padding: 0 8px; border: 0; border-radius: 9px;
	background: transparent; color: var(--text-muted); font-size: 14px; font-weight: 600; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(16 18 24 / 14%); }
.segmented .count {
	min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
	background: var(--unread); color: var(--accent-text); font-size: 11px; line-height: 20px; font-weight: 700;
}
.sidebar__scroll {
	flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
	padding: 0 12px calc(var(--safe-bottom) + 16px);
}
.sidebar .search-field { margin-top: 6px; }
/* Detailbereich linksbündig mit Abstand zur Seitenleiste; Konversationen breit, Formulare schmal, Platzhalter mittig */
.app--split { --pane-pad: clamp(20px, 3vw, 40px); --pane-wide: 1200px; }
.app--split .app-bar { padding-left: 4px; }
.app--split .screen { margin: 0; padding: 8px calc(var(--pane-pad) + var(--safe-right)) calc(var(--safe-bottom) + 24px) var(--pane-pad); }
.app--split .screen--wide { max-width: var(--pane-wide); }
.app--split .screen--center { margin: 0 auto; }
.app--split .screen--composer { padding-bottom: calc(var(--composer-h, 72px) + var(--safe-bottom) + 16px); }
.app--split .composer { left: var(--sidebar-w); padding-left: var(--pane-pad); padding-right: calc(var(--pane-pad) + var(--safe-right)); }
.app--split .composer__inner { max-width: calc(var(--pane-wide) - 2 * var(--pane-pad)); margin: 0; }
/* Vorschaubilder so breit wie der Text: Spalten ab 100 px, aber immer mindestens drei pro Reihe */
.app--split .thumbs { max-width: none; grid-template-columns: repeat(auto-fill, minmax(min(100px, calc((100% - 12px) / 3)), 1fr)); }
.app--split .toast { left: calc(var(--sidebar-w) + (100% - var(--sidebar-w)) / 2); bottom: calc(var(--safe-bottom) + 96px); }

/* Maus/Trackpad (iPad mit Tastatur, Desktop) */
@media (hover: hover) {
	.row:hover { background: var(--surface-2); }
	.icon-button:hover:not(:disabled) { background: var(--surface-2); }
	.segmented button:hover:not([aria-pressed="true"]) { color: var(--text); }
}
.row.is-active { background: var(--accent-soft); }

@media (min-width: 760px) {
	.screen { padding-top: 8px; }
	.dialog-backdrop { align-items: center; }
}
