/* ========== RailCrew – Unternehmens-UI ========== */

:root {
  --red: #c8102e;
  --red-dark: #a30d26;
  --dark: #2b2e34;
  --dark-2: #3d4149;
  --gray: #6b7078;
  --gray-light: #e8eaec;
  --gray-lighter: #f4f5f6;
  --line: #d7dadd;
  --green: #6cbe45;
  --yellow: #f7b500;
  --white: #fff;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 14px rgba(0, 0, 0, .06);
  font-size: 15px;
}

/* Das hidden-Attribut muss jede Klasse schlagen. Layout-Klassen wie .fldRow
   setzen display und übersteuern die Vorgabe des Browsers – das Element bliebe
   dann trotz hidden stehen (so blieben die Gültigkeitsfelder eines unbegrenzt
   gültigen Qualifikationstyps sichtbar). */
[hidden] { display: none !important; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: var(--gray-lighter);
  color: var(--dark);
}

button { font-family: inherit; font-size: inherit; cursor: pointer; }
h1 { font-size: 1.35rem; margin: 0; }
h3 { font-size: 1.02rem; margin: 22px 0 10px; }
h4 { font-size: .95rem; margin: 16px 0 8px; }

.icon { width: 18px; height: 18px; vertical-align: -4px; }
.sortIcon { width: 14px; height: 14px; }
.okIcon { color: var(--green); }
.muted { color: var(--gray); }
.small { font-size: .85rem; }

/* ---------- Header ---------- */

#header { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.headerInner { max-width: 1280px; margin: 0 auto; display: flex; align-items: stretch; gap: 24px; padding: 0 20px; min-height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--dark); }
.brandLogo svg { width: 32px; height: 32px; display: block; }
.brandName { font-size: 1.25rem; font-weight: 700; letter-spacing: 0; }
.mainNav { display: flex; flex: 1; justify-content: center; }
.navItem {
  display: flex; align-items: center; padding: 0 22px; text-decoration: none;
  color: var(--dark); font-weight: 600; border-bottom: 4px solid transparent; border-top: 4px solid transparent;
}
.navItem.active { border-bottom-color: var(--red); }
.navItem:hover { background: var(--gray-lighter); }
.headerRight { display: flex; align-items: center; gap: 12px; }
.userTag { color: var(--gray); font-size: .85rem; white-space: nowrap; }
.demoTag {
  background: var(--yellow); color: var(--dark); font-weight: 700; font-size: .8rem;
  border-radius: 999px; padding: 5px 13px; text-decoration: none; white-space: nowrap;
}
.demoTag:hover { filter: brightness(.95); }
.licText { width: 100%; border: 1px solid var(--line); border-radius: 4px; padding: 10px; font-family: monospace; font-size: .8rem; background: var(--gray-lighter); }
.lockNote { color: var(--red-dark); }

/* ---------- Layout ---------- */

#app { max-width: 1280px; margin: 0 auto; padding: 18px 20px 60px; }
.card { background: var(--white); border-radius: 6px; box-shadow: var(--shadow); padding: 18px 22px 14px; }

.crumbBar { margin: 4px 0 14px; font-size: 1.25rem; }
.crumbMain, .crumbs .crumbMain { font-weight: 700; color: var(--dark); }
.crumbSub { color: var(--gray); font-weight: 400; }
.crumbSep { color: var(--gray); margin: 0 2px; }
.crumbs { font-size: 1.35rem; font-weight: 700; }

footer.appFoot {
  max-width: 1280px; margin: 0 auto; padding: 14px 20px 26px; color: var(--gray);
  font-size: .82rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
footer.appFoot a { color: var(--gray); text-decoration: none; margin-left: 14px; }
footer.appFoot a:hover { text-decoration: underline; }

/* ---------- Listenkopf & Aktionen ---------- */

.listHead { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.listActions { display: flex; align-items: center; gap: 18px; }
.actionLink {
  background: none; border: 0; font-weight: 600; color: var(--dark);
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 4px;
}
.actionLink:hover { color: var(--red); }
.linkBtn { background: none; border: 0; color: var(--dark); font-weight: 600; text-decoration: underline; padding: 0; }
.linkBtn:hover { color: var(--red); }

.searchBox {
  display: inline-flex; align-items: center; gap: 8px; border-bottom: 2px solid var(--dark); padding: 4px 2px;
}
.searchBox input { border: 0; outline: 0; font-size: 1rem; min-width: 240px; background: transparent; }

.filterBar {
  display: flex; gap: 16px; align-items: end; flex-wrap: wrap;
  background: var(--gray-lighter); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; margin-bottom: 12px;
}
.filterSel { display: flex; flex-direction: column; gap: 3px; font-size: .8rem; color: var(--gray); }
.filterSel select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--white); font-size: .9rem; }

/* ---------- Tabelle ---------- */

.tableWrap { overflow-x: auto; }
.empTable { width: 100%; border-collapse: collapse; min-width: 900px; }
.empTable th {
  text-align: left; padding: 12px 10px; border-bottom: 2px solid var(--line);
  font-size: .92rem; white-space: nowrap;
}
.empTable td { padding: 12px 10px; vertical-align: middle; font-size: .95rem; }
.empTable tbody tr:nth-child(odd) { background: var(--gray-lighter); }
.empTable tbody tr:nth-child(even) { background: var(--white); }
.empRow { cursor: pointer; }
.empRow:hover { background: #e9edf2 !important; }
.rowInactive { opacity: .55; }
.thSort { cursor: pointer; user-select: none; }
.thProof { white-space: nowrap; }
.cellId { font-variant-numeric: tabular-nums; }
.cellAct { font-size: .88rem; }
.cellMail { max-width: 210px; overflow: hidden; text-overflow: ellipsis; }
.cellActions { white-space: nowrap; }

.empName { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; }
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; }

.statusCell { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex: none; }
.dot-green { background: var(--green); }
.dot-red { background: var(--red); }
.dot-gray { background: #4a4d52; }
.dot-yellow { background: var(--yellow); }

/* Kompakte Qualifikationsübersicht (erste Seite) */
.qualOverview { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.qualGroup { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qualGroupLabel { font-size: .78rem; font-weight: 700; color: var(--gray); min-width: 120px; }
.qualChip {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--white);
  font-size: .85rem; font-weight: 500; white-space: nowrap; cursor: pointer;
}
.qualChip:hover { border-color: var(--red); color: var(--red); }
.qualChip .dot { width: 10px; height: 10px; }
.qualChip .muted { font-size: .78rem; }

.proofFlag { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-weight: 500; cursor: pointer; }
.proofFlag .icon { width: 17px; height: 17px; }
.proofFlag:hover { text-decoration: underline; color: var(--red); }

/* Sprungziel nach Klick auf den Nachweisstatus kurz hervorheben */
@keyframes jumpFlash {
  0% { background: #fdf3d7; box-shadow: 0 0 0 3px var(--yellow); }
  100% { background: transparent; box-shadow: none; }
}
.proofSection.jumpHi { animation: jumpFlash 2.5s ease-out; border-radius: 6px; }
.datePill {
  background: var(--yellow); color: var(--dark); font-weight: 700; border-radius: 999px;
  padding: 3px 12px; font-size: .88rem; white-space: nowrap;
}

.emptyState {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 46px 10px; color: var(--dark); background: var(--white);
}

/* Nachweisfilter-Dropdown im Tabellenkopf */
.thFilter { position: relative; display: inline-block; margin-left: 8px; }
.filterBtn {
  border: 1px solid var(--gray); background: var(--white); border-radius: 4px;
  padding: 4px 8px; display: inline-flex; align-items: center; gap: 6px; font-size: .9rem;
}
.filterBtn.active { border-color: var(--dark); box-shadow: inset 0 0 0 1px var(--dark); }
.filterBtn .caret { font-size: .7rem; }
.filterMenu {
  position: fixed; z-index: 60; background: var(--white);
  border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); min-width: 250px; padding: 4px;
}
.filterMenu button {
  display: flex; width: 100%; text-align: left; gap: 8px; align-items: center;
  background: none; border: 0; padding: 9px 10px; border-radius: 4px; font-size: .92rem; font-weight: 400;
}
.filterMenu button:hover { background: var(--gray-lighter); }
.filterMenu button.sel { font-weight: 700; }

/* ---------- Pagination ---------- */

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 14px 4px 6px; font-size: .9rem; }
.pagerSelect { padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--white); }
.pagerRange { min-width: 90px; text-align: right; }

.iconBtn {
  background: none; border: 0; padding: 6px; border-radius: 4px; color: var(--dark);
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; min-height: 40px;   /* Touch-Zielgröße */
}
.iconBtn:hover:not(:disabled) { background: var(--gray-light); }
.iconBtn:disabled { color: var(--line); cursor: default; }
.iconBtn.tiny { min-width: 30px; min-height: 30px; padding: 4px; }
.iconBtn.tiny .icon { width: 14px; height: 14px; }
/* Sichtbarer Tastatur-Fokus überall */
:focus-visible { outline: 2px solid var(--dark); outline-offset: 1px; }
.btn:focus-visible, .iconBtn:focus-visible, .subTabBtn:focus-visible, .tabBtn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- Buttons ---------- */

.btn {
  border: 0; border-radius: 4px; padding: 10px 22px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
}
.btnRed { background: var(--red); color: var(--white); }
.btnRed:hover { background: var(--red-dark); }
.btnDark { background: var(--dark); color: var(--white); }
.btnDark:hover { background: var(--dark-2); }
.btnGhost { background: var(--white); border: 1px solid var(--dark); color: var(--dark); }
.btnGhost:hover { background: var(--gray-lighter); }
.btnSm { padding: 6px 14px; font-size: .88rem; }
.btnWide { width: 100%; justify-content: center; }

/* ---------- Tabs ---------- */

.detailCard { padding-top: 0; }
.tabBar { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 0 -22px 20px; padding: 0 10px; }

/* Sub-Tabs (zweite Ebene) als Pills */
.subTabBar { display: flex; gap: 8px; margin: -8px 0 20px; flex-wrap: wrap; }
.subTabBtn {
  border: 1px solid var(--line); background: var(--white); border-radius: 999px;
  padding: 6px 16px; font-weight: 600; font-size: .88rem; color: var(--dark);
}
.subTabBtn.active { background: var(--dark); color: var(--white); border-color: var(--dark); }
.subTabBtn:hover:not(.active) { border-color: var(--red); color: var(--red); }
.documentSubPanel,
.employeeDocumentMenu,
.employeeDocumentUnknown { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.employeeDocumentMenu *,
.employeeDocumentUnknown * { min-width: 0; overflow-wrap: anywhere; }
.employeeDocumentRootHead,
.employeeDocumentSectionHead,
.employeeDocumentNewUpload,
.employeeDocumentBreadcrumb {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.employeeDocumentRootHead { align-items: flex-start; margin-bottom: 14px; }
.employeeDocumentRootHead h2,
.employeeDocumentRootHead p,
.employeeDocumentSectionHead h3,
.employeeDocumentChildPanel h3 { margin: 0; overflow-wrap: anywhere; }
.employeeDocumentCount {
  flex: none; border-radius: 999px; padding: 5px 10px; background: var(--gray-lighter);
  color: var(--dark-2); font-size: .82rem; font-weight: 700;
}
.employeeDocumentFiles,
.employeeDocumentChildPanel {
  min-width: 0; margin: 0 0 16px; padding: 14px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface-soft);
}
.employeeDocumentFileList { display: grid; gap: 8px; margin-top: 10px; }
.employeeDocumentFileRow {
  display: flex; min-width: 0; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 9px 10px; border: 1px solid var(--line-soft); border-radius: var(--radius);
  background: var(--white);
}
.employeeDocumentFileRow .uploadWrap { min-width: 0; max-width: 100%; flex-wrap: wrap; }
.employeeDocumentFileRow .iconBtn { margin-left: auto; }
.employeeDocumentNewUpload {
  align-items: flex-start; justify-content: flex-start; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line);
}
.employeeDocumentChildGrid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
  margin: 12px 0 16px;
}
.employeeDocumentChildCard {
  display: flex; min-width: 0; min-height: 104px; flex-direction: column; align-items: flex-start;
  gap: 5px; padding: 12px; text-align: left; border: 1px solid var(--line-soft);
  border-radius: var(--radius); background: var(--white); color: var(--dark);
}
.employeeDocumentChildCard:hover { border-color: var(--red); box-shadow: var(--shadow-soft); }
.employeeDocumentChildCard[aria-expanded="true"] {
  border-color: var(--dark); background: var(--gray-lighter);
}
.employeeDocumentChildLabel { font-weight: 750; overflow-wrap: anywhere; }
.employeeDocumentChildPanel { margin-top: 4px; }
.employeeDocumentBreadcrumb {
  justify-content: flex-start; flex-wrap: wrap; margin-bottom: 8px;
  color: var(--gray); font-size: .82rem; font-weight: 650;
}
.documentMenuSearchRow {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin-top: 12px;
}
.documentMenuSearchRow .fld { flex: 1 1 320px; margin: 0; }
.documentMenuSearchRow p { flex: none; margin: 0 0 10px; }
.employeeDocumentEmpty { margin: 10px 0; }
.employeeDocumentUnknown .fileTag {
  appearance: none; border: 0; padding: 0; background: transparent; font: inherit;
}
@media (max-width: 900px) {
  .employeeDocumentChildGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .documentSubTabBar {
    max-width: 100%; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    overscroll-behavior-inline: contain; scrollbar-width: thin;
  }
  .documentSubTabBar .subTabBtn { flex: 0 0 auto; }
  .employeeDocumentRootHead,
  .employeeDocumentSectionHead,
  .documentMenuSearchRow { align-items: stretch; flex-direction: column; }
  .employeeDocumentCount { align-self: flex-start; }
  .documentMenuSearchRow p { margin: 0; }
  .employeeDocumentFileRow .uploadWrap { width: 100%; }
  .employeeDocumentFileRow .dropzone { min-width: 0; max-width: 100%; flex: 1 1 170px; }
}
@media (max-width: 520px) {
  .employeeDocumentChildGrid { grid-template-columns: minmax(0, 1fr); }
  .employeeDocumentFiles,
  .employeeDocumentChildPanel { padding: 11px; }
}

.documentMenuGroups { display: grid; gap: 12px; }
.documentMenuGroup { border: 1px solid var(--line); border-radius: 6px; background: var(--white); overflow: hidden; }
.documentMenuRootHead, .documentMenuChild {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 12px 14px;
}
.documentMenuRootHead { background: var(--gray-lighter); }
.documentMenuText { min-width: 0; }
.documentMenuText h3, .documentMenuText p { margin: 0; }
.documentMenuMeta, .documentMenuActions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.documentMenuMeta { margin-top: 7px; font-size: .82rem; }
.documentMenuChildren { border-top: 1px solid var(--line); }
.documentMenuChild + .documentMenuChild { border-top: 1px solid var(--line); }
.documentMenuEmpty { margin: 0; padding: 10px 14px; }
.tabBtn {
  background: none; border: 0; padding: 16px 18px; font-weight: 700; font-size: .98rem;
  color: var(--dark); border-bottom: 3px solid transparent; white-space: nowrap;
}
.tabBtn.active { border-bottom-color: var(--red); }
.tabBtn:hover { color: var(--red); }
.tabPanel[hidden] { display: none !important; }

/* ---------- Formulare ---------- */

.idLine { font-size: 1rem; }
.idRow { align-items: center; gap: 24px; margin-bottom: 14px; }
.idRow .persNr { flex: 0 1 220px; }
.fld.zipFld { flex: 0 1 110px; min-width: 90px; }
.personTop { display: flex; gap: 26px; flex-wrap: wrap; align-items: flex-start; }
.photoBox { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.photo { width: 120px; height: 120px; object-fit: cover; border-radius: 4px; background: var(--gray-light); }
.personFields { flex: 1; min-width: min(100%, 320px); }

.fldRow { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.fld { display: flex; flex-direction: column; position: relative; min-width: 180px; flex: 1; }
.fld.wide { flex: 2 1 320px; }
.fld.dateFld { flex: 0 1 170px; min-width: 150px; }
.fld.srcFld { flex: 2 1 280px; }
.fld.actField { flex: 0 1 260px; }
.fldLabel {
  position: absolute; top: 4px; left: 10px; font-size: .68rem; color: var(--gray); pointer-events: none;
  white-space: nowrap; overflow: hidden; max-width: calc(100% - 16px); text-overflow: ellipsis;
}
.fld input, .fld select {
  padding: 18px 10px 6px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--gray-lighter); font-size: .95rem; font-family: inherit; width: 100%;
}
.fld input[type="checkbox"][data-contract-field] {
  width: 18px; height: 18px; margin: 18px 0 6px; padding: 0; accent-color: var(--dark);
}
.contractFormSection { margin: 18px 0; padding-top: 14px; border-top: 1px solid var(--line); }
.contractFormSection .sectionHead { margin-bottom: 10px; }
.contractFormSection .sectionHead h4 { margin: 0; }
.contractFormSection [data-contract-help-text] { margin: -2px 0 12px; max-width: 72ch; }
.contractBasisField {
  position: relative;
  display: flex;
  flex: 1;
  min-width: 180px;
}
.contractBasisField > .fld { min-width: 0; }
.contractBasisHelp {
  position: absolute;
  z-index: 2;
  top: 4px;
  right: 5px;
  width: 24px;
  height: 24px;
  padding: 3px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--gray);
}
.contractBasisHelp .icon { width: 14px; height: 14px; }
.contractBasisHelp:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }
.contractBasisHelpText {
  position: absolute;
  z-index: 20;
  top: 32px;
  right: 0;
  width: min(340px, 90vw);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--white);
  box-shadow: var(--shadow);
  color: var(--dark);
  font-size: .78rem;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
}
.contractBasisHelp:hover + .contractBasisHelpText,
.contractBasisHelp:focus-visible + .contractBasisHelpText { opacity: 1; }
.contractFact {
  display: flex; flex: 1 1 180px; min-width: 180px; min-height: 42px;
  flex-direction: column; gap: 4px; overflow-wrap: anywhere;
}
.contractFact .proofMeta { margin: 0; }
.fld input:focus, .fld select:focus { outline: 2px solid var(--dark); background: var(--white); }
.fld input:disabled { color: var(--gray); }

.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 999px;
  font-weight: 600; font-size: .92rem;
}
.chipActive { background: var(--dark); color: var(--white); cursor: pointer; }
.chipX { opacity: .8; }

.checkLine { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.checkLine input { width: 18px; height: 18px; accent-color: var(--dark); flex: none; }
.checkLine.implied { opacity: .45; }
.radioLine { display: inline-flex; align-items: center; gap: 7px; margin-right: 12px; cursor: pointer; }
.radioLine input { width: 17px; height: 17px; accent-color: var(--dark); }

.roleRow, .statusRow { gap: 22px; }
.lockReason { flex: 2 1 340px; }

.formFoot { display: flex; justify-content: flex-end; gap: 14px; padding: 22px 0 10px; border-top: 1px solid var(--line); margin-top: 26px; }

/* ---------- Nachweis-Abschnitte ---------- */

.proofSection { padding: 6px 0 14px; border-bottom: 1px solid var(--gray-light); }
.proofSection:last-of-type { border-bottom: 0; }
.proofSection h3 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.proofRow { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 8px; }
.proofSourceControls { display: flex; flex: 1 1 360px; gap: 8px; align-items: flex-end; min-width: 0; }
.proofSourceControls .srcFld { flex: 1 1 230px; min-width: 0; }
.proofSourceSelect { flex: 0 0 185px; }
@media (max-width: 640px) {
  .proofSourceControls { flex-basis: 100%; flex-wrap: wrap; }
  .proofSourceControls .srcFld,
  .proofSourceSelect { flex-basis: 100%; }
}
.proofMeta { font-size: .84rem; color: var(--gray); margin: 2px 0 8px; }
.catHint { margin: -.25rem 0 .5rem; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600;
  border-radius: 4px; padding: 3px 9px;
}
.badge .icon { width: 14px; height: 14px; }
.badge-ok { background: #e7f4df; color: #3e7a1e; }
.badge-warn { background: #fdf3d7; color: #8a6400; }
.badge-err { background: #fbe3e7; color: var(--red-dark); }
.badge .datePill { font-size: .78rem; padding: 1px 9px; }

.taskRow { display: flex; gap: 26px; flex-wrap: wrap; margin: 4px 0 8px; }

/* Personalakte: Dokument- und Eintragslisten */
.recList { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 12px; }
.recItem {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--gray-lighter); border: 1px solid var(--gray-light); border-radius: 4px;
  padding: 8px 12px; font-size: .92rem;
}
.recItem b { white-space: nowrap; }
.recItem .iconBtn { margin-left: auto; }
.fileTag {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  color: var(--dark-2); font-weight: 600;
}
.fileTag:hover { color: var(--red); text-decoration: underline; }
.fileTag .icon { width: 17px; height: 17px; }
.recAddRow { align-items: flex-end; border-top: 1px dashed var(--line); padding-top: 12px; }
.zeitPos { color: #3e7a1e; }
.zeitNeg { color: var(--red-dark); }
.recAddRow .btn { margin-bottom: 2px; }
.recItem .uploadWrap .dropzone { padding: 5px 12px; min-width: 130px; font-size: .74rem; }

/* Offboarding-Zeilen tragen einen Inline-Editor. Lange Standardtexte duerfen
   dessen Grid auf schmalen Akten nicht ueber die verfuegbare Breite ziehen. */
[data-offboarding-root] [data-offboarding-item],
[data-offboarding-root] form,
[data-offboarding-root] .fld { min-width: 0; max-width: 100%; }
[data-offboarding-root] .recItem b { white-space: normal; overflow-wrap: anywhere; }
[data-offboarding-root] .formFoot { flex-wrap: wrap; }

/* Darlehen und Vorschuesse */
.financeHead,
.financeLedgerHead,
.financeLedgerActions,
.financeContract,
.financeBalance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.financeHead { margin-bottom: 14px; }
.financeHead h3,
.financeLedgerHead h3 { margin: 0 0 4px; }
.financeHead p,
.financeLedgerHead p { margin: 0; }
.financeTable { min-width: 820px; }
.financeRowSelected td { background: #fff5f6 !important; }
.financeLedger {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}
.financeContract {
  justify-content: flex-start;
  margin: 14px 0;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.financeContract .uploadWrap { flex: 1; }
.financeContract .dropzone { padding: 7px 12px; }
.financeAmount { font-weight: 700; color: var(--red-dark); white-space: nowrap; }
.financeCredit { color: #3e7a1e; }
.financeBalance {
  justify-content: flex-end;
  margin-top: 12px;
  font-size: 1rem;
}
.financeBalance strong { min-width: 140px; font-size: 1.2rem; text-align: right; }
.financePlan {
  margin: 18px 0;
  padding: 18px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

/* Individuell geführte Lagerexemplare */
.inventoryModeBox {
  margin: 4px 0 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft, #f8f9fb);
}

.identifierKindFields {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  min-width: min(100%, 360px);
}

.identifierKindFields[hidden] { display: none; }

.individualStockIntro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.individualStockIntro p { margin: 0; max-width: 760px; }
.stockItemsModal { width: min(96vw, 1500px); }
.stockItemsTable input,
.stockItemsTable select { min-width: 112px; }
.stockItemsTable [data-si-kind="imei"] {
  min-width: 158px;
  font-variant-numeric: tabular-nums;
}
.stockItemSelect { min-width: 210px; }

@media (max-width: 720px) {
  .individualStockIntro { align-items: stretch; flex-direction: column; }
}
.financePlanHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.financePlanHead h3,
.financePlanHead p { margin: 0 0 4px; }
.financePlanSummary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.financePlanSummary > div { padding: 12px 14px; }
.financePlanSummary > div + div { border-left: 1px solid var(--line-soft); }
.financePlanSummary span,
.financePlanSummary strong { display: block; }
.financePlanSummary span { margin-bottom: 4px; color: var(--gray); font-size: .76rem; }
.financePlanSummary strong { font-size: 1rem; }
.financePlanTable { min-width: 860px; }
.financePlanNotice {
  padding: 11px 12px;
  border-left: 3px solid var(--gray-light);
  background: var(--surface-soft);
  color: var(--text-soft);
}
.financePlanWarning { border-left-color: #d6a400; background: #fff9e9; color: #6c5200; }
.financePlanMore { margin: 10px 0 0; }
.formGrid { display: grid; gap: 14px; }
.formGrid.twoCol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.formGrid .fld { min-width: 0; }
.formGrid .fldWide { grid-column: 1 / -1; }
.fldHint { margin-top: 4px; color: var(--gray); font-size: .76rem; }

/* ---------- Lager ---------- */
.stockTriple { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.stockTriple .dot { width: 10px; height: 10px; }
.sizeStockLine { display: flex; align-items: center; gap: 10px; white-space: nowrap; font-size: .85rem; padding: 1px 0; }
.sizeStockLine .dot { width: 9px; height: 9px; }
.sizeStockLine b { min-width: 26px; }
.condQty { display: inline-flex; align-items: center; gap: 4px; }
.articleVariantsCell { min-width: 190px; }
.articleForm { min-width: 0; }
.articleVariantLine {
  display: grid;
  grid-template-columns: minmax(34px, auto) minmax(110px, 1fr);
  gap: 10px;
  align-items: baseline;
  padding: 3px 0;
  font-size: .84rem;
}
.articleVariantLine + .articleVariantLine { border-top: 1px solid var(--line-soft); }
.articleVariantLine b { color: var(--text); }
.articleVariantLine span,
.articleLocationSingle { color: var(--text-soft); }
.articleEditorModal { max-width: 920px; }
.articleEditorModal .modalBody { overflow-x: hidden; }
.articleVariantHead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.articleVariantHead h3 { margin: 0 0 3px; }
.articleVariantHead p { margin: 0; }
.articleVariantTableWrap { width: 100%; max-width: 100%; min-width: 0; max-height: 310px; overflow: auto; }
.articleVariantTable { min-width: 700px; }
.articleVariantTable th,
.articleVariantTable td { padding: 8px 10px; }
.articleVariantTable input { width: 100%; min-width: 130px; }
.articleVariantTable td:first-child { width: 76px; }
.articleSingleVariant .fld { min-width: 180px; }
.articlePolicyRow { margin-top: 16px; }
/* nur für Screenreader sichtbar */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  left: 0; top: 0; overflow: hidden; clip: rect(0 0 0 0);
  clip-path: inset(50%); white-space: nowrap; border: 0;
}
.stockTable { max-width: 680px; margin: 8px 0 14px; min-width: 610px !important; }
.stockTable th, .stockTable td { padding: 7px 10px; }
.stockTable input { width: 80px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; }
.scanRow { max-width: 520px; margin-bottom: 14px; }
.scanRow input { font-size: 1.05rem; letter-spacing: 0; }
.sigPad { border: 1.5px dashed var(--gray); border-radius: 6px; background: var(--gray-lighter); width: 100%; max-width: 560px; touch-action: none; }
.receipt { border: 1px solid var(--line); border-radius: 6px; padding: 14px 18px; background: var(--gray-lighter); }
.receiptCompany { display: flex; gap: 16px; align-items: flex-start; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 10px; }
.receiptLogo { max-height: 54px; max-width: 170px; object-fit: contain; }
.receiptCompanyText { font-size: .88rem; line-height: 1.35; }
.coLogoPrev { max-height: 54px; max-width: 170px; object-fit: contain; border: 1px solid var(--line); border-radius: 4px; background: var(--white); padding: 3px; }
.coLogoThumb { height: 22px; max-width: 70px; object-fit: contain; vertical-align: middle; }
.coNameCell { display: inline-flex; align-items: center; gap: 8px; }
.logoRow { align-items: center; }
.receiptHead { margin-bottom: 10px; font-size: 1.05rem; }
.receiptTable td { padding: 3px 14px 3px 0; vertical-align: top; font-size: .92rem; }
.receiptTable td:first-child { color: var(--gray); min-width: 170px; }

/* Lesemodus: Aktionen ausblenden, bis „Bearbeiten“ gedrückt wurde */
.readonly .dropzone,
.readonly [data-recdel],
.readonly [data-recadd],
.readonly [data-fact="del"],
.readonly .recAddRow,
.readonly .photoBox .btn { display: none !important; }

.infoNote {
  display: flex; gap: 10px; align-items: flex-start; color: var(--dark);
  font-size: .9rem; margin: 4px 0 18px; max-width: 720px;
}
.infoNote .icon { flex: none; margin-top: 1px; }

/* ---------- Upload ---------- */

.uploadWrap { display: flex; align-items: center; gap: 14px; }
.dropzone {
  border: 1.5px dashed var(--gray); border-radius: 4px; padding: 10px 18px; text-align: center;
  font-size: .82rem; font-weight: 600; color: var(--dark-2); background: var(--gray-lighter);
  cursor: pointer; min-width: 170px;
}
.dropzone:hover, .dropzone.drag { border-color: var(--red); color: var(--red); background: #fdf5f6; }
.fileChip { display: flex; flex-direction: column; align-items: center; gap: 2px; max-width: 110px; }
.fileIcon { position: relative; color: var(--dark-2); }
.fileIcon .icon { width: 30px; height: 30px; }
.fileCheck { position: absolute; right: -6px; bottom: -2px; background: var(--green); border-radius: 50%; width: 15px; height: 15px; display: flex; align-items: center; justify-content: center; }
.fileCheck .icon { width: 10px; height: 10px; color: var(--white); }
.fileName {
  appearance: none; background: transparent; border: 0; padding: 0; color: inherit;
  font-size: .75rem; cursor: pointer; text-align: center; word-break: break-all;
}
.fileName:hover { text-decoration: underline; color: var(--red); }
.fileName:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.uploadStatus { font-size: .8rem; color: var(--gray); }

/* ---------- Admin ---------- */

.adminLayout { display: flex; gap: 18px; align-items: flex-start; }
.adminNav {
  background: var(--white); border-radius: 6px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-width: 220px; overflow: hidden; flex: none;
}
.adminNavBtn {
  background: none; border: 0; text-align: left; padding: 13px 18px; font-weight: 600;
  border-left: 4px solid transparent; color: var(--dark);
}
.adminNavBtn:hover { background: var(--gray-lighter); }
.adminNavBtn.active { border-left-color: var(--red); background: var(--gray-lighter); }
.adminNavSep { border-top: 1px solid var(--line); margin: 4px 12px; }
.adminCard { flex: 1; min-width: 0; }
.adminTable { min-width: 780px; }
.accountStatusStack { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.accountSecurityBox {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 8px 0 16px; padding: 12px 14px; border: 1px solid var(--line);
  border-left: 3px solid var(--red); border-radius: 6px; background: var(--gray-lighter); line-height: 1.45;
}
.accountSecurityBox > div { display: flex; flex-direction: column; gap: 3px; }
.accountSecurityBox > span,
.accountSecurityBox > div > span { color: var(--gray); font-size: .84rem; }
.accountSecurityBox .btn { flex: 0 0 auto; }
.auditTable td { font-size: .85rem; }
.systemSettingsGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.systemSettingsCard { border: 1px solid var(--line-soft); border-radius: 12px; padding: 16px; background: var(--surface); }
.systemSettingsCard h3 { margin-top: 0; }
.workflowTaskEditor { margin-top: 16px; }
.workflowTaskEditorHead,
.workflowTaskRowHead,
.workflowTaskMoves,
.workflowTaskFlags,
.terminationPlaceholderPicker {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.workflowTaskEditorHead,
.workflowTaskRowHead { justify-content: space-between; }
.workflowTaskRow {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--gray-lighter);
}
.workflowTaskFlags { margin-top: 10px; }
.technicalDetails { margin-top: 10px; color: var(--gray); }
.technicalDetails summary { cursor: pointer; font-size: .82rem; font-weight: 600; }
.technicalDetails .fld { margin-top: 8px; }
.auditFilters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 14px; }
.auditPager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.auditPager > div { display: flex; gap: 8px; }
@media (max-width: 700px) {
  .systemSettingsGrid { grid-template-columns: minmax(0, 1fr); }
}

.typeForm h4 { border-bottom: 1px solid var(--gray-light); padding-bottom: 4px; }

/* Rechte-Baum in der Benutzerverwaltung */
.permTree { display: flex; flex-direction: column; gap: 12px; }
.permGroup { border: 1px solid var(--gray-light); border-radius: 6px; padding: 10px 14px; background: var(--gray-lighter); }
.permHead { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.permMode { padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--white); font-size: .85rem; }
.permSubs { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 8px 0 2px 26px; }
.permSubs .checkLine { font-weight: 400; font-size: .92rem; }
.errList { margin: 0; padding-left: 20px; }
.errList li { margin-bottom: 6px; }

/* ---------- Modal ---------- */

.modalOverlay {
  position: fixed; inset: 0; background: rgba(30, 32, 36, .5); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.modal { background: var(--white); border-radius: 8px; box-shadow: var(--shadow); width: 100%; max-width: 760px; }
.modalHead { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.modalHead h3 { margin: 0; }
.modalBody { padding: 18px 22px; max-height: 65vh; overflow-y: auto; }
.modalFoot { display: flex; justify-content: flex-end; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--line); }
.importPreviewModal { max-width: min(1180px, calc(100vw - 32px)); }
.importSummary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 13px; margin-bottom: 14px; border: 1px solid var(--line); border-left-width: 4px; border-radius: 6px; }
.importSummaryOk { border-left-color: #4f9228; background: #f5fbf2; }
.importSummaryError { border-left-color: var(--red); background: #fff5f6; }
.importPreviewWrap { max-height: 48vh; }
.importPreviewTable { min-width: 1080px; }
.importPreviewTable td { vertical-align: top; }
.importRowError { background: #fff7f8; }
.importErrors { margin: 0; padding-left: 18px; color: var(--red-dark); font-size: .82rem; }
.importErrors li + li { margin-top: 3px; }
.errorNote { border-left-color: var(--red); background: #fff5f6; color: var(--red-dark); }
.confirmModal { max-width: 480px; }
.confirmMsg { margin: 0; white-space: pre-line; line-height: 1.5; }
.actionLink.filterActive { color: var(--red); }
.actionLink.filterActive .dot { width: 8px; height: 8px; margin-left: 2px; }

/* ---------- Login ---------- */

body.loginBg { min-height: 100vh; background: #f2f3f5; }
body.loginBg #app { max-width: none; margin: 0; padding: 0; }
.loginExperience { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 5fr) minmax(390px, 3fr); }
.loginPromise { position: relative; overflow: hidden; display: flex; align-items: center; background: #252930; color: #fff; }
.loginPromise::after {
  content: ""; position: absolute; inset: 0 0 auto; height: 6px; background: var(--red);
}
.loginPromiseInner { width: 100%; max-width: 820px; padding: 72px 9vw; position: relative; z-index: 1; }
.loginPromiseBrand { display: flex; align-items: center; gap: 14px; margin-bottom: 64px; }
.loginPromiseBrand .brandLogo svg { display: block; width: 58px; height: 58px; }
.loginPromiseBrand > span { display: flex; flex-direction: column; gap: 2px; }
.loginPromiseBrand b { font-size: 1.3rem; }
.loginPromiseBrand small { color: #c3c7ce; font-size: .8rem; }
.loginEyebrow { color: #ff8599; text-transform: uppercase; font-size: .78rem; font-weight: 700; letter-spacing: .08em; margin: 0 0 16px; }
.loginPromise h1 { font-size: 56px; line-height: 1.03; letter-spacing: 0; margin: 0; max-width: 720px; }
.loginPromise h1 span { color: #ff8599; }
.loginLead { color: #d2d5da; font-size: 1.05rem; line-height: 1.65; max-width: 650px; margin: 24px 0 0; }
.loginBenefits { display: grid; gap: 17px; margin-top: 34px; }
.loginBenefits > div { display: flex; align-items: flex-start; gap: 13px; }
.loginBenefits .icon { color: #ff8599; flex: 0 0 auto; margin-top: 2px; }
.loginBenefits span { display: flex; flex-direction: column; gap: 2px; }
.loginBenefits b { font-size: .92rem; }
.loginBenefits small { color: #bec2c9; font-size: .8rem; line-height: 1.45; }
.loginPanel { display: flex; align-items: center; justify-content: center; background: #f2f3f5; padding: 52px 40px 82px; }
.loginCard {
  position: relative; z-index: 2; width: 100%; max-width: 440px; padding: 35px; background: #fff; border: 1px solid #d9dce1;
  border-radius: 8px; box-shadow: 0 24px 60px rgba(34, 38, 45, .12);
}
.loginCardHead { margin-bottom: 25px; }
.loginCardKicker { display: block; color: var(--red); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 8px; }
.loginCardHead h2 { margin: 0; color: var(--dark); font-size: 1.55rem; line-height: 1.2; }
.loginCardHead p { color: var(--gray); line-height: 1.5; margin: 9px 0 0; }
.loginCard .fld { margin-bottom: 15px; }
.loginCard .fldLabel { font-weight: 600; color: var(--dark-2); }
.loginCard input { min-height: 42px; border-radius: 6px; }
.loginCard input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(200, 16, 46, .12); outline: 0; }
.loginCard .btn { min-height: 42px; margin-top: 7px; }
.loginSubmit { font-weight: 700; }
.loginFieldHint { display: block; margin-top: 6px; color: var(--gray); font-size: .78rem; line-height: 1.35; }
.loginSecondaryAction {
  display: flex; width: fit-content; margin: 13px auto 0; padding: 2px 0; border: 0;
  background: transparent; color: var(--red-dark); font-weight: 600; font-size: .84rem;
  text-align: center; text-decoration: none;
}
.loginSecondaryAction:hover { text-decoration: underline; }
.loginNotice { display: flex; gap: 9px; align-items: flex-start; padding: 10px 11px; margin: 0 0 16px; border-left: 3px solid var(--red); background: #fff4f6; color: var(--dark-2); font-size: .84rem; line-height: 1.4; }
.loginNotice[hidden] { display: none; }
.loginNotice .icon { flex: 0 0 auto; color: var(--red); }
.loginSecurity { display: flex; justify-content: center; align-items: center; gap: 7px; color: var(--gray); font-size: .79rem; line-height: 1.4; text-align: center; margin: 17px 0 0; }
.loginSecurity .icon { width: 16px; height: 16px; flex: 0 0 auto; }
.loginError { color: var(--red-dark); font-weight: 600; font-size: .88rem; margin: 4px 0 10px; }
.loginBtn[disabled], .btn[disabled] { opacity: .6; cursor: default; }
.loginStateMessage .emptyState { margin: 0 0 15px; }
body.loginBg footer.appFoot {
  position: fixed; z-index: 3; right: 0; bottom: 0; width: 37.5%; max-width: none;
  padding: 14px 24px 18px; justify-content: center; background: #f2f3f5;
}

/* ---------- Hilfe / Handbuch ---------- */

.helpDoc { max-width: 860px; line-height: 1.6; font-size: .95rem; }
#helpDoc { overflow-wrap: anywhere; }
.helpDoc h2 { font-size: 1.3rem; margin: 6px 0 14px; }
.helpDoc h3 { font-size: 1.08rem; margin: 26px 0 8px; border-bottom: 1px solid var(--gray-light); padding-bottom: 4px; }
.helpDoc h4 { font-size: .98rem; margin: 18px 0 6px; }
.helpDoc h5 { font-size: .92rem; margin: 14px 0 4px; }
.helpDoc p { margin: 8px 0; }
.helpDoc ul, .helpDoc ol { margin: 8px 0; padding-left: 24px; }
.helpDoc li { margin: 4px 0; }
.helpDoc hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.helpDoc code { background: var(--gray-lighter); border: 1px solid var(--gray-light); border-radius: 3px; padding: 1px 5px; font-size: .85em; }
.helpTable { border-collapse: collapse; width: 100%; margin: 10px 0; }
.helpTable th, .helpTable td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
.helpTable th { background: var(--gray-lighter); }
a.iconBtn { text-decoration: none; }
.legalDoc .infoNote { background: #fdf5f6; border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; margin-bottom: 16px; }
.legalPh { color: var(--red-dark); font-style: italic; }
.legalDoc ul { margin: 8px 0; }

/* ---------- Toast ---------- */

#toastHost { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--dark); color: var(--white); border-radius: 6px; padding: 11px 20px;
  box-shadow: var(--shadow); font-size: .92rem; max-width: 90vw; opacity: 1; transition: opacity .4s;
}
.toast.error { background: var(--red-dark); }
.toast.ok { background: #3e7a1e; }
.toast.out { opacity: 0; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .statsMetricGrid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .adminLayout { flex-direction: column; }
  .adminNav { flex-direction: row; flex-wrap: wrap; min-width: 0; width: 100%; }
  .adminNavBtn { border-left: 0; border-bottom: 3px solid transparent; }
  .adminNavBtn.active { border-bottom-color: var(--red); }
  .headerInner { gap: 10px; }
  .mainNav { justify-content: flex-start; }
  .userTag { display: none; }
}
@media (max-width: 640px) {
  :root { font-size: 14px; }
  .navItem { padding: 0 10px; }
  .searchBox input { min-width: 130px; }
}

/* ---------- Modernisierung 2026 ---------- */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #fbfcfd;
  --text: #1f2328;
  --text-soft: #59616d;
  --line-soft: #e7eaf0;
  --shadow: 0 10px 30px rgba(28, 35, 45, .08), 0 1px 2px rgba(28, 35, 45, .06);
  --shadow-soft: 0 8px 22px rgba(28, 35, 45, .055);
  --radius: 8px;
}

body {
  background: var(--bg);
  color: var(--text);
}

body.appShell #header {
  position: fixed;
  inset: 0 auto 0 0;
  width: 256px;
  background: transparent;
  border: 0;
  z-index: 50;
}

body.appShell .headerInner {
  height: 100vh;
  min-height: 0;
  max-width: none;
  margin: 0;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
  background: rgba(255, 255, 255, .96);
  border-right: 1px solid var(--line-soft);
  box-shadow: 10px 0 30px rgba(28, 35, 45, .04);
}

body.appShell .brand {
  min-height: 50px;
  padding: 8px 10px;
  border-radius: var(--radius);
}

body.appShell .brandLogo svg {
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 6px 12px rgba(200, 16, 46, .18));
}

body.appShell .brandName {
  font-size: 1.28rem;
  letter-spacing: 0;
}

body.appShell .mainNav {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
}

body.appShell .navItem {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius);
  justify-content: flex-start;
  color: var(--text-soft);
  font-size: .95rem;
}

body.appShell .navItem.active {
  background: #fff1f3;
  color: var(--red);
  box-shadow: inset 3px 0 0 var(--red);
}

body.appShell .navItem:hover {
  background: var(--gray-lighter);
  color: var(--text);
}

body.appShell .headerRight {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
}

body.appShell .shellSearch {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--text-soft);
}

body.appShell .shellSearch input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
}

body.appShell .userTag {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--gray-lighter);
  color: var(--text-soft);
}

body.appShell #app {
  max-width: none;
  margin: 0 0 0 256px;
  padding: 28px 30px 64px;
}

body.appShell footer.appFoot {
  max-width: none;
  margin-left: 256px;
  padding-left: 30px;
  padding-right: 30px;
}

.card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 20px 22px;
}

.crumbBar,
.crumbs {
  font-size: 1.55rem;
  letter-spacing: 0;
}

.crumbSub,
.muted,
.small {
  color: var(--text-soft);
}

.listHead {
  margin-bottom: 16px;
}

.actionLink {
  min-height: 38px;
  padding: 7px 12px;
  border-radius: var(--radius);
  color: var(--red);
  background: #fff5f6;
}

.actionLink:hover {
  background: #ffe8ec;
  color: var(--red-dark);
}

.filterBar {
  background: var(--surface-soft);
  border-color: var(--line-soft);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
}

.searchBox {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--white);
}

.searchBox input {
  min-width: 280px;
}

.employeeSearchBox { min-width: 0; }
.employeeSearchBox input { width: 100%; }

.filterSel select,
.fld input,
.fld select,
.pagerSelect {
  border-color: var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.fld input:focus,
.fld select:focus {
  outline: 2px solid rgba(200, 16, 46, .18);
  border-color: var(--red);
  background: var(--white);
}

.metricGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}

.employeeMetricGrid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
}

.metricGroup {
  grid-column: span 2;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.metricGroup:nth-child(2),
.metricGroup:nth-child(4) { grid-column: span 4; }
.metricGroup:nth-child(5) { grid-column: 1 / -1; }
.metricGroup h2 {
  margin: 0 2px 5px;
  color: var(--text-soft);
  font-size: .7rem;
  line-height: 1.2;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.metricGroupGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 6px;
}

.metricGridCompact {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.metricCard {
  position: relative;
  min-height: 96px;
  padding: 14px 15px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 1px 2px rgba(28, 35, 45, .04);
  overflow: hidden;
}
.employeeMetricGrid .metricCard {
  min-height: 42px;
  padding: 6px 9px 6px 11px;
  overflow: visible;
}

.metricCard::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--line);
}

.metric-ok::before { background: var(--green); }
.metric-warn::before { background: var(--yellow); }
.metric-err::before { background: var(--red); }
.metric-neutral::before { background: var(--dark-2); }
.metric-green::before { background: var(--green); }
.metric-yellow::before { background: var(--yellow); }
.metric-red::before { background: var(--red); }
.metric-unknown::before { background: #807567; }
.metric-unknown { border-style: dashed; }

.metricLabel,
.metricHint {
  display: block;
  color: var(--text-soft);
  font-size: .78rem;
}

.employeeMetricGrid .metricLabel {
  display: block;
  color: var(--text-soft);
  font-size: max(.9rem, 12.5px);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.metricCardHead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.metricUrgency { color: var(--dark); font-weight: 600; }
.metricCountHelp {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.metricCard strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 1.45rem;
  line-height: 1.1;
}
.employeeMetricGrid .metricCard strong {
  display: inline-block;
  flex: 0 0 auto;
  margin: 0;
  font-size: 1.15rem;
}

.employeeMetricGrid .metricGroup h2 {
  font-size: max(.84rem, 11.6px);
  font-weight: 700;
}

.metricCardAction {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.metricCardAction:hover {
  border-color: #aeb7c2;
  box-shadow: 0 7px 18px rgba(28, 35, 45, .09);
  transform: translateY(-2px);
}

.metricCardAction.active {
  border-color: var(--dark-2);
  box-shadow: 0 0 0 2px rgba(28, 35, 45, .08);
}

.metricCardAction:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.statsMetricGrid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.statsPeriodBar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin: 4px 0 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

.statsPeriodTitle {
  display: flex;
  flex: 1 1 220px;
  flex-direction: column;
  gap: 3px;
  min-width: 180px;
}

.statsPeriodTitle strong {
  font-size: 1rem;
}

.statsYearField select,
.statsPeriodDetail select {
  min-width: 128px;
}

.statsPeriodSwitch {
  display: inline-flex;
  min-height: 42px;
  padding: 3px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.statsPeriodBtn {
  min-height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: .84rem;
  font-weight: 700;
  cursor: pointer;
}

.statsPeriodBtn:hover {
  color: var(--text);
}

.statsPeriodBtn.active {
  background: var(--white);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(28, 35, 45, .12);
}

.statsPeriodBtn:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 1px;
}

.statsMetricCard {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.statsMetricCard:hover,
.statsMetricCard.active {
  border-color: var(--dark-2);
  box-shadow: 0 7px 18px rgba(28, 35, 45, .09);
  transform: translateY(-1px);
}

.statsMetricCard:focus-visible,
.metricResultRow:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.statsWelcome {
  padding: 42px 0 16px;
  text-align: center;
}

.statsWelcome h2 {
  margin-bottom: 6px;
}

.statsDetail {
  padding-top: 8px;
}

.statsDetailHead,
.quickEntryBar,
.quickEntryBarActions,
.quickSaveActions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vacationRule {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.statsDetailHead {
  justify-content: space-between;
  margin: 18px 0 14px;
}

.statsDetailActions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.statsDetailHead h2 {
  margin: 2px 0 0;
}

.statsFilterBar .searchBox {
  flex: 1 1 360px;
}

.filterField {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-soft);
  font-size: .76rem;
}

.filterField select {
  min-width: 160px;
  min-height: 42px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--white);
  padding: 0 34px 0 10px;
}

.tableSortBtn {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-transform: inherit;
  text-align: left;
  cursor: pointer;
}

.tableSortBtn:hover,
.tableSortBtn:focus-visible {
  color: var(--red);
}

.tableSub {
  display: block;
  margin-top: 3px;
  color: var(--text-soft);
  font-size: .76rem;
  font-weight: 400;
}

.statsResultCount {
  margin: 8px 2px 0;
  text-align: right;
}

.quickEntryBar {
  justify-content: space-between;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.quickEntryBar .overline {
  display: block;
}

.quickSaveActions {
  flex: 1 1 auto;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.quickSaveActions .btn {
  white-space: normal;
}

.pickerTable tbody tr {
  cursor: pointer;
}

.modalFoot {
  flex-wrap: wrap;
}

.metricResultRow {
  cursor: pointer;
}

.metricResultRow:hover td,
.metricResultRow:focus td {
  background: var(--surface-soft);
}

.tableWrap {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--white);
}

.empTable {
  border-collapse: separate;
  border-spacing: 0;
}

.empTable th {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: .78rem;
  text-transform: uppercase;
}

.empTable td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--white);
}

.empTable tbody tr:nth-child(odd),
.empTable tbody tr:nth-child(even) {
  background: transparent;
}

.empTable tbody tr:last-child td {
  border-bottom: 0;
}

.empRow:hover td {
  background: #fff8f9 !important;
}

.avatar {
  width: 34px;
  height: 34px;
  box-shadow: 0 0 0 2px var(--white), 0 0 0 3px var(--line-soft);
}

.statusCell,
.proofFlag,
.badge,
.datePill,
.qualChip,
.statusPill {
  border-radius: 999px;
}

.missingIdBadge,
.missingIdHint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #785900;
  background: #fff4d8;
  border: 1px solid #efd58b;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 650;
}

.missingIdBadge {
  padding: 4px 8px;
  white-space: nowrap;
}

.missingIdHint {
  padding: 4px 9px;
}

.missingIdHint .ico {
  width: 14px;
  height: 14px;
}

.statusCell {
  padding: 4px 10px;
  background: var(--gray-lighter);
  font-size: .84rem;
}

.dot {
  width: 9px;
  height: 9px;
}

.proofFlag {
  padding: 5px 10px;
  background: var(--gray-lighter);
  font-size: .84rem;
}

.proofFlag.expired {
  background: #fbe3e7;
  color: var(--red-dark);
}

.proofFlag.expiring {
  background: #fff4d8;
  color: #785900;
}

.btn {
  border-radius: var(--radius);
  min-height: 40px;
}

.btnRed {
  box-shadow: 0 8px 18px rgba(200, 16, 46, .18);
}

.iconBtn {
  border-radius: var(--radius);
}

.tabBar {
  margin: 0 -22px 18px;
  padding: 0 12px;
  gap: 4px;
  border-bottom: 1px solid var(--line-soft);
}

.tabBtn {
  padding: 15px 14px;
  border-radius: 8px 8px 0 0;
  color: var(--text-soft);
}

.tabBtn.active {
  background: #fff5f6;
  color: var(--red);
}

.subTabBar {
  gap: 8px;
}

.subTabBtn {
  border-color: var(--line-soft);
  background: var(--surface-soft);
}

.subTabBtn.active {
  background: var(--text);
  border-color: var(--text);
}

.employeeHero {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
  margin: 0 0 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #fff8f9;
}

.employeeDetailSticky {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 0 -22px 18px;
  padding: 0 22px;
  background: var(--white);
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 14px 20px -22px rgba(28, 35, 45, .55);
}

.employeeDetailSticky .employeeHero {
  margin-bottom: 10px;
}

.employeeDetailSticky .tabBar {
  margin: 0 -22px;
  border-bottom: 0;
}

.employeeHeroPhoto {
  width: 82px;
  height: 82px;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--line-soft);
}

.employeeHeroMain h2 {
  margin: 3px 0 6px;
  font-size: 1.45rem;
}

.overline {
  color: var(--red);
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.employeeHeroMeta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-soft);
  font-size: .88rem;
}

.employeeHeroMeta span {
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid var(--line-soft);
}

.employeeHeroBadges {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.employeeHeroSide {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.employeeHeroActions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.statusPill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 11px;
  font-weight: 700;
  font-size: .82rem;
}

.status-aktiv,
.status-ok {
  background: #e7f4df;
  color: #376f18;
}

.status-inaktiv {
  background: var(--gray-lighter);
  color: var(--text-soft);
}

.status-gesperrt,
.status-err {
  background: #fbe3e7;
  color: var(--red-dark);
}

.status-warn {
  background: #fff4d8;
  color: #785900;
}

/* Onboarding: konkrete Fehl-Liste eines automatischen Schritts */
.onbMissing {
  color: #785900;
  margin-top: 2px;
}

.personTop {
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.photo {
  border-radius: var(--radius);
}

.proofSection {
  padding: 14px 0 18px;
  border-bottom-color: var(--line-soft);
}

.recItem,
.permGroup,
.receipt {
  border-color: var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.dropzone {
  border-color: var(--line-soft);
  border-radius: var(--radius);
  background: var(--white);
}

.adminLayout {
  gap: 16px;
}

.adminNav {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.adminNavBtn {
  border-left-width: 3px;
  color: var(--text-soft);
}

.adminNavBtn.active {
  background: #fff5f6;
  color: var(--red);
}

.adminCard {
  border-radius: var(--radius);
}

.adminNav {
  gap: 10px;
  padding: 12px;
  overflow: visible;
}

.adminNavGroup {
  margin: 0;
}

.adminNavGroup h2,
.adminNavGroup summary {
  margin: 0;
  padding: 7px 10px;
  color: var(--text-soft);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.adminNavGroup summary { cursor: pointer; }
.adminNavGroupItems { display: flex; flex-direction: column; }
.adminNavGroup .adminNavBtn { width: 100%; }
.adminNavAvailability { display: block; margin-top: 3px; color: var(--red-dark); font-size: .72rem; font-weight: 600; }
.adminContextHelp { display: inline-flex; margin: 0 0 16px; color: var(--red-dark); font-size: .86rem; font-weight: 600; }
.helpSearch { display: flex; align-items: end; gap: 10px; margin-bottom: 12px; }
.helpSearch .fld { margin: 0; }
.helpSearchResults { margin: 0 0 14px; padding-left: 20px; }
.helpSearchResults li { margin: 4px 0; }

@media (max-width: 760px) {
  .loginExperience { display: block; min-height: auto; }
  .loginPromise { min-height: 374px; align-items: flex-start; }
  .loginPromiseInner { padding: 20px 24px 34px; }
  .loginPromiseBrand { margin-bottom: 14px; }
  .loginPromiseBrand .brandLogo svg { width: 48px; height: 48px; }
  .loginPromise h1 { font-size: 32px; }
  .loginLead { font-size: .85rem; line-height: 1.45; margin-top: 8px; }
  .loginBenefits { gap: 7px; margin-top: 16px; }
  .loginBenefits b { font-size: .85rem; }
  .loginBenefits small { display: none; }
  .loginPanel { padding: 0 16px 28px; align-items: flex-start; }
  .loginCard { margin-top: -44px; max-width: 440px; padding: 24px; }
  .accountSecurityBox { align-items: stretch; flex-direction: column; }
  .accountSecurityBox .btn { width: 100%; }
  body.loginBg footer.appFoot {
    position: static; width: 100%; padding: 10px 16px 18px; background: #f2f3f5;
  }
  body.loginBg footer.appFoot a:first-child { margin-left: 0; }
}

@media (max-width: 1000px) and (max-height: 600px) and (orientation: landscape) {
  .loginExperience { display: grid; min-height: 100vh; grid-template-columns: minmax(0, .95fr) minmax(420px, 1.05fr); }
  .loginPromise { min-height: 100vh; align-items: center; }
  .loginPromiseInner { padding: 22px 28px; }
  .loginPromiseBrand { margin-bottom: 22px; }
  .loginPromiseBrand .brandLogo svg { width: 44px; height: 44px; }
  .loginPromise h1 { font-size: 32px; }
  .loginLead { font-size: .82rem; line-height: 1.45; margin-top: 12px; }
  .loginBenefits { gap: 8px; margin-top: 16px; }
  .loginBenefits small { display: none; }
  .loginPanel { padding: 12px 26px 32px; align-items: center; }
  .loginCard { margin: 0; padding: 18px 24px; max-width: 430px; max-height: calc(100vh - 52px); overflow-y: auto; }
  .loginCardHead { margin-bottom: 14px; }
  .loginCardHead p { margin-top: 5px; font-size: .82rem; }
  .loginCard .fld { margin-bottom: 9px; }
  .loginCard .btn { min-height: 38px; }
  .loginFieldHint { margin-top: 3px; font-size: .72rem; }
  .loginSecondaryAction { margin-top: 7px; }
  .loginSecurity { display: none; }
  body.loginBg footer.appFoot {
    position: fixed; width: 52.5%; padding: 8px 14px 10px; font-size: .7rem;
  }
}

@media (max-width: 1100px) {
  .metricGrid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
  .employeeMetricGrid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .metricGroup,
  .metricGroup:nth-child(2),
  .metricGroup:nth-child(4) { grid-column: span 3; }
  .metricGroup:nth-child(5) { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  body.appShell #header {
    position: sticky;
    inset: auto;
    width: auto;
  }

  body.appShell .headerInner {
    height: auto;
    min-height: 64px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
  }

  body.appShell .brand { flex: 0 0 auto; }

  body.appShell .shellSearch {
    flex: 1 1 220px;
    min-width: 180px;
  }

  body.appShell .mainNav {
    order: 4;
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  body.appShell .navItem {
    white-space: nowrap;
  }

  body.appShell .headerRight {
    flex: 0 1 auto;
    margin-left: auto;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .tabBar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .tabBtn { flex: 0 0 auto; }

  body.appShell #app,
  body.appShell footer.appFoot {
    margin-left: 0;
  }

  .employeeHero {
    grid-template-columns: auto 1fr;
  }

  .employeeDetailSticky {
    position: static;
  }

  .adminLayout { align-items: stretch; }
  .adminNav { flex-direction: column; }
  .adminNavGroup { border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface-soft); }
  .adminNavGroup summary { list-style: none; }
  .adminNavGroup summary::-webkit-details-marker { display: none; }
  .adminNavGroupItems { padding: 0 4px 4px; }
  .adminCard { width: 100%; max-width: 100%; min-width: 0; }

  .financePlanSummary { grid-template-columns: 1fr; }
  .financePlanSummary > div + div { border-left: 0; border-top: 1px solid var(--line-soft); }

  .employeeHeroSide {
    grid-column: 1 / -1;
    width: 100%;
    align-items: flex-start;
    flex-direction: row;
    justify-content: space-between;
  }

  .employeeHeroBadges {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  body.appShell #app {
    padding: 16px 12px 48px;
  }

  .helpSearch { align-items: stretch; flex-direction: column; }
  .helpSearch .btn { width: 100%; }

  .metricGrid,
  .metricGridCompact {
    grid-template-columns: 1fr;
  }
  .employeeMetricGrid { grid-template-columns: 1fr; }
  .metricGroup,
  .metricGroup:nth-child(2),
  .metricGroup:nth-child(4),
  .metricGroup:nth-child(5) { grid-column: 1; }
  .metricGroupGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .statsDetailHead,
  .quickEntryBar {
    align-items: stretch;
    flex-direction: column;
  }

  .statsDetailActions {
    justify-content: stretch;
    width: 100%;
  }

  .statsDetailActions .btn {
    flex: 1 1 170px;
    justify-content: center;
  }

  .statsPeriodBar {
    align-items: stretch;
  }

  .statsPeriodTitle {
    flex-basis: 100%;
  }

  .statsPeriodBar .filterField {
    flex: 1 1 140px;
  }

  .statsPeriodBar .filterField select,
  .statsPeriodSwitch {
    width: 100%;
  }

  .statsPeriodBtn {
    flex: 1 1 0;
  }

  .quickEntryBarActions,
  .quickSaveActions {
    justify-content: stretch;
    width: 100%;
  }

  .quickEntryBarActions .btn,
  .quickSaveActions .btn {
    flex: 1 1 100%;
  }

  .employeeHero {
    grid-template-columns: 1fr;
  }

  .employeeHeroSide,
  .employeeHeroActions {
    width: 100%;
  }

  .employeeHeroSide {
    flex-direction: column;
  }

  .employeeHeroActions .btn {
    flex: 1 1 calc(50% - 4px);
  }

  body.appShell .shellSearch {
    order: 5;
    flex-basis: 100%;
    min-width: 0;
  }

  body.appShell .headerRight .userTag { display: none; }
  body.appShell .headerRight { gap: 2px; }
  body.appShell .mainNav { order: 4; }

  .formGrid.twoCol { grid-template-columns: 1fr; }
  .formGrid .fldWide { grid-column: auto; }
  .financeLedgerActions { width: 100%; justify-content: flex-start; }

  .employeeSearchBox {
    flex: 1 1 100%;
    width: 100%;
  }

  .employeeSearchBox input { min-width: 0; }

  .listActions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

  .listActions .searchBox {
    flex: 1 1 220px;
    min-width: 0;
  }

  .listActions .searchBox input {
    width: 100%;
    min-width: 0;
  }

  .modalOverlay { padding: 8px; }
  .articleEditorModal { max-height: calc(100vh - 16px); }
  .articleEditorModal .modalHead,
  .articleEditorModal .modalBody,
  .articleEditorModal .modalFoot { padding-left: 14px; padding-right: 14px; }
  .articleEditorModal .modalBody { max-height: calc(100vh - 132px); }
  .articleVariantTableWrap {
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
  }
}

/* ---------- Zeitenabgleich (P5.2) ---------- */
.zeitBadge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; }
.zeitBadgeOpen { background: #fdecea; color: #b3261e; }
.zeitBadgeOk { background: #e6f4ea; color: #137333; }
.zeitBadgeAdj { background: #e8f0fe; color: #1a73e8; }
.zeitEntry { display: flex; flex-wrap: wrap; gap: 10px; padding: 2px 0; }
.zeitEntryWithdrawn { opacity: .6; text-decoration: line-through; }
.zeitEntryFlag { color: #b3261e; font-size: .82rem; font-weight: 600; }
.zeitRowDeviating td { border-left: 3px solid #b3261e; }
.zeitTable td { vertical-align: top; }

.recBadge { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; vertical-align: 1px; }
.recBadgeRailshift { background: #e8f0fe; color: #1a73e8; }
.recBadgeWarn { background: #fdecea; color: #b3261e; }

.psSectionTitle { margin: 14px 0 4px; }
.psKeepRow { display: block; margin: 2px 0; }

/* ---------- Mitarbeiterarchiv ---------- */
.archiveNotice { margin-bottom: 16px; line-height: 1.5; }
.archiveEntry { margin-bottom: 18px; }
.archiveEntryHead,
.archiveRetentionHead,
.archiveRetentionActions,
.archiveEntryHold,
.archiveEvidence,
.archiveFinal {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.archiveEntryHead,
.archiveRetentionHead { justify-content: space-between; }
.archiveEntryHead h2,
.archiveRetentionHead h3 { margin: 2px 0 4px; }
.archiveProgress { margin: 10px 0 0; }
.archiveRetentionItem {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-subtle, #fafafa);
}
.archiveRetentionItem textarea { min-height: 72px; }
.archiveRetentionActions,
.archiveEntryHold,
.archiveFinal { margin-top: 12px; }
.archiveRetentionActions input,
.archiveEntryHold input { flex: 1 1 260px; }
.archiveEvidence { color: var(--gray); font-size: .85rem; }
.archiveEvidence span { margin-right: 12px; }
.archiveFinal { justify-content: flex-end; }

.employeeExitGuide {
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--gray-lighter);
}
.employeeExitGuideHead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.employeeExitGuideHead h3 { margin: 2px 0 0; }
.employeeExitSteps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.employeeExitSteps li {
  display: flex;
  gap: 9px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}
.employeeExitSteps li[data-state="complete"],
.employeeExitSteps li[data-state="confirmed"],
.employeeExitSteps li[data-state="handed_off"],
.employeeExitSteps li[data-state="completed"] { border-color: var(--green); }
.employeeExitSteps li[data-state="blocked"] { border-color: var(--red); }
.employeeExitStepNumber {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: var(--white);
  background: var(--gray);
  font-weight: 700;
  font-size: .78rem;
}
.employeeExitSteps li[data-state="complete"] .employeeExitStepNumber,
.employeeExitSteps li[data-state="confirmed"] .employeeExitStepNumber,
.employeeExitSteps li[data-state="handed_off"] .employeeExitStepNumber,
.employeeExitSteps li[data-state="completed"] .employeeExitStepNumber { background: var(--green); }
.employeeExitSteps li[data-state="blocked"] .employeeExitStepNumber { background: var(--red); }
.employeeExitSteps b,
.employeeExitSteps span { overflow-wrap: anywhere; }
.employeeExitSteps li > div > span {
  display: block;
  margin-top: 3px;
  color: var(--gray);
  font-size: .78rem;
  line-height: 1.35;
}
.terminationFieldHelp { display: block; margin-top: 5px; line-height: 1.35; }
[data-exit-destination]:focus-visible { outline: 3px solid var(--focus, #335dff); outline-offset: 4px; }

/* ---------- Beendigung & Kündigung (PLAN 1.2 / Task 7) ---------- */
.terminationSectionHead,
.terminationCaseHead,
.terminationBranchHead,
.terminationDocumentHead,
.terminationCaseActions,
.terminationDocumentActions,
.terminationDelivery,
.terminationTemplateBlockHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.terminationSectionHead { align-items: flex-start; margin-bottom: 16px; }
.terminationSectionHead h2,
.terminationCaseHead h3,
.terminationBranchHead h4 { margin: 0; }
.terminationCase {
  margin: 0 0 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
}
.terminationCaseActions { justify-content: flex-start; margin: 12px 0; }
.terminationFacts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.terminationFacts > div {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--gray-lighter);
}
.terminationFacts dt { color: var(--gray); font-size: .75rem; }
.terminationFacts dd { margin: 4px 0 0; overflow-wrap: anywhere; font-weight: 600; }
.terminationBranch {
  margin: 12px 0;
  padding: 14px;
  border-left: 3px solid var(--dark);
  background: #f7f8f9;
}
.terminationForm,
.terminationChecks {
  margin: 14px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
}
.terminationForm > h4,
.terminationChecks legend { font-weight: 700; }
.terminationForm .formGrid,
.terminationChecks .formGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.terminationForm textarea,
.terminationTemplateBlock textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 20px 10px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--gray-lighter);
  color: var(--dark);
  font: inherit;
  resize: vertical;
}
.terminationForm textarea:focus,
.terminationTemplateBlock textarea:focus { outline: 2px solid var(--dark); background: var(--white); }
.terminationBlockList { display: grid; gap: 8px; margin: 14px 0; }
.terminationBlock {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
}
.terminationBlock input { margin-top: 3px; accent-color: var(--dark); }
.terminationBlock span,
.terminationBlock small { display: block; }
.terminationBlock small { margin-top: 3px; color: var(--gray); }
.terminationDocuments { display: grid; gap: 12px; }
.terminationDocument {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.terminationPreview {
  max-width: 720px;
  margin: 12px 0;
  padding: 24px;
  border: 1px solid #c9cdd2;
  background: var(--white);
  box-shadow: 0 2px 8px rgb(22 29 37 / 8%);
}
.terminationPreview header,
.terminationPreview footer { display: grid; gap: 3px; color: var(--gray); font-size: .78rem; }
.terminationPreview header { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.terminationPreviewBody { min-height: 120px; padding: 22px 0; line-height: 1.55; }
.terminationPreview footer { padding-top: 10px; border-top: 1px solid var(--line); }
.terminationDocumentActions { align-items: flex-end; justify-content: flex-start; margin-top: 12px; }
.terminationDocument > .fileTag { margin-right: 12px; }
.terminationDelivery { align-items: flex-end; justify-content: flex-start; width: 100%; }
.terminationSigned { width: min(100%, 540px); }
.terminationTemplateBlock {
  margin: 12px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--gray-lighter);
}
.terminationPlaceholderPicker { margin-top: 8px; }
.terminationPlaceholderPicker .fld { min-width: min(100%, 360px); }
.terminationTemplateExample {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
}
.terminationTemplateExample > b { display: block; margin-bottom: 6px; font-size: .82rem; }
[data-termination-block-preview] { min-height: 2.5em; white-space: pre-wrap; overflow-wrap: anywhere; }
[data-termination-block-preview] mark { padding: 0 2px; background: #fff1a8; }

@media (max-width: 640px) {
  .employeeExitGuideHead { align-items: stretch; flex-direction: column; }
  .employeeExitGuideHead .btn { width: 100%; justify-content: center; }
  .employeeExitSteps { grid-template-columns: 1fr; }
  .terminationCase { padding: 12px; }
  .terminationFacts,
  .terminationForm .formGrid,
  .terminationChecks .formGrid { grid-template-columns: 1fr; }
  .terminationSectionHead .btn,
  .terminationCaseActions .btn,
  .terminationDocumentActions > .btn,
  .terminationDelivery .btn { width: 100%; justify-content: center; }
  .terminationPreview { padding: 16px; }
  .terminationDelivery { align-items: stretch; flex-direction: column; }
}

@media (max-width: 420px) {
  .employeeMetricGrid .metricGroupGrid { grid-template-columns: 1fr; }
}
