/* Design „Schwarz & Signal“ (Designsheet: Stil B, Akzent Orange, Schrift Plex, Dichte 1, a3 b2 c1 d1 e2).
   Dunkel ist Standard; Hell über data-theme="light" (Einstellungen → Darstellung). */
:root {
  --bg: #000000;
  --bg-side: #000000;
  --bg-subtle: #111111;
  --bg-hover: rgba(255, 255, 255, .06);
  --bg-active: rgba(255, 255, 255, .1);
  --bg-selected: #1b1b1b;
  --text: #f4f4f4;
  --text-2: #c2c2c2;
  --muted: #8c8c8c;
  --line: #222222;
  --line-strong: #3a3a3a;
  --accent: #ff6a2b;
  --accent-hover: #ff8148;
  --accent-text: #000000;
  --link: #ff8b5a;
  --danger: #ff5c5c;
  --star: #f2c14e;
  --shadow: 0 16px 48px rgba(0, 0, 0, .7);
  --radius: 0;
  --font: "IBM Plex Sans", -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --track: .06em;
  font-family: var(--font);
  color-scheme: dark;
}
:root[data-theme=light] {
  --bg: #ffffff;
  --bg-side: #f6f6f6;
  --bg-subtle: #f0f0f0;
  --bg-hover: rgba(0, 0, 0, .045);
  --bg-active: rgba(0, 0, 0, .08);
  --bg-selected: #ececec;
  --text: #111111;
  --text-2: #444444;
  --muted: #767676;
  --line: #e2e2e2;
  --line-strong: #c9c9c9;
  --accent: #d9480f;
  --accent-hover: #c2410c;
  --accent-text: #ffffff;
  --link: #c2410c;
  --danger: #c4372f;
  --star: #b7860b;
  --shadow: 0 16px 48px rgba(0, 0, 0, .14);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
input:not([type=checkbox]), textarea { -webkit-appearance: none; appearance: none; border-radius: 0; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3 { font-weight: 600; letter-spacing: -.01em; }
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.error { color: var(--danger); font-size: 13px; margin: 0; }
.error:empty { display: none; }
.muted { color: var(--muted); }

/* ---------- Icons ---------- */
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; }
.ic.filled { fill: currentColor; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 34px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--bg); font-weight: 500;
}
.btn:hover { background: var(--bg-subtle); }
.btn .ic { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; text-transform: uppercase; letter-spacing: var(--track); font-size: 12.5px; }
.btn-primary:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-block { width: 100%; }
.btn-small { height: 28px; padding: 0 10px; gap: 6px; font-size: 13px; text-decoration: none; color: var(--text); }
.btn-small .ic { width: 14px; height: 14px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none;
  border-radius: var(--radius); color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.on { color: var(--star); }
.link { color: var(--link); font-size: 13px; }
.link:hover { text-decoration: underline; }

/* ---------- Formulare ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field input, .field select, .field textarea {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg); color: var(--text); font-size: 14px;
}
.field textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus, .search:focus-within {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); margin-top: 12px; }
.note { margin: 0; font-size: 13px; color: var(--text-2); background: var(--bg-subtle); border-radius: var(--radius); padding: 9px 12px; }
.note:empty { display: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- Marke ---------- */
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14px; text-transform: uppercase; letter-spacing: var(--track); }
.brand-mark { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: var(--radius); background: var(--accent); color: var(--accent-text); }
.brand-mark .ic { width: 15px; height: 15px; stroke-width: 2; }

/* ---------- Login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; background: var(--bg-side); }
.login-card {
  width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 14px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow);
}
.login-card .brand { font-size: 18px; margin-bottom: 6px; }
.login-card .btn { height: 38px; margin-top: 4px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 220px minmax(440px, 44%) minmax(0, 1fr); height: 100dvh; }
.sidebar {
  display: flex; flex-direction: column; min-height: 0; gap: 10px;
  background: var(--bg-side); border-right: 1px solid var(--line);
  padding: calc(14px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom));
}
.sidebar-head { padding: 0 6px 4px; }
.compose-btn { height: 36px; }
.nav { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 32px; padding: 0 8px;
  border-radius: var(--radius); color: var(--text-2); text-align: left; white-space: nowrap;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--bg-active); color: var(--text); font-weight: 600; }
.nav-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-item .count { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--text-2); }
.nav-item .ic { color: var(--muted); }
.nav-item.active .ic { color: var(--text); }
.nav-group { margin-top: 18px; }
.nav-group-head { display: flex; align-items: center; margin-bottom: 2px; }
.nav-group-toggle {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 4px 8px;
  font-family: var(--mono); font-size: 11.5px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
}
.nav-group-toggle:hover { color: var(--text-2); }
.nav-group-toggle .label { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-group-toggle .ic { width: 14px; height: 14px; transition: transform .15s; }
.nav-group.collapsed .nav-group-toggle .ic { transform: rotate(-90deg); }
.nav-add, .nav-more { flex: none; display: grid; place-items: center; width: 26px; height: 26px; color: var(--muted); opacity: 0; }
.nav-add .ic, .nav-more .ic { width: 15px; height: 15px; }
.nav-group-head:hover .nav-add, .nav-row:hover .nav-more, .nav-add:focus, .nav-more:focus { opacity: 1; }
.nav-add:hover, .nav-more:hover { color: var(--text); background: var(--bg-hover); }
.nav-row { position: relative; display: flex; align-items: center; }
.nav-row .nav-item { flex: 1; min-width: 0; }
.nav-row .nav-more { position: absolute; right: 2px; background: var(--bg-side); }
.nav-row.drop .nav-item { background: var(--bg-selected); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.nav-item.warn .ic, .nav-item.warn .count { color: var(--danger); }
.nav-item.danger { color: var(--danger); }
.nav-item.danger .ic { color: var(--danger); }
.nav-group.collapsed .nav-folders { display: none; }
.nav-hint { font-size: 12.5px; color: var(--muted); padding: 4px 8px; }
.nav-hint.error { color: var(--danger); }
.acc-dot { width: 8px; height: 8px; border-radius: var(--radius); flex: none; }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: 8px; }
.backdrop { display: none; }

/* ---------- Liste ---------- */
.list-pane { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--bg); }
.pane-head {
  display: flex; align-items: center; gap: 6px; min-height: 58px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 6px 16px;
}
.pane-title { flex: 1; min-width: 0; }
.pane-title h2 { margin: 0; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pane-sub { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.pane-sub:empty { display: none; }
.search {
  display: flex; align-items: center; gap: 8px; margin: 4px 12px 10px; padding: 0 10px; height: 34px;
  background: var(--bg-subtle); border: 1px solid transparent; border-radius: var(--radius); color: var(--muted);
}
.search .ic { width: 16px; height: 16px; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--text); font-size: 14px; }
#errors .error { padding: 8px 16px; border-top: 1px solid var(--line); }

.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; border-top: 1px solid var(--line); }
.item {
  position: relative; display: flex; gap: 12px; padding: 12px 16px 12px 14px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.item:hover { background: var(--bg-subtle); }
.item.active { background: var(--bg-selected); }
.item.unread::before {
  content: ""; position: absolute; left: 5px; top: 19px; width: 6px; height: 6px;
  border-radius: var(--radius); background: var(--accent);
}
.item-main { flex: 1; min-width: 0; }
.item-check { position: relative; flex: none; display: block; width: 34px; height: 34px; cursor: pointer; }
.item-check > .avatar { display: grid; }
.item-check .check {
  position: absolute; inset: 0; display: none; place-items: center;
  background: var(--accent); color: var(--accent-text);
}
.item-check .check .ic { width: 18px; height: 18px; stroke-width: 2.4; }
.item:hover .item-check .check { display: grid; background: color-mix(in srgb, var(--bg-active) 70%, var(--bg)); color: var(--muted); border: 1px solid var(--line-strong); }
.item.selected .item-check .check { display: grid; background: var(--accent); color: var(--accent-text); border: 0; }
.item.selected { background: color-mix(in srgb, var(--accent) 12%, var(--bg)); }
.selection-bar { gap: 2px; }
.selection-bar .pane-title h2 { font-size: 15px; }
.outbox-icon { flex: none; display: grid; place-items: center; width: 34px; height: 34px; color: var(--muted); }
.outbox-icon.error { color: var(--danger); }
.outbox-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.outbox-actions .btn { height: 28px; padding: 0 10px; font-size: 12.5px; }
.outbox-item { cursor: default; }
.item-top { display: flex; align-items: baseline; gap: 8px; }
.item-from { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.item-count { flex: none; font-size: 11.5px; font-weight: 600; color: var(--muted); border: 1px solid var(--line-strong); padding: 0 5px; line-height: 16px; }
.item-date { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.item-subject { margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); font-size: 13.5px; }
.item-subject .ic { width: 13px; height: 13px; margin-right: 5px; vertical-align: -2px; color: var(--muted); }
.item-snippet {
  margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.item-meta { display: flex; align-items: center; gap: 8px; margin-top: 5px; color: var(--muted); font-size: 11.5px; }
.item-meta .ic { width: 13px; height: 13px; }
.item-meta .star { color: var(--star); }
.item-acc, .item-folder { display: inline-flex; align-items: center; gap: 5px; }
.item-acc { margin-left: auto; }
.item.unread .item-from { color: var(--text); font-weight: 600; }
.item.unread .item-subject { color: var(--text); font-weight: 600; }
.item.row {
  display: grid; grid-template-columns: 22px minmax(0, 132px) minmax(0, 1fr) auto auto; align-items: center; gap: 10px;
  height: 36px; padding: 0 12px 0 10px; font-size: 13px;
}
.item.row.unread::before { display: none; }
.item.row.unread { box-shadow: inset 3px 0 0 var(--accent); }
.item.row .item-check { width: 22px; height: 22px; }
.item.row .avatar { width: 22px; height: 22px; font-size: 9.5px; letter-spacing: 0; }
.item.row .item-check .check .ic { width: 14px; height: 14px; }
.item.row .item-from { display: flex; align-items: center; gap: 6px; }
.item.row .item-from .name { overflow: hidden; text-overflow: ellipsis; }
.item.row .item-line { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.item.row .item-line .subj { color: var(--text-2); }
.item.row.unread .item-from, .item.row.unread .item-line .subj { color: var(--text); font-weight: 600; }
.item.row .item-flags { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.item.row .item-flags .ic { width: 13px; height: 13px; }
.item.row .item-flags .star { color: var(--star); }
.item.row .item-date { font-family: var(--mono); font-size: 11.5px; min-width: 44px; text-align: right; }
.item-count { font-family: var(--mono); }
.acc-tag-short {
  font-family: var(--mono); font-size: 10.5px; line-height: 15px; padding: 0 4px; border: 1px solid currentColor; letter-spacing: .03em;
}
.item-folder { white-space: nowrap; font-size: 11.5px; }
.item-snooze { font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
.list .placeholder { list-style: none; padding: 40px 16px; text-align: center; color: var(--muted); }
.list .placeholder.error { color: var(--danger); }
.more { padding: 12px; color: var(--accent); border-top: 1px solid var(--line); font-weight: 500; }

.avatar {
  flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius);
  font-size: 12px; font-weight: 500; letter-spacing: .02em; color: var(--text-2); border: 1px solid var(--line-strong);
}
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }

/* ---------- Lesen ---------- */
.read-pane { min-height: 0; min-width: 0; display: flex; background: var(--bg); }
.reader { flex: 1; min-height: 0; min-width: 0; overflow-y: auto; display: flex; flex-direction: column; }
.reader-empty { margin: auto; text-align: center; color: var(--muted); }
.reader-empty .ic { width: 40px; height: 40px; stroke-width: 1.2; margin-bottom: 8px; }
.toolbar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 2px; min-height: 58px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 6px; border-bottom: 1px solid var(--line); background: var(--bg);
}
.toolbar .sep { width: 1px; height: 20px; background: var(--line-strong); margin: 0 6px; }
.toolbar .spacer { flex: 1; }
.thread-head { padding: 22px 24px 12px; }
.thread-head h1 { font-size: 20px; line-height: 1.3; margin: 0; overflow-wrap: anywhere; }
.thread-meta { display: flex; gap: 14px; margin-top: 6px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.thread-meta:empty { display: none; }
.acc-tag { display: inline-flex; align-items: center; gap: 6px; }
.cards { padding: 0 24px 40px; }
.card { border: 1px solid var(--line); margin-top: 10px; background: var(--bg); }
.card:not(.expanded) { background: var(--bg-subtle); }
.card-head { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; cursor: pointer; }
.card-who { flex: 1; min-width: 0; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.card-who .name { font-size: 14px; font-weight: 600; color: var(--text); }
.card-who .addr { color: var(--muted); }
.card.unread .card-who .name::before { content: ""; display: inline-block; width: 6px; height: 6px; background: var(--accent); margin-right: 7px; vertical-align: 2px; }
.card-snippet { display: block; margin-top: 1px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-to { margin-top: 2px; color: var(--muted); }
.card-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.card-date { flex: none; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.card-actions { display: flex; }
.card-actions .icon-btn { width: 30px; height: 30px; }
.card-body { padding: 4px 14px 16px 66px; }
.card-body iframe { display: block; width: 100%; height: 60px; border: 0; }
.card-body iframe.light { background: #fff; }
.card-body .plain { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.6; }
.loading-inline { color: var(--muted); }
.atts { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 10px 66px; }
.att {
  display: inline-flex; align-items: center; gap: 8px; max-width: 280px; padding: 7px 12px 7px 10px;
  border: 1px solid var(--line-strong); color: var(--text); text-decoration: none; font-size: 13px;
}
.att:hover { background: var(--bg-subtle); }
.att .ic { width: 16px; height: 16px; color: var(--muted); }
.att .att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .muted { font-family: var(--mono); font-size: 12px; }
.banner {
  display: flex; align-items: center; gap: 10px; margin: 0 14px 10px 66px; padding: 8px 12px;
  background: var(--bg-subtle); font-size: 13px; color: var(--text-2);
}
.banner .ic { width: 16px; height: 16px; color: var(--muted); }
.loading { margin: auto; color: var(--muted); }
.item-snooze { display: inline-flex; align-items: center; gap: 4px; color: var(--star); }

/* ---------- Original (Quelltext) ---------- */
.source { width: min(980px, calc(100vw - 32px)); height: 90dvh; }
.source-text {
  flex: 1; margin: 0; padding: 14px 20px; overflow: auto; font: 12.5px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace;
  white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2);
}

/* ---------- Vorlagen ---------- */
.template-item .label { overflow: hidden; text-overflow: ellipsis; }
.template-item.empty { color: var(--muted); cursor: default; }

/* ---------- Suche: Filter ---------- */
.chips { display: none; flex-wrap: wrap; gap: 6px; margin: -4px 12px 10px; }
.chips.show { display: flex; }
.chip { height: 26px; padding: 0 10px; font-size: 12.5px; color: var(--text-2); border: 1px solid var(--line-strong); }
.chip:hover { color: var(--text); background: var(--bg-hover); }
.chip.on { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }

.icon-btn.spin .ic { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Adressvorschläge ---------- */
.suggest { max-height: 280px; }
.suggest-item { height: auto; padding: 6px 8px; }
.suggest-item .avatar { width: 26px; height: 26px; font-size: 10.5px; }
.suggest-item.active { background: var(--bg-active); }

/* ---------- Menü (Verschieben) ---------- */
.menu {
  position: fixed; z-index: 40; min-width: 220px; max-height: 60vh; overflow-y: auto; padding: 5px;
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow);
}
.menu-title { padding: 6px 10px 4px; font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Dialoge ---------- */
.sheet {
  border: 1px solid var(--line); padding: 0; border-radius: var(--radius); width: min(640px, calc(100vw - 32px)); max-height: 90dvh;
  background: var(--bg); color: var(--text); box-shadow: var(--shadow); overflow: hidden;
}
.sheet[open] { display: flex; flex-direction: column; }
.sheet::backdrop { background: rgba(15, 16, 18, .38); }
.sheet > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { flex: 1; margin: 0; font-size: 15px; }
.sheet-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 24px; }
.sheet-foot { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; border-top: 1px solid var(--line); }
.section-title { margin: 0 0 10px; font-family: var(--mono); font-size: 11.5px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: var(--track); }

.compose { width: min(760px, calc(100vw - 32px)); height: min(720px, 90dvh); }
.compose.mode-side, .compose.mode-dock { position: fixed; margin: 0; z-index: 35; max-width: none; max-height: none; }
.compose.mode-side { top: 0; bottom: 0; right: 0; left: auto; width: auto; height: auto; border-width: 0 0 0 1px; box-shadow: none; }
.compose.mode-dock {
  top: auto; left: auto; right: 20px; bottom: 0; width: min(540px, calc(100vw - 40px)); height: min(620px, calc(100dvh - 40px));
  border-color: var(--line-strong); border-bottom: 0;
}
.compose-modes { display: flex; gap: 0; margin-right: 4px; border: 1px solid var(--line); }
.compose-modes .icon-btn { width: 30px; height: 28px; }
.compose-modes .icon-btn .ic { width: 16px; height: 16px; }
.compose-modes .icon-btn.active { background: var(--bg-active); color: var(--text); }
.compose-fields { border-bottom: 1px solid var(--line); }
.compose .row { display: flex; align-items: center; gap: 10px; padding: 0 20px; min-height: 42px; border-bottom: 1px solid var(--line); }
.compose .row:last-child { border-bottom: 0; }
.compose .row > span { width: 56px; flex: none; color: var(--muted); font-size: 13px; }
.compose .row input, .compose .row select { flex: 1; min-width: 0; height: 40px; border: 0; background: none; outline: none; color: var(--text); font-size: 14px; }
.compose-body {
  flex: 1; min-height: 160px; width: 100%; border: 0; outline: none; resize: none; padding: 16px 20px;
  background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.6;
}
.editor { overflow-y: auto; overflow-wrap: anywhere; cursor: text; }
.editor p { margin: 0 0 .6em; }
.editor ul, .editor ol { margin: 0 0 .6em; padding-left: 1.6em; }
.editor blockquote { margin: .4em 0 .8em; padding-left: 12px; border-left: 2px solid var(--line-strong); color: var(--text-2); }
.editor a { color: var(--accent); }
.editor .signature { color: var(--text-2); margin: .8em 0; }
.editor-bar { display: flex; align-items: center; gap: 2px; padding: 4px 14px; border-bottom: 1px solid var(--line); }
.editor-bar .icon-btn { width: 30px; height: 30px; }
.editor-bar .icon-btn .ic { width: 16px; height: 16px; }
.editor-bar .txt { font-size: 14.5px; font-family: Georgia, "Times New Roman", serif; }
.editor-bar .sep { width: 1px; height: 18px; background: var(--line-strong); margin: 0 6px; }
.draft-status { font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.split { display: flex; }
.split .btn-primary:first-child { border-right-color: color-mix(in srgb, var(--accent-text) 25%, var(--accent)); }
.split-more { width: 34px; padding: 0; }
.schedule, .snooze { min-width: 280px; }
.menu .nav-item .muted { margin-left: auto; font-size: 12px; }
.menu-sep { height: 1px; margin: 4px 0; background: var(--line); }
.schedule .nav-item .muted { font-size: 12px; }
.schedule-custom { display: flex; gap: 6px; padding: 8px 6px 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.schedule-custom input { flex: 1; min-width: 0; height: 32px; padding: 0 8px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); }
.schedule-custom .btn { height: 32px; }
.drop-hint {
  display: none; position: absolute; inset: 0; z-index: 5; place-items: center; pointer-events: none;
  background: color-mix(in srgb, var(--bg) 85%, transparent); border: 2px dashed var(--accent);
  color: var(--accent); font-size: 15px; font-weight: 600;
}
.compose.dropping .drop-hint { display: grid; }
.compose form { position: relative; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 260px; }
.file-chip .ic { width: 13px; height: 13px; color: var(--muted); flex: none; }
.file-chip.uploading { opacity: .6; }
.file-remove { display: inline-grid; place-items: center; width: 18px; height: 18px; color: var(--muted); }
.file-remove:hover { color: var(--danger); }
.file-remove .ic { width: 12px; height: 12px; }
.file-list { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.file-list > span { background: var(--bg-subtle); border-radius: var(--radius); padding: 3px 4px 3px 8px; }
.sheet-foot .error { flex-basis: 100%; order: 5; }

.account-list { list-style: none; margin: 0 0 12px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.account-list li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.account-list li:last-child { border-bottom: 0; }
.account-list .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.account-list .grow b { font-weight: 600; }
.account-list .grow span { display: block; color: var(--muted); font-size: 13px; }
.account-list .empty { color: var(--muted); }
.account-list .danger { color: var(--danger); }
.account-form { display: flex; flex-direction: column; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-side); }
.account-form .section-title { margin: 0; }
.account-form details { border-top: 1px solid var(--line); padding-top: 12px; }
.account-form details[open] summary { margin-bottom: 12px; }
.account-form summary { cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-2); }
.add-account { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-google { background: #fff; color: #1f1f1f; border-color: #fff; font-weight: 600; }
.btn-google:hover { background: #ececec; }
:root[data-theme=light] .btn-google { border-color: var(--line-strong); }
.g-logo { width: 16px; height: 16px; }
#google-missing { margin-top: 10px; }
.badge { display: inline-block; margin-left: 6px; padding: 0 5px; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); border: 1px solid var(--line-strong); vertical-align: 1px; }
.account-form.google .login-only, .account-form:not(.google) .google-only { display: none; }
.segmented { display: inline-flex; border: 1px solid var(--line-strong); }
.segmented button { height: 32px; padding: 0 16px; color: var(--text-2); border-right: 1px solid var(--line-strong); }
.segmented button:last-child { border-right: 0; }
.segmented button:hover { background: var(--bg-hover); color: var(--text); }
.segmented button.active { background: var(--bg-active); color: var(--text); font-weight: 600; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.shortcuts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13px; }
.shortcuts dt { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12px; color: var(--text-2); }
.shortcuts dd { margin: 0; color: var(--text-2); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 16px;
  background: #161616; color: #f4f4f4; padding: 10px 16px; border: 1px solid #3a3a3a; border-radius: var(--radius); font-size: 13.5px;
  box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}
.toast-action { color: #ff8b5a; font-weight: 600; white-space: nowrap; text-transform: uppercase; letter-spacing: var(--track); font-size: 12px; }
.toast-action:hover { text-decoration: underline; }
.ask { width: min(420px, calc(100vw - 32px)); }
.ask .sheet-body { gap: 12px; }
.ask-text { margin: 0; color: var(--text-2); }
.ask-foot { justify-content: flex-end; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(1.1); }
.inline-field { flex-direction: row; align-items: center; gap: 12px; }
.inline-field > span { font-size: 13px; }
.inline-field select { width: auto; }

.only-mobile { display: none !important; }

/* ---------- Handy ---------- */
@media (max-width: 820px) {
  .only-mobile { display: inline-grid !important; }
  .only-desktop { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 84vw; max-width: 310px; z-index: 30;
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow);
  }
  .sidebar-head, .compose-btn { display: none; }
  .nav-add { opacity: 1; }
  .nav-row:has(.nav-item.active) .nav-more { opacity: 1; }
  .editor-bar { overflow-x: auto; }
  .draft-status { display: none; }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 16, 18, .35); z-index: 20; }
  .list-pane { border-right: 0; }
  .read-pane { display: none; }
  .app[data-view=read] .list-pane { display: none; }
  .app[data-view=read] .read-pane { display: flex; height: 100dvh; }
  .thread-head { padding: 16px 16px 8px; }
  .thread-head h1 { font-size: 18px; }
  .cards { padding: 0 8px 32px; }
  .card-body, .atts { padding-left: 14px; }
  .banner { margin-left: 14px; }
  .card-actions { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .sheet, .compose { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: var(--radius); border: 0; }
  .sheet-head { padding-top: calc(12px + env(safe-area-inset-top)); }
  .sheet-foot { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .compose .row { padding: 0 16px; }
  .compose-body { padding: 14px 16px; font-size: 16px; }
  .compose-modes { display: none; }
  .item.row {
    height: auto; padding: 10px 14px 10px 12px; row-gap: 2px; font-size: 14px;
    grid-template-columns: 28px minmax(0, 1fr) auto auto;
    grid-template-areas: "check from flags date" "check line line line";
  }
  .item.row .item-check { grid-area: check; align-self: start; width: 26px; height: 26px; margin-top: 2px; }
  .item.row .avatar { width: 26px; height: 26px; font-size: 10.5px; }
  .item.row .item-from { grid-area: from; }
  .item.row .item-flags { grid-area: flags; }
  .item.row .item-date { grid-area: date; }
  .item.row .item-line { grid-area: line; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .field input, .field select, .field textarea, .search input, .compose .row input { font-size: 16px; } /* verhindert Zoom auf iOS */
}
.addr-search { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-left: 2px; vertical-align: -6px; color: var(--muted); opacity: 0; }
.addr-search .ic { width: 14px; height: 14px; }
.addr-search:hover { color: var(--text); }
.card-head:hover .addr-search, .addr-search:focus-visible { opacity: 1; }
@media (hover: none) { .addr-search { opacity: 1; } }

/* ---------- Kalender-Einladung ---------- */
.invite { display: flex; gap: 14px; margin: 0 14px 12px 66px; padding: 12px 14px; border: 1px solid var(--line-strong); background: var(--bg-subtle); }
.invite > .ic { width: 22px; height: 22px; color: var(--accent); margin-top: 2px; }
.invite-main { flex: 1; min-width: 0; }
.invite-title { font-weight: 600; font-size: 14.5px; }
.invite-when { margin-top: 2px; }
.invite-meta { margin-top: 2px; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.invite-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.invite-actions .btn { height: 30px; }
.invite-actions .btn.chosen { border-color: var(--accent); color: var(--accent); }
.invite.cancelled .invite-title { text-decoration: line-through; }
.invite-state { margin-top: 8px; font-size: 13px; color: var(--text-2); }

/* ---------- Anhänge: Vorschau ---------- */
.att-zip { color: var(--muted); }
.preview { width: min(1100px, calc(100vw - 32px)); height: 92dvh; }
.preview-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: auto; background: var(--bg-subtle); }
.preview-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.preview-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview-body pre { align-self: stretch; flex: 1; margin: 0; padding: 16px 20px; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; }
.preview-body .muted { padding: 24px; }

/* ---------- Regeln ---------- */
.rule-form { display: flex; flex-direction: column; gap: 10px; padding: 14px; margin-bottom: 12px; border: 1px solid var(--line-strong); }
.rule-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rule-line > span { width: 44px; color: var(--muted); font-size: 13px; }
.rule-line select, .rule-line input:not([type=checkbox]) { height: 32px; padding: 0 8px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); }
.rule-line input[name=value] { flex: 1; min-width: 180px; }
.rule-actions .check { margin: 0; }
.account-list li.off .grow { opacity: .5; }
