/* ---------- Allgemein ---------- */
.table td, .table th { vertical-align: middle; }
.stat-card .stat-num { font-size: 2.5rem; font-weight: 600; line-height: 1.2; }
@media (max-width: 767.98px) { .stat-card .stat-num { font-size: 1.4rem; } }
.font-mono { font-family: var(--bs-font-monospace); }
.participant-list { max-height: 26rem; overflow-y: auto; }

/* Formulare: Label links neben dem Feld (.form-h > .row) */
.form-h .row { --bs-gutter-x: .75rem; margin-bottom: .6rem; }
.form-h .col-form-label { font-weight: 500; }
.form-h .form-section { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
  color: var(--bs-secondary-color); border-bottom: 1px solid var(--bs-border-color); padding-bottom: .25rem; margin: 1.25rem 0 .75rem; }
.form-h .form-section:first-child { margin-top: 0; }
@media (max-width: 575.98px) {
  .form-h .col-form-label { font-size: .9rem; }
}

/* Buttonleiste unter Formularen: immer eine Zeile */
.form-actions { display: flex; flex-wrap: nowrap; align-items: center; gap: .5rem; }
.form-actions .btn { white-space: nowrap; }
@media (max-width: 575.98px) {
  .form-actions { gap: .35rem; }
  .form-actions .btn { padding-left: .6rem; padding-right: .6rem; }
}

/* Teilnehmerauswahl: Abteilung (fett) → Unterabteilung → Mitarbeiter, jeweils eingerückt */
.participant-list .form-check { margin-bottom: .15rem; }
.participant-list .form-check-label { cursor: pointer; }
.participant-list .pl-main {
  position: sticky; top: 0; z-index: 2; background: var(--bs-body-bg);
  margin-top: .75rem; padding-top: .4rem; padding-bottom: .3rem;
  border-bottom: 2px solid var(--bs-primary-border-subtle);
}
.participant-list .pl-main:first-child { margin-top: 0; }
.participant-list .pl-main .form-check-label { font-weight: 700; }
.participant-list .pl-sub {
  margin-left: 1.5rem; margin-top: .5rem; padding-top: .15rem; padding-bottom: .15rem;
  border-bottom: 1px solid var(--bs-border-color-translucent);
}
.participant-list .pl-sub .form-check-label { font-weight: 600; }
.participant-list .pl-sub .form-check-label::before {
  content: "\F132"; font-family: "bootstrap-icons"; font-weight: normal; color: var(--bs-secondary-color); margin-right: .3rem;
}
.participant-list .pl-sub-none .form-check-label { font-weight: 500; font-style: italic; color: var(--bs-secondary-color); }
.participant-list .pl-emp { margin-left: 1.5rem; }
.participant-list .pl-emp-sub { margin-left: 3.25rem; }

/* ---------- Erfassungs-Terminal ---------- */
.terminal { max-width: 36rem; margin: 0 auto; }
.terminal .panel { min-height: 20rem; display: flex; flex-direction: column; justify-content: center; }
.terminal .big-btn { font-size: 1.5rem; padding: 1.1rem 1rem; }
.terminal .person-name { font-size: 2.2rem; font-weight: 700; line-height: 1.2; }

.nfc-wave {
  width: 9rem; height: 9rem; margin: 1.5rem auto; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bs-primary-bg-subtle); color: var(--bs-primary);
  font-size: 4.5rem; position: relative;
}
.nfc-wave::before, .nfc-wave::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid var(--bs-primary); opacity: 0;
  animation: nfc-pulse 2.4s ease-out infinite;
}
.nfc-wave::after { animation-delay: 1.2s; }
@keyframes nfc-pulse {
  0%   { transform: scale(1);   opacity: .6; }
  100% { transform: scale(1.6); opacity: 0; }
}
.result-icon { font-size: 5rem; line-height: 1; }

/* Typeahead (manuelle Erfassung) */
.typeahead { position: relative; }
.typeahead-results {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 1050;
  max-height: 22rem; overflow-y: auto; margin-top: .25rem;
}
.typeahead-results .list-group-item { padding-top: .75rem; padding-bottom: .75rem; }
.typeahead:has(.is-invalid) .invalid-feedback { display: block; }
.typeahead .search-cancel { display: none; }

/* Tabellen: Sortierung und Filterzeile (data-table-tools) */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--bs-primary); }
th .sort-icon { font-size: .75em; opacity: .35; }
th[data-dir] .sort-icon { opacity: 1; color: var(--bs-primary); }
.btn.filter-btn {
  --bs-btn-color: var(--bs-secondary-color); --bs-btn-hover-color: var(--bs-primary);
  --bs-btn-active-color: var(--bs-primary); --bs-btn-focus-box-shadow: none;
  line-height: 1; vertical-align: baseline; text-decoration: none; border: 0;
}
.btn.filter-btn[aria-expanded="true"] { color: var(--bs-primary); }
.filter-menu { min-width: 14rem; max-width: min(22rem, 90vw); font-weight: normal; white-space: normal; cursor: default; }
.filter-menu .filter-options { max-height: min(18rem, 50vh); overflow-y: auto; }
.filter-menu .form-check { margin-bottom: .2rem; }
.terminal.searching .typeahead .search-cancel { display: block; }

/* ---------- Mobil: Seite genau so hoch wie der Bildschirm ----------
   body.fit-screen (page_header opts fit): die Seite selbst scrollt nicht,
   .fit-fill füllt die Resthöhe, nur .fit-scroll scrollt (z. B. Tabellen). */
@media screen and (max-width: 767.98px) {
  body.fit-screen {
    height: 100vh; height: 100dvh;
    overflow: hidden; overscroll-behavior: none;
    display: flex; flex-direction: column;
  }
  body.fit-screen > nav { flex-shrink: 0; }
  body.fit-screen .navbar-collapse { max-height: 70dvh; overflow-y: auto; }
  body.fit-screen > main {
    flex: 1 1 auto; min-height: 0;
    display: flex; flex-direction: column;
    padding-top: .75rem !important; padding-bottom: .75rem !important;
  }
  body.fit-screen > main > * { flex-shrink: 0; }
  body.fit-screen .fit-fill { flex: 1 1 auto !important; min-height: 0; display: flex; flex-direction: column; }
  body.fit-screen .fit-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; }
  body.fit-screen .fit-scroll thead { position: sticky; top: 0; z-index: 2; }
  body.fit-screen h1 { font-size: 1.35rem; }
  body.fit-screen .fit-limit { max-height: 35dvh; overflow: auto; }

  /* Terminal */
  body.fit-screen .terminal { width: 100%; }
  body.fit-screen .terminal .panel { min-height: 0; flex: 1 1 auto; }
  body.fit-screen .terminal .card-body { display: flex; flex-direction: column; overflow: hidden; padding: .75rem; }
  body.fit-screen .terminal .big-btn { font-size: 1.25rem; padding: .8rem 1rem; }
  body.fit-screen .terminal .person-name { font-size: 1.8rem; }
  body.fit-screen .nfc-wave { width: 6.5rem; height: 6.5rem; font-size: 3.2rem; margin: 1rem auto; }
  body.fit-screen .result-icon { font-size: 3.5rem; }

  /* Während der Namenssuche nur Suchfeld + Treffer zeigen */
  body.fit-screen .terminal.searching .terminal-main { display: none !important; }
  body.fit-screen .terminal.searching .typeahead { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; margin-top: 0 !important; }
  body.fit-screen .terminal.searching .typeahead-results { position: static; max-height: none; flex: 1 1 auto; min-height: 0; }
}
@media screen and (max-width: 767.98px) and (max-height: 640px) {
  body.fit-screen .nfc-wave { width: 5rem; height: 5rem; font-size: 2.5rem; margin: .5rem auto; }
  body.fit-screen .terminal .person-name { font-size: 1.5rem; }
}

@media print {
  body { background: #fff !important; }
  .card { border: 0 !important; box-shadow: none !important; }
}

.min-w-0 { min-width: 0; }