:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d8dee8;
  --accent: #0f6c81;
  --accent-dark: #0a4f61;
  --soft: #eef7f9;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #027a48;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
.app-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.brand h1 { margin: 0; font-size: 1.35rem; }
.brand p { margin: .2rem 0 0; color: var(--muted); }
.logo-box {
  width: 80px;
  height: 54px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #fff;
  overflow: hidden;
  flex: 0 0 auto;
  font-weight: 700;
}
.logo-box img { width: 100%; height: 100%; object-fit: contain; }
.header-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }
button, .button-like {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  border-radius: 10px;
  padding: .58rem .78rem;
  font: inherit;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button.secondary, .button-like.secondary { background: white; color: var(--accent); }
button.ghost { background: transparent; color: var(--accent); border-color: transparent; }
button.danger { background: var(--danger); border-color: var(--danger); }
button:hover, .button-like:hover { background: var(--accent-dark); }
button:disabled, .button-like.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

.tabs {
  display: flex;
  gap: .35rem;
  padding: .7rem 1.25rem 0;
  overflow-x: auto;
}
.tab {
  background: #e8edf3;
  border-color: #e8edf3;
  color: var(--text);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  white-space: nowrap;
}
.tab.active { background: var(--card); border-color: var(--card); color: var(--accent-dark); }
main { padding: 1.25rem; }
.panel { display: none; }
.panel.active { display: block; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.card h2, .card h3 { margin-top: 0; }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
label { display: grid; gap: .35rem; font-weight: 700; color: #344054; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .55rem .65rem;
  font: inherit;
  background: white;
}
textarea { min-height: 80px; resize: vertical; }
.help { color: var(--muted); font-size: .92rem; }
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .75rem; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: white; }
table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: .45rem .5rem; vertical-align: top; }
th { background: #f2f4f7; text-align: left; position: sticky; top: 0; z-index: 1; }
td[contenteditable="true"] { min-width: 90px; background: #fffdf7; }
.matrix-table th.sticky-left, .matrix-table td.sticky-left { position: sticky; left: 0; z-index: 2; background: #fff; }
.matrix-table th.sticky-left { background: #f2f4f7; }
.matrix-table .wide { min-width: 210px; }
.matrix-table .zone-cell { min-width: 94px; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .18rem .5rem;
  font-weight: 800;
  font-size: .82rem;
  background: #eef4ff;
  color: #3538cd;
}
.badge.ok { background: #ecfdf3; color: var(--ok); }
.badge.warn { background: #fff7ed; color: var(--warn); }
.badge.danger { background: #fef3f2; color: var(--danger); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .85rem; }
.scenario-card { border: 1px solid var(--line); border-radius: 14px; background: white; padding: .9rem; }
.scenario-card h3 { margin: 0 0 .35rem; }
.scenario-card p { color: var(--muted); margin: .2rem 0 .8rem; }
.pruefblatt, .script-page {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.print-title { display: flex; justify-content: space-between; align-items: start; gap: 1rem; border-bottom: 2px solid var(--text); padding-bottom: .6rem; margin-bottom: .7rem; }
.print-logo { max-width: 140px; max-height: 70px; object-fit: contain; }
.check-cell { white-space: nowrap; min-width: 130px; }
.sign-line { display: inline-block; width: 140px; border-bottom: 1px solid #333; height: 1.2rem; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .5rem; }
.status-box { border: 1px solid var(--line); border-radius: 12px; padding: .7rem; background: #fafafa; }
footer { padding: .75rem 1.25rem; color: var(--muted); }
.small { font-size: .88rem; color: var(--muted); }
.empty { padding: 2rem; text-align: center; color: var(--muted); }
@media (max-width: 860px) {
  .app-header { position: static; align-items: flex-start; flex-direction: column; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
}
@media print {
  body { background: white; }
  .no-print, nav, footer { display: none !important; }
  main { padding: 0; }
  .panel { display: none !important; }
  .panel.active { display: block !important; }
  .card, .pruefblatt, .script-page { border: none; box-shadow: none; border-radius: 0; page-break-inside: avoid; }
  .table-wrap { overflow: visible; border: none; }
  th { position: static; }
  button, input, select, textarea { border: 1px solid #777; color: black; background: white; }
  .pruefblatt, .script-page { page-break-after: always; }
}

/* Version 0.2 Anpassungen */
.print-only { display: none; }
.id-cell { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 82px; }
.zone-editor-wrap input, .zone-editor-wrap select { min-width: 130px; }
.zone-editor-wrap .zone-trigger-location-input { min-width: 190px; }
.zone-editor-wrap .zone-detector-group-input { min-width: 150px; }
.zone-editor-wrap .zone-type-other-input { min-width: 150px; }
.zone-editor-wrap .zone-nr-input { min-width: 80px; max-width: 95px; }
.zone-preview,
.zone-type-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .18rem .5rem;
  font-weight: 800;
  font-size: .82rem;
  border: 1px solid rgba(0,0,0,.08);
}
.zone-preview { font-size: .9rem; }
.zone-title { font-weight: 900; }
.matrix-table th.type-bm,
.zone-preview.type-bm,
.scenario-card.type-bm { background: #eff8ff; color: #175cd3; }
.matrix-table th.type-hfm,
.zone-preview.type-hfm,
.scenario-card.type-hfm { background: #fff1f3; color: #c01048; }
.matrix-table th.type-wla,
.zone-preview.type-wla,
.scenario-card.type-wla { background: #ecfdf3; color: #027a48; }
.matrix-table th.type-dm,
.zone-preview.type-dm,
.scenario-card.type-dm { background: #f0f9ff; color: #026aa2; }
.matrix-table th.type-ma,
.zone-preview.type-ma,
.scenario-card.type-ma { background: #fff7ed; color: #b54708; }
.matrix-table th.type-saw,
.zone-preview.type-saw,
.scenario-card.type-saw { background: #f4f3ff; color: #5925dc; }
.matrix-table th.type-other,
.zone-preview.type-other,
.scenario-card.type-other { background: #f8fafc; color: #344054; }
.zone-type-pill { background: rgba(255,255,255,.7); color: inherit; }
.active-toggle {
  margin-top: .35rem;
  width: 100%;
  background: white;
  color: var(--muted);
  border-color: var(--line);
  padding: .42rem .5rem;
}
.active-toggle:hover { background: #f9fafb; color: var(--text); }
.active-toggle.on { color: var(--ok); border-color: #9ae6b4; background: #ecfdf3; }
.active-dot { font-size: 1.25rem; line-height: .8; vertical-align: -1px; }
.active-mark { color: var(--muted); font-weight: 800; white-space: nowrap; }
.active-mark.on { color: var(--ok); }
.matrix-table select { min-width: 86px; }
.matrix-table td:nth-child(3) select { min-width: 180px; }
.matrix-table td:nth-child(4) select { min-width: 190px; }

@media print {
  .print-only { display: table-cell !important; }
}

/* Version 0.3 Prüfblätter, Pflichtbemerkung und Drehbuch */
.pruef-position,
.script-position {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .85rem;
  margin: 1rem 0;
  background: #fff;
}
.pruef-position h3,
.script-position h4 { margin: 0 0 .5rem; }
.position-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: .5rem;
  margin: .5rem 0 .75rem;
}
.position-meta > div {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .55rem;
  background: #fafafa;
}
.checklist-table th:nth-child(1),
.checklist-table td:nth-child(1) { width: 60px; text-align: center; }
.checklist-table th:nth-child(2),
.checklist-table td:nth-child(2) { min-width: 360px; }
.nio-warning {
  margin-top: .3rem;
  font-size: .78rem;
  font-weight: 800;
  color: var(--danger);
}
.hidden { display: none !important; }
.required-missing {
  border-color: var(--danger) !important;
  background: #fff5f5 !important;
}
.required-text { color: var(--danger); font-weight: 800; }
.missing-note-row td { background: #fff8f7; }
.script-page { page-break-after: always; }
.script-position ol { margin-top: .35rem; }
@media print {
  .pruef-position,
  .script-position { page-break-inside: avoid; }
  .position-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .checklist-table th:nth-child(2),
  .checklist-table td:nth-child(2) { min-width: auto; }
  .missing-note-row td { background: white; }
}

/* Version 0.4 Mängel, Teilnehmerliste und Kontrolltexte */
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-weight: 800;
}
.checkbox-label input { width: auto; }
.done-cell.done {
  background: #dcfae6;
  color: var(--ok);
  font-weight: 900;
}
.mangel-done-row td { background: #f6fef9; }
.participant-table input,
.participant-table select { min-width: 130px; }
.participant-table select[multiple] { min-width: 260px; }
.checklist-textarea { min-height: 320px; font-family: inherit; line-height: 1.45; }
.checklist-editor-grid { align-items: start; }
.script-summary { background: #fbfdff; }

/* Version 0.5 Titellblatt Drehbuch */
.image-preview {
  margin-top: .45rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .55rem;
  background: #fafafa;
  display: grid;
  gap: .45rem;
}
.image-preview img {
  max-width: 100%;
  max-height: 160px;
  object-fit: contain;
  background: white;
  border-radius: 10px;
}
.title-image-preview img { max-height: 220px; }
.title-page {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 2rem;
  margin-bottom: 1rem;
  min-height: 960px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  page-break-after: always;
}
.title-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  border-bottom: 3px solid var(--text);
  padding-bottom: 1.2rem;
}
.title-page h1 {
  font-size: 2.4rem;
  line-height: 1.08;
  margin: 0 0 1.2rem;
}
.title-page h1 span { font-weight: 500; }
.title-page h2 {
  font-size: 1.45rem;
  margin: 0 0 .35rem;
}
.title-page p { margin: 0; color: var(--muted); }
.title-logo {
  max-width: 180px;
  max-height: 90px;
  object-fit: contain;
}
.title-image {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  place-items: center;
  overflow: hidden;
  min-height: 420px;
  background: #f8fafc;
}
.title-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.empty-title-image span { color: var(--muted); font-weight: 800; }
.title-footer {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .5rem;
  font-size: .82rem;
  border-top: 1px solid var(--line);
  padding-top: .8rem;
}
.title-footer div {
  min-height: 3.3rem;
  border-right: 1px solid var(--line);
  padding-right: .45rem;
}
.title-footer div:last-child { border-right: none; }
.title-footer span {
  display: block;
  color: var(--muted);
  font-weight: 800;
  margin-bottom: .2rem;
}
.title-footer strong {
  display: block;
  font-weight: 700;
  word-break: break-word;
}
@media (max-width: 860px) {
  .title-page { min-height: auto; padding: 1rem; }
  .title-page-head { flex-direction: column; }
  .title-footer { grid-template-columns: 1fr; }
  .title-footer div { border-right: none; border-bottom: 1px solid var(--line); padding-bottom: .45rem; }
}
@media print {
  .title-page { border: none; border-radius: 0; min-height: 270mm; padding: 12mm; margin: 0; }
  .title-image { min-height: 135mm; }
  .image-preview { border: none; padding: 0; }
}

/* Version 0.6 Prüfresultate als Aktivierungsfelder und Prüfübersicht */
.result-choice-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(95px, 1fr));
  gap: .35rem;
  min-width: 210px;
}
.result-choice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .28rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .38rem .45rem;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
  user-select: none;
}
.result-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}
.result-choice.selected {
  border-width: 2px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.03);
}
.result-choice.selected.ok { background: #ecfdf3; border-color: #75e0a7; color: var(--ok); }
.result-choice.selected.danger { background: #fef3f2; border-color: #fda29b; color: var(--danger); }
.result-choice.selected.warn { background: #fff7ed; border-color: #fdba74; color: var(--warn); }
.result-choice.selected.muted { background: #f2f4f7; border-color: #98a2b3; color: #475467; }
.badge.muted { background: #f2f4f7; color: #475467; }
.progress-line {
  height: 10px;
  border-radius: 999px;
  background: #eaecf0;
  overflow: hidden;
  margin: .45rem 0;
}
.progress-line span {
  display: block;
  height: 100%;
  background: currentColor;
  opacity: .55;
}
.overview-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.scenario-overview-card h3 { margin: 0 0 .35rem; }
.overview-table th:nth-child(7),
.overview-table td:nth-child(7) { min-width: 320px; }
@media print {
  .result-choice-group { display: none; }
}


/* Version 0.7 Drehbuch A4, Einleitung, Teilnehmer und kleines Indexfeld */
.project-index-field {
  max-width: 170px;
}
.project-index-input {
  max-width: 120px;
  text-align: center;
  font-weight: 800;
}
.script-intro-page {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
  page-break-after: always;
}
.script-intro-text p,
.script-intro-text li {
  line-height: 1.45;
}
.script-intro-text ul {
  margin-top: .35rem;
}
.script-participant-table th:nth-child(1),
.script-participant-table td:nth-child(1) { width: 45px; text-align: center; }
.script-participant-table th:nth-child(7),
.script-participant-table td:nth-child(7) { min-width: 260px; }

@page {
  size: A4 portrait;
  margin: 12mm;
}
@media print {
  html, body {
    width: 210mm;
    background: white;
    font-size: 10pt;
  }
  .app-header { display: none !important; }
  main { padding: 0 !important; }
  .title-page,
  .script-intro-page,
  .script-page {
    width: 100%;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
  }
  .title-page {
    min-height: 273mm;
    display: flex;
    flex-direction: column;
  }
  .title-page-head { padding-bottom: 8mm; margin-bottom: 8mm; }
  .title-page h1 { font-size: 24pt; }
  .title-page h2 { font-size: 15pt; }
  .title-image { min-height: 135mm; border-radius: 0; }
  .title-footer { font-size: 8pt; margin-top: auto; }
  .script-intro-page,
  .script-page { page-break-after: always; }
  .print-title { margin-bottom: 5mm; padding-bottom: 3mm; }
  .print-title h2 { font-size: 15pt; margin: 0 0 2mm; }
  .print-logo { max-width: 35mm; max-height: 18mm; }
  .script-intro-text h2,
  .script-participants h2,
  .script-page h3 { page-break-after: avoid; }
  .script-intro-text p,
  .script-intro-text li { line-height: 1.35; }
  .script-participant-wrap { overflow: visible; }
  .script-participant-table,
  .script-page table { font-size: 8.5pt; }
  .script-participant-table th,
  .script-participant-table td,
  .script-page th,
  .script-page td { padding: 2.2mm; }
  .script-position {
    border: 1px solid #999 !important;
    border-radius: 0;
    padding: 3mm;
    margin: 4mm 0;
    page-break-inside: avoid;
  }
}

/* Version 0.9 Matrix mit ID, Kategorie und Unterkategorie fixiert */
.project-index-field {
  max-width: 115px;
  align-self: start;
}
.project-index-input {
  width: 90px;
  max-width: 90px;
  min-height: auto;
  height: 2.38rem;
  padding: .55rem .65rem;
}
.matrix-wrap {
  max-height: calc(100vh - 210px);
  overflow: auto;
  position: relative;
}
.matrix-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}
.matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
}
.matrix-table th.sticky-col,
.matrix-table td.sticky-col {
  position: sticky;
  background: #fff;
}
.matrix-table th.sticky-col {
  top: 0;
  background: #f2f4f7;
  z-index: 9;
}
.matrix-table td.sticky-col { z-index: 5; }
.matrix-table .sticky-id {
  left: 0;
  width: 90px;
  min-width: 90px;
  max-width: 90px;
}
.matrix-table .sticky-category {
  left: 90px;
  width: 190px;
  min-width: 190px;
  max-width: 190px;
}
.matrix-table .sticky-subcategory {
  left: 280px;
  width: 210px;
  min-width: 210px;
  max-width: 210px;
  box-shadow: 8px 0 10px -10px rgba(16,24,40,.35);
}
.matrix-table .sticky-category select,
.matrix-table .sticky-subcategory select {
  width: 100%;
}
.title-image img {
  object-fit: contain;
  background: white;
}
@media print {
  html, body {
    width: auto !important;
    max-width: none !important;
  }
  .title-page {
    height: 273mm !important;
    min-height: 273mm !important;
    max-height: 273mm !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6mm !important;
    page-break-after: always !important;
  }
  .title-page-head {
    flex: 0 0 auto !important;
    padding-bottom: 5mm !important;
    margin-bottom: 0 !important;
    gap: 6mm !important;
  }
  .title-page h1 {
    font-size: 22pt !important;
    line-height: 1.04 !important;
    margin: 0 0 5mm !important;
  }
  .title-page h2 {
    font-size: 13pt !important;
    margin: 0 0 2mm !important;
  }
  .title-logo {
    max-width: 34mm !important;
    max-height: 18mm !important;
  }
  .title-image {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    border-radius: 0 !important;
  }
  .title-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }
  .title-footer {
    flex: 0 0 auto !important;
    font-size: 7.5pt !important;
    line-height: 1.15 !important;
    gap: 2mm !important;
    padding-top: 3mm !important;
    margin-top: 0 !important;
  }
  .title-footer div {
    min-height: auto !important;
    padding-right: 2mm !important;
  }
}

/* Version 0.10 Genehmigungsvermerk */
.approval-form { margin-bottom: 1rem; }
.approval-form-large textarea { min-height: 110px; }
.approval-scope-textarea { min-height: 150px; }
.approval-result-fieldset {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .85rem;
  margin: 1rem 0 0;
}
.approval-result-fieldset legend { font-weight: 900; color: #344054; }
.approval-result-options {
  display: grid;
  gap: .45rem;
}
.approval-page {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.2rem;
  margin-bottom: 1rem;
  max-width: 900px;
  min-height: 1120px;
}
.approval-page h1 {
  margin: 0 0 .35rem;
  font-size: 1.65rem;
}
.approval-page h2 {
  font-size: 1rem;
  margin: 1rem 0 .35rem;
}
.approval-ref {
  margin: 0 0 1rem;
  color: var(--muted);
  font-weight: 700;
}
.approval-meta th {
  width: 210px;
  background: white;
  color: #344054;
}
.approval-meta th,
.approval-meta td,
.approval-signatures th,
.approval-signatures td {
  border-right: none;
  border-bottom: 1px solid var(--line);
  padding: .42rem .5rem;
}
.approval-textbox {
  min-height: 42px;
  border-bottom: 1px solid var(--line);
  padding: .25rem 0 .5rem;
}
.approval-remarks { min-height: 76px; }
.approval-scope-list { margin: .3rem 0 .8rem 1.2rem; padding: 0; }
.approval-scope-list li { margin: .25rem 0; }
.approval-result-list {
  display: grid;
  gap: .3rem;
  margin: .25rem 0 .75rem;
}
.approval-check {
  display: inline-block;
  width: 1.4rem;
  font-weight: 900;
}
.approval-signatures {
  margin-top: .65rem;
  table-layout: fixed;
}
.approval-signatures th {
  width: 42%;
  background: white;
}
.approval-signatures td {
  height: 46px;
}
@media print {
  .approval-page {
    width: 100% !important;
    min-height: 273mm !important;
    max-height: 273mm !important;
    overflow: hidden !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    page-break-after: always !important;
    font-size: 9.5pt !important;
  }
  .approval-page h1 { font-size: 17pt !important; margin-bottom: 2mm !important; }
  .approval-page h2 { font-size: 10.5pt !important; margin: 5mm 0 1.5mm !important; }
  .approval-ref { margin-bottom: 5mm !important; }
  .approval-meta th,
  .approval-meta td,
  .approval-signatures th,
  .approval-signatures td { padding: 2mm !important; }
  .approval-meta th { width: 48mm !important; }
  .approval-textbox { min-height: 10mm !important; padding-bottom: 2mm !important; }
  .approval-remarks { min-height: 20mm !important; }
  .approval-scope-list li { margin: 1.4mm 0 !important; }
  .approval-signatures td { height: 13mm !important; }
}

/* Direkte Navigation aus der Prüfübersicht ins passende Prüfblatt */
.overview-detail-row {
  cursor: pointer;
}
.overview-detail-row:hover td {
  background: #eef4ff;
}

/* Version 0.11 Verantwortliche in Mängelliste */
.mangel-responsible {
  min-width: 180px;
}
@media print {
  .mangel-responsible {
    border: 0;
    padding: 0;
    background: transparent;
  }
}


/* Version 0.12 Druckbare Mängelliste */
.print-inline { display: none; }
.maengel-card .print-title { display: none; }
@media print {
  .maengel-card {
    page-break-inside: auto !important;
  }
  .maengel-card .print-title {
    display: flex !important;
  }
  .maengel-table {
    font-size: 8.5pt;
    width: 100%;
  }
  .maengel-table thead {
    display: table-header-group;
  }
  .maengel-table th,
  .maengel-table td {
    padding: 2mm !important;
    vertical-align: top;
  }
  .maengel-table th:nth-child(6),
  .maengel-table td:nth-child(6),
  .maengel-table th:nth-child(7),
  .maengel-table td:nth-child(7) {
    min-width: 34mm;
  }
  .print-inline {
    display: inline !important;
  }
  .done-cell.done {
    background: #dcfae6 !important;
    color: #027a48 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Version 0.13 Entwicklerlogo und Druck-Fusszeile */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.developer-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  color: var(--muted);
  font-size: .82rem;
  white-space: nowrap;
}
.developer-badge img {
  width: 82px;
  max-height: 28px;
  object-fit: contain;
}
.print-developer-footer {
  display: none;
}
@media (max-width: 760px) {
  .app-footer {
    align-items: flex-start;
    flex-direction: column;
  }
  .developer-badge {
    white-space: normal;
  }
}
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 12mm 18mm 12mm;
  }
  .print-developer-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 4mm;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 2.5mm;
    font-size: 6.8pt;
    line-height: 1;
    color: #555;
    text-align: center;
    z-index: 9999;
    pointer-events: none;
  }
  .print-developer-footer img {
    width: 22mm;
    max-height: 7mm;
    object-fit: contain;
  }
  .title-page,
  .approval-page {
    min-height: 267mm !important;
    max-height: 267mm !important;
    height: 267mm !important;
  }
  .pruefblatt,
  .script-intro-page,
  .script-page,
  .maengel-card {
    padding-bottom: 10mm !important;
  }
}


/* Version 0.14 VonCom Logo oben links und Druck-Fussleiste unten */
.app-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}
.developer-header-badge {
  width: 112px;
  height: 48px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 10px;
  padding: .2rem .35rem;
}
.developer-header-badge img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.developer-footer-text {
  color: var(--muted);
  font-size: .82rem;
}
@media (max-width: 760px) {
  .app-header-left {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }
  .developer-header-badge {
    width: 120px;
  }
}
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 12mm 20mm 12mm;
  }
  .print-developer-footer {
    bottom: 0 !important;
    height: 12mm !important;
    padding: 1.5mm 0 2mm !important;
    border-top: .2mm solid #ddd !important;
    background: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2.5mm !important;
    font-size: 6.8pt !important;
    color: #555 !important;
    text-align: center !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-developer-footer img {
    width: 20mm !important;
    max-height: 7mm !important;
    object-fit: contain !important;
  }
}

/* Version 0.15 Druck-Fussleiste ca. 1 cm vor Blattende */
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 12mm 10mm 12mm;
  }
  .print-developer-footer {
    bottom: 0 !important;
    height: 8mm !important;
    padding: 0 !important;
    border-top: none !important;
    align-items: center !important;
  }
  .print-developer-footer img {
    width: 18mm !important;
    max-height: 6mm !important;
  }
  .pruefblatt,
  .script-intro-page,
  .script-page,
  .maengel-card,
  .approval-page,
  .title-page {
    padding-bottom: 14mm !important;
  }
}

/* Version 0.16 Druck-Fussleiste 1 mm vor Blattende */
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 12mm 1mm 12mm;
  }
  .print-developer-footer {
    bottom: 1mm !important;
    height: 6mm !important;
    padding: 0 !important;
    border-top: none !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .print-developer-footer img {
    width: 16mm !important;
    max-height: 5mm !important;
  }
  .pruefblatt,
  .script-intro-page,
  .script-page,
  .maengel-card,
  .approval-page,
  .title-page {
    padding-bottom: 12mm !important;
  }
}

/* Version 0.17 Login und Rollenverwaltung */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: linear-gradient(135deg, #eef7f9, #f6f7f9);
}
.login-card {
  width: min(520px, 100%);
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 34px rgba(16,24,40,.12);
  padding: 1.4rem;
  display: grid;
  gap: .9rem;
}
.login-logo {
  width: min(380px, 100%);
  max-height: 150px;
  object-fit: contain;
  justify-self: center;
  margin-bottom: .15rem;
}
.login-card h1 { margin: 0; }
.login-error {
  color: var(--danger);
  background: #fef3f2;
  border: 1px solid #fda29b;
  border-radius: 10px;
  padding: .65rem;
  margin: 0;
  font-weight: 800;
}
body.logged-out .app-header,
body.logged-out .tabs,
body.logged-out main,
body.logged-out .app-footer,
body.logged-out .print-developer-footer {
  display: none !important;
}
.session-info {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .25rem .4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 800;
}
.session-info button {
  padding: .35rem .55rem;
  border-radius: 999px;
}
.permission-note {
  color: var(--warn);
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  padding: .65rem;
  font-weight: 800;
}
.readonly-cell {
  background: #f8fafc !important;
  color: var(--muted);
}

.user-table tr.online-row td {
  background: #ecfdf3;
}
.user-table tr.online-row input,
.user-table tr.online-row select {
  border-color: #75e0a7;
}
.user-online-cell {
  min-width: 90px;
  text-align: center;
}

.user-table input,
.user-table select,
.user-create-grid input,
.user-create-grid select {
  min-width: 150px;
}
.user-table select[multiple],
.user-assignment-create select {
  min-width: 260px;
}
.user-table td:nth-child(4),
.user-table td:nth-child(5),
.user-table td:nth-child(6) {
  min-width: 230px;
}
@media (max-width: 760px) {
  .session-info { align-items: flex-start; flex-direction: column; border-radius: 12px; }
}
@media print {
  .login-screen,
  .session-info,
  #benutzer { display: none !important; }
}

/* Version 0.18: Login-Maske nach erfolgreicher Anmeldung sicher ausblenden */
.login-screen[hidden] {
  display: none !important;
}

/* Version 0.20 Manuelle Szenarien */
.scenario-meta-edit {
  margin: .75rem 0;
  gap: .6rem;
}
.scenario-meta-edit label {
  font-size: .88rem;
}
.manual-scenario-list {
  display: grid;
  gap: .9rem;
}
.manual-scenario-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .9rem;
  background: #fff;
}
.manual-scenario-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .5rem;
}
.manual-scenario-head h3 {
  margin: 0;
}
.manual-element-picker {
  margin: .75rem 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.75);
}
.manual-element-picker summary {
  cursor: pointer;
  padding: .65rem .75rem;
  font-weight: 800;
}
.manual-element-list {
  max-height: 280px;
  overflow: auto;
  display: grid;
  gap: .35rem;
  padding: 0 .75rem .75rem;
}
.manual-element-option {
  font-weight: 600;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .45rem .55rem;
}
.manual-scenario-card.type-bm { background: #eff8ff; color: #175cd3; }
.manual-scenario-card.type-hfm { background: #fff1f3; color: #c01048; }
.manual-scenario-card.type-wla { background: #ecfdf3; color: #027a48; }
.manual-scenario-card.type-dm { background: #f0f9ff; color: #026aa2; }
.manual-scenario-card.type-ma { background: #fff7ed; color: #b54708; }
.manual-scenario-card.type-saw { background: #f4f3ff; color: #5925dc; }
.manual-scenario-card.type-other { background: #f8fafc; color: #344054; }
.manual-scenario-card input,
.manual-scenario-card select,
.scenario-card input {
  background: #fff;
  color: var(--text);
}

.participant-user-cell {
  min-width: 12rem;
}
.checkline {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-weight: 800;
  white-space: nowrap;
}

/* Projektverwaltung / Online-Version */
.project-switch {
  max-width: 260px;
  min-width: 190px;
  padding: .45rem .6rem;
  font-size: .88rem;
}
.project-admin-table select[multiple] { min-width: 220px; }
.project-admin-actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.superadmin-note { border-left: 4px solid var(--accent); padding-left: .8rem; }
.success-text { color: #0f7a3a; font-weight: 700; }

/* Version 0.30 Prüfbericht, Mangel-Doppelklick und Zeitstempel */
.overview-detail-row, .mangel-row { cursor: pointer; }
.jump-highlight { animation: jumpHighlight 2.2s ease-out; }
@keyframes jumpHighlight {
  0% { outline: 3px solid #f59e0b; background: #fff7ed; }
  75% { outline: 3px solid #f59e0b; background: #fff7ed; }
  100% { outline: 0 solid transparent; background: inherit; }
}
.test-timestamp { min-width: 120px; font-size: .82rem; color: #475569; }

/* Projektlimits */
.portal-project-limit {
  width: 92px;
  min-width: 80px;
}
.limit-over {
  border-color: #dc2626 !important;
  background: #fef2f2 !important;
}

/* Version 0.42 Matrix-Zuteilung gruppiert unter Zielanlage */
.matrix-link-cell {
  min-width: 180px;
  max-width: 220px;
  background: #fff;
}
.matrix-link-label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .78rem;
  color: var(--muted);
  font-weight: 700;
}
.matrix-link-label select {
  width: 100%;
  min-width: 150px;
}
.linked-zone-cell {
  background: #f8fafc;
}

.matrix-linked-child-row td {
  background: #f8fbff;
}
.matrix-linked-child-row td.sticky-col {
  background: #f8fbff;
}
.matrix-linked-child-row .id-cell {
  color: #475467;
}
.matrix-child-marker {
  color: #2563eb;
  font-weight: 800;
}
.linked-zone-cell select,
.linked-zone-cell button {
  opacity: .72;
}
.warn {
  color: #b54708;
  font-style: normal;
}

/* Version 0.46 Matrix-Spalten ein-/ausblenden */
.matrix-column-panel {
  margin: .75rem 0 1rem;
  border: 1px solid #d0d5dd;
  border-radius: 12px;
  background: #fff;
  padding: .65rem .85rem;
}
.matrix-column-panel summary {
  cursor: pointer;
  font-weight: 700;
  color: #344054;
}
.matrix-column-panel .toolbar.compact {
  margin: .5rem 0;
  gap: .5rem;
}
.matrix-column-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .35rem .75rem;
  margin-top: .5rem;
}
.matrix-column-option {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .25rem .35rem;
  border-radius: 8px;
}
.matrix-column-option:hover {
  background: #f9fafb;
}
.matrix-column-option.is-fixed {
  background: #f9fafb;
}
.matrix-col-hidden {
  display: none !important;
}
.small-btn {
  padding: .35rem .65rem;
  font-size: .82rem;
}

/* Auto-Szenario Steuerungen Modal */
body.modal-open { overflow: hidden; }
.auto-element-summary { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-window {
  width: min(1100px, 96vw);
  max-height: 90vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 22px;
  border-bottom: 1px solid #e5e7eb;
}
.modal-head h2 { margin: 0 0 4px; }
.modal-close { font-size: 28px; line-height: 1; padding: 2px 10px; }
.modal-body {
  padding: 18px 22px;
  overflow: auto;
}
.modal-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 14px;
}
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #1e3a8a;
  font-weight: 600;
}
.auto-scenario-modal-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 8px;
  max-height: 58vh;
  overflow: auto;
  padding-right: 4px;
}
.auto-modal-element-option {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 9px 10px;
  min-height: 38px;
}
.scenario-origin-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
}
.modal-actions {
  padding: 14px 22px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
}
@media (max-width: 700px) {
  .modal-backdrop { padding: 8px; align-items: stretch; }
  .modal-window { width: 100%; max-height: 96vh; }
  .auto-scenario-modal-list { grid-template-columns: 1fr; }
}

/* Prüfblatt Bilder und Projekt-Chat */
.test-image-box { min-width: 120px; max-width: 180px; }
.test-image-preview { display: block; max-width: 150px; max-height: 95px; object-fit: contain; border: 1px solid var(--border, #d8dee8); border-radius: 6px; background: #fff; margin-bottom: 4px; }
.test-image-actions { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.small-button { font-size: 0.78rem; padding: 4px 7px; line-height: 1.2; }
.chat-card { max-width: 1100px; margin: 0 auto; }
.chat-messages { border: 1px solid var(--border, #d8dee8); border-radius: 10px; background: #f8fafc; min-height: 280px; max-height: 58vh; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.chat-message { max-width: 76%; background: #fff; border: 1px solid var(--border, #d8dee8); border-radius: 12px; padding: 10px 12px; box-shadow: 0 1px 3px rgba(15,23,42,.06); }
.chat-message.mine { align-self: flex-end; background: #eef7ff; }
.chat-meta { display: flex; gap: 12px; justify-content: space-between; color: #64748b; font-size: .82rem; margin-bottom: 5px; }
.chat-text { white-space: normal; line-height: 1.4; }
.chat-image { display: block; max-width: 360px; max-height: 260px; object-fit: contain; border: 1px solid var(--border, #d8dee8); border-radius: 8px; background: #fff; margin-top: 6px; }
.chat-compose { margin-top: 12px; display: grid; gap: 8px; }
.chat-compose textarea { width: 100%; resize: vertical; }
.chat-image-preview { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.chat-image-thumb { max-width: 70px; max-height: 48px; object-fit: contain; border: 1px solid var(--border, #d8dee8); border-radius: 6px; background: #fff; }
@media print {
  .test-image-preview { max-width: 120px; max-height: 80px; }
  .chat-compose { display: none !important; }
}

/* Chat Hinweis bei ungelesenen Nachrichten */
.tab[data-tab="chat"] { position: relative; }
.chat-unread-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  border: 2px solid #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(15,23,42,.25);
}
.tab.has-unread-chat {
  box-shadow: inset 0 -3px 0 #dc2626;
}

/* Szenario Start/Stopp */
.scenario-run-controls {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin: .5rem 0 .75rem;
}
.project-notification-toast {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  max-width: min(420px, calc(100vw - 2.4rem));
  padding: .9rem 1rem;
  border-radius: 14px;
  background: #111827;
  color: white;
  box-shadow: 0 18px 45px rgba(0,0,0,.25);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 9999;
  font-weight: 700;
}
.project-notification-toast.show {
  transform: translateY(0);
  opacity: 1;
}
@media print {
  .project-notification-toast,
  .scenario-run-controls {
    display: none !important;
  }
}


/* Version 0.54 Matrix: Kategorie / Unterkategorie ausblendbar */
.matrix-table.hide-category .sticky-subcategory {
  left: 90px;
}
.matrix-table.hide-subcategory .sticky-category,
.matrix-table.hide-category.hide-subcategory .sticky-id {
  box-shadow: 8px 0 10px -10px rgba(16,24,40,.35);
}
.matrix-column-option.is-fixed {
  background: #eef2f6;
}
.project-admin-table .center { text-align: center; vertical-align: middle; }
.toggle-line { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }

/* PDF-Pläne und Brandfallsteuerungs-Markierungen */
.plan-select-label { display: inline-grid; gap: .35rem; max-width: 420px; margin-top: .5rem; }
.plan-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.plan-stage {
  position: relative;
  width: 80%;
  max-width: 1280px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #f8fafc;
}
.plan-pdf-stage { min-height: 500px; height: 58vh; }
.plan-image-stage { min-height: 0; height: auto; background: white; }
.plan-stage-inner { position: relative; width: 100%; height: 100%; min-height: inherit; }
.plan-image-stage .plan-stage-inner { height: auto; min-height: 0; }
.plan-pdf-stage .plan-stage-inner { height: 100%; }
.plan-stage.is-adding-marker { cursor: crosshair; outline: 3px solid rgba(15,108,129,.25); }
.plan-pdf, .plan-pdf iframe { width: 100%; height: 100%; display: block; border: 0; background: white; }
.plan-image { width: 100%; height: auto; display: block; background: white; }
.plan-description { margin: .25rem 0 .35rem; font-weight: 700; color: var(--accent-dark); }
.plan-description-input { min-height: 64px; }
.plan-header-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.plan-marker-layer { position: absolute; inset: 0; pointer-events: none; }
.plan-stage.is-adding-marker .plan-marker-layer { pointer-events: auto; }
.plan-marker {
  position: absolute;
  transform: translate(-50%, -100%);
  border: 0;
  background: transparent;
  color: var(--danger);
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
  z-index: 3;
  display: inline-grid;
  justify-items: center;
  gap: .15rem;
}
.plan-marker:hover .plan-marker-label, .plan-marker:focus .plan-marker-label { box-shadow: 0 0 0 3px rgba(180,35,24,.18); }
.plan-marker.is-highlighted { animation: markerPulse .55s ease-in-out 3; z-index: 6; }
.plan-marker.is-highlighted .plan-marker-pin { box-shadow: 0 0 0 8px rgba(180,35,24,.22), 0 2px 12px rgba(16,24,40,.45); }
.plan-marker.is-highlighted .plan-marker-label { box-shadow: 0 0 0 5px rgba(180,35,24,.22), 0 1px 8px rgba(16,24,40,.22); }
.pruef-plan-marker-btn { margin-left: .5rem; vertical-align: middle; }
@keyframes markerPulse { 0%, 100% { transform: translate(-50%, -100%) scale(1); } 50% { transform: translate(-50%, -100%) scale(1.25); } }
.plan-marker-pin {
  width: 24px;
  height: 24px;
  background: var(--danger);
  border: 2px solid white;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 2px 8px rgba(16,24,40,.35);
}
.plan-marker-pin::after {
  content: '';
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: white;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.plan-marker-label {
  background: white;
  color: var(--danger);
  border: 1px solid rgba(180,35,24,.35);
  border-radius: 999px;
  padding: .1rem .4rem;
  font-size: .78rem;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(16,24,40,.16);
}
.plan-marker.missing { color: var(--warn); }
.plan-marker.missing .plan-marker-pin { background: var(--warn); }
.plan-marker.missing .plan-marker-label { color: var(--warn); border-color: rgba(181,71,8,.35); }
.plan-marker-summary { margin-top: 1rem; }
.plan-marker-list { display: grid; gap: .45rem; }
.plan-marker-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .45rem .55rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.plan-marker-row.missing { background: #fff7ed; }
.plan-marker-jump { color: var(--accent); font-weight: 800; text-align: left; }
.plan-edit-card { border-style: dashed; }
.plan-zoom-controls { display: none; gap: .35rem; align-items: center; }
.plan-zoom-controls button { min-width: 44px; min-height: 38px; }
#planZoomValue { text-align: center; font-weight: 800; }
@media (max-width: 900px) {
  .plan-stage { width: 100%; max-width: none; }
  .plan-pdf-stage { height: 60vh; min-height: 420px; }
}

.small-button { font-size: .8rem; padding: .35rem .55rem; }
@media print {
  #plaene { break-before: page; }
  .plan-pdf-stage { height: 250mm; min-height: 250mm; page-break-inside: avoid; }
  .plan-image-stage { height: auto; min-height: 0; page-break-inside: avoid; }
}

.report-filter-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .75rem;
  margin: .75rem 0;
  background: #fff;
}
.report-filter-box legend {
  padding: 0 .35rem;
  font-weight: 800;
  color: #344054;
}
.report-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .85rem;
  align-items: center;
}
.report-filter-option {
  display: inline-flex;
  width: auto;
  align-items: center;
  gap: .35rem;
  font-weight: 700;
}
.report-filter-option input {
  width: auto;
}

/* Version 0.56.20: Zuweisungsfenster und Drehbuch-Einleitung */
.element-assignment-box { display: grid; gap: 6px; min-width: 220px; }
.element-assignment-box .assignment-summary { max-width: 320px; line-height: 1.35; }
.element-assignment-modal-list { min-height: 180px; }
.script-intro-editor { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; }
.script-intro-editor summary { cursor: pointer; font-weight: 800; color: var(--accent-dark); }
.script-intro-textarea { min-height: 260px; width: 100%; margin-top: 10px; font-family: inherit; line-height: 1.45; }

/* Version 0.56.21: Drehbuch-Vorbereitung bearbeitbar */
.script-text-editors { display: grid; gap: 10px; margin-top: 12px; }
.script-preparation-textarea { min-height: 130px; width: 100%; margin-top: 10px; font-family: inherit; line-height: 1.45; }

/* Version 0.56.22 Matrix sortierbare Ueberschriften */
.matrix-sort-header,
.zone-sort-header {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  width: 100%;
  min-height: 100%;
  padding: .15rem .2rem;
  text-align: left;
  cursor: pointer;
}
.matrix-sort-header:hover,
.matrix-sort-header:focus-visible,
.zone-sort-header:hover,
.zone-sort-header:focus-visible {
  background: rgba(255,255,255,.45);
  border-radius: 8px;
  outline: none;
}
.matrix-sort-header.is-active,
.zone-sort-header.is-active {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.matrix-sort-arrow {
  white-space: nowrap;
  font-weight: 900;
}
.matrix-table th.zone-cell .matrix-sort-header {
  text-align: center;
}

/* Version 0.56.24 Zonentabelle sortierbar */
.zone-editor-wrap th .zone-sort-header { text-align: left; }


/* Version 0.56.25 Planmarker in der Matrix */
.id-cell.has-plan-marker {
  background: #fff4cc;
  color: #7a4b00;
  box-shadow: inset 4px 0 0 #f59e0b;
  cursor: pointer;
}
.id-cell.has-plan-marker:hover,
.id-cell.has-plan-marker:focus-visible {
  background: #ffed99;
  outline: 2px solid rgba(245, 158, 11, .45);
  outline-offset: -2px;
}
.matrix-plan-marker-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: .4rem;
  font-size: .85rem;
  color: #b45309;
  vertical-align: middle;
}

/* Version 0.56.27 Planmarker Dropdown und verschieben */
#planMarkerElementSelect option.plan-option-marked {
  background: #dcfce7;
  color: #166534;
  font-weight: 800;
}
#planMarkerElementSelect.has-placed-marker {
  border-color: #16a34a;
  background: #f0fdf4;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, .14);
}
#planMarkerPlacedInfo.ok {
  color: #166534;
  font-weight: 800;
}
.plan-stage.can-move-marker .plan-marker {
  cursor: grab;
}
.plan-stage.can-move-marker .plan-marker.is-dragging {
  cursor: grabbing;
  z-index: 9;
}
.plan-stage.can-move-marker .plan-marker.is-dragging .plan-marker-pin {
  box-shadow: 0 0 0 8px rgba(15, 108, 129, .18), 0 4px 14px rgba(16,24,40,.45);
}


/* Version 0.56.40 Genehmigungsvermerk Druck ohne unnoetige Leerseiten */
@media print {
  body.printing-approval-only {
    background: white !important;
  }
  body.printing-approval-only .app-header,
  body.printing-approval-only .tabs,
  body.printing-approval-only .app-footer,
  body.printing-approval-only .print-developer-footer,
  body.printing-approval-only .no-print {
    display: none !important;
  }
  body.printing-approval-only main {
    padding: 0 !important;
  }
  body.printing-approval-only .panel {
    display: none !important;
  }
  body.printing-approval-only #genehmigung {
    display: block !important;
  }
  body.printing-approval-only #approvalPageHost {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  body.printing-approval-only .approval-page,
  body.printing-approval-only .approval-page:last-child {
    width: 100% !important;
    min-height: auto !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    page-break-after: auto !important;
    break-after: auto !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
  }
}

/* Version 0.56.48 Automatisches Server-Backup */
.backup-schedule-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .85rem;
  margin: .75rem 0 1rem;
  background: #f8fafc;
}
.backup-schedule-box h4 {
  margin: 0 0 .45rem;
}
.backup-schedule-box input[readonly] {
  background: #f2f4f7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .85rem;
}


/* Version 0.56.56 Mobile Ansicht fuer Plaene, Pruefbericht, Pruefblaetter und Chat */
@media (max-width: 760px) {
  body { -webkit-text-size-adjust: 100%; }
  main { padding: .7rem; }
  .tabs {
    padding: .5rem .7rem 0;
    gap: .35rem;
    scroll-snap-type: x proximity;
  }
  .tab {
    padding: .58rem .68rem;
    font-size: .86rem;
    scroll-snap-align: start;
  }
  #plaene .card,
  #uebersicht .card,
  #pruefblaetter .card,
  #pruefblaetter .pruefblatt,
  #chat .card {
    border-radius: 12px;
    padding: .75rem;
    margin-bottom: .75rem;
  }
  #plaene .toolbar,
  #uebersicht .toolbar,
  #pruefblaetter .toolbar,
  #chat .toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: .5rem;
    align-items: stretch;
  }
  #plaene .toolbar > button,
  #plaene .toolbar > .button-like,
  #plaene .toolbar > a.button-like,
  #uebersicht .toolbar > button,
  #uebersicht .toolbar > .button-like,
  #pruefblaetter .toolbar > button,
  #pruefblaetter .toolbar > .button-like,
  #chat .toolbar > button,
  #chat .toolbar > .button-like {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  /* PDF-Plaene: auf Mobile volle Breite, einfache Bedienflaechen und groessere Touch-Ziele */
  #plaene .plan-select-label {
    display: grid;
    max-width: none;
    width: 100%;
  }
  #plaene .plan-header {
    flex-direction: column;
    align-items: stretch;
  }
  #plaene .plan-header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: .5rem;
    justify-content: stretch;
  }
  #plaene .plan-stage {
    width: 100%;
    max-width: none;
    border-radius: 10px;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }
  #plaene .plan-stage-inner {
    width: var(--plan-mobile-zoom-width, 100%);
    min-width: 100%;
  }
  #plaene .plan-pdf-stage {
    height: 62vh;
    min-height: 360px;
    max-height: 650px;
  }
  #plaene .plan-pdf-stage .plan-stage-inner {
    height: var(--plan-mobile-zoom-width, 100%);
    min-height: 100%;
  }
  #plaene .plan-image-stage { min-height: 180px; }
  #plaene .plan-zoom-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    margin-top: .35rem;
  }
  #plaene .plan-zoom-controls #planZoomValue {
    grid-column: 1 / -1;
  }
  #plaene .plan-marker {
    min-width: 44px;
    min-height: 44px;
    touch-action: none;
  }
  #plaene .plan-marker-pin {
    width: 20px;
    height: 20px;
  }
  #plaene .plan-marker-pin::after {
    width: 6px;
    height: 6px;
  }
  #plaene .plan-marker-label {
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: .68rem;
  }
  #plaene .plan-marker-row {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  #plaene .plan-marker-row button { justify-content: flex-start; }
  #plaene #planMarkerElementSelect,
  #plaene #activePlanSelect {
    min-height: 44px;
    font-size: 1rem;
  }

  /* Pruefbericht: Detailtabelle wird auf Mobile zu Karten. */
  #uebersicht .overview-grid,
  #uebersicht .status-grid {
    grid-template-columns: 1fr;
  }
  #uebersicht .scenario-overview-card .open-overview-scenario,
  #uebersicht #exportPruefberichtPdfBtn {
    width: 100%;
    min-height: 44px;
  }

  /* Version 0.56.63: Filterauswahl im Pruefbericht auf Mobile ausblenden. */
  #uebersicht .report-filter-box {
    display: none;
  }
  #uebersicht .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }
  #uebersicht .overview-table {
    border-collapse: separate;
    border-spacing: 0 .65rem;
  }
  #uebersicht .overview-table thead { display: none; }
  #uebersicht .overview-table tbody,
  #uebersicht .overview-table tr,
  #uebersicht .overview-table td {
    display: block;
    width: 100%;
  }
  #uebersicht .overview-table tr {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(16,24,40,.05);
    padding: .25rem 0;
    overflow: hidden;
  }
  #uebersicht .overview-table td {
    position: relative;
    border: 0;
    border-bottom: 1px solid #eef2f6;
    min-width: 0 !important;
    min-height: 2.25rem;
    padding: .52rem .7rem .52rem 8.2rem;
    word-break: break-word;
  }
  #uebersicht .overview-table td:last-child { border-bottom: 0; }
  #uebersicht .overview-table td::before {
    position: absolute;
    left: .7rem;
    top: .52rem;
    width: 6.9rem;
    color: var(--muted);
    font-weight: 900;
    font-size: .78rem;
    line-height: 1.2;
  }
  #uebersicht .overview-table td:nth-child(1)::before { content: 'Szenario'; }
  #uebersicht .overview-table td:nth-child(2)::before { content: 'Ausloesung'; }
  #uebersicht .overview-table td:nth-child(3)::before { content: 'ID'; }
  #uebersicht .overview-table td:nth-child(4)::before { content: 'Gewerk / Typ'; }
  #uebersicht .overview-table td:nth-child(5)::before { content: 'Anlage'; }
  #uebersicht .overview-table td:nth-child(6)::before { content: 'Pos'; }
  #uebersicht .overview-table td:nth-child(7)::before { content: 'Kontrolle'; }
  #uebersicht .overview-table td:nth-child(8)::before { content: 'Resultat'; }
  #uebersicht .overview-table td:nth-child(9)::before { content: 'Geprueft am'; }
  #uebersicht .overview-table td:nth-child(10)::before { content: 'Geprueft von'; }
  #uebersicht .overview-table td:nth-child(11)::before { content: 'Bemerkung'; }
  #uebersicht .overview-table td:nth-child(12)::before { content: 'Bild'; }

  /* Pruefblaetter: jede Kontrolle als mobile Karte, PC-Ansicht bleibt unveraendert. */
  #pruefblaetter .print-title {
    flex-direction: column;
    align-items: flex-start;
  }
  #pruefblaetter .position-meta {
    grid-template-columns: 1fr;
  }
  #pruefblaetter .pruef-position {
    padding: .65rem;
    margin: .75rem 0;
    border-radius: 12px;
  }
  #pruefblaetter .pruef-position h3 {
    font-size: 1rem;
    line-height: 1.35;
  }
  #pruefblaetter .pruef-plan-marker-btn {
    display: block;
    width: 100%;
    margin: .45rem 0 0;
  }
  #pruefblaetter .checklist-table,
  #pruefblaetter .checklist-table tbody,
  #pruefblaetter .checklist-table tr,
  #pruefblaetter .checklist-table td {
    display: block;
    width: 100%;
  }
  #pruefblaetter .checklist-table thead { display: none; }
  #pruefblaetter .checklist-table tr {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    margin: .65rem 0;
    padding: .3rem 0;
    overflow: hidden;
  }
  #pruefblaetter .checklist-table td {
    border: 0;
    padding: .52rem .7rem;
    min-width: 0 !important;
    width: 100% !important;
    text-align: left !important;
    word-break: break-word;
  }
  #pruefblaetter .checklist-table td:nth-child(1) {
    background: #f8fafc;
    font-weight: 900;
    border-bottom: 1px solid #eef2f6;
  }
  #pruefblaetter .checklist-table td:nth-child(1)::before { content: 'Position '; }
  #pruefblaetter .checklist-table td:nth-child(2)::before,
  #pruefblaetter .checklist-table td:nth-child(3)::before,
  #pruefblaetter .checklist-table td:nth-child(4)::before,
  #pruefblaetter .checklist-table td:nth-child(5)::before,
  #pruefblaetter .checklist-table td:nth-child(6)::before,
  #pruefblaetter .checklist-table td:nth-child(7)::before {
    display: block;
    margin-bottom: .25rem;
    color: var(--muted);
    font-weight: 900;
    font-size: .78rem;
  }
  #pruefblaetter .checklist-table td:nth-child(2)::before { content: 'Kontrolle'; }
  #pruefblaetter .checklist-table td:nth-child(3)::before { content: 'Resultat'; }
  #pruefblaetter .checklist-table td:nth-child(4)::before { content: 'Bemerkungen / Mangel'; }
  #pruefblaetter .checklist-table td:nth-child(5)::before { content: 'Bild'; }
  #pruefblaetter .checklist-table td:nth-child(6)::before { content: 'Geprueft am'; }
  #pruefblaetter .checklist-table td:nth-child(7)::before { content: 'Geprueft von'; }
  #pruefblaetter .result-choice-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
    width: 100%;
  }
  #pruefblaetter .result-choice {
    min-height: 44px;
    padding: .55rem .45rem;
  }
  #pruefblaetter .test-note {
    min-height: 44px;
    font-size: 1rem;
  }
  #pruefblaetter .test-image-box {
    max-width: none;
    min-width: 0;
  }
  #pruefblaetter .test-image-preview {
    max-width: 100%;
    max-height: 165px;
  }
  #pruefblaetter .test-image-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  /* Chat: bessere Lesbarkeit und kompakter Eingabebereich auf Mobile. */
  #chat .chat-card { max-width: none; }
  #chat .chat-messages {
    min-height: calc(100vh - 360px);
    max-height: 55vh;
    padding: .65rem;
    gap: .55rem;
  }
  #chat .chat-message {
    max-width: 92%;
    padding: .7rem .75rem;
  }
  #chat .chat-meta {
    flex-direction: column;
    gap: .1rem;
  }
  #chat .chat-image {
    max-width: 100%;
    max-height: 240px;
  }
  #chat .chat-compose {
    position: sticky;
    bottom: .4rem;
    background: var(--card);
    padding: .65rem;
    margin: .75rem -.2rem 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 -4px 18px rgba(16,24,40,.12);
    z-index: 5;
  }
  #chat .chat-compose textarea {
    min-height: 96px;
    font-size: 1rem;
  }
  #chat .chat-compose .toolbar {
    grid-template-columns: 1fr 1fr;
  }
  #chat #sendChatBtn {
    grid-column: 1 / -1;
  }
}

@media (max-width: 420px) {
  #uebersicht .overview-table td {
    padding: 1.75rem .65rem .55rem;
  }
  #uebersicht .overview-table td::before {
    left: .65rem;
    top: .42rem;
    width: auto;
  }
  #pruefblaetter .result-choice-group,
  #chat .chat-compose .toolbar {
    grid-template-columns: 1fr;
  }
}


/* Version 0.56.58 Mobile Pruefblaetter: Druckfelder auf Smartphone ausblenden */
@media screen and (max-width: 760px) {
  #pruefblaetter .checklist-table td.print-only {
    display: none !important;
  }
}


/* Version 0.56.59 Mobile Plan Zoom und Marker-Fokus */
@media screen and (max-width: 760px) {
  #plaene .plan-marker.is-highlighted {
    z-index: 20;
  }
  #plaene .plan-marker.is-highlighted .plan-marker-label {
    font-size: .78rem;
  }
}

/* Version 0.56.64 Szenario vorbereiten */
.scenario-prep-controls {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
  margin: .5rem 0 .35rem;
}
.scenario-preparation-modal-window {
  width: min(1180px, 98vw);
}
.scenario-preparation-list {
  display: grid;
  gap: 12px;
}
.scenario-prep-position {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.scenario-prep-position.is-ready {
  border-color: rgba(2, 122, 72, .45);
  background: #f6fef9;
}
.scenario-prep-position-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.scenario-prep-position-head h3 {
  margin: 0 0 .5rem;
}
.scenario-prep-ready-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.scenario-prep-meta {
  margin-top: .25rem;
}
.scenario-prep-ready-text {
  margin-bottom: 0;
  color: var(--ok);
  font-weight: 700;
}
@media (max-width: 700px) {
  .scenario-prep-position {
    padding: 12px;
  }
  .scenario-prep-position-head {
    display: grid;
    gap: 8px;
  }
  .scenario-prep-ready-actions {
    align-items: stretch;
  }
  .scenario-prep-ready-actions button {
    width: 100%;
  }
}

/* Version 0.56.66 Vorbereitung global und Prüferanzeige */
.assigned-pruefer-meta strong {
  color: var(--accent-dark);
}
