:root {
  --bg: #ffffff; --bg2: #f5f6f8; --bg3: #e9ecf1; --fg: #1d2127; --muted: #6b7380; --line: #dfe3e9;
  --accent: #2456d6; --accent-fg: #ffffff; --unread: #101418; --danger: #b3261e; --sel: #e4ecff; --ok: #2e7d4f; --warn: #a66b00;
  --rail: #1e2633; --rail-fg: #c9d1dd; --rail-on: #ffffff; --shadow: 0 6px 24px rgba(20, 30, 50, .14);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171c; --bg2: #1a1e25; --bg3: #232832; --fg: #e4e7ec; --muted: #8d95a3; --line: #2b313b;
    --accent: #6c93ff; --accent-fg: #0b1020; --unread: #ffffff; --danger: #ff8a80; --sel: #24325a; --ok: #6fcf97; --warn: #f2c94c;
    --rail: #0e1116; --rail-fg: #9aa3b2; --rail-on: #ffffff; --shadow: 0 6px 24px rgba(0, 0, 0, .5); }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--fg); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
[hidden] { display: none !important; }
a { color: var(--accent); }
h2 { font-size: 20px; margin: 0 0 14px; }
h3 { font-size: 15px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono, textarea.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.pre { white-space: pre-wrap; }
.center { text-align: center; padding: 24px 12px; }
.right { text-align: right; white-space: nowrap; }
.error { color: var(--danger); min-height: 1.4em; margin: 0; }
.error:empty { min-height: 0; }
.spacer, .grow { flex: 1; }
button.primary { background: var(--accent); color: var(--accent-fg); border: 0; border-radius: 7px; padding: 8px 14px; font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); border-radius: 7px; padding: 6px 10px; }
button.ghost, label.button, a.button { background: transparent; border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; display: inline-block; text-decoration: none; color: inherit; cursor: pointer; }
button.ghost:hover, label.button:hover, a.button:hover, button.icon:hover { background: var(--bg3); }
button.icon { background: transparent; border: 0; border-radius: 7px; padding: 6px 9px; }
button.link { background: none; border: 0; color: var(--accent); padding: 0 8px 0 0; }
button.link.small { font-size: 12.5px; padding: 2px 6px; }
button.wide { width: 100%; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, .messages li:focus-visible, [contenteditable]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: grid; gap: 4px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], input[type=tel], select, textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; width: 100%; min-width: 0; }
textarea { resize: vertical; }
label.check { display: flex; gap: 8px; align-items: center; }
label.check input { flex: none; }
.inline-label { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-label select, .inline-label input { width: auto; }

/* Anmeldung */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; background: var(--bg2); }
.login form { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 28px; width: min(360px, 100%); display: grid; gap: 14px; box-shadow: var(--shadow); }
.login h1 { margin: 0 0 4px; font-size: 24px; }

/* Grundgerüst: Kopfzeile, Leiste links, Bereich */
.app { height: 100%; display: grid; grid-template-columns: 76px 1fr; grid-template-rows: auto 1fr; }
.top { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--bg2); min-width: 0; }
.brand { font-size: 16px; letter-spacing: .3px; padding-left: 4px; }
#search-form { flex: 1; max-width: 520px; }
.me { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.rail { background: var(--rail); display: flex; flex-direction: column; gap: 4px; padding: 10px 6px; }
.rail a { color: var(--rail-fg); text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px; border-radius: 9px; font-size: 11px; }
.rail a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rail a:hover { background: rgba(255, 255, 255, .07); color: var(--rail-on); }
.rail a[aria-current=true] { background: rgba(255, 255, 255, .13); color: var(--rail-on); }
.view { min-height: 0; min-width: 0; }

/* Mail */
.view-mail { display: grid; grid-template-columns: 220px minmax(280px, 380px) 1fr; }
.folders { border-right: 1px solid var(--line); padding: 12px 8px; overflow: auto; background: var(--bg2); display: flex; flex-direction: column; }
.folders ul { list-style: none; margin: 12px 0 6px; padding: 0; }
.folders li button { width: 100%; text-align: left; background: none; border: 0; border-radius: 7px; padding: 7px 10px; display: flex; gap: 8px; align-items: center; }
.folders li.d1 button { padding-left: 24px; } .folders li.d2 button { padding-left: 38px; } .folders li.d3 button { padding-left: 52px; }
.folders li button:hover { background: var(--bg3); }
.folders li button[aria-current=true] { background: var(--sel); font-weight: 600; }
.folders .ico { width: 1.3em; text-align: center; flex: none; font-size: 13px; }
.folders .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folders li .n { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.folders li .n.unread { color: var(--accent); font-weight: 700; }
.folders li button.drop { outline: 2px dashed var(--accent); background: var(--sel); }
.usage-mini { margin-top: auto; padding: 12px 6px 4px; font-size: 12px; display: grid; gap: 4px; }
.usage-mini progress, .usage progress, td progress { width: 100%; height: 6px; accent-color: var(--accent); }
progress.full { accent-color: var(--danger); }
.list-pane { border-right: 1px solid var(--line); overflow: auto; min-height: 0; }
.list-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px 10px 8px; border-bottom: 1px solid var(--line); font-weight: 600; position: sticky; top: 0; background: var(--bg); z-index: 2; }
.pick-all { display: flex; padding: 0 2px; }
.folder-tools { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--bg2); font-size: 13px; }
.messages { list-style: none; margin: 0; padding: 0; }
.messages li { padding: 9px 14px 9px 8px; border-bottom: 1px solid var(--line); cursor: pointer; display: grid; grid-template-columns: auto 1fr auto; gap: 2px 8px; }
.messages li:hover { background: var(--bg2); }
.messages li[aria-selected=true], .messages li.picked { background: var(--sel); }
.messages .pick { grid-row: 1 / span 3; align-self: start; margin: 3px 2px 0; }
.messages .from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.messages .date { color: var(--muted); font-size: 12px; white-space: nowrap; }
.messages .subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.messages .prev { grid-column: 2 / -1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.messages li.unread .from, .messages li.unread .subj { font-weight: 700; color: var(--unread); }
.bulk { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--bg2); position: sticky; top: 41px; z-index: 2; }
.bulk button { padding: 4px 8px; }
.bulk select { width: auto; flex: 0 1 auto; padding: 5px; }

.reader { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: auto; }
.reader .placeholder { margin: auto; }
.msg-head { padding: 14px 18px 8px; border-bottom: 1px solid var(--line); }
.msg-head h2 { margin: 0 0 6px; font-size: 18px; overflow-wrap: anywhere; }
.msg-head .meta { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.msg-head .meta b { color: var(--fg); font-weight: 600; }
.from-line { display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 18px; border-bottom: 1px solid var(--line); background: var(--bg2); }
.actions.plain { background: none; border: 0; padding: 4px 0 14px; }
.actions select { width: auto; padding: 5px 8px; }
.actions .more { font-weight: 700; letter-spacing: 1px; }
.banner { margin: 8px 18px 0; padding: 8px 12px; background: var(--bg3); border-radius: 7px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner.warn { background: color-mix(in srgb, var(--warn) 18%, var(--bg)); }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; padding: 16px 18px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13.5px; margin: 0; }
iframe.msg-html { flex: 1; min-height: 360px; width: 100%; border: 0; background: #fff; }
.attachments { padding: 8px 18px; display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); }
.attachments a { border: 1px solid var(--line); border-radius: 7px; padding: 5px 9px; text-decoration: none; }
.fill { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.fill > .fill { flex: 1; }
.thread .card { border-bottom: 1px solid var(--line); }
.card-head { width: 100%; display: flex; gap: 12px; align-items: baseline; text-align: left; background: none; border: 0; padding: 10px 18px; }
.card-head:hover { background: var(--bg2); }
.card-head .who { font-weight: 600; flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-head.unread .who, .card-head.unread .prev { color: var(--unread); font-weight: 700; }
.card-head .prev { flex: 1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.card-head .date { color: var(--muted); font-size: 12px; flex: none; }
.card:not(.open) .card-body { display: none; }
.card.open .card-head { background: var(--bg2); }
.message .msg-head.meta, .fill > .msg-head.meta { padding-top: 8px; }
.thread iframe.msg-html { flex: none; height: 480px; min-height: 0; }

/* Verfassen */
.compose { position: fixed; right: 18px; bottom: 0; width: min(720px, 100vw); height: min(640px, 92vh); background: var(--bg); border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; box-shadow: var(--shadow); display: flex; flex-direction: column; z-index: 20; }
.compose.max { inset: 4vh 6vw; width: auto; height: auto; border-radius: 12px; border-bottom: 1px solid var(--line); }
.compose.dropping { outline: 3px dashed var(--accent); outline-offset: -6px; }
.compose-head { display: flex; align-items: center; padding: 8px 12px; background: var(--bg3); border-radius: 12px 12px 0 0; }
.compose .row { display: grid; grid-template-columns: 64px 1fr; align-items: center; padding: 3px 12px; gap: 6px; border-bottom: 1px solid var(--line); position: relative; }
.compose .row.links { display: block; padding: 2px 12px; border: 0; }
.compose .row input, .compose .row select { border: 0; padding: 6px 4px; background: transparent; }
.c-editor { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.compose .files { list-style: none; margin: 0; padding: 4px 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.compose .files:empty { display: none; }
.compose .files li { background: var(--bg3); border-radius: 7px; padding: 3px 8px; display: flex; gap: 6px; }
.compose .files button { background: none; border: 0; padding: 0; }
.compose #c-status { padding: 0 12px; margin: 4px 0; min-height: 1.2em; }
.compose-foot { display: flex; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); align-items: center; }
.suggest { position: absolute; left: 76px; right: 12px; top: 100%; z-index: 30; list-style: none; margin: 0; padding: 4px 0; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; box-shadow: var(--shadow); max-height: 260px; overflow: auto; }
.suggest li { padding: 6px 10px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--sel); }

/* Editor */
.editor { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.ed-bar { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; padding: 4px 8px; border-bottom: 1px solid var(--line); background: var(--bg2); }
.ed-btn { background: none; border: 0; border-radius: 6px; min-width: 30px; height: 30px; padding: 0 6px; }
.ed-btn:hover { background: var(--bg3); }
.ed-btn.on { background: var(--sel); color: var(--accent); }
.ed-block { width: auto !important; padding: 4px 6px !important; height: 30px; }
.ed-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.ed-mode { font-size: 12.5px; }
.ed-area, .ed-plain { flex: 1; min-height: 160px; overflow: auto; padding: 12px 14px; border: 0; border-radius: 0; outline: none; background: var(--bg); }
.ed-plain { font-family: inherit; resize: none; }
.ed-area blockquote { margin: 6px 0 6px 2px; padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }
.ed-area pre { background: var(--bg2); padding: 8px; border-radius: 6px; }
.ed-area h2 { font-size: 18px; margin: 8px 0 4px; } .ed-area h3 { font-size: 15px; margin: 8px 0 4px; }
.ed-area .pw-sig { color: var(--muted); }
#sig-editor { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 8px 0; }
#sig-editor .ed-area { min-height: 90px; max-height: 260px; }

/* Bereiche mit Liste/Unternavigation und Inhalt */
.view-split { display: grid; grid-template-columns: 240px 1fr; }
#view-kontakte { grid-template-columns: 320px 1fr; }
.subnav { border-right: 1px solid var(--line); background: var(--bg2); padding: 14px 8px; display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.subnav a { color: inherit; text-decoration: none; padding: 8px 12px; border-radius: 7px; }
.subnav a:hover { background: var(--bg3); }
.subnav a[aria-current=true] { background: var(--sel); font-weight: 600; color: var(--accent); }
.panel { overflow: auto; padding: 22px 28px 60px; min-width: 0; }
.panel > .page, .panel > .error { max-width: 860px; }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 14px; }
.card h3 { margin-bottom: 4px; }
.stack { display: grid; gap: 10px; }
.stack > p, .card > p { margin: 0; }
.card > p + * { margin-top: 8px; }
.version { margin-top: 14px; }
.fab { position: absolute; right: 18px; bottom: 18px; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-fg); font-size: 22px; box-shadow: var(--shadow); z-index: 4; }
.row-end { display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 12px; }
.toolbar input { max-width: 360px; }
.rows { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 4px; }
.rows li { display: flex; gap: 8px; align-items: center; padding: 7px 10px; background: var(--bg2); border-radius: 7px; flex-wrap: wrap; }
.rows li .grow { overflow-wrap: anywhere; }
.rows li button { padding: 3px 8px; }
.rows li.ok::before { content: "✓"; color: var(--ok); font-weight: 700; }
.rows li.warn::before { content: "!"; color: var(--warn); font-weight: 700; }
.rows li.error::before { content: "✗"; color: var(--danger); font-weight: 700; }
.rows code.fix { flex-basis: 100%; font-size: 12px; overflow-wrap: anywhere; user-select: all; }
form.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline input { flex: 1; min-width: 140px; width: auto; }
form.inline select { width: auto; }
pre.zone { background: var(--bg2); padding: 10px; border-radius: 7px; overflow: auto; font-size: 12.5px; max-height: 340px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 0; user-select: all; }
pre.codes { columns: 2; background: var(--bg2); padding: 10px; border-radius: 7px; user-select: all; }
.new-secret code { font-size: 1.1em; padding: 2px 6px; background: var(--bg2); border-radius: 4px; user-select: all; }
#tfa-qr { background: #fff; border-radius: 7px; }
.client-info { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.client-info dt { color: var(--muted); }
.client-info dd { margin: 0; user-select: all; overflow-wrap: anywhere; }
.usage { display: grid; gap: 6px; }
.banner#rules-custom { margin: 0 0 12px; }
.badge { font-size: 12px; padding: 1px 7px; border-radius: 10px; background: var(--bg3); white-space: nowrap; display: inline-block; margin: 0 4px 2px 0; }
.badge.allow { background: color-mix(in srgb, var(--ok) 20%, var(--bg)); }
.badge.block { background: color-mix(in srgb, var(--danger) 18%, var(--bg)); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 14px; padding: 3px 10px; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.chip.on { background: var(--sel); border-color: transparent; }
.chip.ext { background: color-mix(in srgb, var(--warn) 16%, var(--bg)); }
.chip-x { background: none; border: 0; padding: 0 2px; color: var(--muted); }
.switch { display: inline-flex; gap: 10px; align-items: center; cursor: pointer; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 11px; background: var(--bg3); border: 1px solid var(--line); position: relative; margin: 0; flex: none; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left .15s; }
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::after { left: 18px; }
.switch.small input { width: 32px; height: 18px; } .switch.small input::after { width: 12px; height: 12px; } .switch.small input:checked::after { left: 16px; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.choice { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; cursor: pointer; align-items: start; }
.choice input { grid-row: 1 / span 2; margin-top: 3px; }
.choice span { font-size: 12.5px; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--sel); }
.dates { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.dates label { display: flex; gap: 6px; align-items: center; }
.dates input, label.days input { width: auto; }
label.days { display: flex; gap: 6px; align-items: center; }
label.days input { width: 5em; }

/* Filterregeln */
.rule-cards { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.rule-card { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.rule-card.off { opacity: .6; }
.rule-card .grow { min-width: 0; }
.rule-card .muted { font-size: 13px; overflow-wrap: anywhere; }
.rule-btns { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.empty-hint { padding: 16px; border: 1px dashed var(--line); border-radius: 10px; }
.rule-editor { border-color: var(--accent); }
.cond-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cond-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cond-row select { width: auto; }
.cond-row input { flex: 1 1 200px; width: auto; }

/* Kontakte */
.side { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--bg2); }
.side-head { display: flex; gap: 8px; padding: 12px; }
.side-foot { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
#ct-groups { padding: 0 12px 8px; }
.ct-list { list-style: none; margin: 0; padding: 0 6px; overflow: auto; flex: 1; }
.ct-list .letter { font-size: 12px; font-weight: 700; color: var(--muted); padding: 10px 8px 2px; }
.ct-list .group-mail { padding: 4px 4px 8px; }
.ct-row { width: 100%; display: flex; gap: 10px; align-items: center; text-align: left; background: none; border: 0; border-radius: 8px; padding: 7px 8px; }
.ct-row:hover { background: var(--bg3); }
.ct-row[aria-current=true] { background: var(--sel); }
.ct-text { display: grid; min-width: 0; }
.ct-text b, .ct-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.avatar.big { width: 58px; height: 58px; font-size: 20px; }
.detail { overflow: auto; padding: 22px 28px 60px; min-width: 0; }
.detail .placeholder { margin-top: 20vh; }
.ct-head { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.ct-head h2 { margin: 0; }
.fields { display: grid; gap: 12px; max-width: 640px; }
.field .muted { font-size: 12px; }
.ct-form { max-width: 720px; }
.multi { display: grid; gap: 6px; }
.multi-row { display: flex; gap: 6px; }
.multi-wrap .label { margin-bottom: 4px; }

/* Verwaltung */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.stat { border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 2px; color: inherit; text-decoration: none; background: var(--bg); }
.stat:hover { border-color: var(--accent); }
.stat-value { font-size: 26px; font-weight: 700; }
.stat-label { font-weight: 600; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
#adm-users tbody tr { cursor: pointer; }
#adm-users tbody tr:hover { background: var(--bg2); }
#adm-users td:nth-child(2) { min-width: 140px; }
.addr-input { display: flex; gap: 6px; align-items: center; }
.addr-input input { flex: 1; }
.addr-input select { width: auto; max-width: 50%; }
.pw-row { display: flex; gap: 6px; }
.pw-row input { flex: 1; }
.alias-list { list-style: none; margin: 0; padding: 0; }
.alias.card { display: grid; gap: 8px; }
.alias-src { font-size: 15px; }

/* Dialog, Menü, Meldungen */
.modal { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--fg); width: min(520px, calc(100vw - 24px)); max-height: 90vh; padding: 18px 20px; box-shadow: var(--shadow); }
.modal.wide { width: min(680px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(0, 0, 0, .45); }
.modal-close { float: right; margin: -8px -8px 0 0; }
.modal h2 { font-size: 18px; overflow-wrap: anywhere; }
.menu-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.menu-item { width: 100%; text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 7px; overflow-wrap: anywhere; }
.menu-item:hover { background: var(--bg3); }
.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 9px 16px; border-radius: 9px; z-index: 40; max-width: 90vw; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow); }
.toast-action { background: transparent; border: 0; color: #8fb0ff; font-weight: 700; padding: 0; cursor: pointer; }
@media (prefers-color-scheme: dark) { .toast-action { color: var(--accent-fg); text-decoration: underline; } }
.only-narrow { display: none; }
button.back { display: none; }

/* Schmale Bildschirme: Leiste unten, eine Spalte */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; position: relative; }
  .rail { grid-row: 3; flex-direction: row; justify-content: space-around; padding: 4px; }
  .rail a { flex: 1; padding: 6px 2px; }
  .only-narrow { display: inline-block; }
  .top .spacer { display: none; }
  #search-form { flex: 1; max-width: none; }
  #logout-btn { margin-left: auto; }
  .toast { bottom: 74px; }
  .app.show-reader .fab, .app.show-folders .fab { display: none; }
  .me { display: none; }
  .brand { display: none; }
  .view-mail { grid-template-columns: 1fr; position: relative; }
  .folders { position: absolute; top: 0; bottom: 0; left: 0; width: 260px; z-index: 10; transform: translateX(-100%); transition: transform .15s; }
  .app.show-folders .folders { transform: none; box-shadow: 4px 0 20px rgba(0,0,0,.3); }
  .reader { display: none; position: absolute; inset: 0; background: var(--bg); z-index: 5; }
  .app.show-reader .reader { display: flex; }
  .list-pane { border-right: 0; }
  .view-split, #view-kontakte { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .subnav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 6px; }
  .subnav a { white-space: nowrap; }
  .panel, .detail { padding: 16px; }
  #view-kontakte { grid-template-rows: 1fr; position: relative; }
  #view-kontakte .detail { display: none; position: absolute; inset: 0; background: var(--bg); z-index: 5; }
  .app.show-detail #view-kontakte .detail { display: block; }
  .compose, .compose.max { inset: 0; width: auto; height: auto; max-height: none; border-radius: 0; }
  .compose-head { border-radius: 0; }
  button.back { display: inline-block; margin-bottom: 8px; }
  .grid2 { grid-template-columns: 1fr; }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }
}
.compose-foot { flex-wrap: wrap; }
.compose-foot button, .compose-foot label { white-space: nowrap; }
