/* OpenVerein – schlichtes, gut lesbares Verwaltungs-Layout ohne externe Abhängigkeiten */
:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --text: #1d2321;
  --muted: #5f6b66;
  --line: #e2dfd7;
  --accent: #1f6f5c;
  --accent-ink: #ffffff;
  --accent-soft: #e3f0ec;
  --danger: #b4352a;
  --danger-soft: #fbe9e6;
  --warn: #9a6a00;
  --warn-soft: #fff4d6;
  --ok: #2f7a3d;
  --ok-soft: #e6f4e8;
  --sidebar: #17302a;
  --sidebar-ink: #d5e5df;
  --sidebar-active: #24473e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 2px 8px rgba(20, 30, 25, .04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121615; --surface: #1a201e; --surface-2: #1f2624; --text: #e6ebe9; --muted: #98a6a0;
    --line: #2d3633; --accent: #4fb396; --accent-ink: #0d1a16; --accent-soft: #1d3a32;
    --danger: #ef7a6e; --danger-soft: #3a1f1c; --warn: #e3b549; --warn-soft: #3a3019;
    --ok: #74c486; --ok-soft: #1c3322; --sidebar: #0d1513; --sidebar-ink: #b9cbc4; --sidebar-active: #1b2c28;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--danger); }

/* Layout */
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-ink); padding: 1.25rem .75rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; gap: .6rem; align-items: center; padding: 0 .5rem 1.25rem; color: #fff; font-weight: 650; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 800; flex: none;
}
.brand-logo { object-fit: contain; background: #fff; padding: 2px; }
.brand small { display: block; font-weight: 400; color: var(--sidebar-ink); font-size: .78rem; line-height: 1.2; }
.nav-section { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; opacity: .6; padding: 1rem .6rem .35rem; }
.sidebar a {
  display: block; color: var(--sidebar-ink); padding: .42rem .6rem; border-radius: 7px; font-size: .94rem;
}
.sidebar a:hover { background: var(--sidebar-active); text-decoration: none; color: #fff; }
.sidebar a.active { background: var(--sidebar-active); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.main { padding: 1.75rem 2rem 3rem; min-width: 0; max-width: 1280px; }
.topbar { display: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* Cards & grid */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 1rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.65rem; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .hint { font-size: .82rem; color: var(--muted); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }

/* Buttons */
.btn, button, input[type=submit] {
  display: inline-flex; align-items: center; gap: .35rem; font: inherit; font-size: .92rem; font-weight: 550;
  padding: .45rem .9rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); cursor: pointer; text-decoration: none; line-height: 1.3;
}
.btn:hover, button:hover { border-color: var(--accent); text-decoration: none; }
.btn-primary, button.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-danger { color: var(--danger); border-color: var(--danger-soft); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { padding: .25rem .6rem; font-size: .84rem; }
form.inline { display: inline; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .55rem .8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.link:hover { background: var(--accent-soft); cursor: pointer; }
.card table th { background: transparent; }
.card > table { margin: -.25rem 0; }
tfoot td { font-weight: 650; border-top: 2px solid var(--line); }

/* Badges */
.badge { display: inline-block; padding: .08rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* Forms */
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: center; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=datetime-local],
input[type=password], input[type=search], input[type=url], input[type=tel], select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: .45rem .6rem; width: 100%; max-width: 100%;
  box-sizing: border-box; min-height: 2.4rem; line-height: 1.35;
}
/* Safari (iPad/iPhone) zeichnet Datum und Auswahl sonst mit eigener Höhe, Einrückung und grauem Hintergrund */
input[type=date], input[type=datetime-local], select { -webkit-appearance: none; appearance: none; }
input[type=date], input[type=datetime-local] { display: block; height: 2.4rem; }
input::-webkit-date-and-time-value { text-align: left; margin: 0; }
select:not([multiple]) {
  height: 2.4rem; padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23888' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center;
}
input[type=color] { width: 4.5rem; height: 2.4rem; padding: .2rem; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); cursor: pointer; }
input.swatch {
  appearance: none; width: 1.6rem; height: 1.6rem; margin: 0; border-radius: 50%; cursor: pointer; flex: none;
  background: var(--swatch); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line);
}
input.swatch-custom { background: conic-gradient(#d33, #db3, #3b5, #3bd, #36d, #b3d, #d33); }
input.swatch:checked { box-shadow: 0 0 0 2px var(--text); }
input.swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.filters input, .filters select { width: auto; min-width: 10rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.25rem; }
.field { display: flex; flex-direction: column; gap: .25rem; }
.field.wide { grid-column: 1 / -1; }
.field label { font-weight: 550; font-size: .9rem; }
.field .help { color: var(--muted); font-size: .8rem; }
.field .errors { color: var(--danger); font-size: .85rem; margin: 0; padding: 0; list-style: none; }
.field.check { flex-direction: row; align-items: flex-start; gap: .5rem; }
.field.check input { margin-top: .3rem; }
.field.check { flex-wrap: wrap; }
.field.check label { flex: 1; }
.field.check .errors { flex-basis: 100%; padding-left: 1.5rem; }
.field ul.choices, .field div.choices > div { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.field ul.choices label { font-weight: 400; }
fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; }
legend { font-weight: 650; font-size: 1.02rem; margin-bottom: .75rem; padding: 0; }
.form-actions { display: flex; gap: .5rem; justify-content: space-between; align-items: center; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* Messages */
.messages { list-style: none; padding: 0; margin: 0 0 1.25rem; display: grid; gap: .5rem; }
.messages li { padding: .65rem .9rem; border-radius: 8px; background: var(--accent-soft); border: 1px solid transparent; }
.messages .error { background: var(--danger-soft); color: var(--danger); }
.messages .warning { background: var(--warn-soft); color: var(--warn); }
.messages .success { background: var(--ok-soft); color: var(--ok); }
.notice { padding: .75rem 1rem; border-radius: 8px; background: var(--warn-soft); color: var(--warn); margin-bottom: 1rem; }

.pagination { display: flex; gap: .5rem; justify-content: center; align-items: center; margin-top: 1rem; }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .5rem .85rem; border-bottom: 2px solid transparent; color: var(--muted); }
.tabs a.active { border-color: var(--accent); color: var(--text); font-weight: 600; }
pre.preview { white-space: pre-wrap; font-family: inherit; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 1rem; margin: 0; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: .5rem 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 1rem; }
.list-plain li:last-child { border-bottom: 0; }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.auth .card { width: 100%; max-width: 400px; padding: 2rem; }
.auth .brand { color: var(--text); padding: 0 0 1.5rem; }
.auth .brand small { color: var(--muted); }
.auth .field { margin-bottom: .9rem; }
.auth button { width: 100%; justify-content: center; }
.auth.wide .card { max-width: 760px; }
.auth.wide .field { margin-bottom: 0; }
.auth.wide button { width: auto; }
[hidden] { display: none !important; }  /* sonst überschreibt z. B. .field { display: flex } das Ausblenden */
.button-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Mobil */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .2s; z-index: 20; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .topbar { display: flex; align-items: center; gap: .75rem; padding: .75rem 16px; background: var(--sidebar); color: #fff; position: sticky; top: 0; z-index: 10; }
  .topbar button { background: transparent; color: #fff; border-color: rgba(255,255,255,.25); }
  .main { padding: 1.25rem 16px 3rem; }
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
  .grid-4.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters input, .filters select { flex: 1 1 100%; }
}
@media print {
  .sidebar, .topbar, .actions, .filters, .btn { display: none !important; }
  .layout { display: block; }
  body { background: #fff; }
}
.field > div[id] { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; }
.field > div[id] label { font-weight: 400; display: inline-flex; gap: .35rem; align-items: center; }
.grid > .card + .card { margin-top: 0; }
.grid + .card, .card + .grid, .grid + .grid { margin-top: 1rem; }
