/* app.css: Stylesheet des Fahrten- und Belegbuchs. Hier sind (anders als auf den öffentlichen Seiten) Klassen erlaubt.
   Farben und Schriften passen zur Website: Blau #1A3585, Creme #F6F1E7, Grund #F2F5FA, Rot #E8482F (nur Linien/Akzente),
   Text-Rot #C8371D, Gelb #F2B61F. Kleinste Schrift 13 px, Beschriftungen 14 px, Eingabefelder 16 px (kein Zoom auf iOS). */

:root {
  --blau: #1A3585;
  --blau-dunkel: #122668;
  --creme: #F6F1E7;
  --grund: #F2F5FA;
  --rot: #E8482F;
  --textrot: #C8371D;
  --gelb: #F2B61F;
  --text: #1C1B1A;
  --nebentext: #4A4A48;
  --linie: #C9D0DE;
  --weiss: #FFFFFF;
  --gruen: #1F6B3A;
  --radius: 10px;
  --tippflaeche: 44px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font-family: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 { font-family: 'DM Serif Display', Georgia, serif; font-weight: 400; line-height: 1.2; color: var(--blau); margin: 0 0 12px; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
p { margin: 0 0 12px; }
a { color: var(--blau); text-underline-offset: 2px; }
a:hover { color: var(--textrot); }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
ul { margin: 0; padding: 0; }

/* Sichtbarer Fokus wie auf der Website: innen Blau, außen Gelb */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--blau);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--gelb);
  border-radius: 4px;
}
h1:focus, main:focus { outline: none; box-shadow: none; }

/* Sprunglink: nur bei Tastaturfokus sichtbar */
.sprunglink { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--creme); color: var(--blau); padding: 10px 14px; border-radius: 6px; }
.sprunglink:focus { left: 8px; }

.sr-nur { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Testumgebung (nur auf Dev) */
.testband { background: var(--gelb); color: #1C1B1A; padding: 10px 16px; text-align: center; font-size: 15px; font-weight: 500; }

/* Kopf */
.kopf { background: var(--blau); color: var(--creme); }
.kopf-innen { max-width: 1040px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.marke { color: var(--creme); text-decoration: none; display: flex; flex-direction: column; line-height: 1.15; min-height: var(--tippflaeche); justify-content: center; }
.marke:hover { color: var(--gelb); }
.marke-klein { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; opacity: .9; }
.marke-gross { font-family: 'DM Serif Display', Georgia, serif; font-size: 22px; }
.kopf a:focus-visible, .hauptnav a:focus-visible { outline-color: var(--creme); }

/* Navigation: breit oben im Kopf, schmal unten fest */
.hauptnav[hidden] { display: none; }
.navliste { list-style: none; display: flex; gap: 4px; }
.navliste li { display: flex; }
.hauptnav a { color: var(--creme); text-decoration: none; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tippflaeche); padding: 0 14px; border-radius: 8px; font-size: 16px; }
.hauptnav a:hover { color: var(--gelb); }
.hauptnav a[aria-current="page"] { background: var(--blau-dunkel); box-shadow: inset 0 -3px 0 var(--gelb); }
.plakette { background: var(--gelb); color: #1C1B1A; border-radius: 999px; font-size: 13px; font-weight: 700; min-width: 22px; height: 22px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; }

@media (max-width: 720px) {
  .hauptnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--blau); border-top: 3px solid var(--gelb); padding-bottom: env(safe-area-inset-bottom); }
  .navliste { gap: 0; }
  .navliste li { flex: 1 1 0; min-width: 0; }
  .hauptnav a { flex: 1; flex-direction: column; gap: 0; padding: 6px 2px; min-height: 56px; font-size: 13px; border-radius: 0; text-align: center; line-height: 1.2; }
  .hauptnav a[aria-current="page"] { box-shadow: inset 0 3px 0 var(--gelb); }
  body.angemeldet main { padding-bottom: 96px; }
  .marke-gross { font-size: 19px; }
  h1 { font-size: 26px; }
}

/* Hinweise und Meldungen */
.hinweisband:empty { display: none; }
.hinweis { background: var(--creme); border-bottom: 3px solid var(--rot); padding: 10px 16px; }
.hinweis p { margin: 0; max-width: 1040px; margin-left: auto; margin-right: auto; }
.meldungen { position: sticky; top: 0; z-index: 30; max-width: 760px; width: 100%; margin: 0 auto; padding: 0 16px; }
.meldungen > div:empty { display: none; }
.meldung { margin-top: 12px; padding: 12px 16px; border-radius: var(--radius); border: 2px solid var(--blau); background: var(--weiss); }
.meldung-fehler { border-color: var(--textrot); color: var(--textrot); font-weight: 500; }

/* Inhalt */
main { flex: 1 0 auto; width: 100%; max-width: 760px; margin: 0 auto; padding: 20px 16px 40px; }
main.breit { max-width: 1040px; }
.ansicht > * + * { margin-top: 16px; }
.seitenkopf h1 { margin-bottom: 4px; }
.zurueck { display: inline-flex; align-items: center; min-height: var(--tippflaeche); margin-bottom: 4px; }
.untertitel, .nebentext, .hilfe { color: var(--nebentext); font-size: 14px; }
.laedt { color: var(--nebentext); }

.karte { background: var(--weiss); border-radius: var(--radius); border: 1px solid var(--linie); padding: 16px; }
.karte > :last-child { margin-bottom: 0; }
.karte-fehler { border-color: var(--textrot); }
.karte-fehler p { color: var(--textrot); font-weight: 500; }

/* Formulare */
.formular > * + * { margin-top: 16px; }
.feld label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.feld .hilfe { margin-bottom: 6px; }
.feld input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .feld select, .feld textarea {
  width: 100%; min-height: var(--tippflaeche); padding: 10px 12px; font-size: 16px; background: var(--weiss);
  border: 2px solid #8792AD; border-radius: 8px;
}
.feld textarea { resize: vertical; }
.feld [aria-invalid="true"] { border-color: var(--textrot); }
.feldfehler { color: var(--textrot); font-size: 14px; font-weight: 500; margin: 4px 0 0; }
.formfehler:empty { display: none; }
.formfehler { color: var(--textrot); font-weight: 500; border-left: 4px solid var(--textrot); padding-left: 12px; }
.formfehler p { margin: 0 0 6px; }
.hakenzeile { display: flex; align-items: center; gap: 12px; min-height: var(--tippflaeche); cursor: pointer; font-weight: 400; }
.hakenzeile input { width: 24px; height: 24px; flex: none; accent-color: var(--blau); }
.feld-haken label { margin-bottom: 0; font-size: 16px; }

/* Knöpfe */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tippflaeche); padding: 8px 18px;
  border-radius: 8px; border: 2px solid var(--blau); background: var(--weiss); color: var(--blau);
  font-weight: 500; text-decoration: none; cursor: pointer; font-size: 16px; text-align: center;
}
.knopf:hover { background: var(--creme); color: var(--blau-dunkel); }
.knopf.primaer { background: var(--blau); color: var(--creme); }
.knopf.primaer:hover { background: var(--blau-dunkel); color: var(--weiss); }
.knopf.gefahr { background: var(--weiss); color: var(--textrot); border-color: var(--textrot); }
.knopf.gefahr:hover { background: #FBEAE6; color: var(--textrot); }
.knopf.gefahr.voll { background: var(--textrot); color: var(--weiss); }
.knopf.link { border-color: transparent; background: transparent; text-decoration: underline; padding-left: 8px; padding-right: 8px; }
.knopf.klein { min-height: var(--tippflaeche); padding: 6px 12px; font-size: 15px; }
.knopf[disabled] { opacity: .55; cursor: not-allowed; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Dialog */
.dialog { border: 0; border-radius: var(--radius); padding: 20px; max-width: min(440px, calc(100vw - 32px)); box-shadow: 0 10px 40px rgba(0, 0, 0, .35); }
.dialog::backdrop { background: rgba(18, 38, 104, .55); }
.dialog h2 { font-size: 20px; }
.dialog .knopfreihe { justify-content: flex-end; margin-top: 8px; }
.bilddialog { max-width: calc(100vw - 16px); padding: 12px; }
.bilddialog .grossbild { display: block; max-width: 100%; max-height: calc(100vh - 140px); margin: 0 auto; object-fit: contain; }

/* Kalender */
.monatskopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.monatskopf h1 { margin: 0; text-align: center; flex: 1; }
.monatskopf .knopf { min-width: var(--tippflaeche); font-size: 22px; padding: 4px 12px; }
.kalender { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.kalender th { font-size: 14px; font-weight: 500; color: var(--nebentext); padding: 4px 0; }
.kalender abbr { text-decoration: none; }
.kalender td { padding: 0; height: 56px; }
.kalender td.aus { background: transparent; }
.kalender .tag { width: 100%; height: 100%; min-height: var(--tippflaeche); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: var(--weiss); border: 1px solid var(--linie); border-radius: 8px; cursor: pointer; padding: 2px; }
.kalender .tag:hover { background: var(--creme); border-color: var(--blau); }
.kalender .tag.belegt { border-color: var(--blau); }
.kalender .tag.heute { background: var(--blau); color: var(--creme); border-color: var(--blau); font-weight: 700; }
.kalender .tag.heute:hover { background: var(--blau-dunkel); }
.tagzahl { font-size: 16px; line-height: 1; }
.punkte { display: flex; gap: 3px; min-height: 8px; }
.punkt { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.punkt.fahrt { background: var(--blau); }
.punkt.beleg { background: var(--gruen); }
.punkt.vorschlag { background: var(--gelb); box-shadow: 0 0 0 1px #8A6500; }
.heute .punkt.fahrt { background: var(--creme); }
.heute .punkt.beleg { background: #9FE0B5; }
.legende { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 12px 0; font-size: 14px; color: var(--nebentext); }
.legende .punkt { margin-right: 4px; vertical-align: baseline; }
@media (max-width: 400px) { .kalender { border-spacing: 2px; } .kalender td { height: 52px; } }

/* Einträge des Tages */
.eintraege { list-style: none; display: grid; gap: 12px; margin-top: 8px; }
.eintrag { background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius); padding: 14px 16px; }
.eintrag > * + * { margin-top: 6px; }
.eintrag p { margin-bottom: 0; }
.eintrag-kopf { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.betrag { font-weight: 700; white-space: nowrap; color: var(--blau); }
.marken { display: flex; flex-wrap: wrap; gap: 6px; }
.marke-klein-box { font-size: 13px; font-weight: 500; padding: 2px 10px; border-radius: 999px; background: var(--creme); border: 1px solid var(--blau); color: var(--blau); }
.marke-klein-box.geaendert { border-color: #8A6500; color: #5B4200; background: #FFF4D1; }
.tagwechsel { display: flex; justify-content: space-between; gap: 12px; }
section > h2 { margin-top: 8px; }

/* Ortsuche (Combobox) */
.ortsbox { position: relative; }
.ortsliste { list-style: none; position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 4px; max-height: 300px; overflow-y: auto;
  background: var(--weiss); border: 2px solid var(--blau); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.ortsliste[hidden] { display: none; }
.ortsliste-kopf { font-size: 13px; color: var(--nebentext); padding: 8px 12px 2px; text-transform: uppercase; letter-spacing: .04em; }
.ortseintrag { display: flex; flex-direction: column; padding: 10px 12px; min-height: var(--tippflaeche); cursor: pointer; border-top: 1px solid var(--linie); }
.ortseintrag:first-child { border-top: 0; }
.ortseintrag:hover, .ortseintrag.aktiv { background: var(--blau); color: var(--creme); }
.ortsname { font-weight: 500; }
.ortsdetail { font-size: 14px; opacity: .85; }
.ortsuche-hinweis:empty { display: none; }

/* Fahrtformular */
.gruppe { border: 0; padding: 0; margin: 0; min-width: 0; }
.gruppe legend { font-size: 14px; font-weight: 500; padding: 0; margin-bottom: 2px; }
.kminfo { font-size: 15px; color: var(--nebentext); margin: 0; }
.kminfo:empty { display: none; }

/* Belegdateien */
.dateiwahl { display: grid; gap: 12px; }
.dateiwahl label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.dateifeld { width: 100%; font-size: 15px; padding: 8px; border: 2px dashed #8792AD; border-radius: 8px; background: var(--grund); }
.dateiliste { list-style: none; display: grid; gap: 10px; margin-top: 12px; }
.dateiliste[hidden] { display: none; }
.datei { display: grid; grid-template-columns: 72px 1fr; gap: 6px 12px; align-items: center; padding: 10px; border: 1px solid var(--linie); border-radius: 8px; background: var(--grund); }
.datei .knopf { grid-column: 1 / -1; justify-self: start; }
.vorschau { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--linie); background: var(--weiss); }
.dateisymbol { display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--blau); font-size: 14px; }
.dateitext { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }

/* Terminvorschläge */
.reiter { display: flex; gap: 8px; }
.reiter .knopf[aria-current="page"] { background: var(--blau); color: var(--creme); }
.statusbereich > * + * { margin-top: 8px; }
.fortschritt[hidden] { display: none; }
.fortschritt label { display: block; font-size: 14px; font-weight: 500; }
progress { width: 100%; height: 14px; accent-color: var(--blau); }
.vorschlagliste { display: grid; gap: 24px; }
.tagesgruppe > * + * { margin-top: 12px; }
.vorschlag .ziel { margin: 0; }
.anpassen { margin-top: 12px; padding-top: 12px; border-top: 2px solid var(--linie); }
.rundliste { list-style: none; display: grid; gap: 8px; margin-bottom: 12px; }
.rundzeile { border: 1px solid var(--linie); border-radius: 8px; padding: 8px 12px; background: var(--grund); }
.rundbereich > * + * { margin-top: 12px; }

/* Jahresübersicht */
.reiterliste { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 3px solid var(--blau); }
.reiter-tab { min-height: var(--tippflaeche); min-width: 76px; padding: 6px 18px; font-size: 17px; font-weight: 500; cursor: pointer; background: var(--weiss);
  border: 2px solid var(--blau); border-bottom: 0; border-radius: 8px 8px 0 0; color: var(--blau); }
.reiter-tab[aria-selected="true"] { background: var(--blau); color: var(--creme); }
.kopfwerte { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 0; }
.wert { background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius); padding: 12px 16px; }
.wert dt { font-size: 14px; color: var(--nebentext); }
.wert dd { margin: 0; display: flex; flex-direction: column; }
.wert .gross { font-family: 'DM Serif Display', Georgia, serif; font-size: 26px; color: var(--blau); line-height: 1.2; }
.tabellenrahmen { overflow-x: auto; background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius); }
.uebersicht { width: 100%; border-collapse: collapse; font-size: 15px; }
.uebersicht caption { text-align: left; font-family: 'DM Serif Display', Georgia, serif; font-size: 20px; color: var(--blau); padding: 12px 12px 8px; }
.uebersicht th, .uebersicht td { text-align: left; vertical-align: top; padding: 8px 12px; border-top: 1px solid var(--linie); }
.uebersicht thead th { background: var(--creme); font-size: 14px; border-top: 0; }
.uebersicht .zahl { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.uebersicht .datum { white-space: nowrap; }
.uebersicht tfoot th, .uebersicht tfoot td { font-weight: 700; background: var(--creme); }
.nur-druck { display: none; }
@media (max-width: 720px) { .uebersicht { min-width: 560px; } .uebersicht.summen { min-width: 0; } }
body.druckansicht .kopf, body.druckansicht .hauptnav, body.druckansicht .fuss { display: none; }
body.druckansicht.angemeldet main { padding-bottom: 24px; }

/* Profil und Verwaltung */
.satzliste { display: grid; gap: 16px; margin: 12px 0; }
.satzzeile { padding: 12px; border: 1px solid var(--linie); border-radius: 8px; background: var(--grund); }
.satzfelder { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.gefahrzone { border-color: var(--textrot); border-width: 2px; }
.mitgliederliste { display: grid; gap: 12px; }
.mitglied > * + * { margin-top: 8px; }
.mitglied h3 { margin: 0; }
.rollenzeile { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.rollenzeile .feld { flex: 1 1 200px; }
.loeschform { margin-top: 12px; padding-top: 12px; border-top: 2px solid var(--textrot); }

/* Fuß */
.fuss { flex: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; padding: 16px 16px 24px; font-size: 14px; }
.fuss a { display: inline-flex; align-items: center; min-height: 32px; }
body.angemeldet .fuss { padding-bottom: 96px; }
@media (min-width: 721px) { body.angemeldet .fuss { padding-bottom: 24px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Druck: nur der Inhalt, schwarz auf weiß */
@media print {
  body { background: #fff; color: #000; display: block; font-size: 11pt; }
  .sprunglink, .testband, .kopf, .hauptnav, .hinweisband, .meldungen, .fuss, .knopf, .zurueck, .nicht-drucken { display: none !important; }
  main, main.breit { max-width: none; padding: 0; }
  .karte { border: 0; padding: 0; }
  h1, h2, h3 { color: #000; }
  a { color: #000; text-decoration: none; }
  .nur-druck { display: block !important; font-size: 10pt; margin: 0 0 8pt; }
  .tabellenrahmen { overflow: visible; border: 0; background: none; }
  .uebersicht { font-size: 9.5pt; min-width: 0 !important; }
  .uebersicht th, .uebersicht td { border-top: 0.5pt solid #000; padding: 3pt 5pt; }
  .uebersicht thead th, .uebersicht tfoot th, .uebersicht tfoot td { background: none; border-bottom: 1pt solid #000; }
  .uebersicht thead { display: table-header-group; }
  .uebersicht tr { break-inside: avoid; }
  .wert { border: 0.5pt solid #000; border-radius: 0; padding: 4pt 8pt; }
  .wert .gross { font-size: 14pt; color: #000; }
  .kopfwerte { grid-template-columns: repeat(4, 1fr); gap: 6pt; }
  .uebersicht caption { color: #000; font-size: 12pt; padding-left: 0; }
  .reiterliste { display: none; }
}

/* Seitliche Aussparungen (iPhone quer, viewport-fit=cover): Kopf, Inhalt und Fuß halten Abstand zu Notch und Rundungen */
@media screen {
  .testband, .kopf-innen, .hinweis, .meldungen, main, .fuss {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
}
@media screen and (max-width: 720px) {
  .hauptnav { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
}

/* Monat und Jahr direkt wählen */
/* C-2-06: eine Zeile (Monat, Jahr, Knopf); die Beschriftungen bleiben für Screenreader erhalten, sind aber nicht sichtbar. */
.monatssprung { display: flex; flex-wrap: nowrap; gap: 8px; align-items: center; margin: 4px 0 8px; }
.monatssprung .feld { flex: 1 1 0; min-width: 0; margin: 0; }
.monatssprung .feld + .feld { flex: 0 0 5.5rem; }
.monatssprung .feld label { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.monatssprung .knopf { flex: 0 0 auto; }
