/* =====================================================================
   Styles für Startseite, Arztbrief und Überleitungsbogen
   (nutzt Farben/Buttons des Medikamentenplans: --ui, .btn, .btn.primary)
   ===================================================================== */

/* ---------- Ansichten umschalten (Medikamentenplan nur in seiner Ansicht) ---------- */
body:not(.sim-v-medplan) > #toolbar,
body:not(.sim-v-medplan) > #viewbar,
body:not(.sim-v-medplan) > #stage { display: none !important; }
body.sim-v-medplan > #simApp { display: none !important; }

/* Der Patienten-Zufallsgenerator ist auf die Startseite gewandert */
#btnPatient, #mobil [data-act="patient"] { display: none !important; }

/* Mess- und Exportbereich für die Dokumentseiten */
#simMess { position: absolute; left: -12000px; top: 0; visibility: hidden; }
#simExport { position: absolute; left: 0; top: 0; z-index: -1; }

/* Navigation, Kopf- und Tab-Leiste: siehe design.css (App-Rahmen) */

/* ---------- Startseite & Einstellungen ---------- */
.sim-wrap { max-width: 1040px; margin: 0 auto; padding: 18px 16px 48px; display: flex; flex-direction: column; gap: 14px; }
.sim-kopfzeile h1 { margin: 0; font-size: 22px; }
.sim-kopfzeile p { margin: 4px 0 0; color: #444; font-size: 14px; }
.sim-karte { background: #fff; border-radius: 10px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.sk-kopf { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.sk-kopf h2 { margin: 0; font-size: 17px; }
.sk-unter { margin-top: 18px; }
.sk-unter h3 { margin: 0; font-size: 15px; }
.sk-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.sk-hinweis { margin: 2px 0 10px; font-size: 12.5px; color: #5b6170; }
.sk-hinweis.warn { padding: 7px 9px; border-radius: 6px; background: #fff6dd; color: #7a5200; }

.sf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 12px; }
.sf-unter { margin-top: 12px; padding-top: 12px; border-top: 1px dashed #d5d9e1; }
.sf { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 12px; color: #5b6170; }
.sf.breit { grid-column: span 2; }
.sf input, .sf select {
  width: 100%; min-width: 0; padding: 7px 9px;
  font: 16px Arial, Helvetica, sans-serif; color: #111;   /* 16 px: iOS zoomt sonst beim Antippen */
  border: 1px solid #c5cad4; border-radius: 7px; background: #fff;
}
.sf input:focus, .sf select:focus { outline: 2px solid var(--ui); outline-offset: -1px; }
.sf.info b { padding: 7px 0; font-size: 15px; color: #111; }

.dx-gruppen { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.dx-gruppe { margin: 0; padding: 6px 10px 8px; border: 1px solid #d5d9e1; border-radius: 8px; }
.dx-gruppe legend { padding: 0 4px; font-size: 12px; font-weight: bold; color: #5b6170; }
.cb-zeile { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 14px; cursor: pointer; }
.cb-zeile input { flex: none; width: 18px; height: 18px; margin: 0; }
.al-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 10px; margin-bottom: 10px; }

.sim-kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.kachel {
  display: flex; flex-direction: column; gap: 6px; padding: 18px;
  background: #fff; border: 2px solid transparent; border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.12); color: #111; text-decoration: none;
}
.kachel:hover, .kachel:focus-visible { border-color: var(--ui); }
.k-titel { font-size: 17px; font-weight: bold; color: var(--ui); }
.k-status { font-size: 12.5px; color: #5b6170; }
.sim-export { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sim-export .sk-hinweis { margin: 0; }

.doc-wrap { max-width: none; }
.doc-wrap .doc-einst { width: 100%; max-width: 900px; margin: 0 auto; }
.dx-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; font-size: 13px; color: #5b6170; }
.chip { padding: 3px 10px; border-radius: 999px; background: #eef1f5; color: #222; font-size: 12.5px; }
.chip.leer { color: #888; }
.chip-link { font-size: 12.5px; }
.einst-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 14px; align-items: end; }
.schalter { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; cursor: pointer; }
.schalter input { width: 18px; height: 18px; margin: 0; }
.einst-infekt { margin: 10px 0 4px; }
.infekt-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 10px; }
.auto-med { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; padding: 10px 12px; border: 1px solid #9fb6e6; border-radius: 8px; background: var(--ui-soft); cursor: pointer; font-size: 14px; }
.auto-med input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; }
.auto-med small { color: #4a5160; font-size: 12px; }
.ue-checkliste { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 0 12px; margin-bottom: 6px; }

@media (max-width: 760px) {
  .sf.breit { grid-column: auto; }
  .sim-wrap { padding: 12px 12px 40px; }
}

/* =====================================================================
   DIN-A4-Dokumentseiten (794 × 1123 px = 210 × 297 mm bei 96 dpi)
   ===================================================================== */
.doc-stapel { display: flex; flex-direction: column; align-items: center; gap: 22px; margin-top: 6px; }
.doc-seite {
  position: relative; flex: none;
  width: 794px; height: 1123px; overflow: hidden;
  display: flex; flex-direction: column;
  padding: 36px 56px 18px 70px;
  background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.18);
  font: 12px/1.45 Arial, Helvetica, sans-serif; color: #111;
}
.doc-inhalt { flex: 1; min-height: 0; overflow: hidden; }
.doc-fuss {
  min-height: 19px; display: flex; justify-content: space-between; gap: 12px;
  margin-top: 8px; padding-top: 5px; border-top: 1px solid #9aa3ad; font-size: 8.5px; color: #555;
}
.doc-uebung { margin-top: 2px; font-size: 7.5px; color: #9aa0a6; text-align: center; }
.doc-seite p { margin: 0 0 6px; }
.doc-seite svg { display: block; width: 100%; height: 100%; }

/* ---------- Arztbrief (klassischer Klinikbrief) ---------- */
.ab-seite { padding: 40px 46px 14px 70px; font: 12.5px/1.42 Arial, Helvetica, sans-serif; color: #1a1a1a; hyphens: auto; }
.ab-seite p { margin: 0 0 7px; }
.ab-seite .bs { text-align: justify; }
.ab1 { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 172px; gap: 26px; }
.ab1-links { display: flex; flex-direction: column; min-height: 0; }
.ab1-links .doc-inhalt { flex: 1; min-height: 0; overflow: hidden; }
.ab1-absender { margin-top: 104px; padding-bottom: 2px; border-bottom: 1px solid #444; font-size: 8.5px; line-height: 1.35; color: #333; width: 300px; }
.ab1-anschrift { margin-top: 10px; min-height: 102px; font-size: 12.5px; line-height: 1.45; }
.ab1-titel { position: relative; margin: 18px 0 16px; padding: 3px 0; border-top: 1px solid #555; border-bottom: 1px solid #555; text-align: center; font-size: 17px; letter-spacing: .3px; }
.ab1-rand { font-size: 9px; line-height: 1.38; color: #333; }
.ab-wortmarke { display: flex; align-items: center; gap: 8px; margin-bottom: 44px; font-family: Georgia, 'Times New Roman', serif; font-size: 17px; line-height: 1.12; letter-spacing: 1.2px; color: #6e6259; }
.ab-wm-logo { flex: none; width: 34px; height: 34px; }
.r-abt { font-size: 12px; font-weight: bold; color: #333; }
.r-unter { margin-bottom: 14px; font-size: 9.5px; color: #555; }
.r-chef { margin-bottom: 12px; font-size: 10.5px; color: #333; }
.r-chef b { font-size: 11px; }
.r-block { margin-bottom: 10px; }
.r-schwerpunkte { margin: 4px 0 10px; font-weight: bold; color: #3b3b3b; }
.r-amb { margin-bottom: 7px; }
.r-amb b { font-style: italic; }
.r-lehr { margin-top: 8px; color: #555; }
.ab-seitenzahl { height: 16px; margin-top: 4px; text-align: center; font-size: 9.5px; line-height: 16px; color: #333; }   /* feste Höhe: Seitenzahl wird erst nach dem Umbruch eingesetzt */
.ab-folgekopf { margin: -10px 0 18px; padding-top: 3px; border-top: 1px solid #888; text-align: right; font-size: 10px; color: #333; }
.ab-recht { display: grid; grid-template-columns: 1.1fr 1.2fr 1fr 1.1fr; gap: 12px; margin-top: 6px; padding-top: 5px; border-top: 1px solid #999; font-size: 7.3px; line-height: 1.35; color: #444; }

.ab-betreff { font-size: 11.5px; }
.ab-abschnitt h3 { margin: 14px 0 6px; padding: 0; font-size: 13.5px; font-weight: bold; color: #222; text-decoration: underline; text-underline-offset: 2px; }
.ab-abschnitt h3.ohne-linie { text-decoration: none; font-size: 14px; }
.ab-abschnitt h4 { margin: 8px 0 3px; font-size: 12.5px; font-weight: bold; color: #333; }
.forts > h3::after, .forts > h4::after, .forts .lab-titel::after { content: ' (Fortsetzung)'; color: #666; font-size: 10.5px; font-weight: normal; text-decoration: none; }
.ab-unter { margin-bottom: 7px; }
.ab-unter h4 { margin: 0 0 1px; font-size: 12.5px; font-weight: bold; color: #333; }
.ab-unter p { margin: 0; }
.ab-dx ol { margin: 0; padding: 0; list-style: none; }
.ab-dx li { display: flex; gap: 6px; padding: 1px 0; }
.ab-dx .dx-nr { flex: none; width: 18px; }
.ab-dx .dx-haupt { font-weight: bold; }
.dx-sub { padding-left: 8px; font-weight: normal; }
.icd { color: #555; font-weight: normal; white-space: nowrap; }
.vg-zeile { margin-bottom: 3px; }
.ab-befund { margin-bottom: 8px; text-align: justify; }
.ab-labor { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 11px; }
.ab-labor .lab-titel { padding: 0 0 4px; font-size: 13.5px; font-weight: bold; text-align: left; color: #222; }
.ab-labor thead tr + tr th { padding: 2px 4px 4px; font-size: 9.5px; font-weight: normal; color: #555; text-align: left; vertical-align: bottom; }
.ab-labor tbody th { padding: 1px 4px; font-weight: bold; text-align: left; color: #333; }
.ab-labor td { padding: 1px 4px; }
.lab-w { text-align: left !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.patho { font-weight: bold; }
.proc-zeile { padding-left: 2px; margin-bottom: 3px; text-align: justify; }
.proc-termin { margin-top: 10px !important; }
.ab-medtab { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.ab-medtab thead th { padding: 2px 4px; border-bottom: 1px solid #333; text-align: left; font-weight: bold; text-decoration: underline; }
.ab-medtab td { padding: 3px 4px; vertical-align: top; }
.ab-medtab .dz { width: 62px; text-align: center !important; white-space: nowrap; }
.med-hinweis { font-size: 10.5px; color: #444; }
.ab-notiz { margin-top: 4px; font-size: 10px; color: #444; }
.ab-unterschriften { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin: 34px 0 6px; text-align: center; font-size: 11.5px; }
.ab-unterschriften small { color: #444; }
.u-linie { display: block; margin-bottom: 4px; border-top: 1px solid #333; }

/* ---------- Überleitungsbogen ---------- */
.ab-tabelle { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 10.5px; }
.ab-tabelle th, .ab-tabelle td { padding: 2px 5px; border-bottom: 1px solid #ddd5b5; text-align: left; vertical-align: top; }
.ab-tabelle .dz { width: 26px; text-align: center !important; }
.ab-tabelle .dz-frei { text-align: center !important; font-style: italic; }
.ab-tabelle .tab-titel { padding: 3px 8px; font-size: 12px; font-weight: bold; text-align: left; }
.forts .tab-titel::after { content: ' (Fortsetzung)'; font-size: 10px; font-weight: normal; }
.ue-seite { --ue: #f2c200; --ue-text: #5c4800; --ue-hell: #fff6cc; --ue-linie: #d8c26b; padding: 30px 40px 16px 46px; font-size: 11px; }
.ue-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 8px; border-bottom: 3px solid var(--ue); }
.ue-marke { display: flex; align-items: center; gap: 11px; }
.ue-logo { flex: none; width: 56px; height: 56px; }
.ue-name { font-size: 22px; font-weight: bold; color: #1d1d1b; line-height: 1.1; }
.ue-zusatz { font-size: 10.5px; color: var(--ue-text); }
.ue-adresse { margin-top: 3px; font-size: 9px; color: #555; line-height: 1.4; }
.ue-titelbox { padding: 6px 10px; border: 2px solid var(--ue); text-align: right; }
.ue-titel { font-size: 17px; font-weight: bold; color: #1d1d1b; }
.ue-untertitel { margin-top: 3px; font-size: 9.5px; }
.ue-kopfband { display: grid; grid-template-columns: 1fr 190px; gap: 10px; margin-top: 8px; }
.ue-uebergabe { border-top: 1px solid var(--ue-linie); }
.ue-etikett { padding: 5px 8px; border: 1.5px dashed #777; background: #fafafa; font-size: 10px; line-height: 1.45; }
.ue-etikett-titel { font-size: 7.5px; color: #777; letter-spacing: .4px; }
.ue-kopf-klein { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; padding-bottom: 5px; border-bottom: 2px solid var(--ue); font-size: 9.5px; color: #444; }
.ue-mini { display: flex; align-items: center; gap: 6px; font-weight: bold; color: #1d1d1b; }
.ue-mini-logo { width: 18px; height: 18px; }
.ue-block h3 { display: flex; align-items: center; gap: 7px; margin: 9px 0 0; padding: 3px 7px; background: var(--ue); color: #1d1d1b; font-size: 11.5px; }
.ue-block.forts h3::after { color: #5c4800; }
.ue-nr { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 3px; border-radius: 3px; background: #1d1d1b; color: #f2c200; font-size: 10px; font-weight: bold; }
.ue-raster { display: grid; grid-template-columns: repeat(4, 1fr); border-left: 1px solid var(--ue-linie); }
.ue-feld { min-height: 29px; padding: 2px 6px 3px; border-right: 1px solid var(--ue-linie); border-bottom: 1px solid var(--ue-linie); font-size: 10.5px; line-height: 1.35; }
.ue-feld label { display: block; font-size: 7.5px; color: var(--ue-text); letter-spacing: .3px; }
.ue-feld.s2, .ue-karten.s2 { grid-column: span 2; }
.ue-feld.s3 { grid-column: span 3; }
.ue-feld.s4, .ue-karten.s4, .ue-vital.s4 { grid-column: span 4; }
.ue-feld.ue-rea { background: #fdecea; box-shadow: inset 3px 0 0 #b3261e; }
.ue-feld.ue-warn { background: #fff4e0; box-shadow: inset 3px 0 0 #d98a00; }
.ue-klein { font-size: 9px; color: #555; }
.ue-karten { display: grid; border-right: 1px solid var(--ue-linie); border-bottom: 1px solid var(--ue-linie); }
.ue-karten.k1 { grid-template-columns: 1fr; }
.ue-karten.k2 { grid-template-columns: 1fr 1fr; }
.ue-karten.k3 { grid-template-columns: 1fr 1fr 1fr; }
.ue-karte { padding: 4px 7px; font-size: 10px; line-height: 1.4; }
.ue-karte + .ue-karte { border-left: 1px solid var(--ue-linie); }
.ue-karte-t { margin-bottom: 2px; font-size: 7.5px; color: var(--ue-text); letter-spacing: .3px; }
.ue-vital { display: grid; grid-template-columns: repeat(7, 1fr); border-right: 1px solid var(--ue-linie); border-bottom: 1px solid var(--ue-linie); background: var(--ue-hell); }
.ue-vital > div { padding: 2px 6px 3px; font-size: 10.5px; font-weight: bold; }
.ue-vital > div + div { border-left: 1px solid var(--ue-linie); }
.ue-vital label { display: block; font-size: 7.5px; font-weight: normal; color: var(--ue-text); }
.ue-dx > div { display: flex; justify-content: space-between; gap: 10px; padding: 1px 0; border-bottom: 1px dotted #e6d9a3; }
.ue-dx > div:last-child { border-bottom: none; }
.ue-cb-z { display: inline-flex; align-items: center; gap: 3px; margin-right: 9px; white-space: nowrap; }
.ue-cb { display: inline-grid; place-items: center; width: 10px; height: 10px; border: 1px solid #333; font-size: 9px; line-height: 1; }
.ue-cb.an { font-weight: bold; background: #fff; }
.ue-cbgrid { display: flex; flex-wrap: wrap; gap: 3px 0; }
.ue-btm { padding: 0 3px; border-radius: 2px; background: #b3261e; color: #fff; font-size: 8px; font-weight: bold; }
.ab-tabelle.ue-med { margin-top: 9px; font-size: 10px; }
.ue-med .tab-titel { display: table-cell; padding: 3px 7px !important; border: none !important; background: var(--ue) !important; color: #1d1d1b !important; font-size: 11.5px !important; text-align: left; font-weight: bold; }
.ue-med .tab-titel .ue-nr { margin-right: 6px; }
.ue-med thead tr + tr th { background: var(--ue-hell); border-bottom-color: var(--ue-linie); }
.ue-med small { color: #5c4800 !important; }
.ue-med .nw, .ue-risiko .nw { white-space: nowrap; }
.ue-pflegetitel { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; padding-bottom: 4px; border-bottom: 3px solid var(--ue); color: #1d1d1b; font-size: 15px; font-weight: bold; }
.ue-pflegetitel .ue-nr { background: #1d1d1b; color: #f2c200; }
.ue-pflegetitel small { color: #555; font-size: 9.5px; font-weight: normal; }
.ue-sig { display: block; height: 22px; }

/* =====================================================================
   Druck: Arztbrief/Überleitungsbogen als A4 hoch (Seitenformat setzt
   gemeinsam.js je Ansicht), Bedienelemente ausblenden
   ===================================================================== */
@media print {
  #simNav, .doc-einst, .sim-kopfzeile, .sim-export { display: none !important; }
  body.sim-dokument { background: #fff !important; }
  body.sim-dokument .sim-wrap { display: block !important; max-width: none !important; padding: 0 !important; }
  .doc-seite { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-stapel { display: block !important; zoom: 1 !important; gap: 0 !important; margin: 0 !important; }
  .doc-seite { margin: 0 !important; box-shadow: none !important; break-after: page; }
  .doc-seite:last-child { break-after: auto; }
}


/* =====================================================================
   v7: Szenarien, Rechtliches, Diabetes (Startseite)
   ===================================================================== */
.sim-szenario { padding: 3px 10px; border-radius: 999px; background: #2f8f4e; color: #fff; font-size: 12px; font-weight: bold; text-decoration: none; }
.btn.klein { padding: 4px 9px; font-size: 12.5px; }
label.btn { display: inline-flex; align-items: center; cursor: pointer; }
.bib-aktiv { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid #9fd0a8; border-radius: 8px; background: #e9f6ec; font-size: 14px; }
.bib-aktiv.geaendert { border-color: #e6c46a; background: #fff6dd; }
.bib-label { color: #5b6170; }
.bib-status { margin-left: 8px; font-size: 12px; color: #5b6170; }
.bib-neu { display: grid; grid-template-columns: 1fr 1.3fr auto; gap: 10px; align-items: end; margin-bottom: 12px; }
.bib-liste { display: flex; flex-direction: column; gap: 8px; }
.bib-eintrag { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border: 1px solid #d5d9e1; border-radius: 8px; }
.bib-eintrag.aktiv { border-color: var(--ui); box-shadow: inset 4px 0 0 var(--ui); }
.bib-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bib-meta { font-size: 12px; color: #5b6170; }
.bib-beschreibung { font-size: 12.5px; color: #333; }
.bib-sicherung { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed #d5d9e1; font-size: 12.5px; color: #5b6170; }
.bib-sicherung small { flex-basis: 100%; }
.cb-zeile.gesperrt { opacity: .45; cursor: not-allowed; }
.in-box { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed #d5d9e1; }
.dx-notiz { margin: 6px 0 0 !important; }
.pv-schalter { margin: 0; align-self: stretch; }
.pv-auswahl { display: flex; flex-direction: column; gap: 4px; margin: 10px 0 6px; }
.pv-zeile { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid #eef0f4; }
.pv-name { font-size: 14px; }
.pv-knoepfe { display: inline-flex; overflow: hidden; border: 1px solid #c5cad4; border-radius: 8px; }
.pv-k { padding: 6px 12px; border: 0; background: #fff; color: #333; font-size: 13px; cursor: pointer; }
.pv-k + .pv-k { border-left: 1px solid #c5cad4; }
.pv-k.an.ja { background: #2f8f4e; color: #fff; }
.pv-k.an.nein { background: #b3261e; color: #fff; }
.pv-vorauswahl { margin-top: 6px; }
.export-wahl { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 16px; width: 100%; font-size: 14px; }
.schalter-pall { color: #4b2f7a; font-weight: bold; }
@media (max-width: 760px) { .bib-neu { grid-template-columns: 1fr; } }

/* Arztbrief: Hinweis Palliativsituation / Reanimationsstatus */
.ab-pall { margin: 2px 0 8px; padding: 5px 9px; border: 1.5px solid #6b4a9b; background: #f5f0fb; font-size: 12px; }
.ab-pall.leicht { border-color: #9aa3ad; background: #f6f7f8; }

/* Gemeinsam: Praxisstempel und Unterschriften */
.stempel { display: inline-block; padding: 4px 8px; border: 1.5px solid #34409c; border-radius: 3px; color: #34409c; font: 9.5px/1.35 Arial, Helvetica, sans-serif; transform: rotate(-1.2deg); }
.stempel b { font-size: 10.5px; }

/* =====================================================================
   Insulinschema (A4)
   ===================================================================== */
.in-seite { padding: 28px 50px 12px 56px; font-size: 10.5px; }
.in-kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 8px; border-bottom: 3px solid #1f6f8b; }
.in-titel { font-size: 22px; font-weight: bold; color: #1f6f8b; }
.in-unter { margin-top: 2px; font-size: 12px; color: #333; }
.in-patient { display: grid; grid-template-columns: 2fr 1fr .8fr 1.9fr 1fr; margin: 10px 0 2px; border: 1px solid #9cc3d1; background: #f2f8fa; }
.in-patient > div { padding: 4px 7px; font-size: 11.5px; }
.in-patient > div + div { border-left: 1px solid #9cc3d1; }
.in-patient label { display: block; font-size: 8.5px; color: #1f6f8b; }
.in-kopf-klein { display: flex; justify-content: space-between; margin-bottom: 8px; padding-bottom: 4px; border-bottom: 2px solid #1f6f8b; font-size: 10px; color: #444; }
.in-block h3 { margin: 8px 0 4px; padding: 2px 8px; background: #1f6f8b; color: #fff; font-size: 12px; }
.in-block.in-warn h3 { background: #b3261e; }
.in-tab { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.in-tab th, .in-tab td { padding: 2px 6px; border: 1px solid #9cc3d1; text-align: left; vertical-align: middle; }
.in-tab thead th { background: #e3f0f4; font-size: 10.5px; }
.in-tab .in-z { width: 78px; text-align: center; }
.in-korr td:first-child { font-weight: bold; white-space: nowrap; }
.in-hypo td { background: #fdecea; }
.in-klein { font-size: 9.5px; color: #444; }
.in-notiz { margin: 4px 0 0 !important; font-size: 10px; line-height: 1.35; }
.in-zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.in-zwei ul { margin: 4px 0 0; padding-left: 18px; }
.in-ziel { margin-top: 4px; border-collapse: collapse; }
.in-ziel td { padding: 2px 12px 2px 0; }
.in-ziel td + td { font-weight: bold; }
.in-hypo-liste, .in-liste { margin: 0; padding-left: 20px; }
.in-hypo-liste li, .in-liste li { margin-bottom: 1px; }
.in-liste { font-size: 10px; }
.in-unterschrift { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 10px; font-size: 10.5px; color: #333; }
.in-sig { width: 48mm; height: 12mm; }

/* =====================================================================
   Patientenverfügung (A4)
   ===================================================================== */
.pv-seite { padding: 46px 64px 16px 70px; font: 12px/1.5 Georgia, 'Times New Roman', serif; color: #1a1a1a; }
.pv-kopf { margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid #444; text-align: center; }
.pv-titel { font-size: 27px; letter-spacing: 1px; }
.pv-unter { font-size: 11px; color: #555; }
.pv-kopf-klein { margin-bottom: 10px; padding-bottom: 4px; border-bottom: 1px solid #999; font: 10px Arial, Helvetica, sans-serif; color: #555; }
.pv-eingang { margin: 6px 0 10px !important; text-align: justify; }
.pv-abschnitt h3 { margin: 12px 0 5px; font: bold 13.5px Arial, Helvetica, sans-serif; }
.pv-abschnitt h4 { margin: 8px 0 2px; font: bold 12px Arial, Helvetica, sans-serif; }
.pv-punkt { display: flex; gap: 8px; margin: 3px 0; text-align: justify; }
.pv-cb { flex: none; display: grid; place-items: center; width: 12px; height: 12px; margin-top: 3px; border: 1px solid #333; font: bold 10px Arial, Helvetica, sans-serif; }
.pv-tab td { padding: 2px 12px 2px 0; vertical-align: top; }
.pv-schluss { margin-top: 14px; }
.pv-unterschrift { display: grid; grid-template-columns: 1fr 1.3fr; gap: 30px; align-items: end; margin-top: 14px; font: 10px Arial, Helvetica, sans-serif; color: #555; }
.pv-wert { display: block; margin-bottom: 2px; color: #1c2b6e; font: italic 13px 'Segoe Script', 'Bradley Hand', 'Brush Script MT', cursive; }
.pv-sig { display: block; width: 60mm; height: 16mm; }
.pv-aktual { margin-top: 14px; padding-top: 8px; border-top: 1px dashed #999; font-size: 11px; }
.pv-arzt { margin-top: 16px; padding: 8px 12px 10px; border: 1px solid #bbb; }
.pv-arzt h3 { margin: 0 0 4px; font: bold 12.5px Arial, Helvetica, sans-serif; }
.pv-arztfeld .stempel { margin-bottom: 2px; }

/* =====================================================================
   Formulare Muster 6 (A5 quer, gelb) und Muster 4 (A5 hoch, blau)
   ===================================================================== */
.fm-stapel { gap: 0; }
.doc-seite.fm-seite { --rot: #e2001a; display: block; width: 210mm; height: 148mm; padding: 0; overflow: hidden; background: #fdf7c6; font: 10px Arial, Helvetica, sans-serif; color: var(--rot); }
.doc-seite.fm-m4 { width: 148mm; height: 210mm; background: #d7eaf8; box-shadow: 0 0 0 2.2mm #fff inset, 0 2px 12px rgba(0,0,0,.18); }
.fm-seite > div { position: absolute; }
.fm-rahmen { border: .3mm solid var(--rot); }
.fm-lh { border-top: .3mm solid var(--rot); }
.fm-lv { border-left: .3mm solid var(--rot); }
.fm-t { color: var(--rot); line-height: 1.1; white-space: nowrap; }
.fm-t[style*="width"] { white-space: normal; }
.fm-r { text-align: right; }
.fm-lbl { font-size: 6.4pt; }
.fm-m { font-size: 8.5pt; }
.fm-2z { line-height: 1.02; }
.fm-titel { font-size: 12.8pt; font-weight: bold; }
.fm-nr { color: #111; font-size: 13pt; font-weight: bold; }
.fm-abschn { font-size: 9.6pt; }
.fm-fuss { font-size: 6.6pt; }
.fm-seitlich { font-size: 5.8pt; white-space: nowrap; transform: rotate(-90deg); transform-origin: left top; }
.fm-ecke { width: 4mm; height: 4mm; border: 0 solid #111; }
.fm-titel4 { font-size: 12.4pt; font-weight: bold; line-height: 1.08; }
.fm-nr4 { font-size: 11.5pt; }
.fm-g { font-size: 7.7pt; }
.fm-g9 { font-size: 7.4pt; }
.fm-h { font-size: 7.9pt; font-weight: bold; }
.fm-h2 { font-size: 7.5pt; font-weight: bold; }
.fm-n { font-size: 6.9pt; }
.fm-ki { font-size: 6pt; }
.fm-dr { color: #111; font: bold 8.6pt/1 'Courier New', Courier, monospace; white-space: nowrap; }
.fm-cb { display: grid; place-items: center; border: .3mm solid var(--rot); background: #fff; }
.fm-cb span, .fm-zz.an::after { color: #111; font: bold 11pt/1 'Courier New', Courier, monospace; }
.fm-zz { display: flex; align-items: center; justify-content: center; border: .3mm solid var(--rot); font-size: 5pt; line-height: 1.05; text-align: center; }
.fm-m4 .fm-lbl { font-size: 5.2pt; }
.fm-m4 .fm-2z { line-height: 1.12; }
.fm-zz.an::after { content: 'X'; position: absolute; font-size: 16pt; }
.fm-zeile { background: #fff; border-bottom: .3mm solid var(--rot); }
.fm-druck { position: absolute; left: 1.2mm; bottom: .8mm; color: #111; font: bold 9pt/1 'Courier New', Courier, monospace; white-space: nowrap; }
.fm-in { --k: .75; position: absolute; left: 0; top: 0; width: calc(100% / var(--k)); height: calc(100% / var(--k)); padding: 0 calc(1.2mm / var(--k)); border: 0; border-radius: 0; background: transparent; color: #111; font: bold 16px 'Courier New', Courier, monospace; transform: scale(var(--k)); transform-origin: 0 0; -webkit-appearance: none; appearance: none; }
.fm-klein { font-size: 7.4pt !important; }
.fm-kz { display: grid; place-items: center; border: .3mm solid var(--rot); background: #fff; color: #111; font: bold 9.5pt 'Courier New', Courier, monospace; }
.fm-kz + .fm-kz { border-left-width: 0; }
.fm-kz i { color: rgba(226, 0, 26, .22); font: bold 10.5pt Arial, Helvetica, sans-serif; font-style: normal; }
.fm-kz-in { padding: 0; border: 0; border-radius: 0; background: transparent; color: transparent; caret-color: #111; font: 16px 'Courier New', monospace; -webkit-appearance: none; appearance: none; }
.fm-stempelfeld { border: .3mm solid var(--rot); background: #fff; }
.fm-stempelfeld > div { position: absolute; }
.fm-stempel { left: 2.2mm; top: 2.2mm; color: #34409c; font: 6.6pt/1.3 Arial, Helvetica, sans-serif; transform: rotate(-1.5deg); transform-origin: left top; }
.fm-stempel b { font-size: 7.2pt; }
.fm-sig { right: 2mm; bottom: 4.6mm; width: 30mm; height: 9mm; }
.fm-stempel-label { left: 0; right: 0; bottom: .8mm; color: var(--rot); font-size: 6.3pt; text-align: center; }
/* Simulationskennzeichnung nur auf den Formularen (Muster 2, 4, 6): Wasserzeichen und roter Vermerk im Unterschriftsfeld */
.fm-wasserzeichen { inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; overflow: hidden; pointer-events: none; }
.fm-wasserzeichen span { font: bold 26mm/1 Arial, Helvetica, sans-serif; letter-spacing: 1.5mm; color: #000; opacity: .1; transform: rotate(-30deg); white-space: nowrap; }
.fm-m4 .fm-wasserzeichen span { font-size: 23mm; transform: rotate(-55deg); }
.fm-m2 .fm-wasserzeichen span { font-size: 17mm; letter-spacing: 1mm; transform: rotate(-30deg); }
.fm-sig-sim { right: 3mm; bottom: 5mm; z-index: 2; padding: .6mm 1.6mm; border: .45mm solid #d0021b; border-radius: .8mm; color: #d0021b; font: bold 9pt/1 Arial, Helvetica, sans-serif; letter-spacing: .6mm; transform: rotate(-8deg); background: rgba(255, 255, 255, .55); pointer-events: none; }
.fm-m2 .fm-sig-sim { font-size: 7.5pt; bottom: 4mm; }
/* Muster 2a (A6 quer, rosé) */
.doc-seite.fm-m2 { width: 148mm; height: 105mm; background: #fdebe4; }
.fm-weiss { background: #fff; }
.fm-titel2 { font-size: 9.6pt; font-weight: bold; line-height: 1.02; }
.fm-nr2 { font-size: 12pt; font-weight: bold; }
.fm-unter2 { font-size: 5.6pt; }
.fm-m2t { font-size: 6.6pt; }
.fm-abschn2 { font-size: 8.4pt; }
.fm-m2 .fm-lbl { font-size: 5.3pt; }
.fm-m2 .fm-2z { line-height: 1.05; }
.fm-m2 .fm-fuss { font-size: 5.6pt; }
.fm-m2 .fm-seitlich { font-size: 4.6pt; }
.fm-m2 .fm-dr { font-size: 7.8pt; }
.fm-m2 .fm-cb span { font-size: 10pt; }
.fm-m2 .fm-stempel { font-size: 5.9pt; }
.fm-m2 .fm-stempel b { font-size: 6.4pt; }
.fm-zeile.fm-ohne { background: transparent; border-bottom: 0; }
/* Touch: größere Tippfläche für Kästchen, kein Doppeltipp-Zoom auf Bedienelementen */
.fm-edit .fm-cb.edit::after, .fm-edit .fm-zz.edit::before { content: ''; position: absolute; inset: -1.8mm; }
.fm-zz.edit { position: absolute; }
#simApp button, #simApp .btn, #simApp label, #simApp select, #simApp .fm-cb, #simApp .fm-zz, #simApp .kachel, #simNav a { touch-action: manipulation; }
.fm-edit .fm-cb.edit, .fm-edit .fm-zz.edit { cursor: pointer; }
.fm-edit .fm-cb.edit:hover, .fm-edit .fm-zz.edit:hover, .fm-edit .fm-cb.edit:focus-visible { box-shadow: 0 0 0 .6mm rgba(43, 108, 176, .55); outline: none; }
.fm-edit .fm-zeile { box-shadow: inset 0 0 0 .25mm rgba(43, 108, 176, .35); }
.fm-edit .fm-in:focus, .fm-edit .fm-kz-in:focus { outline: .5mm solid rgba(43, 108, 176, .7); background: rgba(43, 108, 176, .06); }
.nur-druck { display: none; }
@media print {
  .fm-edit .fm-in { display: none !important; }
  .fm-edit .nur-druck { display: block; }
  .doc-seite.fm-m4 { box-shadow: none !important; }
  .fm-edit .fm-zeile, .fm-edit .fm-cb.edit { box-shadow: none !important; }
  .fm-edit .fm-in, .fm-edit .fm-kz-in { outline: none !important; background: transparent !important; }
}

/* =====================================================================
   FESTER SIMULATIONSHINWEIS (Produktregel 4)
   Randstreifen an der oberen Kante jeder Dokumentseite: Bildschirm,
   Druck, PDF und Bild. Wird per CSS erzeugt und lässt sich nicht
   abschalten. Formulare (A5/A6) tragen ihn an der unteren Kante, weil
   ihr Kopfbereich wie beim Original bis an den Rand reicht.
   ===================================================================== */
.doc-seite::before, .sheet::before {
  content: "SIMULATION  ·  NUR FÜR AUSBILDUNGSZWECKE  ·  KEINE ECHTEN PATIENTENDATEN  ·  PAPERSIM";
  position: absolute; left: 0; right: 0; top: 0; z-index: 5;
  height: 15px; line-height: 15px; padding: 0 8px;
  background: #e4e7eb; color: #3a3f47;
  font: bold 8.5px/15px Arial, Helvetica, sans-serif; letter-spacing: .12em; text-align: center; white-space: nowrap;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
  pointer-events: none;
}
.sheet { position: relative; }
.doc-seite.fm-seite::before { top: auto; bottom: 0; height: 12px; line-height: 12px; font-size: 7px; background: rgba(228, 231, 235, .92); }
