:root {
  --gruen: #1f4d36;
  --gruen-2: #2d6a4b;
  --gruen-hell: #e8f1ec;
  --sand: #c8673a;
  --sand-hell: #fbeee6;
  --text: #1d2420;
  --grau: #66706a;
  --linie: #dfe5e1;
  --bg: #f5f7f6;
  --weiss: #fff;
  --rot: #b3261e;
  --rot-hell: #fdecea;
  --gelb-hell: #fff6dc;
  --gelb: #8a6500;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--gruen-2); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
small, .muted { color: var(--grau); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* Layout */
.layout { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { background: var(--gruen); color: #fff; padding: 1rem 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .6rem; padding: 0 1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: .5rem; }
.brand .ball { width: 34px; height: 34px; flex: none; }
.brand b { display: block; font-size: .95rem; line-height: 1.2; }
.brand small { color: rgba(255,255,255,.65); font-size: .75rem; }
.nav a { display: block; color: rgba(255,255,255,.88); text-decoration: none; padding: .5rem 1.1rem; border-left: 3px solid transparent; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: rgba(255,255,255,.12); color: #fff; border-left-color: var(--sand); font-weight: 600; }
.nav .sep { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.45); padding: 1rem 1.1rem .3rem; }
.main { min-width: 0; }
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; padding: .6rem 1.5rem; background: var(--weiss); border-bottom: 1px solid var(--linie); font-size: .9rem; }
.topbar form { margin: 0; }
.content { padding: 1.5rem; max-width: 1300px; }
.btn.menu-toggle { display: none; }

/* Komponenten */
.card { background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.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)); }
.kpi { background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem 1.2rem; }
.kpi .label { color: var(--grau); font-size: .85rem; }
.kpi .wert { font-size: 1.6rem; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: .2rem; }
.kpi .sub { color: var(--grau); font-size: .82rem; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.pagehead h1 { margin: 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

table { width: 100%; border-collapse: collapse; background: var(--weiss); }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--linie); text-align: left; vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--grau); font-weight: 600; background: #fafbfa; }
tbody tr:hover { background: #f9fbfa; }
tfoot td { font-weight: 650; border-top: 2px solid var(--linie); }
.table-wrap { overflow-x: auto; border: 1px solid var(--linie); border-radius: var(--radius); background: var(--weiss); }
.table-wrap table { border: 0; }
table.kompakt td, table.kompakt th { padding: .3rem .5rem; }
dl.daten { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
dl.daten dt { color: var(--grau); }
dl.daten dd { margin: 0; }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 99px; font-size: .78rem; font-weight: 600; background: #eef0ef; color: #444; white-space: nowrap; }
.badge.gruen, .badge.aktiv, .badge.bezahlt, .badge.exportiert { background: var(--gruen-hell); color: var(--gruen); }
.badge.offen, .badge.entwurf { background: var(--gelb-hell); color: var(--gelb); }
.badge.im_lauf, .badge.passiv { background: #e8eefc; color: #2a4a9a; }
.badge.rot, .badge.storniert, .badge.ausgetreten { background: var(--rot-hell); color: var(--rot); }
.badge.ruhend { background: #eee; color: #555; }

.flash { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: .75rem; border: 1px solid; }
.flash.success { background: var(--gruen-hell); border-color: #bcd8c7; color: var(--gruen); }
.flash.error { background: var(--rot-hell); border-color: #f2c0bb; color: var(--rot); }
.flash.info { background: #eef4fb; border-color: #cbdcf0; color: #234; }
.hinweis { background: var(--sand-hell); border: 1px solid #efcdb9; border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: 1rem; }
.warnung { background: var(--rot-hell); border: 1px solid #f2c0bb; border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: 1rem; color: var(--rot); }
.warnung ul, .hinweis ul { margin: .3rem 0 0; padding-left: 1.2rem; }

/* Formulare */
form.inline { display: inline; }
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: .8rem 1rem; }
.field { display: flex; flex-direction: column; gap: .25rem; grid-column: span 6; }
.field.s1 { grid-column: span 1; } .field.s2 { grid-column: span 2; } .field.s3 { grid-column: span 3; } .field.s4 { grid-column: span 4; }
.field.s5 { grid-column: span 5; } .field.s7 { grid-column: span 7; } .field.s8 { grid-column: span 8; } .field.s9 { grid-column: span 9; } .field.s12 { grid-column: span 12; }
.field > span { font-size: .85rem; font-weight: 600; color: #374039; }
.field small { font-weight: normal; }
input[type=text], input[type=email], input[type=date], input[type=password], input[type=number], input[type=search], input[type=file], select, textarea {
  font: inherit; padding: .45rem .6rem; border: 1px solid #c9d1cc; border-radius: 6px; background: #fff; width: 100%; color: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(45,106,75,.35); border-color: var(--gruen-2); }
textarea { min-height: 80px; }
.check { display: flex; align-items: center; gap: .45rem; }
.check input { width: auto; }
fieldset { border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem 1.1rem 1.1rem; margin: 0 0 1rem; background: var(--weiss); }
legend { font-weight: 650; padding: 0 .4rem; color: var(--gruen); }
.filter { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.filter label { display: flex; flex-direction: column; font-size: .8rem; color: var(--grau); gap: .2rem; }
.filter input, .filter select { width: auto; min-width: 140px; }

.btn { display: inline-flex; align-items: center; gap: .35rem; font: inherit; font-weight: 600; font-size: .9rem; padding: .45rem .9rem; border-radius: 6px;
  border: 1px solid var(--gruen-2); background: var(--gruen-2); color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--gruen); }
.btn.sek { background: #fff; color: var(--gruen-2); }
.btn.sek:hover { background: var(--gruen-hell); }
.btn.akzent { background: var(--sand); border-color: var(--sand); }
.btn.akzent:hover { background: #a9522c; }
.btn.gefahr { background: #fff; color: var(--rot); border-color: #e3a29c; }
.btn.gefahr:hover { background: var(--rot-hell); }
.btn.klein { padding: .2rem .55rem; font-size: .8rem; }
.btn.link { background: none; border: 0; color: var(--gruen-2); padding: 0; font-weight: 500; text-decoration: underline; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

details.aktion { display: inline-block; position: relative; }
details.aktion summary { list-style: none; cursor: pointer; }
details.aktion summary::-webkit-details-marker { display: none; }
details.aktion[open] .pop { position: absolute; right: 0; z-index: 10; background: #fff; border: 1px solid var(--linie); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: .8rem; width: 280px; display: flex; flex-direction: column; gap: .5rem; text-align: left; }
.pop label { font-size: .82rem; display: flex; flex-direction: column; gap: .2rem; }

.inline-betrag { justify-content: flex-end; flex-wrap: nowrap; }
.inline-betrag input { width: 90px; text-align: right; padding: .25rem .4rem; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, var(--gruen) 0%, var(--gruen-2) 55%, var(--sand) 140%); }
.login { background: #fff; padding: 2rem; border-radius: 12px; width: min(380px, 92vw); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login h1 { font-size: 1.25rem; margin-bottom: .2rem; }
.login form { display: flex; flex-direction: column; gap: .8rem; margin-top: 1.2rem; }
.login .ball { width: 48px; height: 48px; }

/* Druck */
.druck-only { display: none; }
@media print {
  .sidebar, .topbar, .no-print, .flash { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; font-size: 11pt; }
  .card, .table-wrap { border: 0; padding: 0; }
  .druck-only { display: block; }
  .seitenumbruch { page-break-after: always; }
  a { color: inherit; text-decoration: none; }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; display: none; }
  .sidebar.offen { display: block; }
  .btn.menu-toggle { display: inline-flex; margin-right: auto; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .field, .field.s1, .field.s2, .field.s3, .field.s4, .field.s5, .field.s7, .field.s8, .field.s9 { grid-column: span 12; }
  .content { padding: 1rem; }
}

/* Rechte-Tabelle */
table.rechte th.rolle-spalte { text-align: center; text-transform: none; letter-spacing: 0; min-width: 130px; vertical-align: bottom; }
table.rechte th.rolle-spalte input { font-weight: 600; text-align: center; padding: .25rem .4rem; }
table.rechte th.rolle-spalte small { display: block; font-weight: normal; margin-top: .2rem; }
table.rechte td.mitte { text-align: center; vertical-align: middle; }
table.rechte td.mitte input { width: 18px; height: 18px; accent-color: var(--gruen-2); }
table.rechte tr.bereich td { background: var(--gruen-hell); color: var(--gruen); font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }

/* Datenpflege */
.zaehler { display: inline-block; min-width: 1.4em; padding: 0 .4em; border-radius: 99px; background: var(--sand); color: #fff; font-size: .75rem; font-weight: 700; text-align: center; line-height: 1.5; margin-left: .3rem; }
table.pflege td { vertical-align: middle; }
table.pflege input { padding: .3rem .45rem; font-size: .9rem; min-width: 0; }
table.pflege input.fehlt { border-color: #e3a29c; background: var(--rot-hell); }
table.pflege td, table.pflege th { padding: .4rem .35rem; }
table.pflege td:first-child { min-width: 140px; }
table.pflege .w-mail { width: 170px; } table.pflege .w-mobil { width: 120px; } table.pflege .w-datum { width: 130px; }
table.pflege .w-str { width: 140px; } table.pflege .w-plz { width: 62px; } table.pflege .w-ort { width: 100px; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chips a { text-decoration: none; }
.chips a .badge { font-size: .85rem; padding: .3rem .75rem; }
.chips a.aktiv .badge { background: var(--gruen-2); color: #fff; }

/* Jubilare: gleiche Spalten in allen Gruppen, auch im Druck */
table.jubi { table-layout: fixed; width: 100%; }
table.jubi td { overflow-wrap: break-word; }
table.jubi .c-tag { width: 11%; } table.jubi .c-nr { width: 6%; } table.jubi .c-name { width: 20%; }
table.jubi .c-eintritt { width: 11%; } table.jubi .c-adr { width: 22%; } table.jubi .c-kontakt { width: 20%; }
table.jubi .c-status { width: 10%; }
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  table.jubi { font-size: 8.5pt; }
  table.jubi th { font-size: 7pt; padding: .2rem .3rem; }
  table.jubi td { padding: .2rem .3rem; }
  table.jubi td a { color: inherit; text-decoration: none; }
  table.jubi tr { break-inside: avoid; }
  h2 { break-after: avoid; font-size: 12pt; margin: .8rem 0 .3rem; }
  .table-wrap { overflow: visible; }
}
