/* ================= Matching (Runde 2d, PIPELINE): Reiter Vorgeschlagen und Erfolgreich (.pi-), Einsatz-Kontrolle (.ek-) =================
   Nur Tokens aus styles.css. iPersonal Rot nur über die bestehenden Knöpfe, Balken und Markierungen neutral bzw. mit ok/warn-Tokens,
   MediPersonal damit ohne Rot. Hell und dunkel über die Tokens. Bausteine wiederverwendet: .wahl, .tag, .fchip, .kv-raster/.kv-karte, .pd-*. */

/* ---------- Gemeinsam ---------- */
.pi-vs, .pi-es { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pi-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; min-width: 0; }
.pi-suche { flex: 1 1 260px; max-width: 440px; position: relative; display: flex; align-items: center; margin: 0; min-width: 0; }
.pi-suche svg.i { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.pi-suche input { width: 100%; height: 38px; padding-left: 34px; }
.pi-wahlen { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.pi-select { height: 36px; min-width: 160px; max-width: 100%; }
.pi-chips { margin: 0; }
.pi-chips .fchip { font: inherit; font-size: 13px; cursor: pointer; }
.pi-chips .fchip:focus-visible, .pi-monat:focus-visible, .pi-wer:focus-visible { outline: 2px solid var(--fokus, var(--line-3)); outline-offset: 2px; }
.pi-gefiltert { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0; padding: 8px 12px; border-radius: 12px; background: var(--flaeche-2); border: 1px solid var(--line); font-size: 13px; }
.pi-gefiltert svg.i { width: 15px; height: 15px; color: var(--muted); }
.pi-leer { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 16px; text-align: center; color: var(--muted); }
.pi-leer svg.i { width: 28px; height: 28px; opacity: .7; }
.pi-leer p { margin: 0; max-width: 520px; line-height: 1.5; }
.pi-mehr { display: flex; justify-content: center; }
.pi-mehr:empty { display: none; }

/* Wer: Logo bzw. Foto mit Name und Unterzeile */
.pi-wer { display: inline-flex; align-items: center; gap: 9px; min-width: 0; max-width: 100%; color: var(--text); text-decoration: none; vertical-align: middle; }
.pi-wer:hover b { text-decoration: underline; text-underline-offset: 3px; }
.pi-wer > :first-child { flex: none; }
.pi-wer-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.pi-wer-text b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-wer-text small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-woanders { display: inline-block; margin: 4px 0 0 0; }
.pi-berater { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; }
.pi-berater span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-gesendet, .pi-stand { display: inline-flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.pi-gesendet small, .pi-stand small { font-size: 12px; color: var(--muted); }
.pi-stand .tag { align-self: flex-start; margin: 0; }
.pi-akt { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.pi-akt .btn { white-space: nowrap; }
.btn.pi-faellig { background: var(--warn-bg); color: var(--warn-tx); border-color: var(--warn-ln); }
.btn.pi-faellig:hover { border-color: var(--warn-tx); }

/* Tabelle ab 900 px */
.pi-tw { border: 1px solid var(--line); border-radius: 14px; }
.pi-tabelle td { white-space: normal; padding: 10px 10px; }
.pi-tabelle th { padding: 9px 10px; }
.pi-tabelle td:first-child, .pi-tabelle td:nth-child(2) { max-width: 240px; }
.pi-tabelle .pi-gesendet b, .pi-tabelle .pi-gesendet small { white-space: nowrap; }
.pi-tabelle tbody tr:hover td { background: var(--hover); }
.pi-tabelle tr.pi-zeile-faellig td:first-child { box-shadow: inset 3px 0 0 var(--warn-ln); }
.pi-akt-zelle { text-align: right; width: 1%; }
.pi-tabelle .pi-akt { flex-wrap: nowrap; }
.pi-beginn, .pi-dauer-zelle { white-space: nowrap; }
.pi-dauer-zelle { display: flex; flex-direction: column; gap: 2px; }
.pi-tabelle td.pi-dauer-zelle { display: table-cell; }
.pi-dauer-zelle small { display: block; font-size: 12px; }
.pi-dauer.laeuft { color: var(--ok-tx); font-weight: 600; }

/* Karten unter 900 px */
.pi-raster { min-height: 0; }
.pi-karte { gap: 9px; }
.pi-karte.pi-zeile-faellig { border-color: var(--warn-ln); }
.pi-k-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.pi-k-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.pi-k-fuss { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- Pop-ups Stand und Nachhaken ---------- */
.pi-pop { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pi-pop-titel { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 18px; }
.pi-paar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px 14px; padding: 12px; border-radius: 14px; background: var(--flaeche-2); border: 1px solid var(--line); }
.pi-paar > a, .pi-paar > .pi-wer { min-width: 0; }
.pi-paar-mitte { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--flaeche-3); color: var(--muted); }
.pi-paar-mitte svg.i { width: 16px; height: 16px; }
.pi-paar .pi-woanders { grid-column: 3; justify-self: start; margin-top: -4px; }
.pi-pop-meta { margin: 0; }
.pi-alte-notiz { display: flex; align-items: flex-start; gap: 7px; margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--flaeche-2); border: 1px solid var(--line); }
.pi-alte-notiz svg.i { width: 14px; height: 14px; margin-top: 2px; color: var(--muted); flex: none; }
.pi-stand-wahl, .pi-gruende, .pi-art { flex-wrap: wrap; border-radius: 16px; max-width: 100%; align-self: flex-start; }
.pi-stand-wahl > button[disabled] { opacity: .45; cursor: not-allowed; }
.pi-st-felder { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pi-st-felder:empty { display: none; }
.pi-st-felder p { margin: 0; }
.pi-felder-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: end; }
.pi-feld { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; margin: 0; min-width: 0; }
.pi-feld input { width: 100%; min-height: 36px; }
.pi-lbl { font-size: 12px; font-weight: 700; color: var(--muted); }
.pi-hinweis { margin: 0; }
.pi-notiz { display: flex; flex-direction: column; gap: 4px; font-size: 13px; margin: 0; }
.pi-notiz textarea { width: 100%; }
.pi-nh-knoepfe { display: flex; flex-wrap: wrap; gap: 8px; }
.pi-pop .modal-actions { flex-wrap: wrap; margin-top: 4px; }

/* ---------- Erfolgreich: Kacheln und Monatsbalken ---------- */
.pi-kacheln { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.pi-kachel { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 14px; background: var(--flaeche-2); border: 1px solid var(--line); min-width: 0; }
.pi-kachel span { font-size: 12.5px; color: var(--muted); }
.pi-kachel b { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.pi-kachel-ok b { color: var(--ok-tx); }
.pi-es-kopf { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; }
.pi-h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14.5px; }
.pi-h3 svg.i { width: 16px; height: 16px; color: var(--muted); }
.pi-balken { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; height: 160px; padding: 10px 10px 6px; border-radius: 14px; background: var(--flaeche-2); border: 1px solid var(--line); }
.pi-monat { font: inherit; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; min-width: 0; height: 100%; padding: 2px 0; border: 1px solid transparent; border-radius: 10px; background: none; color: var(--text); cursor: pointer; }
.pi-monat:hover { background: var(--hover); }
.pi-monat b { font-size: 12px; font-weight: 700; line-height: 1; }
.pi-monat.leer b { color: var(--muted-2); font-weight: 500; }
.pi-saeule { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; min-height: 0; }
.pi-saeule i { display: block; width: min(28px, 62%); height: var(--h, 0%); min-height: 3px; border-radius: 6px 6px 2px 2px; background: var(--line-3); transition: height .25s ease; }
.pi-monat.jetzt .pi-saeule i { background: var(--silber); }
.pi-monat.aktiv { border-color: var(--line-3); background: var(--flaeche-3); }
.pi-monat.aktiv .pi-saeule i { background: var(--ok-tx); }
.pi-monat small { font-size: 11px; color: var(--muted); }
.pi-monat.jetzt small { color: var(--text); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .pi-saeule i { transition: none; } }

/* ---------- Einsatz-Kontrolle: Durchlauf ---------- */
@media (min-width: 900px) {
  .modal-box.pd-fenster.ek-fenster { height: auto; min-height: min(520px, 94vh); max-height: 94vh; width: min(1080px, 100%); }
  .modal-box.pd-fenster.ek-fenster.pd-klein { min-height: 0; width: min(720px, 100%); }
}
.ek .pd-kopf h2 a { color: inherit; text-decoration: none; }
.ek .pd-kopf h2 a:hover { text-decoration: underline; text-underline-offset: 3px; }
.ek-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ek-zeile { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--flaeche-2); border: 1px solid var(--line); min-width: 0; }
.ek-zeile.beantwortet { background: var(--flaeche-b); }
.ek-wer { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.ek-wer-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 200px; line-height: 1.3; }
.ek-wer-text a { color: var(--text); }
.ek-wer-text b { font-weight: 650; }
.ek-wer-text small { font-size: 12.5px; color: var(--muted); }
.ek-wer .tag { margin: 0; }
.ek-knoepfe { display: flex; flex-wrap: wrap; gap: 8px; }
.ek-knoepfe .btn { min-height: 40px; }
.ek-knoepfe .btn.ek-an { border-color: var(--line-3); background: var(--flaeche-3); }
.ek-auf { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; padding-top: 10px; border-top: 1px dashed var(--line-strong); }
.ek-feld { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; margin: 0; }
.ek-feld input { min-height: 36px; }
.ek-auf-hinweis { flex: 1 1 100%; margin: 0; }
.ek-lbl { flex: 1 1 100%; font-size: 12px; font-weight: 700; color: var(--muted); }
.ek-gruende { display: flex; flex-wrap: wrap; gap: 6px; }
.ek-antwort { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ek-antwort > svg.i { width: 16px; height: 16px; color: var(--ok-tx); }
.ek-antwort .tag { margin: 0; }
.ek-antwort small { font-size: 12.5px; }
.ek-w-zahl { margin-left: auto; }
.ek .pd-w-name { flex: 1 1 auto; }
.ek .pd-entscheid .spacer { flex: 1; }
/* Zeilen wie im Prüf-Durchlauf (.pd-ende-liste li: Rahmen, Radius, Innenabstand 8px 12px) */
.ek-ende-liste li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ek-ende-liste .tag { margin: 0; }
.ek-leer-pop h2 { display: flex; align-items: center; gap: 9px; margin: 0 0 8px; font-size: 18px; }

/* ---------- Einsatz-Kontrolle: Wochenübersicht ---------- */
.ek-ue { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ek-ue-kopf { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; }
.ek-ue-kopf h2 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 18px; }
.ek-woche { display: inline-flex; align-items: center; gap: 6px; }
.ek-woche-text { display: inline-flex; flex-direction: column; align-items: center; min-width: 84px; line-height: 1.2; }
.ek-woche-text small { font-size: 11.5px; color: var(--muted); }
.ek-ue > p { margin: 0; }
.ek-tabelle td, .ek-tabelle th { padding: 9px 10px; }
.ek-tabelle tfoot td { font-weight: 600; border-bottom: 0; border-top: 1px solid var(--line-strong); }
.ek-person { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.ek-person .muted { margin-left: 2px; }
.ek-status { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ek-status .tag { margin: 0; }
.ek-status small { font-size: 12px; }
.ek-karten { display: flex; flex-direction: column; gap: 10px; }
.ek-ue-karte { gap: 8px; }
.ek-ue-zahlen { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); }
.ek-ue-fuss { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- Einsatz-Kontrolle: Mein Tag und Einstellungen ---------- */
.ek-karte { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 14px; flex-wrap: wrap; }
.ek-karte-ic { flex: none; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--flaeche-3); color: var(--muted); }
.ek-karte-offen .ek-karte-ic { background: var(--warn-bg); color: var(--warn-tx); box-shadow: inset 0 0 0 1px var(--warn-ln); }
.ek-karte-text { flex: 1 1 260px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ek-karte-text small { font-size: 12.5px; color: var(--muted); }
.ek-link { font: inherit; padding: 0; border: 0; background: none; color: var(--text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.ek-link:focus-visible { outline: 2px solid var(--fokus, var(--line-3)); outline-offset: 2px; border-radius: 4px; }
#ek-mein-tag:empty, #ek-einstellungen:empty { display: none; }
.ek-einst { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; margin-bottom: 8px; }
.ek-einst .check-line { flex: 1 1 100%; }
.ek-einst-knoepfe { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Schmal ---------- */
@media (max-width: 899px) {
  .pi-suche { max-width: none; flex-basis: 100%; }
  .pi-wahlen { width: 100%; }
  .pi-wahlen .wahl { flex: 1 1 auto; }
  .pi-wahlen .wahl button { flex: 1 1 0; justify-content: center; padding: 0 8px; }
  .pi-select { flex: 1 1 100%; }
  .pi-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .pi-chips::-webkit-scrollbar { display: none; }
  .pi-chips .fchip { flex: none; }
  .pi-kacheln { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pi-balken { gap: 2px; padding: 8px 4px 4px; height: 140px; }
  .pi-monat small { font-size: 10px; }
}
@media (max-width: 560px) {
  .pi-paar { grid-template-columns: minmax(0, 1fr); justify-items: start; }
  .pi-paar-mitte { display: none; }
  .pi-paar .pi-woanders { grid-column: 1; margin-top: -6px; }
  .pi-felder-2 { grid-template-columns: minmax(0, 1fr); }
  .pi-pop .modal-actions .btn, .pi-nh-knoepfe .btn, .pi-nh-knoepfe .anruf { flex: 1 1 100%; justify-content: center; }
  .pi-akt { justify-content: flex-start; }
  .pi-kachel b { font-size: 22px; }
  .ek-knoepfe .btn { flex: 1 1 100%; justify-content: center; }
  .ek-auf .ek-feld { flex: 1 1 100%; }
  .ek-auf .ek-feld input { width: 100%; }
  .ek-auf > .btn { flex: 1 1 100%; justify-content: center; }
  .ek-karte > .btn { flex: 1 1 100%; justify-content: center; }
  .ek-woche-text { min-width: 64px; }
}
