/* Mitgliederverwaltung Union Schönauer Pferdefreunde */
:root {
  --bg: #f6f4ee;
  --flaeche: #ffffff;
  --flaeche-2: #f0ede4;
  --text: #1f2a24;
  --text-2: #5b6660;
  --linie: #dcd7ca;
  --gruen: #234d3b;
  --gruen-hell: #e3eee7;
  --gruen-mittel: #3f7a5f;
  --akzent: #a8722b;
  --akzent-hell: #f6ead6;
  --rot: #a3322a;
  --rot-hell: #f8e3e0;
  --gelb-hell: #fbf0cf;
  --gelb-text: #7a5a00;
  --blau-hell: #e0ebf6;
  --blau-text: #1d4f80;
  --schatten: 0 1px 2px rgba(31, 42, 36, .06), 0 2px 8px rgba(31, 42, 36, .05);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141a17; --flaeche: #1c2420; --flaeche-2: #232d28; --text: #e7ece8; --text-2: #a3b0a8; --linie: #34413a;
    --gruen: #7cc29f; --gruen-hell: #1f3a2d; --gruen-mittel: #5fa583; --akzent: #e0a759; --akzent-hell: #3a2e1c;
    --rot: #ef8a80; --rot-hell: #3d2220; --gelb-hell: #3a3218; --gelb-text: #f0d27a; --blau-hell: #1b2c3d; --blau-text: #9cc6ef;
    --schatten: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141a17; --flaeche: #1c2420; --flaeche-2: #232d28; --text: #e7ece8; --text-2: #a3b0a8; --linie: #34413a;
  --gruen: #7cc29f; --gruen-hell: #1f3a2d; --gruen-mittel: #5fa583; --akzent: #e0a759; --akzent-hell: #3a2e1c;
  --rot: #ef8a80; --rot-hell: #3d2220; --gelb-hell: #3a3218; --gelb-text: #f0d27a; --blau-hell: #1b2c3d; --blau-text: #9cc6ef;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
h1 { font-size: 1.6rem; margin: .2rem 0 .8rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .8rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
a { color: var(--gruen-mittel); }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .92em; }
.klein, small { font-size: .85rem; color: var(--text-2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.laden { padding: 3rem; text-align: center; color: var(--text-2); }
[hidden] { display: none !important; }

/* Kopf und Navigation */
.demo-band { background: var(--akzent-hell); color: var(--text); text-align: center; padding: .4rem 1rem; font-size: .85rem; border-bottom: 1px solid var(--linie); }
.kopf { display: flex; align-items: center; gap: 1.2rem; padding: .6rem 1.5rem; background: var(--gruen); color: #f3efe4; position: sticky; top: 0; z-index: 20; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .kopf { background: #10251b; } }
.marke-titel { display: flex; align-items: center; gap: .5rem; color: inherit; text-decoration: none; font-weight: 700; white-space: nowrap; }
.marke-titel img { height: 32px; border-radius: 4px; background: #fff; }
.nav { display: flex; gap: .2rem; flex: 1; }
.nav a { color: #e5ece7; text-decoration: none; padding: .45rem .75rem; border-radius: 6px; white-space: nowrap; }
.nav a:hover { background: rgba(255,255,255,.1); }
.nav a.aktiv { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }
.zahl { display: inline-block; min-width: 1.2rem; padding: 0 .35rem; border-radius: 99px; background: var(--akzent); color: #fff; font-size: .75rem; text-align: center; }
.zahl:empty { display: none; }
.benutzer { display: flex; align-items: center; gap: .6rem; }
.benutzer .klein { color: #c7d3cb; }
.benutzer .link { color: #fff; }
.menue-knopf { display: none; background: none; border: 0; color: #fff; font-size: 1.5rem; padding: .2rem .5rem; }

main { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.5rem 4rem; outline: none; }

/* Karten und Kacheln */
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1.2rem 1.3rem; margin-bottom: 1.2rem; box-shadow: var(--schatten); }
.karte.ohne-rand { padding: 0; overflow: hidden; }
.karte.ohne-rand > .tabelle-scroll { border-radius: 0; }
.innen, h2.innen { padding: 1rem 1.3rem .2rem; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .9rem; margin-bottom: 1.2rem; }
.kachel { display: flex; flex-direction: column; gap: .1rem; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: .9rem 1rem; text-decoration: none; color: var(--text); box-shadow: var(--schatten); }
a.kachel:hover { border-color: var(--gruen-mittel); }
.kachel .wert { font-size: 1.9rem; font-weight: 700; color: var(--gruen); line-height: 1.15; font-variant-numeric: tabular-nums; }
.kachel .klein-wert { font-size: 1.3rem; padding: .25rem 0; }
.kachel.achtung { border-left: 4px solid var(--akzent); }
.kachel.warnung { border-left: 4px solid var(--rot); }
.klein-kacheln .kachel .wert { font-size: 1.35rem; }
.raster-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 1.5rem; }

.zeile-zwischen { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.zurueck { display: inline-block; font-size: .9rem; margin-bottom: .2rem; text-decoration: none; }
.untertitel { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; color: var(--text-2); margin: -.4rem 0 1rem; }
.unternav { display: flex; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }

/* Knöpfe */
button, .knopf { font: inherit; cursor: pointer; border-radius: 7px; padding: .5rem 1rem; border: 1px solid transparent; text-decoration: none; display: inline-block; line-height: 1.3; }
button:disabled { opacity: .45; cursor: not-allowed; }
.primaer { background: var(--gruen); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .primaer { color: #0f1d16; } }
.primaer:hover:not(:disabled) { filter: brightness(1.1); }
.zweit { background: var(--flaeche); color: var(--text); border-color: var(--linie); }
.zweit:hover:not(:disabled) { border-color: var(--gruen-mittel); }
.gefahr { background: var(--rot); color: #fff; }
.link, .gefahr-link { background: none; border: 0; padding: .3rem .4rem; color: var(--gruen-mittel); text-decoration: underline; }
.gefahr-link { color: var(--rot); }
.knopfgruppe { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.knopfspalte { display: flex; flex-direction: column; gap: .5rem; align-items: stretch; }
.knopfspalte .gefahr-link { align-self: flex-start; }
.aktionsleiste { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.aktionsleiste.innen { padding: 1rem 1.3rem; margin: 0; }
.platz { flex: 1; }
.umschalter { display: inline-flex; border: 1px solid var(--linie); border-radius: 8px; overflow: hidden; }
.umschalter button { border-radius: 0; background: var(--flaeche); color: var(--text); padding: .35rem .9rem; }
.umschalter button.aktiv { background: var(--gruen); color: #fff; }

/* Formulare */
input, select, textarea { font: inherit; color: var(--text); background: var(--flaeche); border: 1px solid var(--linie); border-radius: 7px; padding: .5rem .6rem; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, tr:focus-visible { outline: 2px solid var(--gruen-mittel); outline-offset: 1px; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--gruen); }
input[readonly], textarea[readonly] { background: var(--flaeche-2); }
label { display: block; }
.dialog label, form > label, #e-mail label { margin-bottom: .8rem; }
.dialog label input, .dialog label select, .dialog label textarea { margin-top: .25rem; }
.feld { display: flex; flex-direction: column; gap: .25rem; }
.feld > span { font-size: .85rem; font-weight: 600; color: var(--text-2); }
.feld.breit, .breit { grid-column: 1 / -1; }
.felder { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem 1rem; }
.abschnitt { border: 0; padding: 0; margin: 0 0 1.4rem; }
.abschnitt legend { font-weight: 700; color: var(--gruen); margin-bottom: .6rem; padding: 0; font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; }
.inline { display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; }
.inline input, .inline select { width: auto; }
input.schmal { width: 7rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border: 1px solid var(--linie); border-radius: 99px; margin: 0 .4rem .4rem 0; background: var(--flaeche); cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; }
.filterleiste { display: flex; flex-wrap: wrap; gap: .7rem; align-items: flex-end; }
.filterleiste.karte { padding: .9rem 1rem; }
.filterleiste label > span { display: block; font-size: .8rem; color: var(--text-2); margin-bottom: .15rem; }
.filterleiste .suche { flex: 1 1 260px; }
.filterleiste select { width: auto; }
.fehlerliste { background: var(--rot-hell); color: var(--text); border: 1px solid var(--rot); border-radius: 8px; padding: .7rem 1rem; margin: 1rem 0; }
.fehlerliste ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.hinweis { background: var(--gelb-hell); border-left: 4px solid var(--akzent); padding: .6rem .9rem; border-radius: 6px; margin: .6rem 0 1rem; }
.zuordnung { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .7rem 1rem; }
pre.roh { background: var(--flaeche-2); padding: .8rem; border-radius: 6px; overflow: auto; font-size: .8rem; }

/* Tabellen */
.tabelle-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabelle-scroll.hoch { max-height: 60vh; overflow-y: auto; }
.tabelle { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tabelle th, .tabelle td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--linie); vertical-align: top; }
.tabelle th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-2); background: var(--flaeche-2); position: sticky; top: 0; z-index: 1; }
.tabelle th[data-sort] { cursor: pointer; }
.tabelle th[data-sort]:hover { color: var(--text); }
.tabelle.kompakt th, .tabelle.kompakt td { padding: .35rem .6rem; }
.tabelle.klickbar tbody tr { cursor: pointer; }
.tabelle.klickbar tbody tr:hover, .tabelle tbody tr:focus { background: var(--gruen-hell); }
.tabelle td.leer { text-align: center; color: var(--text-2); padding: 2rem; }
.tabelle .alt { color: var(--text-2); text-decoration: line-through; text-decoration-color: rgba(163,50,42,.5); }
.tabelle .neu { font-weight: 600; }
.tabelle.protokoll td { font-size: .88rem; }
tr.ausgegraut td { opacity: .5; }
tr.warnzeile td:first-child { box-shadow: inset 3px 0 var(--akzent); }
.marke { display: inline-block; padding: .05rem .5rem; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.marke.gruen { background: var(--gruen-hell); color: var(--gruen); }
.marke.grau { background: var(--flaeche-2); color: var(--text-2); }
.marke.rot { background: var(--rot-hell); color: var(--rot); white-space: normal; }
.marke.gelb { background: var(--gelb-hell); color: var(--gelb-text); white-space: normal; }
.marke.blau { background: var(--blau-hell); color: var(--blau-text); }
ul.kompakt { margin: .4rem 0; padding-left: 1.2rem; }
.gruppenliste { list-style: none; padding: 0; margin: 0 0 1rem; }
.gruppenliste li { display: flex; gap: .8rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--linie); }
.gruppenliste li span:first-child { flex: 1; font-weight: 600; }

/* Exporte */
.exportliste { display: flex; flex-direction: column; }
.exportzeile { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; padding: .8rem 0; border-bottom: 1px solid var(--linie); }
.exportzeile:last-child { border-bottom: 0; }
.exportzeile > div { flex: 1 1 280px; display: flex; flex-direction: column; gap: .1rem; }
.exportzeile select { width: auto; }
.exportzeile .chip { align-self: flex-start; margin-top: .3rem; }

/* Tabs */
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--linie); margin-bottom: 1.2rem; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: .6rem 1rem; color: var(--text-2); white-space: nowrap; }
.tabs button.aktiv { color: var(--gruen); border-bottom-color: var(--gruen); font-weight: 600; }

/* Diagramm */
.diagramm { width: 100%; height: auto; max-height: 260px; }
.diagramm .balken { fill: var(--gruen-mittel); }
.diagramm g:hover .balken { fill: var(--akzent); }
.diagramm text { fill: var(--text-2); font-size: 12px; font-family: inherit; }
.diagramm text.wert { fill: var(--text); font-weight: 600; }

/* Dialog */
.dialog-hintergrund { position: fixed; inset: 0; background: rgba(15, 25, 20, .45); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 100; animation: einblenden .12s ease-out; }
.dialog { background: var(--flaeche); border-radius: 12px; width: min(520px, 100%); max-height: calc(100vh - 2rem); display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.dialog.breit { width: min(860px, 100%); }
.dialog h2 { margin: 0; padding: 1.1rem 1.3rem .4rem; }
.dialog-inhalt { padding: .4rem 1.3rem; overflow-y: auto; }
.dialog-inhalt textarea { margin-bottom: .5rem; }
.dialog-knoepfe { display: flex; justify-content: flex-end; gap: .6rem; padding: .9rem 1.3rem 1.1rem; flex-wrap: wrap; border-top: 1px solid var(--linie); margin-top: .6rem; }
@keyframes einblenden { from { opacity: 0; } to { opacity: 1; } }

#toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 150%); background: var(--gruen); color: #fff; padding: .7rem 1.2rem; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.2); transition: transform .2s; z-index: 200; max-width: calc(100% - 2rem); }
#toast.sichtbar { transform: translate(-50%, 0); }
#toast.fehler { background: var(--rot); }
#toast.info { background: #3b4a43; }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login .karte { width: min(400px, 100%); }
.login form label { margin-bottom: .9rem; }
.login .primaer { width: 100%; margin-top: .3rem; }
.login-logo { max-height: 70px; display: block; margin: 0 auto .6rem; }

/* Mobil */
@media (max-width: 860px) {
  .kopf { flex-wrap: wrap; padding: .6rem 1rem; gap: .5rem; }
  .menue-knopf { display: block; margin-left: auto; }
  .nav { display: none; flex-basis: 100%; flex-direction: column; order: 3; padding-bottom: .4rem; }
  .menue-offen .nav { display: flex; }
  .benutzer { display: none; flex-basis: 100%; order: 4; }
  .menue-offen .benutzer { display: flex; }
  main { padding: 1rem 1rem 3rem; }
  .mobil-weg { display: none; }
  .tabelle th, .tabelle td { padding: .5rem .55rem; }
  h1 { font-size: 1.35rem; }
  .felder { grid-template-columns: 1fr; }
  .filterleiste label:not(.suche):not(.chip) { flex: 1 1 calc(50% - .7rem); }
  .filterleiste select { width: 100%; }
  .dialog-knoepfe button { flex: 1 1 auto; }
  .inline { white-space: normal; flex-wrap: wrap; }
}

@media print {
  .kopf, .demo-band, .filterleiste, .aktionsleiste, button { display: none !important; }
  main { max-width: none; padding: 0; }
  .karte { box-shadow: none; border: 0; }
}
