/* AktionsTrackr - Vor-Ort-App. Farben wie die Sternsingerverwaltung (Bordeaux/Gold). Zwei Darstellungen:
   body[data-geraet="handy"]: eine Spalte, große Tasten; body[data-geraet="tablet"]: Liste links, Details rechts. */
:root {
    --bord: #7a1f1f; --gold: #fdc500; --creme: #fbf8f1; --tinte: #1b2333; --grau: #6b7280; --linie: #e3dccb;
    --gruen: #2d7a2d; --gruen-bg: #e3f1e3; --blau: #1f3a6b; --blau-bg: #e8edf6; --orange: #b4600a; --orange-bg: #fbe9d4; --rot: #b03030; --rot-bg: #f7dcdc;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--creme); color: var(--tinte); font-family: 'Segoe UI', system-ui, Arial, sans-serif; font-size: 17px; }
body { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }

.kopf { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; background: var(--bord); color: #fff; padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top)); }
.kopf-titel { flex: 1; font-weight: 700; font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kopf button { background: transparent; border: 0; color: #fff; font-size: 28px; line-height: 1; padding: 6px 12px; cursor: pointer; min-width: 48px; min-height: 48px; }
.menue { position: fixed; right: 8px; top: 62px; z-index: 40; background: #fff; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.3); min-width: 220px; overflow: hidden; }
.menue a, .menue button { display: block; width: 100%; text-align: left; padding: 14px 16px; border: 0; background: #fff; color: var(--tinte); font-size: 17px; text-decoration: none; border-top: 1px solid var(--linie); }
.menue-benutzer { padding: 12px 16px; color: var(--grau); font-size: 14px; }

main { padding: 12px; max-width: 1200px; margin: 0 auto; }
h2 { margin: 6px 0 10px; font-size: 20px; }
.karte { background: #fff; border-radius: 12px; border: 1px solid var(--linie); padding: 14px; margin-bottom: 10px; }
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 18px; border-radius: 10px; border: 2px solid var(--linie); background: #fff; color: var(--tinte); font-size: 17px; font-weight: 600; cursor: pointer; text-decoration: none; }
.knopf.primaer { background: var(--gold); border-color: var(--gold); }
.knopf.gruen { background: var(--gruen); border-color: var(--gruen); color: #fff; }
.knopf.gefahr { background: var(--rot); border-color: var(--rot); color: #fff; }
.knopf[disabled] { opacity: .55; }
.knopf.voll { width: 100%; }

.aktion-karte { display: block; text-decoration: none; color: inherit; }
.aktion-karte .titel { font-weight: 700; font-size: 18px; }
.aktion-karte .meta { color: var(--grau); font-size: 15px; margin-top: 2px; }
.fortschritt { height: 8px; background: var(--linie); border-radius: 6px; margin-top: 10px; overflow: hidden; }
.fortschritt > div { height: 100%; background: var(--gruen); }

.zaehler { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; margin-bottom: 10px; }
.zaehler button { background: #fff; border: 2px solid var(--linie); border-radius: 10px; padding: 8px 4px; text-align: center; font-size: 13px; color: var(--grau); cursor: pointer; }
.zaehler button strong { display: block; font-size: 24px; color: var(--tinte); }
.zaehler button.aktiv { border-color: var(--gold); background: #fff8dc; }
.suche { width: 100%; min-height: 48px; padding: 0 14px; border-radius: 10px; border: 2px solid var(--linie); font-size: 17px; margin-bottom: 10px; background: #fff; }

.zeile { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--linie); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.zeile.gewaehlt { border-color: var(--bord); box-shadow: 0 0 0 2px var(--bord) inset; }
.zeile .name { flex: 1; min-width: 0; cursor: pointer; }
.zeile .name b { display: block; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zeile .name small { color: var(--grau); font-size: 14px; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: #eee; color: #444; }
.chip.Eingeladen { background: #ececec; color: #555; }
.chip.Angemeldet { background: var(--blau-bg); color: var(--blau); }
.chip.Anwesend { background: var(--gruen-bg); color: var(--gruen); }
.chip.Entschuldigt { background: var(--orange-bg); color: var(--orange); }
.chip.Unentschuldigt { background: var(--rot-bg); color: var(--rot); }
.ew-ja { color: var(--gruen); font-weight: 700; }
.ew-nein { color: var(--orange); font-weight: 700; }

.formular label { display: block; font-weight: 600; font-size: 14px; color: var(--grau); margin: 12px 0 4px; }
.formular input, .formular textarea, .formular select { width: 100%; min-height: 48px; padding: 8px 12px; border: 2px solid var(--linie); border-radius: 10px; font-size: 17px; background: #fff; font-family: inherit; }
.formular textarea { min-height: 80px; }
.vorschlaege { border: 2px solid var(--linie); border-radius: 10px; background: #fff; margin-top: 4px; overflow: hidden; }
.vorschlaege div { padding: 12px 14px; border-top: 1px solid var(--linie); cursor: pointer; }
.vorschlaege div:first-child { border-top: 0; }
.status-tasten { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.status-tasten .knopf.aktiv { outline: 3px solid var(--bord); }
.aktionen-liste { display: grid; gap: 8px; margin-top: 12px; }
.hinweis { padding: 10px 12px; border-radius: 10px; background: var(--blau-bg); color: var(--blau); font-size: 15px; margin: 8px 0; }
.hinweis.fehler { background: var(--rot-bg); color: var(--rot); }

.toast { position: fixed; left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 60; background: var(--tinte); color: #fff; padding: 14px 16px; border-radius: 12px; font-size: 16px; box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.toast.fehler { background: var(--rot); }
.toast.gut { background: var(--gruen); }
.blatt-hintergrund { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; justify-content: center; }
.blatt { background: var(--creme); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.blatt h3 { margin: 0 0 8px; }

/* Tablet: Liste links, Details rechts */
body[data-geraet="tablet"] main { max-width: none; }
body[data-geraet="tablet"] .zweispaltig { display: grid; grid-template-columns: minmax(320px, 42%) 1fr; gap: 16px; align-items: start; }
body[data-geraet="tablet"] .zweispaltig .liste { max-height: calc(100vh - 190px); overflow-y: auto; padding-right: 4px; }
body[data-geraet="tablet"] .detail-pane { position: sticky; top: 76px; max-height: calc(100vh - 100px); overflow-y: auto; }
body[data-geraet="tablet"] { font-size: 18px; }
body[data-geraet="tablet"] .aktionen-gitter { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
body[data-geraet="handy"] .detail-pane.leer { display: none; }
.detail-pane.leer { color: var(--grau); text-align: center; padding: 60px 20px; }
.login-hinweis { text-align: center; padding: 40px 16px; }

[hidden] { display: none !important; }

.tabs { display: flex; gap: 0; margin-bottom: 10px; border-bottom: 2px solid var(--linie); }
.tabs button { flex: 1; min-height: 48px; background: transparent; border: 0; border-bottom: 4px solid transparent; margin-bottom: -2px; font-size: 16px; font-weight: 600; color: var(--grau); cursor: pointer; }
.tabs button.aktiv { color: var(--tinte); border-bottom-color: var(--gold); }
