:root {
  --bg: #fff;
  --fg: #111;
  --muted: #767676;
  --line: #e6e6e6;
  --soft: #f5f5f5;
  --accent: #2f6bff;
  --danger: #c0352b;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e0e0e; --fg: #ededed; --muted: #8c8c8c; --line: #262626; --soft: #181818; --accent: #6b95ff; --danger: #ef6b60; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 17px/1.55 var(--font); letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; left: -9999px; }

.wrap { max-width: 640px; margin: 0 auto; padding: 72px 24px 96px; }
.wrap.narrow { max-width: 360px; }
.title { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; margin: 0 0 32px; }
.subtitle { font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 6px; }
.note { font-size: 14px; color: var(--muted); margin: 0 0 24px; }

/* Navigation (nur Admin) */
.nav { display: flex; gap: 28px; justify-content: center; padding: 20px 24px 0; font-size: 15px; }
.nav a { color: var(--muted); text-decoration: none; padding-bottom: 4px; border-bottom: 1px solid transparent; }
.nav a.on { color: var(--fg); border-color: var(--fg); }
.badge { font-variant-numeric: tabular-nums; color: var(--accent); margin-left: 2px; }
.nav + .wrap, .nav ~ .wrap { padding-top: 48px; }

/* Schreiben */
textarea {
  display: block; width: 100%; min-height: 34vh; resize: vertical;
  border: 0; border-bottom: 1px solid var(--line); background: transparent;
  padding: 0 0 20px; font-size: 21px; line-height: 1.5; outline: none;
}
textarea::placeholder { color: var(--muted); opacity: .7; }
textarea:focus { border-color: var(--fg); }
.row { display: flex; align-items: center; gap: 20px; margin-top: 20px; }
.count { flex: 1; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hint { font-size: 13px; color: var(--muted); margin: 14px 0 0; text-align: right; }
.status { min-height: 1.55em; margin: 16px 0 0; font-size: 15px; }
.status.ok { color: var(--fg); }
.status.check-big { font-size: 28px; line-height: 1; }
.status.err { color: var(--danger); }

.btn {
  appearance: none; border: 1px solid var(--fg); background: var(--fg); color: var(--bg);
  padding: 11px 26px; border-radius: 999px; font-size: 16px; font-weight: 500; cursor: pointer;
  transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, .link:focus-visible, .nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.link {
  appearance: none; background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--muted); font-size: 15px; text-decoration: underline; text-decoration-color: var(--line);
  text-underline-offset: 4px;
}
.link:hover { color: var(--fg); text-decoration-color: currentColor; }
.link.small { font-size: 13px; }
.link.danger { color: var(--danger); }

.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.thumbs:empty { display: none; }
.thumb { margin: 0; padding: 0; border: 0; background: none; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; cursor: pointer; }
.thumb img { width: 76px; height: 76px; object-fit: cover; border-radius: 6px; background: var(--soft); display: block; }

/* Listen */
.mine { margin-top: 88px; }
.list { list-style: none; margin: 0; padding: 0; }
.item { padding: 22px 0; border-top: 1px solid var(--line); }
.item:last-child { border-bottom: 1px solid var(--line); }
.meta { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.sender { color: var(--fg); font-weight: 500; }
.item:not(.unread) .sender { font-weight: 400; color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.body { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 14px; font-size: 14px; }
.actions .link { font-size: 14px; }
.ask { font-size: 14px; }

/* Gesendet (Absender sieht nur Haken) */
.sent-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.sent { display: flex; align-items: baseline; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.check { color: var(--fg); font-size: 15px; }

/* Posteingang */
.head { display: flex; align-items: baseline; gap: 20px; margin-bottom: 28px; }
.head .title { margin: 0; }
.spacer { flex: 1; }
.tools { display: flex; align-items: center; flex-wrap: wrap; gap: 16px 20px; margin-bottom: 20px; }
input[type="search"], .login input {
  border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 6px 0; outline: none; min-width: 0; width: 180px; font-size: 15px;
}
input[type="search"]:focus, .login input:focus { border-color: var(--fg); }
.seg { display: flex; gap: 14px; }
.seg button { background: none; border: 0; padding: 0; cursor: pointer; color: var(--muted); font-size: 15px; }
.seg button.on { color: var(--fg); }
.empty { color: var(--muted); padding: 56px 0; text-align: center; border-top: 1px solid var(--line); margin: 0; }

.login { display: flex; flex-direction: column; gap: 12px; }
.login input { width: 100%; font-size: 18px; }
.label { font-size: 13px; color: var(--muted); }
.login .btn { align-self: flex-start; }

.lightbox {
  position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 94%, transparent);
  display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; z-index: 10;
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .wrap { padding: 40px 20px 72px; }
  .title { font-size: 24px; margin-bottom: 24px; }
  textarea { font-size: 19px; min-height: 40vh; }
  .hint { display: none; }
  .row .btn { padding: 12px 30px; }
  input[type="search"] { width: 100%; }
  .tools .spacer { display: none; }
}
