:root {
  --bg: #f4f5f3;
  --surface: #ffffff;
  --ink: #1c2321;
  --muted: #6b746f;
  --line: #e2e5e1;
  --brand: #2f6b4f;
  --brand-ink: #ffffff;
  --new: #b5502e;
  --new-bg: #fbe9e1;
  --read-bg: #eef1ee;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}
.wrap { max-width: 880px; margin: 0 auto; padding: 24px 16px 64px; }
header.top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 8px;
}
header.top h1 { font-size: 1.25rem; margin: 0; }
header.top a.logout { color: var(--muted); font-size: 0.9rem; text-decoration: none; }
header.top a.logout:hover { text-decoration: underline; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.login-card { max-width: 360px; margin: 12vh auto; }
.login-card h1 { font-size: 1.1rem; margin: 0 0 16px; }
label { display: block; font-size: 0.85rem; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=password] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 1rem; background: var(--bg);
}
input[type=text]:focus, input[type=password]:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
button, .btn {
  background: var(--brand); color: var(--brand-ink); border: none;
  border-radius: 8px; padding: 10px 16px; font-size: 0.95rem; cursor: pointer;
  text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { opacity: 0.9; }
button.secondary, .btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
button.danger { background: var(--new); }
.error { color: var(--new); font-size: 0.9rem; margin-top: 10px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.entry {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 18px; text-decoration: none; color: inherit;
}
.entry:hover { border-color: var(--brand); }
.entry .row1 { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.entry .name { font-weight: 600; }
.entry .date { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.entry .subject { color: var(--muted); font-size: 0.92rem; margin-top: 2px; }
.badge {
  display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 2px 8px;
  border-radius: 999px; text-transform: uppercase; letter-spacing: 0.02em;
}
.badge.neu { background: var(--new-bg); color: var(--new); }
.badge.gelesen { background: var(--read-bg); color: var(--muted); }
.badge.archiviert { background: var(--read-bg); color: var(--muted); }

.empty { color: var(--muted); padding: 40px 0; text-align: center; }

table.fields { width: 100%; border-collapse: collapse; margin: 16px 0; }
table.fields td { padding: 6px 0; vertical-align: top; border-bottom: 1px solid var(--line); }
table.fields td.label { color: var(--muted); width: 40%; padding-right: 12px; }
.message-box {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; white-space: pre-wrap; word-break: break-word; margin-top: 8px;
}
.actions { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.back { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.back:hover { text-decoration: underline; }
.meta { color: var(--muted); font-size: 0.85rem; }
