:root {
  --brand: #b4232a;
  --bg: #f6f4f1;
  --card: #ffffff;
  --text: #1f1f1f;
  --muted: #6b6b6b;
  --line: #e3dfd9;
  --ok: #1d7a46;
  --ok-bg: #e7f5ec;
  --err: #a8201a;
  --err-bg: #fdecea;
  --warn-bg: #fff6dd;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
small, .muted { color: var(--muted); }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.wrap-wide { max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* Öffentlicher Kopf */
.hero { background: var(--brand); color: #fff; padding: 28px 0 32px; margin-bottom: 24px; }
.hero h1 { font-size: 2rem; margin-bottom: .2em; }
.hero p { margin: 0; opacity: .92; }
.hero .logo { max-height: 72px; max-width: 220px; background: #fff; padding: 8px; border-radius: 8px; margin-bottom: 14px; display: block; }
.hero .facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 14px; font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; }
.card > :last-child { margin-bottom: 0; }

/* Formulare */
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date], input[type=number], input:not([type]), select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #cfc9c1; border-radius: 8px; font: inherit; background: #fff; color: inherit;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
input[type=color] { width: 60px; height: 40px; padding: 2px; border: 1px solid #cfc9c1; border-radius: 8px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin-bottom: 10px; }
.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.grid { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-2 { display: grid; gap: 0 14px; grid-template-columns: 1fr 1fr; }
.req::after { content: " *"; color: var(--brand); }
.hint { font-size: .85rem; color: var(--muted); margin-top: 4px; font-weight: 400; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.person { border: 1px solid var(--line); border-radius: 8px; padding: 14px 14px 2px; margin-bottom: 12px; background: #fcfbf9; position: relative; }
.person-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.person-head strong { font-size: .95rem; }

/* Buttons */
.btn {
  display: inline-block; border: 1px solid var(--brand); background: var(--brand); color: #fff; padding: 10px 18px;
  border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2;
}
.btn:hover { filter: brightness(.93); }
.btn-ghost { background: #fff; color: var(--brand); }
.btn-small { padding: 6px 12px; font-size: .88rem; }
.btn-danger { background: #fff; color: var(--err); border-color: var(--err); }
.btn-link { background: none; border: 0; color: var(--brand); padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.btn-big { font-size: 1.05rem; padding: 13px 26px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
form.inline { display: inline; }

/* Meldungen */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-error { background: var(--err-bg); color: var(--err); }
.alert-warn { background: var(--warn-bg); color: #6b4e00; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.cancelled td { color: #999; text-decoration: line-through; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: #eee; color: #555; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: #6b4e00; }
.badge-err { background: var(--err-bg); color: var(--err); }
.badge-brand { background: var(--brand); color: #fff; }

/* Balken für Zählungen */
.bar-row { display: grid; grid-template-columns: 110px 1fr 44px; gap: 10px; align-items: center; padding: 3px 0; font-size: .92rem; }
.bar-row .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 14px; background: #efebe6; border-radius: 4px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 4px; min-width: 2px; }
.bar-row .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.public-counts { columns: 2; column-gap: 28px; }
.public-counts .bar-row { break-inside: avoid; grid-template-columns: 90px 1fr 34px; }

/* Admin */
.topbar { background: #222; color: #fff; }
.topbar .wrap-wide { display: flex; align-items: center; gap: 18px; min-height: 52px; flex-wrap: wrap; }
.topbar a { color: #fff; text-decoration: none; }
.topbar .brand { font-weight: 700; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: .88rem; opacity: .8; }
.subnav { background: #fff; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.subnav .wrap-wide { display: flex; gap: 4px; overflow-x: auto; }
.subnav a { padding: 13px 14px; text-decoration: none; color: var(--text); border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 500; }
.subnav a.active { border-color: var(--brand); color: var(--brand); }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin: 4px 0 18px; }
.page-head h1 { margin-bottom: .15em; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi .v { font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: .88rem; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 80px; }
.spark span { flex: 1; background: var(--brand); opacity: .8; border-radius: 2px 2px 0 0; min-height: 1px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.filters .field { margin: 0; }
.filters input, .filters select { min-width: 160px; }
.copy { display: flex; gap: 8px; }
.copy input { font-size: .88rem; }
.placeholders code { display: inline-block; background: #f1eee9; padding: 1px 6px; border-radius: 4px; margin: 0 4px 4px 0; font-size: .85rem; }
.tpl { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 18px; }
.tpl:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; }
.login { max-width: 400px; margin: 10vh auto; }
footer.site { text-align: center; color: var(--muted); font-size: .85rem; padding: 30px 16px 40px; }
footer.site a { color: var(--muted); }

@media (max-width: 760px) {
  .cols, .grid-2 { grid-template-columns: 1fr; }
  .public-counts { columns: 1; }
  .hero h1 { font-size: 1.6rem; }
  .card { padding: 16px; }
  .bar-row { grid-template-columns: 80px 1fr 36px; }
}
