/* Aussehen wie im Prototyp (prototype/standbuchung.html), Vereinsgrün #889d37.
   Schrift: Systemschrift des Geräts – keine fremden Schriftdienste (SICHERHEIT.md S-68). */

:root {
  --g: #889d37; --gd: #5f6f20; --bg: #f5f6ef; --cd: #fff; --tx: #232618; --mu: #686e55;
  --bd: #d8dcc8; --bad: #b3402f; --ok: #e6eecb;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171a10; --cd: #232819; --tx: #eef0e4; --mu: #a6ad8c; --bd: #3a4128;
    --gd: #b2c866; --ok: #34401a; --bad: #e0806f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #171a10; --cd: #232819; --tx: #eef0e4; --mu: #a6ad8c; --bd: #3a4128;
  --gd: #b2c866; --ok: #34401a; --bad: #e0806f; color-scheme: dark;
}

html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0; background: var(--bg); color: var(--tx);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Kopf mit Wappen */
header {
  background: var(--g); color: #fff; padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
header b { font-size: 19px; }
header small { display: block; opacity: .9; }
header > div:first-child { min-width: 0; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  flex: none; width: 46px; height: 46px; box-sizing: border-box; padding: 3px;
  border-radius: 10px; background: #fff; object-fit: contain;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .5);
}
#hb { display: flex; align-items: center; gap: 10px; font-size: 14px; }
#hb .nm { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .75); padding: 6px 12px; }

/* Inhalt und Reiterleiste */
main { max-width: 760px; margin: 0 auto; padding: 12px; }
nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
nav a.tab {
  border: 1px solid var(--bd); border-radius: 8px; padding: 8px 10px;
  background: var(--cd); color: var(--tx); text-decoration: none;
}
nav a.tab.on { background: var(--g); border-color: var(--g); color: #fff; }

button, select, input {
  font: inherit; border: 1px solid var(--bd); border-radius: 8px; padding: 8px 10px;
  background: var(--cd); color: var(--tx);
}
button { cursor: pointer; }
/* Tippflächen am Handy mindestens 44 px hoch */
button, select, input:not([type="checkbox"]):not([type="radio"]) { min-height: 44px; }
button.p { background: var(--g); border-color: var(--g); color: #fff; }
textarea {
  font: inherit; width: 100%; box-sizing: border-box; min-height: 120px; margin: 8px 0;
  border: 1px solid var(--bd); border-radius: 8px; padding: 8px 10px;
  background: var(--cd); color: var(--tx); resize: vertical;
}
label { display: inline-flex; gap: 6px; align-items: center; margin-right: 10px; }
label.lf { display: flex; flex-direction: column; align-items: stretch; gap: 4px; margin: 0; flex: 1 1 200px; min-width: 0; }
label.lf span { font-size: 14px; color: var(--mu); }
input[type=checkbox], input[type=radio] { width: auto; padding: 0; flex: none; }

.c { background: var(--cd); border: 1px solid var(--bd); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.row input:not([type=checkbox]):not([type=radio]), .row select { flex: 1 1 150px; min-width: 0; }
.row label.lf input:not([type=checkbox]), .row label.lf select { flex: none; width: 100%; box-sizing: border-box; }
.hd { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bk { padding: 4px 10px; font-size: 14px; background: transparent; color: var(--mu); }
h3 { margin: 6px 0 10px; color: var(--gd); }
h4 { margin: 10px 0 8px; color: var(--mu); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
a { color: var(--gd); }
.mu { color: var(--mu); font-size: 14px; }
.bad { color: var(--bad); }
.msg { background: var(--ok); padding: 8px 12px; border-radius: 8px; margin-bottom: 10px; }

/* Raster, Kacheln, Chips (Buchen) */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
.s { text-align: center; padding: 8px 4px; }
.s.f { background: var(--ok); border-color: var(--g); }
.s.x { opacity: .45; cursor: not-allowed; }
.s small { display: block; font-size: 12px; opacity: .85; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { border-radius: 999px; padding: 8px 14px; }
.chip.on, .tile.on { background: var(--g); border-color: var(--g); color: #fff; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 12px; border-radius: 12px; font-size: 17px; }
.tile small { display: block; font-size: 12px; font-weight: 400; opacity: .85; }
.tile.off { opacity: .45; cursor: not-allowed; }

/* Listen */
.it { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--bd); }
.usr { padding: 10px 0; border-bottom: 1px solid var(--bd); }
.ar { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 0 22px; }
.sf { background: var(--bg); border: 1px solid var(--bd); border-radius: 10px; padding: 10px; margin: 6px 0 10px; }

/* Chat */
.th { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.thi { display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; border-radius: 10px; padding: 10px 12px; width: 100%; }
.thi.on { background: var(--g); border-color: var(--g); color: #fff; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); flex: none; }
.msgs { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; max-height: 50vh; overflow: auto; }
.bub { max-width: 88%; padding: 8px 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--bd); align-self: flex-start; white-space: pre-wrap; word-break: break-word; }
.bub.me { align-self: flex-end; background: var(--ok); }
.bub small { display: block; color: var(--mu); font-size: 12px; margin-bottom: 2px; }
.bub .st { display: block; font-weight: 600; color: var(--bad); margin-bottom: 4px; }

/* Kalender (Tagesübersicht) */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 8px; }
.cal b { text-align: center; font-size: 12px; color: var(--mu); }
.d { min-height: 44px; padding: 2px; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.d small { font-size: 11px; }
.d.bk { background: var(--g); border-color: var(--g); color: #fff; font-weight: 600; }
.d.bl { box-shadow: inset 0 0 0 2px var(--bad); }
.d.td { border-color: var(--gd); }
.d.sel { outline: 2px solid var(--tx); outline-offset: 1px; }
.calh { justify-content: space-between; }

/* Fußzeile */
footer { max-width: 760px; margin: 0 auto; padding: 8px 12px 24px; text-align: center; font-size: 11px; color: var(--mu); opacity: .75; }
footer a { color: inherit; text-decoration: none; }

/* Kleine Bildschirme (Handy) */
@media (max-width: 540px) {
  header { padding: 10px 12px; }
  header b { font-size: 16px; }
  header small { display: none; }
  .logo { width: 40px; height: 40px; border-radius: 8px; }
  #hb { gap: 8px; flex: none; }
  #hb .nm { max-width: 84px; }
  .o { padding: 6px 10px; }
}

/* Formulare (Konto, Anmelden, Registrieren) */
form .row { align-items: flex-start; }
label.lf small.bad, small.err { font-size: 13px; }
small.err { display: block; margin: -2px 0 6px 28px; }
.checks { margin: 6px 0 12px; }
label.cb { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 6px; }
label.cb span { flex: 1; min-width: 0; }
label.cb input { margin-top: 4px; }
#hb form { margin: 0; }

/* Links zu Datenschutz und Impressum (über der Fußzeile) */
.legal { max-width: 760px; margin: 0 auto; padding: 4px 12px 0; text-align: center; font-size: 13px; }
.legal a { color: var(--mu); }

/* Buchen: Tage, Anlagen und Dauer sind Links (funktionieren auch ohne JavaScript) */
a.chip, a.tile, span.tile {
  border: 1px solid var(--bd); background: var(--cd); color: var(--tx); text-decoration: none;
}
a.chip { display: inline-block; }
a.chip.on, a.tile.on { background: var(--g); border-color: var(--g); color: #fff; }
a.bk { text-decoration: none; border: 1px solid var(--bd); border-radius: 8px; }
.s.f { font-weight: 600; }
.it form { margin: 0; flex: none; }
.right { text-align: right; }

/* Knöpfe als Links, Aktionen in Listen (Meine Buchungen, Tagesübersicht, Chat) */
a.btn {
  display: inline-block; font-size: 15px; border: 1px solid var(--bd); border-radius: 8px;
  padding: 7px 10px; background: var(--cd); color: var(--tx); text-decoration: none;
}
.acts { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-top: 4px; }
.acts form { margin: 0; }
.it > .acts { flex: none; flex-direction: column; align-items: flex-end; }
.chatbar { margin-top: 10px; }
form.row input[name=text] { flex: 1 1 200px; }
a.thi { color: var(--tx); text-decoration: none; border: 1px solid var(--bd); background: var(--cd); box-sizing: border-box; }
a.thi.on { color: #fff; }
.cal a.d { color: var(--tx); text-decoration: none; border: 1px solid var(--bd); background: var(--cd); }
.cal a.d.bk { background: var(--g); border-color: var(--g); color: #fff; }

/* Stände sperren */
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 10px; }
.it > form { flex: 0 1 auto; }
.it > form button { white-space: normal; max-width: 100%; }

/* Zusatzangaben beim Buchen: große Tippflächen, Textfeld erst nach „Sonstige Anmerkungen“ */
.ex { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; position: relative; }
.ex > input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.ex > label { min-height: 44px; box-sizing: border-box; margin: 0; padding: 8px 14px; gap: 10px;
  border: 1px solid var(--bd); border-radius: 999px; background: var(--cd); cursor: pointer; }
.ex > label::before { content: ""; flex: none; width: 18px; height: 18px; border: 2px solid var(--mu);
  border-radius: 4px; box-sizing: border-box; }
.ex > input:checked + label { background: var(--ok); border-color: var(--g); }
.ex > input:checked + label::before { content: "✓"; background: var(--g); border-color: var(--g);
  color: #fff; font-size: 13px; line-height: 14px; text-align: center; }
.ex > input:focus-visible + label { outline: 2px solid var(--gd); outline-offset: 2px; }
.ex .anm { display: none; flex: 1 1 100%; }
.ex .anm textarea { min-height: 80px; }
#x-sonstige:checked ~ .anm { display: block; }
.zu { display: inline-flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 4px; }
.zu .tag { font-size: 13px; padding: 1px 8px; border-radius: 999px; background: var(--ok); border: 1px solid var(--g); }
.zu .anm-t { font-size: 14px; flex-basis: 100%; overflow-wrap: anywhere; }
/* Trap/Skeet: Was wird geschossen? – bei der eigenen Buchung (OFFENE_PUNKTE #33) */
.tsv { background: var(--bg); border: 1px solid var(--bd); border-radius: 10px; padding: 10px; margin: 6px 0 10px; font-size: 15px; }
.tsv p { margin: 6px 0; }
.tsr { display: flex; gap: 10px; padding: 3px 0; }
.tsr > span:first-child { flex: none; font-weight: 600; }
.tsok { color: var(--gd); font-weight: 600; }
.tsa { justify-content: flex-start; }
/* Öffnungszeiten in den Einstellungen: Tag, von, bis in einer Zeile (#34) */
.hrow { flex-wrap: nowrap; gap: 6px; }
.hrow .cb { flex: 0 0 104px; margin: 0; }
.hrow label.lf { flex: 1 1 0; min-width: 0; margin: 0; }
.hrow label.lf select { width: 100%; }

/* Knopf „Wer darf wann buchen?“ auf der Buchen-Seite (OFFENE_PUNKTE #35) */
details.schiesszeiten { padding: 0; }
details.schiesszeiten > summary {
  list-style: none; cursor: pointer; padding: 12px 14px; border-radius: 12px;
  background: var(--g); color: #fff; font-weight: 600;
}
details.schiesszeiten > summary::-webkit-details-marker { display: none; }
details.schiesszeiten > summary::after { content: " ▾"; }
details.schiesszeiten[open] > summary { border-radius: 12px 12px 0 0; }
details.schiesszeiten[open] > summary::after { content: " ▴"; }
.schiesszeiten-text { padding: 4px 14px 10px; }
.schiesszeiten-text p { margin: 10px 0; }
#schiesszeiten textarea { min-height: 320px; }
