/* ASW Kursverwaltung – mobil zuerst. Farben zentral hier anpassen (Logo/Farben von ASW folgen). */
:root {
  --akzent: #1f5fa8;
  --akzent-dunkel: #174a85;
  --akzent-hell: #e8f0fa;
  --text: #1b2430;
  --text-leise: #5b6675;
  --hintergrund: #f3f5f8;
  --flaeche: #ffffff;
  --rand: #d9dee5;
  --gruen: #1f7a3d;
  --gruen-hell: #e3f4e8;
  --gelb: #8a5a00;
  --gelb-hell: #fdf1d6;
  --rot: #b42318;
  --rot-hell: #fde7e5;
  --grau-hell: #eceff3;
  --radius: 12px;
  --schatten: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--hintergrund); color: var(--text);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--akzent); }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; line-height: 1.2; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
p { margin: .4rem 0 .8rem; }
.leise { color: var(--text-leise); }
.klein { font-size: .88rem; }
.fett { font-weight: 600; }
.versteckt { display: none !important; }
.mitte { text-align: center; }
.umbruch { overflow-wrap: anywhere; }

/* ---------- Kopfzeile & Navigation */
.kopf {
  position: sticky; top: 0; z-index: 20; background: var(--akzent); color: #fff;
  display: flex; align-items: center; gap: .5rem; padding: .5rem 1rem; min-height: 56px;
}
.kopf a { color: #fff; text-decoration: none; }
.kopf .marke { font-weight: 700; font-size: 1.05rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kopf button.menue-knopf {
  background: transparent; border: 1px solid rgba(255,255,255,.5); color: #fff; border-radius: 10px;
  min-height: 44px; min-width: 44px; font-size: 1rem; padding: 0 .8rem; cursor: pointer;
}
.badge { display: inline-block; min-width: 1.4em; padding: 0 .4em; border-radius: 1em; background: #fff; color: var(--akzent);
  font-size: .8rem; font-weight: 700; text-align: center; margin-left: .3em; }
nav.menue { background: var(--flaeche); border-bottom: 1px solid var(--rand); box-shadow: var(--schatten); }
nav.menue a { display: block; padding: .9rem 1.2rem; border-top: 1px solid var(--grau-hell); color: var(--text); text-decoration: none; }
nav.menue a.aktiv { font-weight: 700; color: var(--akzent); }
nav.menue .gruppe { padding: .7rem 1.2rem .2rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-leise); }

main { max-width: 980px; margin: 0 auto; padding: 1rem 1rem 5rem; }
main.schmal { max-width: 560px; }

/* ---------- Karten, Listen */
.karte { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; box-shadow: var(--schatten); }
.karte h2:first-child, .karte h3:first-child { margin-top: 0; }
a.karte { display: block; color: inherit; text-decoration: none; }
a.karte:active { background: var(--akzent-hell); }
.zeile { display: flex; gap: .75rem; align-items: center; }
.zeile > .wachsen { flex: 1; min-width: 0; }
.stapel > * + * { margin-top: .6rem; }
.raster { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.liste { list-style: none; margin: 0; padding: 0; }
.liste > li { border-top: 1px solid var(--grau-hell); padding: .75rem 0; }
.liste > li:first-child { border-top: 0; }
.zahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .6rem; }
.zahl { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); padding: .7rem; text-align: center; }
.zahl b { display: block; font-size: 1.6rem; line-height: 1.1; }

/* ---------- Status */
.pill { display: inline-block; padding: .15em .6em; border-radius: 1em; font-size: .82rem; font-weight: 600; white-space: nowrap; background: var(--grau-hell); color: var(--text); }
.pill.gruen { background: var(--gruen-hell); color: var(--gruen); }
.pill.gelb { background: var(--gelb-hell); color: var(--gelb); }
.pill.rot { background: var(--rot-hell); color: var(--rot); }
.pill.blau { background: var(--akzent-hell); color: var(--akzent-dunkel); }
.banner { border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; font-weight: 600; }
.banner.gruen { background: var(--gruen-hell); color: var(--gruen); border: 1px solid #b7e1c3; }
.banner.gelb { background: var(--gelb-hell); color: var(--gelb); border: 1px solid #f3d99a; }
.banner.rot { background: var(--rot-hell); color: var(--rot); border: 1px solid #f5bdb7; }
.banner.blau { background: var(--akzent-hell); color: var(--akzent-dunkel); border: 1px solid #c6d8ef; }
.banner ul { margin: .4rem 0 0; padding-left: 1.2rem; font-weight: 400; }

/* ---------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 48px; padding: .6rem 1.1rem; border-radius: 10px; border: 1px solid var(--rand);
  background: var(--flaeche); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.primaer { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.btn.primaer:active { background: var(--akzent-dunkel); }
.btn.gruen { background: var(--gruen); border-color: var(--gruen); color: #fff; }
.btn.gefahr { background: var(--flaeche); border-color: #f0a8a1; color: var(--rot); }
.btn.leise { border-color: transparent; background: transparent; color: var(--akzent); }
.btn.gross { width: 100%; min-height: 60px; font-size: 1.1rem; }
.btn.klein { min-height: 40px; padding: .3rem .8rem; font-size: .92rem; }
.knopfleiste { display: flex; flex-wrap: wrap; gap: .6rem; margin: .8rem 0; }
.knopfleiste.voll > .btn { flex: 1 1 200px; }
.unten-fix { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--hintergrund) 30%); padding: 1rem 0 .5rem; z-index: 5; }

/* ---------- Formulare */
label { display: block; font-weight: 600; margin: .9rem 0 .3rem; }
label .leise { font-weight: 400; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], input[type=tel], select, textarea {
  width: 100%; min-height: 52px; padding: .6rem .8rem; font: inherit; font-size: 17px; color: var(--text);
  border: 1px solid #b9c2ce; border-radius: 10px; background: #fff;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 3px solid rgba(31, 95, 168, .35); outline-offset: 1px; }
.haken { display: flex; gap: .75rem; align-items: flex-start; font-weight: 400; margin: .8rem 0; cursor: pointer; }
.haken input { width: 26px; height: 26px; flex: none; margin: 0; accent-color: var(--akzent); }
.fehlertext { color: var(--rot); font-weight: 600; margin: .6rem 0; }
.feldgruppe { display: grid; gap: 0 .8rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
fieldset { border: 1px solid var(--rand); border-radius: var(--radius); padding: .4rem 1rem 1rem; margin: 1rem 0; }
legend { font-weight: 700; padding: 0 .4rem; }

/* Segment-Auswahl (große Touch-Flächen statt Dropdown) */
.segmente { display: flex; flex-wrap: wrap; gap: .4rem; }
.segmente label { margin: 0; flex: 1 1 auto; }
.segmente input { position: absolute; opacity: 0; pointer-events: none; }
.segmente span { display: block; text-align: center; padding: .7rem .8rem; border: 1px solid #b9c2ce; border-radius: 10px; background: #fff; font-weight: 600; cursor: pointer; }
.segmente input:checked + span { background: var(--akzent); color: #fff; border-color: var(--akzent); }
.segmente input:focus-visible + span { outline: 3px solid rgba(31, 95, 168, .35); }

/* ---------- Teilnehmerliste im Cockpit */
.tn { display: flex; gap: .75rem; align-items: center; padding: .7rem 0; border-top: 1px solid var(--grau-hell); }
.tn:first-child { border-top: 0; }
.tn .foto { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--grau-hell); flex: none; display: grid; place-items: center; color: var(--text-leise); font-weight: 700; }
.tn .name { font-weight: 600; overflow-wrap: anywhere; }
.tn button.ganz { all: unset; flex: 1; min-width: 0; cursor: pointer; }
.tn input[type=checkbox] { width: 30px; height: 30px; accent-color: var(--gruen); flex: none; }
.abhaken { display: flex; gap: .9rem; align-items: center; padding: .8rem .2rem; border-top: 1px solid var(--grau-hell); cursor: pointer; font-weight: 600; margin: 0; }
.abhaken:first-child { border-top: 0; }
.abhaken input { width: 32px; height: 32px; accent-color: var(--gruen); flex: none; margin: 0; }

/* ---------- Schrittleiste */
.schritte { display: grid; grid-template-columns: repeat(var(--anzahl, 5), minmax(0, 1fr)); gap: .3rem; margin: 0 0 1rem; }
.schritte button {
  all: unset; cursor: pointer; text-align: center; padding: .45rem .1rem; border-radius: 10px; font-size: .78rem; font-weight: 600;
  color: var(--text-leise); background: var(--flaeche); border: 1px solid var(--rand); min-width: 0; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word;
}
.schritte button b { display: block; font-size: 1.05rem; }
.schritte button.aktiv { background: var(--akzent); color: #fff; border-color: var(--akzent); }
.schritte button.fertig:not(.aktiv) { background: var(--gruen-hell); color: var(--gruen); border-color: #b7e1c3; }

/* ---------- QR */
.qr { background: #fff; border-radius: var(--radius); padding: .5rem; margin: 0 auto; max-width: 420px; }
.qr img { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.code { font: 700 2rem/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .2em; }
body.vollbild { background: #fff; }
body.vollbild main { max-width: 720px; text-align: center; }

/* ---------- Unterschrift */
.unterschrift { position: relative; border: 2px dashed #9aa6b5; border-radius: var(--radius); background: #fff; touch-action: none; }
.unterschrift canvas { display: block; width: 100%; height: 220px; touch-action: none; }
.unterschrift .linie { position: absolute; left: 8%; right: 8%; bottom: 48px; border-bottom: 1px solid #c3cad4; pointer-events: none; }

/* ---------- Test (Teilnehmer) */
.frage { font-size: 1.2rem; font-weight: 700; margin: .5rem 0 1rem; overflow-wrap: anywhere; }
.antwort { display: flex; gap: .8rem; align-items: center; width: 100%; text-align: left; padding: 1rem; margin: 0 0 .7rem;
  border: 2px solid var(--rand); border-radius: var(--radius); background: #fff; font: inherit; cursor: pointer; color: var(--text); min-height: 64px; }
.antwort .kreis { width: 28px; height: 28px; border: 2px solid #9aa6b5; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; }
.antwort.eckig .kreis { border-radius: 6px; }
.antwort.gewaehlt { border-color: var(--akzent); background: var(--akzent-hell); }
.antwort.gewaehlt .kreis { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.fortschritt { height: 8px; background: var(--grau-hell); border-radius: 4px; overflow: hidden; margin: .4rem 0 1rem; }
.fortschritt > div { height: 100%; background: var(--akzent); transition: width .2s; }
.punkte { display: flex; flex-wrap: wrap; gap: .35rem; margin: .5rem 0 1rem; }
.punkte button { all: unset; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-size: .85rem; font-weight: 600; background: var(--grau-hell); cursor: pointer; }
.punkte button.beantwortet { background: var(--akzent-hell); color: var(--akzent-dunkel); }
.punkte button.aktuell { outline: 2px solid var(--akzent); }
.ergebnis-gross { font-size: 3rem; font-weight: 800; line-height: 1; margin: .5rem 0; }
.foto-vorschau { width: 160px; height: 200px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--rand); display: block; margin: .5rem auto; background: var(--grau-hell); }

/* ---------- Tabellen (Büro): auf dem Handy als Karten */
.tabelle { width: 100%; border-collapse: collapse; background: var(--flaeche); border-radius: var(--radius); overflow: hidden; }
.tabelle th, .tabelle td { padding: .6rem .7rem; border-bottom: 1px solid var(--grau-hell); text-align: left; vertical-align: top; }
.tabelle th { font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-leise); background: #f8f9fb; }
.tabelle tr.klickbar { cursor: pointer; }
.tabelle tr.klickbar:hover td { background: #f8fafd; }
@media (max-width: 700px) {
  .tabelle thead { display: none; }
  .tabelle, .tabelle tbody, .tabelle tr, .tabelle td { display: block; width: 100%; }
  .tabelle tr { border-bottom: 1px solid var(--rand); padding: .5rem 0; }
  .tabelle td { border: 0; padding: .2rem .8rem; }
  .tabelle td[data-label]::before { content: attr(data-label) ": "; color: var(--text-leise); font-size: .85rem; }
}

/* ---------- Dialog, Meldungen */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(16, 24, 40, .45); }
dialog .dialog-inhalt { padding: 1rem 1.1rem 1.2rem; }
dialog .dialog-kopf { display: flex; align-items: center; gap: .5rem; padding: .8rem 1.1rem; border-bottom: 1px solid var(--grau-hell); position: sticky; top: 0; background: #fff; z-index: 1; }
dialog .dialog-kopf h2 { margin: 0; flex: 1; font-size: 1.15rem; }
.toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 100; max-width: calc(100vw - 2rem);
  background: #1b2430; color: #fff; padding: .8rem 1.1rem; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-weight: 600; }
.toast.fehler { background: var(--rot); }
.laden { color: var(--text-leise); padding: 2rem 0; text-align: center; }

@media (min-width: 760px) {
  body { font-size: 16px; }
  h1 { font-size: 1.75rem; }
  .kopf { padding: .5rem 1.5rem; }
  main { padding: 1.5rem 1.5rem 5rem; }
  .schritte button { font-size: .9rem; }
}
@media print {
  .kopf, nav, .knopfleiste, .btn { display: none !important; }
  body { background: #fff; }
}
