/* Runde 2b FREIGABE: Bestätigen (.bs-), Prüf-Durchlauf (.pd-), Freigabe-Liste (.frg-). Nur Tokens aus styles.css. */

/* ---------- Bestätigen und Eingeben: eigene Ebene über allem (z-index 70: über #modal 50 und Toast 60, unter Anruf 80 und Glocke 90) ---------- */
.bs-ebene { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; background: rgba(5, 6, 8, .55);
  backdrop-filter: blur(1.5px); -webkit-backdrop-filter: blur(1.5px); animation: bs-ein .14s ease-out; }
html[data-theme="light"] .bs-ebene { background: rgba(29, 29, 31, .3); }
.bs-box { width: min(460px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 22px 22px 18px; border-radius: 20px; background: var(--app);
  border: 1px solid var(--line-strong); box-shadow: var(--sch-2), inset 0 1px 0 rgba(255, 255, 255, .04); color: var(--text); }
html[data-theme="light"] .bs-box { background: #fff; }
.bs-box h2 { display: flex; align-items: center; gap: 9px; font-size: 17px; margin: 0 0 8px; letter-spacing: -.01em; }
.bs-text { margin: 0 0 14px; white-space: pre-line; line-height: 1.5; color: var(--text); display: flex; gap: 9px; align-items: flex-start; }
.bs-box h2 + .bs-text { color: var(--muted); }
.bs-feld { width: 100%; margin: 0 0 6px; }
textarea.bs-feld { min-height: 96px; }
.bs-hinweis { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.bs-knoepfe { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.bs-knoepfe .btn { min-width: 110px; }
.bs-warn-ic { width: 18px; height: 18px; flex: none; }
.bs-ist-gefahr h2 .bs-warn-ic, .bs-ist-gefahr .bs-text > .bs-warn-ic { color: var(--gefahr-tx); }
/* Gefahr: iPersonal dunkleres Rot, MediPersonal dunkles Blau mit Warnsymbol (kein Rot) */
.btn.primary.bs-gefahr { background: linear-gradient(180deg, #B8020F, #8F010B); color: #fff; }
.btn.primary.bs-gefahr:hover { background: #9E010D; }
body[data-mandant="med"] .btn.primary.bs-gefahr { background: linear-gradient(180deg, #05608E, #044A6E); }
body[data-mandant="med"] .btn.primary.bs-gefahr:hover { background: #04547C; }
body[data-mandant="med"] .bs-ist-gefahr h2 .bs-warn-ic, body[data-mandant="med"] .bs-ist-gefahr .bs-text > .bs-warn-ic { color: var(--warn-tx); }
.btn.primary.bs-gefahr .bs-warn-ic { color: #fff; width: 16px; height: 16px; }
@keyframes bs-ein { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .bs-ebene { animation: none; } }
@media (max-width: 560px) {
  .bs-ebene { padding: 16px; align-items: end; }
  .bs-box { padding: 18px 16px 14px; border-radius: 18px; }
  .bs-knoepfe { flex-direction: column-reverse; }
  .bs-knoepfe .btn { width: 100%; min-height: 44px; }
}

/* ---------- Prüf-Durchlauf: ein Pop-up je Kandidat, rechts die Warteliste ---------- */
.modal-box.pd-fenster { padding: 0; display: flex; flex-direction: column; height: min(900px, 94vh); max-height: 94vh; overflow: hidden; width: min(1400px, 100%); }
.modal-box.pd-fenster.pd-klein { height: auto; width: min(780px, 100%); }
.pd { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.pd-kopf { display: flex; align-items: flex-start; gap: 14px; padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.pd-kopf-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.pd-zaehler { font-size: 12px; font-weight: 600; letter-spacing: .03em; color: var(--muted); }
.pd-zaehler b { color: var(--text); font-weight: 700; }
.pd-kopf h2 { font-size: 20px; margin: 0; overflow-wrap: anywhere; }
.pd-nr { font-size: 13px; font-weight: 500; }
.pd-unter { font-size: 13px; color: var(--muted); }
.pd-nav { display: flex; gap: 4px; flex: none; }
.pd-rumpf { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 230px; }
.pd-rumpf.pd-einzeln { grid-template-columns: minmax(0, 1fr); }
.pd-inhalt { min-width: 0; min-height: 0; overflow: auto; padding: 16px 20px; }
.pd-laedt { padding: 30px 0; text-align: center; }
.pd-zwei { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.pd-daten { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pd-meta { margin: 0; overflow-wrap: anywhere; }
.pd-h3 { display: flex; align-items: center; gap: 7px; font-size: 13.5px; margin: 10px 0 2px; }
.pd-h3 svg.i { width: 15px; height: 15px; color: var(--muted); }
.pd-hinweis-box { margin: 6px 0 10px; }

/* Vorschau des Lebenslaufs */
.pd-vorschau { position: sticky; top: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; background: var(--flaeche-2); overflow: hidden; }
.pd-vorschau > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 600; }
.pd-vorschau > summary::-webkit-details-marker { display: none; }
.pd-v-kopf { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--flaeche); }
.pd-v-name { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-v-flaeche { height: calc(min(900px, 94vh) - 250px); min-height: 320px; display: grid; place-items: center; background: var(--feld); }
.pd-v-flaeche iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.pd-v-flaeche img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pd-v-leer { padding: 20px; text-align: center; }
@media (min-width: 900px) { .pd-vorschau > summary { display: none; } .pd-v-kopf { border-top: 0; } }

/* Formular und Listen */
.pd-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
.pd-feld { gap: 4px; font-size: 12px; min-width: 0; }
.pd-feld.breit { grid-column: 1 / -1; }
.pd-feld input, .pd-feld select { width: 100%; min-height: 34px; padding: 6px 10px; }
.pd-hinweise, .pd-dubletten, .pd-docs, .pd-check, .pd-nachrichten, .pd-ende-liste, .pd-warte-liste { list-style: none; margin: 0; padding: 0; }
.pd-hinweise { display: grid; gap: 5px; }
.pd-hinweise li { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; }
.pd-hinweise .tag { flex: none; margin: 1px 0 0; }
.pd-dubletten { display: grid; gap: 4px; margin-top: 4px; }
.pd-dubletten li { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; padding: 7px 10px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-tx); border: 1px solid var(--warn-ln); }
.pd-dubletten svg.i { width: 15px; height: 15px; margin-top: 1px; }
.pd-docs { display: grid; gap: 6px; }
.pd-docs li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--flaeche-2); }
.pd-doc-ic { color: var(--muted); display: inline-grid; }
.pd-doc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.pd-doc-text .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-docs .btn[aria-pressed="true"], .pd-check .btn[aria-pressed="true"] { border-color: var(--line-3); background: var(--flaeche-3); }
.pd-check { display: grid; gap: 6px; }
.pd-check li { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 9px; font-size: 13px; }
.pd-check-ic { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 11px; font-weight: 700; border: 1px solid var(--line-strong); color: var(--muted); }
.pd-check .ok > .pd-check-ic { background: var(--ok-bg); color: var(--ok-tx); border-color: var(--ok-ln); }
.pd-check .fehlt > .pd-check-ic { background: var(--warn-bg); color: var(--warn-tx); border-color: var(--warn-ln); }
.pd-check-text { flex: 1; min-width: 0; }
.pd-nachrichten { display: grid; gap: 6px; }
.pd-nachrichten li { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 12px; font-size: 13px; white-space: pre-line; overflow-wrap: anywhere; background: var(--flaeche-2); border: 1px solid var(--line); }
.pd-nachrichten li.fremd { border-color: var(--info-ln); background: var(--info-bg); }
.pd-rf-tag { align-self: flex-start; margin: 0; }
.pd-kurz summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.pd-kurz p { margin: 6px 0 0; white-space: pre-line; }

/* Warteliste rechts */
.pd-warte { min-height: 0; overflow: auto; border-left: 1px solid var(--line); padding: 14px 12px; background: var(--flaeche-b); }
.pd-warte summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.pd-warte summary b { color: var(--text); }
.pd-warte-liste { display: grid; gap: 3px; }
.pd-w { width: 100%; display: flex; align-items: center; gap: 8px; padding: 7px 8px; border: 1px solid transparent; border-radius: 10px; background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; flex-wrap: wrap; }
.pd-w:hover { background: var(--hover); }
.pd-w.aktiv { border-color: var(--line-3); background: var(--flaeche-3); }
.pd-w.aktiv .pd-w-ic { background: var(--text); color: var(--app); }
.pd-w-ic { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 11px; font-weight: 700; background: var(--flaeche-3); color: var(--muted); }
.pd-w.erledigt .pd-w-ic { background: var(--ok-bg); color: var(--ok-tx); }
.pd-w.erledigt .pd-w-name { color: var(--muted); }
.pd-w-name { flex: 1 1 calc(100% - 30px); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-w .tag { margin-left: 28px; }

/* Entscheid unten */
.pd-fuss { border-top: 1px solid var(--line); padding: 12px 20px; display: flex; flex-direction: column; gap: 10px; background: var(--flaeche-b); }
.pd-entscheid { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pd-haupt { min-height: 42px; padding: 0 18px; }
.pd-haupt span { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.pd-haupt small { font-size: 11px; font-weight: 500; opacity: .85; }
.pd-ganz { margin-left: auto; font-size: 13px; color: var(--muted); }
.pd-aufklapp { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--flaeche); max-height: 42vh; overflow: auto; }
.pd-aufklapp .pd-entscheid { justify-content: flex-end; }
.pd-gruende { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.pd-gruende legend { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; padding: 0; }
.pd-gruende .check-line { margin: 5px 0; font-size: 13px; }

/* Zusammenfassung */
.pd-ende { max-width: 720px; margin: 10px auto; display: flex; flex-direction: column; gap: 12px; }
.pd-ende-satz { display: flex; align-items: center; gap: 9px; font-size: 16px; margin: 0; }
.pd-ende-satz svg.i { color: var(--green); width: 22px; height: 22px; }
.pd-ende-liste { display: grid; gap: 6px; }
.pd-ende-liste li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--flaeche-2); }
.pd-ende-name { flex: 1; min-width: 0; }
.pd-ende-hinweis { flex-basis: 100%; }

@media (max-width: 1100px) {
  .pd-rumpf { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .pd-warte { order: -1; border-left: 0; border-bottom: 1px solid var(--line); padding: 8px 16px; }
  .pd-warte summary { margin: 0; }
  .pd-warte-liste { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-top: 8px; }
}
@media (max-width: 899px) {
  .modal:has(.pd-fenster) { padding: 0; place-items: start stretch; overflow: auto; }
  .modal-box.pd-fenster { height: auto; min-height: 100vh; max-height: none; overflow: visible; border-radius: 0; }
  .pd-rumpf, .pd-inhalt { overflow: visible; }
  .pd-zwei { grid-template-columns: minmax(0, 1fr); }
  .pd-vorschau { position: static; }
  .pd-v-flaeche { height: 60vh; min-height: 280px; }
  .pd-fuss { position: sticky; bottom: 0; z-index: 2; }
}
@media (max-width: 560px) {
  .pd-kopf { padding: 12px 14px 10px; }
  .pd-kopf h2 { font-size: 18px; }
  .pd-inhalt { padding: 12px 14px; }
  .pd-fuss { padding: 10px 14px; }
  .pd-form, .pd-gruende { grid-template-columns: minmax(0, 1fr); }
  .pd-entscheid .btn { flex: 1 1 calc(50% - 8px); }
  .pd-entscheid .pd-haupt { flex-basis: 100%; }
  .pd-ganz { margin: 0 auto; }
}

/* ---------- Freigabe-Liste (Reiter Freigabe der Kandidatenliste) ---------- */
.frg { display: flex; flex-direction: column; gap: 10px; }
.frg-kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.frg-kopf .spacer { flex: 1; }
.frg-kopf .fc { border: 1px solid var(--line); border-radius: 999px; background: none; font: inherit; font-size: 13px; cursor: pointer; }
.frg-kopf .fc.active { background: var(--primary); border-color: transparent; }
.frg-satz { margin: 0; }
.frg-liste { display: grid; gap: 8px; }
.frg-zeile { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px 14px; padding: 12px 14px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 14px; background: var(--flaeche-2); }
.frg-zeile:hover { border-color: var(--line-strong); }
.frg-haupt { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.frg-titel { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.frg-name { border: 0; background: none; padding: 0; font: inherit; font-size: 15px; font-weight: 700; color: var(--text); cursor: pointer; text-align: left; }
.frg-name:hover { text-decoration: underline; text-decoration-color: var(--ak-ln); }
.frg-info { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.frg-info b { color: var(--text); }
.frg-info .sep { margin: 0 6px; color: var(--muted-2); }
.frg-aktion { display: flex; gap: 6px; }
.frg-laedt { padding: 20px; text-align: center; }
.frg-mt .btn { margin-left: auto; }
@media (max-width: 640px) {
  .frg-zeile { grid-template-columns: auto minmax(0, 1fr); }
  .frg-aktion { grid-column: 1 / -1; }
  .frg-aktion .btn { flex: 1; }
  .frg-kopf .btn.primary { width: 100%; }
}
