/* Team-Mail – Webmail von Leitwerk. Dunkel wie das Leitwerk-Panel, nur System-Schriften (strenge CSP).
   Maße wie im Panel: Abstände 4 · 8 · 12 · 16 · 24, Knopf 32 px, klein 26 px, Feld 32 px. */

:root {
  --bg: #0d1017;
  --bg-2: #121621;
  --panel: #151a25;
  --panel-2: #1a2030;
  --fg: #e8ebf2;
  --fg-2: #b4bacb;
  --muted: #7f879b;
  --line: #242b3b;
  --line-2: #2f3749;
  --accent: #7b8aff;
  --accent-soft: #232a4a;
  --ok: #3ccf8a;
  --warn: #f0b451;
  --warn-soft: #33270f;
  --bad: #ff7b6e;
  --bad-soft: #3a1a17;
  --side: #0a0c12;
  --side-hover: #141925;
  --side-active: #1c2335;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 13.5px/1.45 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- Knöpfe & Felder */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid transparent; border-radius: 8px; background: var(--accent); color: #0b0e1a;
  font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: var(--panel); border-color: var(--line-2); color: var(--fg); font-weight: 500; }
.btn.ghost:hover { background: var(--panel-2); filter: none; }
.btn.danger { background: var(--bad); color: #1a0806; }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn svg { flex: none; }
input, textarea, select {
  height: 32px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg-2); outline: none;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.field { display: grid; gap: 4px; font-size: 12px; color: var(--fg-2); }
.error { color: var(--bad); font-size: 12.5px; min-height: 18px; }
.note { padding: 8px 12px; border-radius: 8px; font-size: 12.5px; background: var(--warn-soft); color: var(--warn); display: flex; align-items: center; gap: 10px; }
.note.bad { background: var(--bad-soft); color: var(--bad); }

/* ---------------------------------------------------------------- Anmeldung */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login { width: min(380px, 100%); display: grid; gap: 12px; padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.login h1 { font-size: 18px; }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #5b6cff, #8a5cff); display: grid; place-items: center; color: #fff; }
.brand-name { font-weight: 700; }
.brand-sub { font-size: 11.5px; color: var(--muted); }

/* ---------------------------------------------------------------- Rahmen: Ordner | Liste | Lesen */
.shell { display: grid; grid-template-columns: 220px minmax(300px, 400px) 1fr; height: 100vh; }
.side { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side .brand { padding: 14px 14px 10px; }
.side .compose { margin: 0 12px 10px; justify-content: center; }
.folders { flex: 1; overflow: auto; padding: 0 8px; scrollbar-width: none; }
.folder {
  width: 100%; display: flex; align-items: center; gap: 9px; height: 32px; padding: 0 10px; border: 0; border-radius: 8px;
  background: none; color: var(--fg-2); cursor: pointer; text-align: left;
}
.folder:hover { background: var(--side-hover); color: var(--fg); }
.folder.on { background: var(--side-active); color: var(--fg); font-weight: 600; }
.folder .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder .count { font-size: 11px; background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 0 7px; line-height: 18px; }
.side-foot { border-top: 1px solid var(--line); padding: 10px 12px; display: grid; gap: 6px; }
.side-foot .who { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .row { display: flex; gap: 6px; }

.list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.list-head { padding: 12px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.list-head h2 { font-size: 15px; display: flex; align-items: center; justify-content: space-between; }
.search { display: flex; gap: 6px; }
.search input { flex: 1; min-width: 0; }
.items { flex: 1; overflow: auto; }
.item {
  display: grid; gap: 2px; width: 100%; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line);
  background: none; text-align: left; cursor: pointer; color: var(--fg-2);
}
.item:hover { background: var(--panel); }
.item.on { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--accent); }
.item.unread { color: var(--fg); }
.item.unread .who, .item.unread .subj { font-weight: 650; }
.item .top { display: flex; gap: 8px; align-items: baseline; }
.item .who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .when { font-size: 11.5px; color: var(--muted); flex: none; }
.item .subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.item .subj span { overflow: hidden; text-overflow: ellipsis; }
.item .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }

.read { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg-2); }
.read-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg); }
.read-bar .spacer { flex: 1; }
.read-head { padding: 16px 20px 12px; display: grid; gap: 6px; border-bottom: 1px solid var(--line); }
.read-head h1 { font-size: 18px; line-height: 1.3; word-break: break-word; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 12.5px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; color: var(--fg-2); word-break: break-word; }
.atts { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.att { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px; color: var(--fg); text-decoration: none; font-size: 12.5px; background: var(--panel); }
.att:hover { border-color: var(--accent); }
.att .size { color: var(--muted); }
.read-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.read-body .note { margin: 10px 20px 0; }
.mailframe { flex: 1; width: 100%; min-height: 300px; border: 0; background: #fff; margin-top: 10px; }
.mailtext { flex: 1; overflow: auto; margin: 0; padding: 16px 20px 24px; white-space: pre-wrap; word-break: break-word; font: 13.5px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--fg); }
.placeholder { flex: 1; display: grid; place-items: center; color: var(--muted); }

/* Schreiben */
.compose-form { flex: 1; min-height: 0; overflow: auto; padding: 16px 20px; display: grid; gap: 10px; align-content: start; }
.compose-form h1 { font-size: 17px; }
.compose-form .line { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 8px; }
.compose-form .line span { color: var(--muted); font-size: 12.5px; }
.compose-form textarea { min-height: 320px; font: 13.5px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace; }
.compose-form .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.compose-form .actions .spacer { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 4px 0 10px; border-radius: 13px; background: var(--panel-2); border: 1px solid var(--line-2); font-size: 12px; }
.chip button { border: 0; background: none; color: var(--muted); cursor: pointer; width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; }
.chip button:hover { background: var(--bad-soft); color: var(--bad); }
.linkish { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-size: 12.5px; }

/* Meldungszeile: fest über dem Lesebereich, kein schwebendes Fenster */
.msgline { display: flex; align-items: center; gap: 10px; padding: 8px 16px; font-size: 12.5px; border-bottom: 1px solid var(--line); background: var(--accent-soft); color: var(--fg); }
.msgline.bad { background: var(--bad-soft); color: var(--bad); }
.msgline .txt { flex: 1; }
.msgline button { border: 0; background: none; color: inherit; cursor: pointer; opacity: .7; }
.msgline button:hover { opacity: 1; }

/* Dialog (Einstellungen, Verschieben) */
.overlay { position: fixed; inset: 0; background: rgba(5, 7, 12, .6); display: grid; place-items: center; padding: 24px; z-index: 40; }
.dialog { width: min(480px, 100%); background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; padding: 18px; display: grid; gap: 12px; }
.dialog h2 { font-size: 15.5px; }
.dialog .actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Schmale Fenster: eine Spalte, zurück-Knopf */
.back { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .shell .side, .shell .list, .shell .read { display: none; }
  .shell.v-folders .side, .shell.v-list .list, .shell.v-read .read { display: flex; }
  .back { display: inline-flex; }
  .shell.v-list .list-head .back { display: inline-flex; }
}
.fields { display: grid; gap: 12px; }
