/* Verteiler-Mail — Designsystem aus dem abgestimmten Entwurf:
   Papierton-Grund, Tintenblau, Briefblau-Akzent, Ampelfarben nur für Status.
   Fonts: Zilla Slab (Titel) + Source Sans 3 (UI). */

:root {
  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --surface2: #F2F2EC;
  --ink: #1E2A38;
  --muted: #5C6875;
  --line: #E2E1D9;
  --line2: #EEEDE7;
  --accent: #2B5DB8;
  --accent-ink: #24509E;
  --accent-soft: #E9EEF9;
  --accent-border: #C9D4E8;
  --ok: #2E7D4F;
  --ok-soft: #E4F1E9;
  --warn: #9A6A12;
  --warn-soft: #F6EDD8;
  --red: #C23B3B;
  --red-soft: #F8E4E4;
  --shadow: 0 1px 3px rgba(30, 42, 56, .06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  font-size: 15.5px;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }
code {
  font-family: ui-monospace, monospace; font-size: .85em;
  background: var(--surface2); border: 1px solid var(--line); border-radius: 4px; padding: .05em .35em;
}
h1 { font-family: "Zilla Slab", Georgia, serif; font-size: 26px; font-weight: 600; }

.app { min-height: 100vh; display: flex; flex-direction: column; }
.wrap { display: flex; flex: 1; min-height: 0; }

/* ---- Kopfzeile ---- */
.tb {
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.tbl { display: flex; align-items: center; gap: 14px; }
.brand { font-family: "Zilla Slab", Georgia, serif; font-weight: 700; font-size: 19px; color: var(--accent-ink); }
.tbr { display: flex; align-items: center; gap: 12px; }
.tb-user { font-size: 14px; color: var(--muted); }
.chip {
  font-size: 13px; color: var(--muted); background: var(--surface2);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px;
}
.av {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
/* Verwaltung: dunkle Kopfzeile als klares Signal */
.tb-dark { background: var(--ink); border-bottom-color: var(--ink); }
.tb-dark .brand { color: #E6EAF0; }
.chip-dark { color: #F6EDD8; background: #2E3E52; border-color: #43536A; font-weight: 700; }
.tb-user-dark { color: #97A2B0; }
.av-dark { background: #7FA6E9; color: var(--ink); }
.linkbtn { background: none; border: 0; color: var(--muted); font: inherit; font-size: 13.5px; cursor: pointer; }
.linkbtn:hover { color: var(--accent-ink); text-decoration: underline; }
.linkbtn-dark { color: #97A2B0; }

.impersonate-banner {
  background: var(--warn-soft); color: var(--warn); font-size: 13.5px; font-weight: 600;
  padding: 8px 24px; border-bottom: 1px solid var(--line);
}

/* ---- Seitenleiste ---- */
.side {
  width: 224px; flex-shrink: 0; background: var(--surface2); border-right: 1px solid var(--line);
  padding: 16px 0; display: flex; flex-direction: column; gap: 2px;
}
.nav {
  display: flex; align-items: center; height: 40px; padding: 0 20px;
  font-size: 14.5px; color: var(--muted); border-left: 3px solid transparent;
}
.nav:hover { color: var(--accent-ink); text-decoration: none; }
.nav.on {
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 600;
  border-left-color: var(--accent);
}

/* ---- Inhalt ---- */
.main { flex: 1; min-width: 0; padding: 28px 32px 64px; display: flex; flex-direction: column; gap: 20px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sub { font-size: 14px; color: var(--muted); margin-top: 4px; max-width: 72ch; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.empty { padding: 20px; font-size: 14.5px; color: var(--muted); }

.flash { border-radius: 10px; padding: 12px 16px; font-size: 14.5px; font-weight: 600; }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--red-soft); color: var(--red); }

.kpis { display: flex; gap: 16px; flex-wrap: wrap; }
.kpi {
  flex: 1; min-width: 150px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px 20px; box-shadow: var(--shadow);
}
.kpi b { display: block; font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 13px; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.card.pad { padding: 20px; }
.chead { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.ctitle { font-family: "Zilla Slab", Georgia, serif; font-size: 17px; font-weight: 600; }
.clink { font-size: 13px; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
@media (max-width: 980px) { .grid2 { grid-template-columns: 1fr; } .side { width: 64px; } .nav { padding: 0 10px; font-size: 12px; } }

.row { display: flex; align-items: center; gap: 10px; padding: 13px 20px; border-bottom: 1px solid var(--line2); }
.row:last-child { border-bottom: 0; }
.row.nopad { padding-left: 0; padding-right: 0; }
.grow { flex: 1; min-width: 0; }
.rname { font-weight: 600; font-size: 14.5px; }
.rsub { display: block; font-size: 13px; color: var(--muted); font-weight: 400; }

/* ---- Tabellen ---- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: 12px 20px; border-bottom: 2px solid var(--line); background: #F7F7F2;
}
.tbl td { padding: 11px 20px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.ta-r { text-align: right; white-space: nowrap; }

/* ---- Pills & Chips ---- */
.pill {
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 700;
  border-radius: 999px; padding: 2px 10px; white-space: nowrap;
}
.pok { background: var(--ok-soft); color: var(--ok); }
.pwarn { background: var(--warn-soft); color: var(--warn); }
.pred { background: var(--red-soft); color: var(--red); }
.pacc { background: var(--accent-soft); color: var(--accent-ink); }
.pmut { background: var(--surface2); color: var(--muted); border: 1px solid var(--line); }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fchip {
  display: inline-flex; align-items: center; height: 30px; padding: 0 14px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); background: var(--surface);
}
.fchip:hover { text-decoration: none; color: var(--accent-ink); }
.fchip.on { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); }
.searchform { display: flex; gap: 8px; }
.searchform input[type="search"] { width: 260px; }

/* ---- Buttons ---- */
.btnp, .btng {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px;
  border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; border: 0; font-family: inherit;
  white-space: nowrap;
}
.btnp { background: var(--accent); color: #fff; }
.btnp:hover { background: var(--accent-ink); color: #fff; text-decoration: none; }
.btng { border: 1px solid var(--accent-border); color: var(--accent-ink); background: var(--surface); }
.btng:hover { background: var(--accent-soft); text-decoration: none; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-danger { color: var(--red); border-color: #E5C4C4; }
.btn-danger:hover { background: var(--red-soft); }
.btnrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline { display: inline; }

/* ---- Formulare ---- */
.stack { display: flex; flex-direction: column; gap: 14px; }
.formrow { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.formrow label { flex: 1; min-width: 160px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="url"], input[type="search"], input[type="datetime-local"], input[type="file"], select, textarea {
  font: inherit; font-weight: 400; color: var(--ink); background: var(--surface);
  border: 1px solid var(--accent-border); border-radius: 8px; padding: 8px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; font-family: inherit; }
.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; font-size: 13.5px; color: var(--muted); }
.check input { width: auto; margin-top: 3px; }
.mt6 { margin-top: 6px; }

.optlist { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px;
  border: 1px solid var(--line); border-radius: 10px; font-weight: 400; cursor: pointer;
}
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opt input { width: auto; margin-top: 3px; }
.opt b { font-size: 14.5px; }

.note {
  display: flex; gap: 10px; padding: 13px 16px; background: var(--accent-soft);
  border-radius: 10px; font-size: 14px; color: var(--accent-ink); line-height: 1.5;
}

.tabbar { display: flex; gap: 6px; }
.tab {
  height: 32px; padding: 0 16px; border-radius: 8px; font: inherit; font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface2); color: var(--muted); cursor: pointer;
}
.tab.on { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); }

/* ---- Auth-Seiten ---- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-card {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 32px; display: flex; flex-direction: column; gap: 16px;
}
.auth-brand { font-size: 22px; }
.auth-h1 { font-size: 22px; }
.auth-sub { font-size: 14px; color: var(--muted); line-height: 1.55; }
.auth-link { font-size: 13.5px; align-self: flex-start; }
