:root {
  --bg: #f6f6f4;
  --card: #ffffff;
  --text: #1c1c1a;
  --muted: #6b6b66;
  --line: #e3e3de;
  --accent: #2f5bd3;
  --out: #eef3ff;
  --error: #b42318;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514;
    --card: #1f1f1d;
    --text: #ececea;
    --muted: #a0a09a;
    --line: #34342f;
    --accent: #8aa8ff;
    --out: #1d2640;
    --error: #ff8a80;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
[hidden] { display: none !important; }
.bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--card);
}
.brand { font-weight: 600; }
.who { flex: 1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { max-width: 760px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 0 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.narrow { max-width: 400px; margin: 40px auto; }
label { display: block; font-size: 14px; color: var(--muted); margin: 0 0 4px; }
input, select {
  width: 100%; padding: 10px 12px; font: inherit; color: inherit;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px;
}
button {
  font: inherit; padding: 10px 16px; border-radius: 8px; border: 0;
  background: var(--accent); color: #fff; cursor: pointer;
}
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--line); }
button.link { background: none; color: var(--accent); padding: 4px 0; margin-left: 12px; }
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--error); font-size: 14px; min-height: 1em; }
.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { background: none; color: var(--muted); border-radius: 0; padding: 10px 12px; border-bottom: 2px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.filters { display: flex; gap: 8px; }
.filters select { flex: 1; }
.timeline, .plain { list-style: none; margin: 0; padding: 0; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.item.outbound { background: var(--out); }
.meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.meta .dir { color: var(--text); font-weight: 600; }
.subject { font-weight: 600; margin-bottom: 4px; }
.body { white-space: pre-wrap; overflow-wrap: anywhere; }
.body.clipped { max-height: 9em; overflow: hidden; }
.more { margin: 6px 0 0; padding: 0; background: none; color: var(--accent); font-size: 14px; }
.status-bad { color: var(--error); }
.plain li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.cards { display: grid; gap: 12px; margin-bottom: 12px; }
#older { display: block; margin: 8px auto 24px; }
