:root {
  --bg: #ececec;
  --surface: #ffffff;
  --text: #080808;
  --muted: #7a7a7a;
  --border: #e1e2e2;
  --accent: #000000;
  --accent-text: #ffffff;
  --ok-bg: #e5f4ea;
  --ok-text: #1d6b39;
  --warn-bg: #fdf1dc;
  --warn-text: #8a5300;
  --error-bg: #fbe5e5;
  --error-text: #a12626;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 600; text-decoration: none; color: var(--text); }
.who { display: flex; align-items: center; gap: 12px; }
.who form { margin: 0; }

.devbanner {
  padding: 6px 24px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 13px;
}

main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }

h1 { font-size: 24px; margin: 8px 0 12px; }
h2 { font-size: 16px; margin: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0px;
  padding: 20px;
  margin-bottom: 16px;
}
.card.narrow { max-width: 480px; margin: 40px auto; }

.muted { color: var(--muted); }
.small { font-size: 13px; }

.stack { display: flex; flex-direction: column; gap: 10px; margin: 16px 0 0; align-items: flex-start; }

button, .button {
  display: inline-block;
  font: inherit;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 0px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}
button.primary, .button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.buttonrow { display: flex; flex-wrap: wrap; gap: 8px; }
.linkbutton { border: none; padding: 0; background: none; color: var(--accent); }

input[type="search"], select {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 0px;
  background: var(--surface);
  color: var(--text);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.filters .grow { flex: 1 1 220px; }
.filters .grow input { width: 100%; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 15px; }
.filters label.check { font-size: 13px; padding-bottom: 8px; }

table.drafts {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0px;
}
.drafts th, .drafts td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.drafts th { font-size: 13px; color: var(--muted); font-weight: 600; }

.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 0px;
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge.warn, .badge.basis-none { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.badge.draft { background: var(--bg); }
.badge.status-open { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }

.notice { padding: 10px 14px; border-radius: 0px; background: var(--bg); }
.notice.ok { background: var(--ok-bg); color: var(--ok-text); }
.notice.warn { background: var(--warn-bg); color: var(--warn-text); }
.notice.error { background: var(--error-bg); color: var(--error-text); }

.field { padding: 12px 0; border-bottom: 1px solid var(--border); }
.field:first-child { padding-top: 0; }
.field-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.value { margin: 0; overflow-wrap: anywhere; font-weight: 500; }
.mailtext {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  background: var(--bg);
  border-radius: 0px;
  padding: 12px;
}
.actions { padding-top: 16px; }

.copy-status { min-height: 1.5em; margin: 0 0 8px; }
.copy-status.ok { color: var(--ok-text); }
.copy-status.error { color: var(--error-text); }

dl.meta { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 0 0; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; overflow-wrap: anywhere; }

.empty { color: var(--muted); padding: 24px 0; }

@media (max-width: 720px) {
  .topbar { padding: 12px 16px; }
  table.drafts, .drafts tbody, .drafts tr, .drafts td { display: block; width: 100%; }
  .drafts thead { display: none; }
  .drafts tr { border-bottom: 1px solid var(--border); padding: 8px 0; }
  .drafts td { border: none; padding: 4px 12px; }
  .drafts td::before { content: attr(data-label) ": "; color: var(--muted); font-size: 13px; }
  dl.meta { grid-template-columns: 1fr; }
  dl.meta dd { margin-bottom: 8px; }
}

/* Bearbeiten, Reiter, Status */
input[type="email"], input[type="password"], input:not([type]), input[inputmode], textarea {
  font: inherit;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 0px;
  background: var(--surface);
  color: var(--text);
}
textarea { resize: vertical; min-height: 12em; }
.stack > label:not(.check) { font-size: 13px; color: var(--muted); margin-bottom: -6px; }
fieldset { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
legend { margin-bottom: 6px; }
.notice.sender { font-size: 16px; }
.button.disabled { opacity: 0.5; cursor: not-allowed; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.who a { font-size: 14px; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.badge.status-sent, .badge.status-synced { background: var(--bg); }
.badge.status-replied { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.badge.status-sync_failed { background: var(--error-bg); color: var(--error-text); border-color: transparent; }
