:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #d9dde3;
  --text: #1b2027;
  --muted: #626b78;
  --accent: #2f6f4f;
  --accent-text: #ffffff;
  --ok-bg: #e6f4ec;
  --ok-text: #1c5c3b;
  --ok-border: #a8d5bd;
  --warn-bg: #fdf3e3;
  --warn-text: #7a5312;
  --warn-border: #e8cf9e;
  --bad-bg: #fbe9e9;
  --bad-text: #8c2b2b;
  --bad-border: #e6b3b3;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171b;
    --surface: #1c2026;
    --surface-2: #232830;
    --border: #333a44;
    --text: #e6e9ee;
    --muted: #98a2b0;
    --accent: #4c9e75;
    --accent-text: #0f1417;
    --ok-bg: #17301f;
    --ok-text: #8fd8ae;
    --ok-border: #2c5a3d;
    --warn-bg: #33280f;
    --warn-text: #e8c583;
    --warn-border: #5f4a1c;
    --bad-bg: #331a1a;
    --bad-text: #f0a3a3;
    --bad-border: #63302f;
  }
}

* { box-sizing: border-box; }

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

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

.wrap { max-width: 940px; margin: 0 auto; padding: 0 20px 64px; }

header.top {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
header.top .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
  flex-wrap: wrap;
}
header.top h1 { font-size: 17px; margin: 0; letter-spacing: -0.01em; }
header.top nav { display: flex; gap: 14px; margin-left: auto; align-items: center; font-size: 14px; }
header.top .who { color: var(--muted); font-size: 14px; }

h2 { font-size: 20px; margin: 28px 0 12px; }
h3 { font-size: 15px; margin: 0 0 6px; }
p.lead { color: var(--muted); margin-top: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
}

.card.charge.ok { border-left: 4px solid var(--ok-border); }
.card.charge.warn { border-left: 4px solid var(--warn-border); }
.card.charge.bad { border-left: 4px solid var(--bad-border); }

/* Beide Beträge stehen bewusst gross und nebeneinander: die Abweichung soll
   auffallen, ohne dass jemand rechnen muss. */
dl.facts.amounts { grid-template-columns: max-content max-content; margin-top: 12px; }
.amount {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}
dl.facts.amounts dd.amount { font-size: 16px; }
dd.amount.bad { color: var(--bad-text); }

.hid { color: var(--muted); font-weight: 400; font-size: 15px; }

.payment {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px 14px;
  margin-top: 12px;
}
.payment .purpose { background: var(--surface); }
form.release, form.report { margin-top: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
form.release .hint, form.report .hint { margin: 0; flex: 1 1 240px; }
.blocked-hint { color: var(--warn-text); margin-top: 10px; }

pre.mailbody {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 14px 0;
}
a.btn { display: inline-block; text-decoration: none; margin-right: 8px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

.row { display: flex; gap: 16px; flex-wrap: wrap; align-items: baseline; }
.row .grow { flex: 1 1 260px; min-width: 0; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 10px 0 0; font-size: 14px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }

.purpose {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  overflow-wrap: anywhere;
  margin: 10px 0 0;
}

.badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 0; }
.badge {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }
.badge.warn { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-border); }
.badge.bad { background: var(--bad-bg); color: var(--bad-text); border-color: var(--bad-border); }

.note {
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 0 0 16px;
  font-size: 14.5px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.note.success { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }
.note.error { background: var(--bad-bg); color: var(--bad-text); border-color: var(--bad-border); }
.note.warn { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-border); }
.note strong { display: block; margin-bottom: 2px; }

.tabs { display: flex; gap: 8px; margin: 0 0 18px; flex-wrap: wrap; }
.tabs a {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
}
.tabs a.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }

.item-link { text-decoration: none; color: inherit; display: block; }
.item-link:hover .card { border-color: var(--accent); }

button, .btn {
  font: inherit;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
}
button.secondary, .btn.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
button.linklike {
  background: none; border: none; color: var(--muted);
  padding: 0; font-weight: 400; text-decoration: underline; font-size: 14px;
}
button[disabled] { opacity: .5; cursor: not-allowed; }

label { display: block; font-size: 14px; font-weight: 600; margin: 14px 0 4px; }
input[type=text], input[type=password], textarea, .search input {
  width: 100%;
  font: inherit;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}
textarea { min-height: 74px; resize: vertical; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

details.confirm { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
details.confirm > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--accent);
  list-style: none;
}
details.confirm > summary::-webkit-details-marker { display: none; }
details.confirm > summary::before { content: "▸ "; }
details.confirm[open] > summary::before { content: "▾ "; }

.search { display: flex; gap: 8px; margin: 0 0 16px; }
.search input { flex: 1; }

/* Kontenverwaltung: jede Aktion ein eigenes Formular, damit ein Klick nie mehr
   tut als das, was auf dem Knopf steht. Sie stehen deshalb nebeneinander statt
   in einem gemeinsamen Formular. */
.card.account .badges { margin-top: 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.actions form { margin: 0; }
form.inline-edit { margin-top: 10px; }
form.inline-edit button { margin-top: 12px; }

table.audit { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.audit th, table.audit td {
  text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top;
}
table.audit th { color: var(--muted); font-weight: 600; }
table.audit td.detail { color: var(--muted); overflow-wrap: anywhere; max-width: 380px; }

.empty { color: var(--muted); text-align: center; padding: 40px 0; }
.login { max-width: 380px; margin: 80px auto; }
footer.foot { color: var(--muted); font-size: 13px; text-align: center; padding: 28px 0 0; }
