/* LMCK Mail — Outlook-nahes Design (Fluent), hell und dunkel, Desktop bis Handy. */

:root {
  --brand: #0f6cbd;
  --brand-hover: #115ea3;
  --brand-text: #0f6cbd;
  --brand-soft: #ebf3fc;
  --top: #0f6cbd;
  --top-text: #fff;
  --top-hover: rgba(255, 255, 255, .14);
  --app: #f5f5f5;
  --bg: #fff;
  --bg-2: #fafafa;
  --menu: #fff;
  --hover: #f5f5f5;
  --selected: #ebf3fc;
  --open: #deecf9;
  --flag-bg: #fff8e6;
  --chip: #ebebeb;
  --text: #242424;
  --text-2: #616161;
  --text-3: #8f8f8f;
  --border: #e0e0e0;
  --border-soft: #efefef;
  --border-strong: #d1d1d1;
  --danger: #c50f1f;
  --danger-soft: #fdf3f4;
  --ok: #107c10;
  --warn: #bc4b09;
  --warn-soft: #fff9f5;
  --flag: #c50f1f;
  --shadow: 0 8px 16px rgba(0, 0, 0, .14), 0 0 2px rgba(0, 0, 0, .12);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, .1), 0 0 2px rgba(0, 0, 0, .06);
  --radius: 8px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand: #2886de;
  --brand-hover: #3a96dd;
  --brand-text: #62abf5;
  --brand-soft: #0e2a44;
  --top: #1a1a1a;
  --top-text: #fff;
  --top-hover: rgba(255, 255, 255, .1);
  --app: #141414;
  --bg: #242424;
  --bg-2: #1f1f1f;
  --menu: #2e2e2e;
  --hover: #2e2e2e;
  --selected: #1a3651;
  --open: #1f3f5e;
  --flag-bg: #3a3218;
  --chip: #3a3a3a;
  --text: #f2f2f2;
  --text-2: #c8c8c8;
  --text-3: #9a9a9a;
  --border: #383838;
  --border-soft: #2f2f2f;
  --border-strong: #4a4a4a;
  --danger: #f1707b;
  --danger-soft: #3b1f22;
  --ok: #54b054;
  --warn: #fa9e6c;
  --warn-soft: #3a2a1f;
  --flag: #f1707b;
  --shadow: 0 8px 16px rgba(0, 0, 0, .5), 0 0 2px rgba(0, 0, 0, .4);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.4 "Segoe UI", "Segoe UI Web", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--app);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
#app { height: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-text); }
h1, h2, h3 { margin: 0; }
kbd {
  font: 12px ui-monospace, Consolas, monospace; background: var(--chip); border-radius: 4px; padding: 1px 6px; color: var(--text-2);
}
:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.i {
  width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: middle;
}
.i.big { width: 56px; height: 56px; stroke-width: 1.2; color: var(--text-3); }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.pre { white-space: pre-line; }
.error { color: var(--danger); display: flex; gap: 4px; align-items: center; }
.error .i { width: 14px; height: 14px; }
.only-sm, .only-sm-flex, .only-sm-block { display: none !important; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.big { width: 12px; height: 12px; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 10px; background: var(--chip); color: var(--text-2); white-space: nowrap; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }

/* ── Knöpfe und Felder ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: 4px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text);
  font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s;
}
.btn:hover:not(:disabled) { background: var(--hover); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn.big { height: 40px; width: 100%; font-size: 15px; }
.btn .i { width: 18px; height: 18px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 4px; border: 0;
  background: transparent; color: inherit; cursor: pointer; padding: 0; position: relative;
}
.icon-btn:hover:not(:disabled) { background: var(--hover); }
.icon-btn:disabled { opacity: .4; cursor: default; }
.icon-btn.small { width: 26px; height: 26px; }
.icon-btn.small .i { width: 16px; height: 16px; }
.icon-btn.on { background: var(--brand-soft); color: var(--brand-text); }
.icon-btn.on-brand:hover { background: var(--top-hover); }
.icon-btn.flag-on { color: var(--flag); }
.icon-btn.color { cursor: pointer; }
.icon-btn.color input { position: absolute; inset: auto 4px 2px; width: 24px; height: 4px; padding: 0; border: 0; opacity: .9; cursor: pointer; }

.link {
  background: none; border: 0; padding: 0; color: var(--brand-text); cursor: pointer; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px; text-decoration: none;
}
.link:hover { text-decoration: underline; }
.link:disabled { opacity: .5; }

input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=tel], input:not([type]), select, textarea {
  height: 32px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--bg); min-width: 0;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: inset 0 -1px 0 var(--brand); }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field.row { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.field.row > span { font-size: 14px; font-weight: 400; color: var(--text); }
.check { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0; cursor: pointer; }
.check input { margin-top: 3px; }
.check small { color: var(--text-2); }
.hint { font-size: 12px; color: var(--text-2); }
.hint.warn { color: var(--warn); padding: 0 12px 6px; }
.form-error { margin-top: 12px; padding: 8px 12px; border-radius: 4px; background: var(--danger-soft); color: var(--danger); }

/* ── Anmeldung ─────────────────────────────────────────────────────── */
.boot, .login { height: 100%; display: grid; place-items: center; background: var(--app); }
.login { background: linear-gradient(160deg, var(--brand) 0 38%, var(--app) 38%); padding: 16px; }
.login-card {
  width: min(400px, 100%); background: var(--bg); border-radius: 12px; box-shadow: var(--shadow); padding: 32px;
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.login-logo h1 { font-size: 22px; font-weight: 600; }
.login-card p { color: var(--text-2); margin: 0 0 16px; }
.code-input { font-size: 22px !important; height: 48px !important; letter-spacing: 6px; text-align: center; font-variant-numeric: tabular-nums; }
.login-links { display: flex; justify-content: space-between; margin-top: 16px; }

/* ── Gerüst ────────────────────────────────────────────────────────── */
.shell { height: 100%; display: flex; flex-direction: column; }
.topbar {
  height: 48px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 8px;
  background: var(--top); color: var(--top-text); position: relative; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; width: 190px; white-space: nowrap; }
.search {
  flex: 1; max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 4px 0 10px;
  background: var(--bg); color: var(--text); border-radius: 6px;
}
.search .i { color: var(--text-2); width: 18px; height: 18px; }
.search input { flex: 1; border: 0 !important; box-shadow: none !important; background: transparent; padding: 0; height: 32px; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search select { border: 0; height: 28px; background: var(--hover); font-size: 12px; padding: 0 6px; }
.top-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.avatar-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .6); color: #fff; font-size: 12px;
  font-weight: 600; cursor: pointer; margin-left: 4px;
}

.body { flex: 1; display: flex; min-height: 0; }
.rail { width: 52px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; }
.rail-btn {
  width: 40px; height: 40px; border-radius: 6px; border: 0; background: transparent; color: var(--text-2);
  cursor: pointer; display: grid; place-items: center; position: relative;
}
.rail-btn:hover { background: var(--hover); color: var(--text); }
.rail-btn.active { color: var(--brand-text); background: var(--bg); box-shadow: var(--shadow-soft); }
.rail-btn.active::before { content: ""; position: absolute; left: -6px; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--brand); }

.mail { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 8px 8px 8px 0; gap: 8px; }
.commandbar {
  flex: none; display: flex; align-items: center; gap: 2px; height: 44px; padding: 0 8px; background: var(--bg);
  border-radius: var(--radius); box-shadow: var(--shadow-soft); overflow: hidden;
}
.commandbar .new-mail { margin-right: 4px; }
.cmd {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; border: 0; border-radius: 4px;
  background: transparent; color: var(--text); cursor: pointer; white-space: nowrap;
}
.cmd:hover:not(:disabled) { background: var(--hover); }
.cmd:disabled { opacity: .4; cursor: default; }
.cmd .i { color: var(--brand-text); }
.cmd:disabled .i { color: inherit; }
.tb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; flex: none; }

.panes { flex: 1; display: flex; gap: 8px; min-height: 0; position: relative; }
.sidebar { width: 260px; flex: none; overflow-y: auto; padding: 0 2px 24px 0; }
.sidebar.hidden { display: none; }
.scrim { display: none; }
.list, .reading {
  background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow-soft); min-height: 0; display: flex; flex-direction: column;
  overflow: hidden;
}
.list { width: 390px; flex: none; position: relative; }
.reading { flex: 1; min-width: 0; container-type: inline-size; }
@container (max-width: 560px) {
  .msg-meta { flex-wrap: wrap; }
  .msg-actions { order: -1; width: 100%; justify-content: flex-end; margin-bottom: -8px; }
  .from-line .addr { display: block; margin-left: 0; }
}
.reading-main { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }

/* ── Seitenleiste ──────────────────────────────────────────────────── */
.nav-section {
  display: flex; align-items: center; gap: 4px; width: 100%; padding: 12px 8px 4px; font-size: 12px; font-weight: 600;
  color: var(--text-2); text-transform: none; background: none; border: 0; text-align: left;
}
.nav-section.toggle { cursor: pointer; }
.nav-section .i { width: 14px; height: 14px; }
.nav-item {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 4px 8px; border: 0; border-radius: 4px;
  background: transparent; color: var(--text); cursor: pointer; text-align: left;
}
.nav-item .i { width: 18px; height: 18px; color: var(--text-2); }
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--selected); font-weight: 600; }
.nav-item.active .i { color: var(--brand-text); }
.nav-item.has-unread { font-weight: 600; }
.nav-item.drop, .account-row.drop { background: var(--brand-soft); outline: 2px dashed var(--brand); outline-offset: -2px; }
.nav-item.fav { padding-left: 12px; }
.count { font-size: 12px; font-weight: 600; color: var(--brand-text); min-width: 18px; text-align: right; }
.account-row { padding: 0; gap: 0; }
.account-row .chev { width: 24px; height: 32px; border: 0; background: none; color: var(--text-2); cursor: pointer; display: grid; place-items: center; flex: none; }
.account-row .chev .i { width: 14px; height: 14px; }
.account-name {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px 0 2px; border: 0;
  background: none; cursor: pointer; text-align: left; font-weight: 600;
}
.account.disabled { opacity: .55; }
.warn-icon { color: var(--warn); display: inline-flex; }
.warn-icon .i { width: 16px; height: 16px; }
.nav-empty { padding: 16px 12px; color: var(--text-2); }
.nav-item.needs-password { margin: 6px 0 2px; background: var(--warn-soft); color: var(--text); font-size: 13px; border: 1px solid var(--border-soft); }
.nav-item.needs-password .i { color: var(--warn); }
.new-mail .i { width: 18px; height: 18px; }
.sidebar > .new-mail { width: calc(100% - 16px); margin: 8px; }

/* ── Liste ─────────────────────────────────────────────────────────── */
.list-head { display: flex; align-items: center; gap: 4px; padding: 10px 8px 8px 16px; border-bottom: 1px solid var(--border-soft); flex: none; }
.list-title { display: flex; flex-direction: column; }
.list-title h2 { font-size: 16px; font-weight: 600; }
.list-title small { color: var(--text-2); font-size: 12px; }
.sort-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 8px; border: 0; border-radius: 4px; background: transparent;
  color: var(--text-2); cursor: pointer; font-size: 13px;
}
.sort-btn:hover { background: var(--hover); color: var(--text); }
.sort-btn .i { width: 16px; height: 16px; }
.select-bar { display: flex; align-items: center; gap: 4px; padding: 4px 8px 4px 16px; border-bottom: 1px solid var(--border-soft); background: var(--bg-2); }
.select-bar label { display: flex; align-items: center; gap: 6px; }
.filter-chip { display: flex; align-items: center; gap: 4px; margin: 6px 12px 0; font-size: 12px; color: var(--brand-text); }
.items { flex: 1; overflow-y: auto; overscroll-behavior: contain; outline: none; }
.group {
  position: sticky; top: 0; z-index: 1; padding: 8px 16px 4px; font-size: 12px; font-weight: 600; color: var(--text-2);
  background: var(--bg); border-bottom: 1px solid var(--border-soft);
}
.item {
  display: flex; gap: 10px; padding: 9px 10px 9px 14px; border-bottom: 1px solid var(--border-soft); position: relative; cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.item:hover { background: var(--hover); }
.item.flagged { background: var(--flag-bg); }
.item.selected { background: var(--selected); }
.item.open { background: var(--open); }
.item.unread::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.item-lead { width: 32px; height: 32px; flex: none; position: relative; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 600; flex: none;
}
.avatar.big { width: 40px; height: 40px; font-size: 15px; }
.item-check { position: absolute; inset: 7px; width: 18px; height: 18px; margin: 0; display: none; cursor: pointer; }
.item-check.show, .item.selected .item-check { display: block; }
.item-check.show + *, .item.selected .avatar { visibility: hidden; }
@media (hover: hover) {
  .item:hover .avatar { visibility: hidden; }
  .item:hover .item-check { display: block; }
}
.item-lead .avatar { position: absolute; inset: 0; }
.item-check.show ~ .avatar { visibility: hidden; }
.item-main { flex: 1; min-width: 0; }
.row1, .row2 { display: flex; align-items: center; gap: 8px; }
.from { flex: 1; min-width: 0; font-size: 14px; }
.item.unread .from { font-weight: 600; }
.item-icons { display: flex; gap: 4px; color: var(--text-2); flex: none; }
.item-icons .i { width: 14px; height: 14px; }
.item-icons .flag, .item-icons .imp { color: var(--flag); }
.subject { flex: 1; min-width: 0; font-size: 13px; }
.item.unread .subject { font-weight: 600; color: var(--brand-text); }
.date { font-size: 12px; color: var(--text-2); flex: none; }
.item.unread .date { font-weight: 600; color: var(--brand-text); }
.row3 { font-size: 13px; color: var(--text-2); margin-top: 1px; }
.acct-line { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-3); margin-top: 2px; }
.acct-line .dot { width: 7px; height: 7px; }
.draft-tag { color: var(--danger); font-weight: 400; }
.hover-actions {
  display: none; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); gap: 2px; background: var(--bg); border-radius: 6px;
  box-shadow: var(--shadow-soft); padding: 2px;
}
@media (hover: hover) { .item:hover .hover-actions { display: flex; } }
.list-loading { padding: 16px; display: grid; place-items: center; }
.drag-ghost { position: fixed; top: -100px; left: 0; padding: 6px 12px; background: var(--brand); color: #fff; border-radius: 4px; font-weight: 600; }
:root[data-density="compact"] .item { padding-top: 5px; padding-bottom: 5px; }
:root[data-density="compact"] .item-lead { display: none; }
:root[data-density="compact"] .row3 { display: none; }

.fab {
  position: absolute; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 16px; border: 0;
  background: var(--brand); color: #fff; box-shadow: var(--shadow); cursor: pointer; align-items: center; justify-content: center; z-index: 3;
}
.fab .i { width: 24px; height: 24px; }

.banner {
  display: flex; align-items: center; gap: 8px; margin: 8px 0 0; padding: 8px 12px; border-radius: 6px; background: var(--warn-soft);
  color: var(--text); font-size: 13px; border: 1px solid var(--border-soft);
}
.banner .i { width: 18px; height: 18px; color: var(--warn); }
.banner.info { background: var(--brand-soft); }
.banner.info .i { color: var(--brand-text); }
.banner.notify { margin: 8px 12px 0; background: var(--brand-soft); }
.banner.notify .i { color: var(--brand-text); }

/* ── Lesebereich ───────────────────────────────────────────────────── */
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 24px; text-align: center; color: var(--text-2); }
.empty p { margin: 4px 0; }
.empty.small { padding: 32px 16px; }
.empty b { color: var(--text); }
.multi-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0; }
.message { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.msg-head { flex: none; padding: 16px 20px 10px; border-bottom: 1px solid var(--border-soft); max-height: 55%; overflow-y: auto; }
.msg-subject-row { display: flex; align-items: flex-start; gap: 8px; }
.msg-subject { flex: 1; font-size: 20px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.msg-subject .imp { color: var(--flag); margin-right: 4px; }
.msg-meta { display: flex; align-items: flex-start; gap: 12px; margin-top: 12px; }
.msg-people { flex: 1; min-width: 0; font-size: 13px; color: var(--text-2); }
.from-line { font-size: 15px; color: var(--text); }
.from-line .addr { color: var(--text-2); font-size: 13px; margin-left: 4px; overflow-wrap: anywhere; }
.person { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; }
.person:hover { text-decoration: underline; color: var(--brand-text); }
.person.strong { font-weight: 600; }
.to { overflow-wrap: anywhere; }
.msg-people .date { margin-top: 2px; }
.acct-chip { display: inline-flex; align-items: center; gap: 5px; }
.msg-actions { display: flex; gap: 2px; flex: none; }
.msg-actions .i { color: var(--brand-text); }
.msg-body { flex: 1; width: 100%; min-height: 0; border: 0; display: block; background: var(--bg); }
:root[data-theme="light"] .msg-body { background: #fff; }
.msg-toolbar { align-items: center; gap: 2px; padding: 4px; border-bottom: 1px solid var(--border-soft); flex: none; }
.attachments { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.att {
  display: flex; align-items: center; gap: 4px; max-width: 280px; min-height: 40px; padding: 2px 4px 2px 2px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--bg); position: relative; overflow: hidden;
}
.att-main { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 6px; border: 0; background: none; cursor: pointer; text-align: left; border-radius: 4px; }
.att-main:hover { background: var(--hover); }
.att .i { color: var(--brand-text); }
.att-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--text); text-decoration: none; }
.att small { color: var(--text-2); white-space: nowrap; font-size: 11px; }
.att.failed { border-color: var(--danger); }
.att .progress { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--brand); transition: width .2s; }
.thread { margin-top: 8px; font-size: 13px; }
.thread ul { list-style: none; margin: 4px 0 0; padding: 0; }
.thread-item { display: flex; align-items: center; gap: 6px; width: 100%; padding: 4px 6px; border: 0; background: none; cursor: pointer; border-radius: 4px; text-align: left; color: var(--text-2); }
.thread-item:hover { background: var(--hover); }
.thread-item.unread { font-weight: 600; color: var(--text); }
.thread-item .i { width: 14px; height: 14px; }
.print-frame { position: fixed; right: 0; bottom: 0; width: 0; height: 0; border: 0; }

.preview-back { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .75); display: flex; flex-direction: column; }
.preview-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; color: #fff; }
.preview-body { flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 16px 16px; }
.preview-body img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; box-shadow: var(--shadow); }
.preview-body iframe { width: min(1000px, 100%); height: 100%; border: 0; background: #fff; border-radius: 4px; }

/* ── Verfassen ─────────────────────────────────────────────────────── */
.compose { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
.compose-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border-soft); flex: none; }
.compose-bar .status { font-size: 12px; color: var(--text-2); text-align: right; padding-right: 4px; }
.compose-bar .send { min-width: 96px; }
.compose-fields { padding: 4px 16px 0; flex: none; }
.from-field { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border-soft); }
.from-field span { min-width: 44px; color: var(--text-2); }
.from-field select { flex: 1; max-width: 520px; border-color: transparent; background: transparent; padding-left: 4px; }
.from-field select:hover { border-color: var(--border); }
.addr-row { display: flex; align-items: flex-start; }
.addr-row .addr-field { flex: 1; }
.cc-toggles { display: flex; gap: 12px; padding: 10px 0 0 12px; }
.addr-field { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border-soft); position: relative; cursor: text; }
.addr-label {
  min-width: 44px; height: 26px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--bg);
  color: var(--text); cursor: pointer; flex: none;
}
.chips { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 26px; }
.chip {
  display: inline-flex; align-items: center; gap: 2px; max-width: 100%; height: 24px; padding: 0 2px 0 10px; border-radius: 12px;
  background: var(--chip); font-size: 13px; white-space: nowrap; overflow: hidden;
}
.chip.invalid { background: var(--danger-soft); color: var(--danger); text-decoration: underline wavy; }
.chip button { width: 20px; height: 20px; border: 0; border-radius: 50%; background: none; cursor: pointer; display: grid; place-items: center; color: var(--text-2); padding: 0; }
.chip button:hover { background: rgba(0, 0, 0, .08); }
.chip button .i { width: 12px; height: 12px; }
.chips input { flex: 1; min-width: 140px; height: 26px; border: 0 !important; box-shadow: none !important; background: transparent; padding: 0 2px; }
.suggest {
  position: absolute; top: calc(100% + 2px); left: 52px; right: 0; max-width: 480px; z-index: 30; background: var(--menu);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 4px; max-height: 280px; overflow-y: auto;
}
.suggest button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: 4px; background: none; cursor: pointer; text-align: left;
}
.suggest button.active, .suggest button:hover { background: var(--hover); }
.suggest small { color: var(--text-2); }
.suggest .i { width: 16px; height: 16px; color: var(--text-2); }
.subject-input { width: 100%; height: 40px !important; border: 0 !important; border-bottom: 1px solid var(--border-soft) !important; border-radius: 0 !important; font-size: 15px; padding: 0 !important; background: transparent; box-shadow: none !important; }
.compose-attachments { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 16px 0; flex: none; }
.compose-attachments .att { padding: 4px 4px 4px 8px; gap: 6px; }
.editor-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 1px; padding: 6px 12px; flex: none; border-bottom: 1px solid var(--border-soft); }
.editor-toolbar select { height: 28px; font-size: 12px; padding: 0 4px; margin-right: 2px; max-width: 120px; }
.editor-toolbar select.narrow { width: 56px; }
.editor-toolbar .icon-btn { width: 30px; height: 30px; }
.editor-toolbar .i { width: 17px; height: 17px; }
.editor-wrap { flex: 1; min-height: 180px; position: relative; background: #fff; }
.editor-wrap.sig { height: 260px; flex: none; border: 1px solid var(--border); border-radius: 4px; margin-bottom: 8px; }
.editor-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.drop-hint {
  position: absolute; inset: 8px; border: 2px dashed var(--brand); border-radius: 8px; background: rgba(15, 108, 189, .08); display: flex;
  align-items: center; justify-content: center; gap: 8px; color: var(--brand-text); font-weight: 600; pointer-events: none; z-index: 2;
}
.compose.dragging .compose-fields { opacity: .6; }
.compose-tabs { display: flex; gap: 4px; padding: 4px 8px; border-top: 1px solid var(--border-soft); overflow-x: auto; flex: none; background: var(--bg-2); }
.compose-tabs .tab {
  display: flex; align-items: center; gap: 6px; max-width: 240px; height: 30px; padding: 0 4px 0 8px; border: 1px solid var(--border);
  border-radius: 4px; background: var(--bg); cursor: pointer; font-size: 12px; flex: none;
}
.compose-tabs .tab span:not(.icon-btn) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compose-tabs .tab.active { border-color: var(--brand); color: var(--brand-text); }
.compose-tabs .tab .i { width: 14px; height: 14px; }

/* ── Menüs, Dialoge, Meldungen ─────────────────────────────────────── */
.menu {
  position: fixed; z-index: 100; min-width: 220px; max-width: 320px; padding: 4px; background: var(--menu); border-radius: 8px;
  box-shadow: var(--shadow); border: 1px solid var(--border-soft); max-height: calc(100vh - 16px); overflow-y: auto;
}
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 32px; padding: 4px 10px; border: 0; border-radius: 4px;
  background: none; cursor: pointer; text-align: left; color: var(--text); font-size: 13px;
}
.menu button:hover:not(:disabled), .menu button:focus-visible { background: var(--hover); outline: none; }
.menu button:disabled { color: var(--text-2); cursor: default; }
.menu button .i { width: 16px; height: 16px; color: var(--text-2); }
.menu button.danger, .menu button.danger .i { color: var(--danger); }
.menu kbd { font-size: 11px; background: none; padding: 0; color: var(--text-3); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }

.modal-back { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .4); display: grid; place-items: center; padding: 16px; }
.modal {
  width: min(460px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--bg);
  border-radius: 10px; box-shadow: var(--shadow); overflow: hidden;
}
.modal.wide { width: min(1080px, 100%); height: min(760px, calc(100dvh - 32px)); }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 16px 16px 8px 24px; flex: none; }
.modal-head h2 { flex: 1; font-size: 18px; font-weight: 600; }
.modal-body { padding: 8px 24px 20px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.folder-pick .search-input { width: 100%; margin-bottom: 8px; }
.folder-pick-list { max-height: 55vh; overflow-y: auto; }
.pick-account { display: flex; align-items: center; gap: 8px; padding: 10px 8px 4px; font-weight: 600; font-size: 13px; }
.pick-folder { display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; border: 0; border-radius: 4px; background: none; cursor: pointer; text-align: left; }
.pick-folder:hover:not(:disabled) { background: var(--hover); }
.pick-folder:disabled { opacity: .4; }
.pick-folder .i { width: 16px; height: 16px; color: var(--text-2); }

.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 6px 6px 16px; border-radius: 8px; background: #2b2b2b; color: #fff;
  box-shadow: var(--shadow); animation: toast-in .18s ease-out;
}
.toast.error { background: #a4262c; }
.toast.clickable { cursor: pointer; }
.toast .link { color: #8cc4f5; }
.toast .icon-btn:hover { background: rgba(255, 255, 255, .15); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Einstellungen und Kontakte ────────────────────────────────────── */
.settings-body { flex: 1; min-height: 0; display: flex; }
.settings-nav { width: 200px; flex: none; padding: 8px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--border-soft); }
.settings-nav button { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border: 0; border-radius: 4px; background: none; cursor: pointer; text-align: left; }
.settings-nav button:hover { background: var(--hover); }
.settings-nav button.active { background: var(--selected); font-weight: 600; }
.settings-nav .i { width: 18px; height: 18px; color: var(--text-2); }
.settings-content { flex: 1; min-width: 0; overflow-y: auto; padding: 8px 24px 24px; }
.settings-content h3 { font-size: 15px; font-weight: 600; margin: 16px 0 8px; }
.form { max-width: 760px; }
.form-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.form-head h3 { margin: 0; }
.form-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid4 { display: grid; grid-template-columns: 2fr 90px 130px; gap: 0 12px; }
.grid4 .wide { grid-column: 1 / -1; }
.grid4 .field.wide { grid-column: auto; }
.grid4 .field.wide:last-child { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 8px 16px 4px; margin: 4px 0 12px; }
legend { font-weight: 600; padding: 0 6px; }
.colors { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.on { border-color: var(--text); box-shadow: inset 0 0 0 2px var(--bg); }
.colors input[type=color] { width: 32px; height: 26px; padding: 0 2px; }
.test-result { margin-top: 12px; padding: 8px 12px; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--border-soft); }
.test-result div { display: flex; gap: 6px; align-items: center; margin: 2px 0; }
.test-result .ok { color: var(--ok); }
.test-result .bad { color: var(--danger); }
.tab-head { display: flex; align-items: center; gap: 12px; margin: 8px 0 12px; }
.account-list { display: flex; flex-direction: column; gap: 6px; }
.bulk-input { width: 100%; font: 13px/1.5 ui-monospace, Consolas, monospace; margin-top: 4px; }
.bulk-results { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.bulk-results div { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 6px; background: var(--bg-2); font-size: 13px; }
.bulk-results .ok .i { color: var(--ok); }
.bulk-results .bad .i, .bulk-results .bad span { color: var(--danger); }
.bulk-results .skip .i { color: var(--text-3); }
.account-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: 8px; }
.split { display: flex; gap: 16px; min-height: 100%; }
.split-list { width: 220px; flex: none; display: flex; flex-direction: column; gap: 4px; }
.split-list .btn { margin-bottom: 6px; }
.split-detail { flex: 1; min-width: 0; }
.list-row { display: flex; align-items: center; gap: 8px; width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: 4px; background: none; cursor: pointer; text-align: left; }
.list-row:hover { background: var(--hover); }
.list-row.active { background: var(--selected); font-weight: 600; }
.list-row .i { width: 16px; height: 16px; color: var(--text-2); }
.sig-editor .editor-toolbar { border: 1px solid var(--border); border-bottom: 0; border-radius: 4px 4px 0 0; padding: 4px; }
.sig-editor .editor-wrap.sig { border-radius: 0 0 4px 4px; }
.session-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.session { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: 8px; }
.session .i { color: var(--text-2); }
.log-entry { align-items: flex-start; }
.log-entry.ok > .i { color: var(--ok); }
.log-entry.bad > .i { color: var(--danger); }
.log-entry > div > div + div { margin-top: 2px; }
.log-agent { word-break: break-all; font-size: 11px; }
.keys { border-collapse: collapse; margin-top: 8px; }
.keys td { padding: 6px 16px 6px 0; border-bottom: 1px solid var(--border-soft); }

.contacts { flex: 1; min-width: 0; display: flex; gap: 8px; padding: 8px 8px 8px 0; }
.contacts-list, .contact-detail { background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow-soft); display: flex; flex-direction: column; min-height: 0; }
.contacts-list { width: 360px; flex: none; }
.contact-detail { flex: 1; min-width: 0; overflow-y: auto; padding: 16px 24px; }
.contacts-tools { display: flex; gap: 8px; padding: 12px 12px 4px; }
.contacts-tools.small { justify-content: space-between; padding-top: 4px; font-size: 13px; }
.contacts-tools .search-input { flex: 1; }
.contacts-tools label.link { cursor: pointer; }
.contacts-tools .i { width: 16px; height: 16px; }
.contacts-items { flex: 1; overflow-y: auto; padding: 4px; }
.contact-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 6px; background: none; cursor: pointer; text-align: left; }
.contact-row:hover { background: var(--hover); }
.contact-row.active { background: var(--selected); }
.contact-row small { display: block; color: var(--text-2); }
.contact-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.contact-head h2 { font-size: 20px; font-weight: 600; }

/* ── Mittlere Breiten ──────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .cmd.optional span, .cmd span { display: none; }
  .sidebar { width: 220px; }
  .list { width: 340px; }
  .brand { width: auto; }
  .brand span { display: none; }
}
@media (max-width: 1000px) and (min-width: 761px) {
  .sidebar, .sidebar.hidden {
    display: block; position: absolute; left: 0; top: 0; bottom: 0; z-index: 10; width: 260px; background: var(--app); box-shadow: var(--shadow);
    padding: 8px 4px; border-radius: var(--radius); transform: translateX(-110%); visibility: hidden; transition: transform .2s, visibility .2s;
  }
  .shell.drawer .sidebar { transform: none; visibility: visible; }
  .shell.drawer .scrim { display: block; position: absolute; inset: 0; z-index: 9; }
  .list { width: 320px; }
}

/* ── Handy ─────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .only-sm { display: inline-grid !important; }
  .only-sm-flex { display: flex !important; }
  .only-sm-block { display: flex !important; }
  .hide-sm { display: none !important; }
  .topbar { height: calc(48px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); }
  .topbar > .icon-btn:first-child { display: none; }
  .search { display: none; position: absolute; left: 8px; right: 8px; top: calc(7px + env(safe-area-inset-top)); z-index: 6; max-width: none; }
  .search.open { display: flex; }
  .search select { display: none; }
  .rail, .commandbar { display: none; }
  .mail { padding: 0; gap: 0; }
  .panes { gap: 0; }
  .list, .reading { border-radius: 0; box-shadow: none; }
  .list { width: 100%; }
  .reading { display: none; }
  .shell.is-reading .list { display: none; }
  .shell.is-reading .reading { display: flex; }
  .sidebar, .sidebar.hidden {
    display: block; position: fixed; left: 0; top: 0; bottom: 0; width: min(320px, 86vw); z-index: 40; background: var(--app);
    padding: calc(8px + env(safe-area-inset-top)) 4px 24px; transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow);
  }
  .shell.drawer .sidebar { transform: none; }
  .shell.drawer .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .35); }
  .nav-item, .account-name { min-height: 40px; }
  .item { padding: 10px 12px 10px 14px; }
  .item-lead { width: 40px; height: 40px; }
  .item-lead .avatar { width: 40px; height: 40px; font-size: 14px; }
  .item-check { inset: 11px; }
  .msg-head { padding: 12px 14px 8px; max-height: 50%; }
  .msg-subject { font-size: 18px; }
  .msg-actions .icon-btn { width: 36px; height: 36px; }
  .compose-bar { padding: calc(6px + env(safe-area-inset-top)) 8px 6px; }
  .compose-fields { padding: 0 12px; }
  .editor-toolbar { flex-wrap: nowrap; overflow-x: auto; padding: 4px 8px; }
  .editor-toolbar select { display: none; }
  .modal.wide { height: 100dvh; max-height: none; border-radius: 0; }
  .modal-back:has(.modal.wide) { padding: 0; }
  .settings-body { flex-direction: column; }
  .settings-nav { width: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border-soft); }
  .settings-nav button span { white-space: nowrap; }
  .settings-content { padding: 8px 14px 24px; }
  .grid2, .grid4 { grid-template-columns: 1fr; }
  .grid4 .field.wide { grid-column: auto; }
  .split { flex-direction: column; }
  .split-list { width: auto; }
  .contacts { padding: 0; flex-direction: column; }
  .contacts-list { width: auto; flex: 1; border-radius: 0; }
  .contact-detail { border-radius: 0; }
  .contacts:has(.contact-detail form) .contacts-list { display: none; }
  .contacts:not(:has(.contact-detail form)) .contact-detail { display: none; }
  .toasts { bottom: calc(88px + env(safe-area-inset-bottom)); }
  .preview-body { padding: 0; }
  input, select, textarea { font-size: 16px !important; } /* iOS zoomt sonst beim Fokus */
}
