/* Abfragen: Ergänzungen zum Design-System "Einsatztafel" (einsatztafel.css).
   Nur Tokens, keine festen Farben. Neue Bausteine im Stil des Systems:
   Zeilenliste (.zeilen/.zeile), Formularfeld (.feld), Zahlenleiste (.zahlen),
   Dialog, Meldung, gewählte Antwortkarte (.choice.gewaehlt). */

[hidden] { display: none !important; }
* { box-sizing: border-box; }
body { margin: 0; }
h1, h2, p { margin: 0; }
main { display: block; }
main > section > .card:first-child, main > .card:first-child { margin-top: var(--gap); }

.leise { color: var(--muted); }
.klein { font-size: .88rem; }
.card > * + * { margin-top: 10px; }
.card > .card-title + * { margin-top: 0; }

/* Lange Wörter umbrechen (DESIGN.md Abschnitt 10) */
.zeile-name, .select-name, .fragetext, .frage, .card-title, .zahlen span { hyphens: auto; overflow-wrap: anywhere; }

/* Kopfzeile: Navigation rechts */
.kopf-nav { display: flex; gap: 8px; }
/* Textlinks wie .btn-link: Textfarbe, roter Unterstrich */
a { color: var(--text); text-decoration-color: var(--red); text-underline-offset: 3px; }
a.icon-btn, a.btn-primary, a.btn-secondary, a.btn-sm { text-decoration: none; color: inherit; }
a.btn-primary { color: #fff; }
a.btn-sm { display: inline-flex; align-items: center; }
.icon-btn:disabled { opacity: .45; cursor: not-allowed; }

/* Formular */
.formular { display: flex; flex-direction: column; gap: 10px; }
.feld { display: flex; flex-direction: column; gap: 6px; font-size: .95rem; color: var(--muted); }
.feld input, .feld textarea, .suche, .option-zeile input, .link-feld {
  width: 100%; background: var(--bg); color: var(--text);
  border: 2px solid var(--line); border-radius: 4px;
  padding: 12px 14px; font: inherit; font-size: 16px; min-height: 48px;
  -webkit-appearance: none; appearance: none;
}
.feld textarea { resize: vertical; line-height: 1.4; }
.feld input:focus, .feld textarea:focus, .suche:focus, .option-zeile input:focus { border-color: var(--red); outline: none; }
.feld input:focus-visible, .feld textarea:focus-visible, .suche:focus-visible, .option-zeile input:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.suche { flex: 1 1 12rem; min-width: 0; }
.knopfzeile { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.knopfzeile > * { flex: 1 1 10rem; }
.werkzeuge { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.optionen { display: flex; flex-direction: column; gap: 8px; }
.option-zeile { display: flex; gap: 8px; align-items: center; }
.option-zeile input { flex: 1; min-width: 0; }
.option-zeile > span { width: 44px; text-align: center; flex-shrink: 0; }

/* Zeilenliste (Abfragen, Empfänger) */
.zeilen { display: flex; flex-direction: column; gap: 8px; }
.zeile {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 52px; padding: 10px 12px; text-align: left;
  background: var(--card-2); border: 1px solid var(--line); border-radius: 4px;
  color: var(--text); font: inherit; text-decoration: none;
}
a.zeile, button.zeile { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a.zeile:active, button.zeile:active { background: var(--press); }
.zeile.inaktiv { opacity: .7; }
.zeile-haupt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.zeile-name { font-weight: 600; }
.zeile-meta { color: var(--muted); font-size: .88rem; }
.zeile-antwort { font-weight: 600; color: var(--fb-ok); }
.zeile-antwort.ist-offen { color: var(--muted); font-weight: 400; }
.zeile-aktionen { display: flex; gap: 6px; flex-shrink: 0; }
.zahl-gross { font-family: var(--display); font-weight: 700; font-size: 1.8rem; line-height: 1; text-align: center; flex-shrink: 0; min-width: 3rem; }
.zahl-gross small { display: block; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

/* Auswertung: je Antwort eine Zahl */
.fragetext { white-space: pre-line; }
.zahlen { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(9rem, 100%), 1fr)); gap: 8px; }
.zahlen li { background: var(--card-2); border: 1px solid var(--line); border-radius: 4px; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.zahlen span { font-size: .9rem; color: var(--muted); }
.zahlen b { font-family: var(--display); font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.zahlen li.offen b { color: var(--muted); }

/* Antwortseite */
.gruss { font-size: 1.1rem; }
.frage { font-family: var(--display); font-weight: 700; font-size: 1.85rem; line-height: 1.08; text-transform: uppercase; text-wrap: balance; }
/* Versalien nur für kurze Texte (DESIGN.md): lange Titel normal gesetzt */
.frage.lang { text-transform: none; font-size: 1.55rem; font-weight: 600; line-height: 1.2; }
.choice.gewaehlt { border-color: var(--sel-line); background: var(--sel-bg); }
.choice.gewaehlt .letter { background: var(--btn); color: #fff; }

/* Dialog */
dialog {
  border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--card); color: var(--text);
  padding: 20px 18px; width: min(32rem, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
}
dialog::backdrop { background: var(--bg); opacity: .85; }
#dlg-inhalt { display: flex; flex-direction: column; gap: 10px; }
#dlg-inhalt .select-list { max-height: 40dvh; overflow-y: auto; }

/* Meldung unten */
.meldung {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 30;
  width: min(30rem, calc(100vw - 24px));
}

@media (min-width: 960px) {
  .frage { font-size: 2.3rem; }
}

/* Drucken / PDF: nur Auswertung und Liste */
@media print {
  header, .nicht-drucken, .meldung, dialog { display: none !important; }
  .card { border: none; margin: 0 0 12px; padding: 0; }
  .zeile { break-inside: avoid; min-height: 0; padding: 4px 0; border: none; border-bottom: 1px solid var(--line); border-radius: 0; background: none; }
}
