:root {
  --navy: #14324f;
  --navy-2: #1d4469;
  --ink: #1d2733;
  --muted: #637083;
  --line: #e3e7ed;
  --bg: #f5f7fa;
  --card: #ffffff;
  --accent: #2563a6;
  --red: #b42318;
  --red-bg: #fdecea;
  --orange: #b54708;
  --orange-bg: #fef4e6;
  --green: #067647;
  --green-bg: #e7f6ee;
  --grey-bg: #eef1f5;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--bg);
  display: grid; grid-template-columns: 220px 1fr; min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navigation */
.nav { background: var(--navy); color: #cfdbe8; padding: 20px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav .brand { color: #fff; font-weight: 700; font-size: 16px; padding: 4px 10px 2px; }
.nav .brand-sub { font-size: 12px; color: #93a9c1; padding: 0 10px 18px; }
.nav a { color: #cfdbe8; padding: 8px 10px; border-radius: 6px; display: block; }
.nav a:hover { background: var(--navy-2); color: #fff; text-decoration: none; }
.nav a.aktiv { background: var(--navy-2); color: #fff; font-weight: 600; }
.nav .spacer { flex: 1; }
.nav .user { font-size: 12px; color: #93a9c1; padding: 8px 10px; }
.nav form button { all: unset; cursor: pointer; color: #cfdbe8; padding: 8px 10px; display: block; border-radius: 6px; }
.nav form button:hover { background: var(--navy-2); color: #fff; }

main { padding: 28px 36px 48px; max-width: 1280px; width: 100%; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 22px; }
.kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.kopf .aktionen { display: flex; gap: 8px; flex-wrap: wrap; }

/* Karten & Raster */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.kpi .zahl { font-size: 26px; font-weight: 700; }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi.rot .zahl { color: var(--red); }
.leer { color: var(--muted); font-style: italic; padding: 6px 0; }

/* Tabellen */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
     border-bottom: 1px solid var(--line); padding: 8px 8px; }
td { border-bottom: 1px solid var(--line); padding: 9px 8px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td.nowrap, th.nowrap { white-space: nowrap; }
td.rechts { text-align: right; }
.klein { font-size: 12px; color: var(--muted); }

/* Status */
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--grey-bg); color: var(--muted); }
.pill.rot { background: var(--red-bg); color: var(--red); }
.pill.orange { background: var(--orange-bg); color: var(--orange); }
.pill.gruen { background: var(--green-bg); color: var(--green); }
.pill.blau { background: #e8f0fa; color: var(--accent); }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); margin-right: 4px; }

/* Buttons & Formulare */
.btn, button.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--grey-bg); text-decoration: none; }
.btn.primaer { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primaer:hover { background: #1d528c; }
.btn.klein { padding: 3px 9px; font-size: 12px; }
form.inline { display: inline; }
.filter { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filter label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 3px; }
input[type=text], input[type=email], input[type=url], input[type=date], input[type=number], input[type=password], input[type=search], select, textarea {
  font: inherit; padding: 7px 9px; border: 1px solid #cfd6df; border-radius: 6px; background: #fff; width: 100%; color: var(--ink); }
.filter select, .filter input { width: auto; min-width: 140px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bcd3ee; border-color: var(--accent); }
.formgruppe { margin-bottom: 22px; }
.formgruppe h2 { border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.felder { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 18px; }
.feld label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.feld.check { display: flex; align-items: center; gap: 8px; padding-top: 18px; }
.feld.check label { margin: 0; font-size: 14px; color: var(--ink); }
.feld.check input { width: auto; }
.feld .hilfe { font-size: 11px; color: var(--muted); }
.fehler { color: var(--red); font-size: 12px; }
.fehlerliste { background: var(--red-bg); color: var(--red); padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }

/* Meldungen */
.meldung { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; background: var(--green-bg); color: var(--green); }
.meldung.error { background: var(--red-bg); color: var(--red); }

/* Reiter */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.aktiv { color: var(--ink); border-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--ink); }

/* Stammdaten */
dl.daten { display: grid; grid-template-columns: 200px 1fr; gap: 6px 16px; margin: 0; }
dl.daten dt { color: var(--muted); }
dl.daten dd { margin: 0; }

/* Belegmatrix */
.matrix td, .matrix th { text-align: center; padding: 6px 4px; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix button { all: unset; cursor: pointer; display: inline-block; width: 26px; height: 22px; border-radius: 5px; font-size: 11px; line-height: 22px; font-weight: 700; }
.matrix .fehlt button { background: var(--red-bg); color: var(--red); }
.matrix .teilweise button { background: var(--orange-bg); color: var(--orange); }
.matrix .vollstaendig button { background: var(--green-bg); color: var(--green); }
.matrix .zukunft button { background: var(--grey-bg); color: #b0b8c3; }
.legende { font-size: 12px; color: var(--muted); margin-top: 10px; display: flex; gap: 14px; }
.legende span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legende .l-fehlt::before { background: var(--red-bg); border: 1px solid var(--red); }
.legende .l-teilweise::before { background: var(--orange-bg); border: 1px solid var(--orange); }
.legende .l-voll::before { background: var(--green-bg); border: 1px solid var(--green); }

/* Login */
body.login { display: flex; align-items: center; justify-content: center; background: var(--navy); }
.loginbox { background: #fff; padding: 32px 36px; border-radius: 10px; width: 360px; }
.loginbox h1 { margin-bottom: 18px; }
.loginbox .feld { margin-bottom: 12px; }

.hinweis { background: #e8f0fa; border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 4px; margin-bottom: 16px; font-size: 13px; }
pre.diff { margin: 0; font-size: 12px; white-space: pre-wrap; color: var(--muted); }

/* Ideen & Fehler */
.ideen-knopf { position: fixed; right: 24px; bottom: 24px; background: var(--navy); color: #fff; border: none; border-radius: 999px;
  padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; box-shadow: 0 4px 14px rgba(20,50,79,.25); }
.ideen-knopf:hover { background: var(--navy-2); }
.ideen-dialog { border: none; border-radius: 10px; padding: 22px 24px; width: min(460px, 92vw); box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.ideen-dialog::backdrop { background: rgba(20,50,79,.35); }
.ideen-art { display: flex; gap: 18px; margin-bottom: 10px; }
.ideen-art label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.ideen-art input { width: auto; }
.ideen-aktionen { display: flex; justify-content: flex-end; gap: 8px; }
textarea.export { font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; background: #f8fafc; }

@media (max-width: 900px) {
  body { grid-template-columns: 1fr; }
  .nav { flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .nav .brand-sub, .nav .spacer { display: none; }
  main { padding: 18px; }
  .grid2, .kpis, .felder { grid-template-columns: 1fr; }
}
