/* Lably — Oberfläche. Ruhig, hell, druckartig: weisse A4-Seiten auf grauem Grund. */
:root {
  --bg: #eef0f3; --paper: #ffffff; --ink: #1c1f24; --muted: #667085; --line: #d5d9e0;
  --accent: #0f6fde; --accent-ink: #ffffff; --ok: #1a7f4b; --warn: #b7791f; --bad: #c0392b;
  --draft: #6b7280; --signed: #0f6fde; --counter: #7c3aed; --approved: #1a7f4b;
  --radius: 8px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --mm: 3px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 13px; margin: 14px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
button, input, select, textarea { font: inherit; color: inherit; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 6px 12px; cursor: pointer; line-height: 1.2; white-space: nowrap; }
.btn:hover { background: #f6f7f9; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(.95); }
.btn.danger { color: var(--bad); border-color: #f0c9c4; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.05); }
.btn.sm { padding: 3px 8px; font-size: 12px; }
input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #bcd6fb; border-color: var(--accent); }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
label > input, label > select, label > textarea { margin-top: 4px; color: var(--ink); }
.form .hint { color: var(--muted); font-size: 12px; }
.form .warn { color: var(--warn); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row[hidden] { display: none; }        /* sonst ueberstimmt display:flex das hidden-Attribut (z. B. «Meine Gruppe») */
.grow { flex: 1; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }
.small { font-size: 12px; }

/* Kopfzeile */
nav.top { display: flex; align-items: center; gap: 18px; padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
nav.top .brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
nav.top .brand .mark { width: 44px; height: 44px; border-radius: 8px; }
nav.top .logo { font-weight: 700; font-size: 20px; letter-spacing: .02em; }
nav.top .ver { font-size: 11px; color: var(--muted); background: #eef2f7; border-radius: 999px; padding: 1px 7px; }
nav.top .btn.help { font-weight: 600; }

/* Dashboard-Kopf mit grossem Logo */
.hero { display: flex; align-items: center; gap: 22px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.hero img { width: 176px; height: 176px; flex: none; }   /* Daniel 2026-09-21: Logo auf der Übersicht grösser (vorher 128) */
.hero h1 { margin: 0 0 4px; font-size: 22px; }
.hero .tag { font-size: 15px; color: var(--ink); margin: 0 0 6px; }
.hero .sub { color: var(--muted); font-size: 13px; margin: 0 0 12px; max-width: 640px; }
@media (max-width: 700px) { .hero { flex-direction: column; text-align: center; } .hero .row { justify-content: center; } }

/* Hilfe */
.modal.wide { width: min(760px, 100%); }
.help details { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; margin-bottom: 8px; }
.help summary { cursor: pointer; font-weight: 600; }
.help ul { margin: 6px 0 4px; padding-left: 20px; }
.help li { margin: 4px 0; font-size: 13px; }
/* Lernfilme (Hilfe) */
.help .films { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 4px 0 6px; }
.help .film-card { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; cursor: pointer; text-align: left; font: inherit; }
.help .film-card:hover, .help .film-card:focus-visible { border-color: var(--accent, #1f6feb); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.help .film-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 5px; background: #0f2447; }
.help .film-t { font-size: 13px; font-weight: 600; line-height: 1.3; }
.help .film-d { font-size: 12px; color: var(--muted, #667); }
.modal.film { width: min(1120px, 100%); }
/* Vorlagen wählen (1.21.0): breit, Liste blättert im Fenster */
.modal.tplwide { width: min(1100px, 100%); }
.tplpick .f { min-width: 150px; }
.tplpick-scroll { max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.tplpick-scroll thead th { position: sticky; top: 0; background: #fff; z-index: 1; }
.badge.own { background: #2f7d4f; margin-left: 6px; font-size: 11px; }
.f-tpl { margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.op-tpls { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin: 8px 0; }
/* Formulare aus Originaldateien (1.21.0): fixierte Blöcke, Dialog mit Seitenauswahl */
.page:not(.ro) .block.fixed { cursor: default; }
.block.fixed .rz { display: none; }
.block.fixed.selected::after { content: "🔒"; position: absolute; right: 3px; top: 3px; font-size: 13px; line-height: 1;
  background: rgba(255,255,255,.85); border-radius: 4px; padding: 2px 3px; pointer-events: none; z-index: 2; }
#selFix.on { background: #fff4d6; border-color: #e0b44c; }
.formfiles { display: flex; flex-direction: column; gap: 6px; }
.formfiles .formfile { text-align: left; display: block; width: 100%; }
.formthumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; max-height: 46vh; overflow: auto;
  padding: 4px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 8px; }
.formthumb { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 0; color: var(--ink); cursor: pointer; }
.formthumb img { max-width: 110px; max-height: 150px; border: 1px solid var(--line); background: #fff; }
.formthumb .row { gap: 4px; }
.formthumb input { width: auto; margin: 0; }
.op-tpl-list { max-height: 30vh; overflow: auto; }
.op-tpl-list .chk[hidden] { display: none; }
.op-tpl-list label.chk { margin: 2px 0; font-size: 13px; }
.f-tpl > .row { margin-top: 4px; flex-wrap: nowrap; }
.tplname { color: var(--ink); padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: #f7f8fa; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.film-body { padding: 10px 12px 4px !important; }
.film-video { display: block; width: 100%; max-height: 72vh; background: #000; border-radius: 6px; }

/* Bot4Life-Pille (wie Botbugger/Botaria) */
.bot4life-credit { position: fixed; right: 12px; bottom: 12px; z-index: 900; display: inline-flex; align-items: center; gap: 5px; font: 600 11px/1 'Segoe UI', system-ui, Arial, sans-serif; letter-spacing: .02em; color: #cbd5e1; background: rgba(10,14,26,.72); border: 1px solid rgba(148,163,184,.28); padding: 6px 11px; border-radius: 999px; text-decoration: none; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: 0 2px 12px rgba(0,0,0,.28); }
.bot4life-credit:hover { text-decoration: none; color: #fff; }
.bot4life-credit span { background: linear-gradient(90deg, #4fc3f7, #a78bfa); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; font-weight: 800; }

/* Demo «So funktioniert Lably» (1.21.0, Wunsch Daniel 6.10.: schematisch wie bisher, grafisch aufgehuebscht wie der
   Demofilm): Vollbild, gezeichnet fuer 1440 x 810 (.xd-stage), demo.js skaliert auf das Fenster. Alles unter #xd und mit
   «xd-»-Klassen, damit keine Lably-Regel hineinwirkt. Szenen: Klassen s1..s6 am Container; abgeschlossene Szenen f1..f6
   springen sofort in den Endzustand (Zurueck/Springen), die laufende spielt ihre Animationen ab. */
#xd { position: fixed; inset: 0; z-index: 2000; background: linear-gradient(135deg, #0f2447 0%, #1b4f94 60%, #1f5fae 100%); overflow: hidden;
  font-family: "Segoe UI", system-ui, sans-serif; color: #1d2433; opacity: 0; transition: opacity .35s; }
#xd.xd-on { opacity: 1; }
#xd .xd-stage { position: absolute; left: 0; top: 0; width: 1440px; height: 810px; transform-origin: 0 0; }
#xd h3, #xd h4, #xd h5 { text-transform: none; letter-spacing: normal; color: inherit; font-weight: 700; }
#xd.xd-paused *, #xd.xd-paused { animation-play-state: paused !important; }
#xd.xd-paused .xd-cap { animation-play-state: running !important; }   /* Bildunterschrift erscheint auch in der Pause */
#xd .xd-glow { position: absolute; width: 900px; height: 900px; border-radius: 50%; left: -260px; top: -420px;
  background: radial-gradient(circle, rgba(143,196,255,.22), rgba(143,196,255,0) 65%); }
#xd .xd-glow2 { left: auto; right: -320px; top: auto; bottom: -520px; background: radial-gradient(circle, rgba(96,165,250,.18), rgba(96,165,250,0) 65%); }
#xd .xd-brand { position: absolute; left: 56px; top: 28px; display: flex; align-items: center; gap: 14px; }
#xd .xd-brand img { width: 46px; height: 46px; border-radius: 12px; background: #fff; padding: 3px; box-sizing: border-box; }
#xd .xd-brand b { font: 700 13px/1 "Segoe UI", system-ui; letter-spacing: .14em; text-transform: uppercase; color: #9dcbff; }
#xd .xd-rail { position: absolute; top: 38px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; }
#xd .xd-rail i { display: block; width: 44px; height: 2px; background: rgba(255,255,255,.25); }
#xd .xd-rail button { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
  font: 700 13px "Segoe UI", system-ui; color: #9dcbff; background: transparent; border: 2px solid rgba(157,203,255,.55); transition: all .35s; }
#xd .xd-rail button.xd-cur { background: #fff; color: #123a73; border-color: #fff; transform: scale(1.18); box-shadow: 0 0 0 6px rgba(255,255,255,.14); }
#xd .xd-rail button.xd-past { background: #3fb37f; border-color: #3fb37f; color: #fff; }
#xd .xd-ctrl { position: absolute; right: 40px; top: 30px; display: flex; gap: 8px; }
#xd .xd-ctrl button { height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12);
  color: #fff; font: 600 13px "Segoe UI", system-ui; cursor: pointer; }
#xd .xd-ctrl button:hover, #xd .xd-ctrl button:focus-visible { background: rgba(255,255,255,.24); outline: none; }
#xd .xd-ctrl .xd-x { width: 34px; padding: 0; font-size: 18px; }
#xd .xd-cta { position: absolute; right: 170px; top: 680px; height: 44px; padding: 0 22px; border-radius: 11px; border: 0; background: #fff; color: #123a73;
  font: 700 15px "Segoe UI", system-ui; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .4s; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
#xd.xd-end .xd-cta { opacity: 1; pointer-events: auto; }
#xd .xd-win { position: absolute; left: 170px; top: 96px; width: 1100px; height: 520px; background: #fff; border-radius: 16px;
  box-shadow: 0 30px 80px rgba(3,12,30,.45); overflow: hidden; }
#xd .xd-tbar { height: 46px; border-bottom: 1px solid #e6ebf2; display: flex; align-items: center; gap: 14px; padding: 0 18px; background: #fbfcfe; }
#xd .xd-wm { font: 800 17px "Segoe UI", system-ui; color: #123a73; }
#xd .xd-tt { font: 600 14px "Segoe UI", system-ui; color: #3d4a5c; flex: 1; }
#xd .xd-pill { display: inline-grid; font: 700 12px "Segoe UI", system-ui; color: #fff; text-align: center; }
#xd .xd-pill > span { grid-area: 1 / 1; padding: 5px 12px; border-radius: 999px; background: #6b7280; }   /* beide Texte gestapelt: Breite des laengeren */
#xd .xd-pill .xd-ps { background: #2f9e6b; opacity: 0; }
#xd.s4 .xd-pill .xd-ps { animation: xd-fade .4s 3.6s forwards; }
#xd .xd-wbody { position: absolute; left: 0; right: 0; top: 46px; bottom: 0; }
#xd .xd-side { position: absolute; left: 0; top: 0; bottom: 0; width: 250px; background: #f6f8fb; border-right: 1px solid #e6ebf2; }
#xd .xd-side h4 { margin: 16px 18px 6px; font: 700 11px "Segoe UI", system-ui; letter-spacing: .12em; color: #6b7a90; }
#xd .xd-tile { position: absolute; left: 14px; width: 220px; height: 50px; background: #fff; border: 1px solid #e3e8ef; border-radius: 10px; box-sizing: border-box;
  display: flex; align-items: center; gap: 10px; padding: 0 10px; opacity: 0; transform: translateX(60px); }
#xd .xd-nm { font: 600 12px "Segoe UI", system-ui; color: #2d3748; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
#xd .xd-load { height: 4px; width: 130px; background: #e6ebf2; border-radius: 3px; margin-top: 6px; overflow: hidden; }
#xd .xd-load b { display: block; height: 100%; width: 0; background: #3b82f6; border-radius: 3px; }
#xd .xd-ck { position: absolute; right: 10px; top: 16px; width: 18px; height: 18px; border-radius: 50%; background: #2f9e6b; color: #fff;
  font: 700 12px/18px "Segoe UI", system-ui; text-align: center; transform: scale(0); }
#xd.s1 .xd-tile { animation: xd-tin .55s cubic-bezier(.2,.9,.3,1.2) forwards; }
#xd.s1 .xd-load b { animation: xd-fill 1.1s ease-out forwards; }
#xd.s1 .xd-ck { animation: xd-pop .35s ease-out forwards; }
@keyframes xd-tin { to { opacity: 1; transform: none; } }
@keyframes xd-fill { to { width: 100%; } }
@keyframes xd-pop { 0% { transform: scale(0); } 70% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes xd-fade { to { opacity: 1; } }
#xd .xd-page { position: absolute; left: 300px; top: 22px; width: 300px; height: 424px; background: #fff; border: 1px solid #dfe5ee;
  box-shadow: 0 6px 22px rgba(20,40,80,.12); border-radius: 3px; }
#xd .xd-zone { position: absolute; left: 0; right: 0; height: 20px; font: 600 9px/20px "Segoe UI", system-ui; color: #8a96a8; padding: 0 10px;
  background: repeating-linear-gradient(135deg, #f6f8fb 0 6px, #eef2f7 6px 12px); }
#xd .xd-zh { top: 0; } #xd .xd-zf { bottom: 0; }
#xd .xd-blk { position: absolute; opacity: 0; border-radius: 3px; box-sizing: border-box; }
#xd .xd-pdf { left: 18px; top: 34px; width: 170px; height: 222px; background: #fff; border: 1px solid #cfd8e3; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
#xd .xd-pdf .xd-l { position: absolute; left: 12px; height: 5px; background: #dbe3ee; border-radius: 2px; }
#xd .xd-pdf .xd-h1 { position: absolute; left: 12px; top: 12px; width: 110px; height: 8px; background: #2b4c7e; border-radius: 2px; }
#xd .xd-grid { position: absolute; left: 12px; right: 12px; top: 150px; height: 56px; border: 1px solid #c9d3e0;
  background: linear-gradient(#c9d3e0 1px, transparent 1px) 0 0/100% 14px, linear-gradient(90deg, #c9d3e0 1px, transparent 1px) 0 0/36.5px 100%; }
#xd .xd-photo { left: 198px; top: 40px; width: 88px; height: 66px; background: #0d1117; box-shadow: 0 4px 12px rgba(0,0,0,.25); overflow: hidden; }
#xd .xd-photo i { position: absolute; left: 8px; right: 8px; height: 4px; background: repeating-linear-gradient(90deg, rgba(120,240,170,.85) 0 5px, transparent 5px 9px); }
#xd .xd-txt { left: 198px; top: 122px; width: 92px; height: 62px; border: 1.5px dashed #3b82f6; background: #f5f9ff; padding: 5px 6px;
  font: 600 8.6px/1.45 "Segoe UI", system-ui; color: #1d2433; }
#xd .xd-txt span { display: block; width: 0; overflow: hidden; white-space: nowrap; }
#xd .xd-tbl { left: 18px; top: 270px; width: 268px; height: 66px; border: 1px solid #9fb0c6;
  background: linear-gradient(#9fb0c6 1px, transparent 1px) 0 0/100% 16.5px, linear-gradient(90deg, #9fb0c6 1px, transparent 1px) 0 0/67px 100%, #fff; }
#xd .xd-tbl::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 16px; background: #e8eef7; }
#xd .xd-ghost { position: absolute; width: 36px; height: 46px; opacity: 0; z-index: 5; }
#xd .xd-ghost svg { width: 100%; height: 100%; }
#xd .xd-mouse { position: absolute; width: 26px; height: 26px; opacity: 0; z-index: 9; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }
#xd.s2 .xd-g1 { animation: xd-drag1 1.7s .3s ease-in-out forwards; }
#xd.s2 .xd-m1 { animation: xd-mouse1 1.7s .3s ease-in-out forwards; }
#xd.s2 .xd-pdf { animation: xd-drop .45s 2.0s cubic-bezier(.2,.9,.3,1.3) forwards; }
#xd.s2 .xd-g2 { animation: xd-drag2 1.6s 2.7s ease-in-out forwards; }
#xd.s2 .xd-m2 { animation: xd-mouse2 1.6s 2.7s ease-in-out forwards; }
#xd.s2 .xd-photo { animation: xd-drop .45s 4.3s cubic-bezier(.2,.9,.3,1.3) forwards; }
@keyframes xd-drag1 { 0% { opacity: 0; left: 28px; top: 110px; } 10% { opacity: .95; } 85% { opacity: .95; left: 330px; top: 90px; width: 120px; height: 150px; } 100% { opacity: 0; left: 330px; top: 90px; width: 120px; height: 150px; } }
@keyframes xd-mouse1 { 0% { opacity: 0; left: 48px; top: 128px; } 10% { opacity: 1; } 85% { opacity: 1; left: 400px; top: 150px; } 100% { opacity: 0; left: 400px; top: 150px; } }
@keyframes xd-drag2 { 0% { opacity: 0; left: 28px; top: 172px; } 10% { opacity: .95; } 85% { opacity: .95; left: 500px; top: 66px; } 100% { opacity: 0; left: 500px; top: 66px; } }
@keyframes xd-mouse2 { 0% { opacity: 0; left: 48px; top: 190px; } 10% { opacity: 1; } 85% { opacity: 1; left: 530px; top: 90px; } 100% { opacity: 0; left: 530px; top: 90px; } }
@keyframes xd-drop { 0% { opacity: 0; transform: scale(.85); } 100% { opacity: 1; transform: none; } }
#xd.s3 .xd-txt { animation: xd-drop .4s .2s ease-out forwards; }
#xd.s3 .xd-txt span { animation: xd-type 1s steps(18, end) forwards; }
@keyframes xd-type { to { width: 100%; } }
#xd.s3 .xd-tbl { animation: xd-drop .45s 4.0s cubic-bezier(.2,.9,.3,1.3) forwards; }
#xd .xd-dlg { position: absolute; left: 400px; top: 120px; width: 330px; background: #fff; border-radius: 12px; box-shadow: 0 20px 60px rgba(10,25,50,.35);
  padding: 18px 20px; opacity: 0; transform: translateY(20px); z-index: 6; border: 1px solid #e3e8ef; box-sizing: border-box; }
#xd .xd-dlg h5 { margin: 0 0 12px; font: 700 16px "Segoe UI", system-ui; }
#xd .xd-fl { font: 600 11px "Segoe UI", system-ui; color: #6b7a90; margin: 8px 0 4px; }
#xd .xd-in { height: 30px; border: 1px solid #cfd8e3; border-radius: 7px; display: flex; align-items: center; padding: 0 10px; font: 600 13px "Segoe UI", system-ui; color: #2d3748; }
#xd .xd-dots { display: inline-block; width: 0; overflow: hidden; white-space: nowrap; letter-spacing: 3px; font-size: 16px; }
#xd .xd-btn { margin-top: 14px; height: 34px; border-radius: 8px; background: #1f6fe0; color: #fff; font: 700 13px/34px "Segoe UI", system-ui; text-align: center; }
#xd.s4 .xd-dlg { animation: xd-dlgin .4s .2s ease-out forwards, xd-dlgout .35s 3.2s ease-in forwards; }
#xd.s4 .xd-dots { animation: xd-type 1s 1.0s steps(8, end) forwards; }
#xd.s4 .xd-btn { animation: xd-press .25s 2.85s ease-in-out; }
@keyframes xd-dlgin { to { opacity: 1; transform: none; } }
@keyframes xd-dlgout { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-10px); } }
@keyframes xd-press { 50% { transform: scale(.94); background: #1859b8; } }
#xd .xd-seal { position: absolute; left: 470px; top: 250px; width: 150px; height: 150px; border-radius: 50%; border: 5px solid #2f9e6b; color: #2f9e6b; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; justify-content: center; font: 800 14px/1.2 "Segoe UI", system-ui; text-transform: uppercase;
  letter-spacing: .06em; background: rgba(255,255,255,.92); opacity: 0; z-index: 6; box-shadow: 0 0 0 6px rgba(47,158,107,.15); }
#xd .xd-seal svg { width: 44px; height: 44px; margin-bottom: 4px; }
#xd .xd-seal small { font-size: 11px; }
#xd.s4 .xd-seal { animation: xd-stamp .5s 3.5s cubic-bezier(.2,.9,.3,1.4) forwards; }
@keyframes xd-stamp { 0% { opacity: 0; transform: scale(1.8) rotate(-18deg); } 100% { opacity: 1; transform: scale(1) rotate(-10deg); } }
#xd .xd-panel { position: absolute; left: 640px; top: 22px; width: 430px; height: 424px; background: #fff; border: 1px solid #e3e8ef; border-radius: 12px;
  box-shadow: 0 6px 22px rgba(20,40,80,.10); opacity: 0; transform: translateX(30px); padding: 16px 18px; box-sizing: border-box; }
#xd .xd-panel h5 { margin: 0 0 10px; font: 700 15px "Segoe UI", system-ui; color: #123a73; }
#xd.s5 .xd-audit { animation: xd-dlgin .45s .1s ease-out forwards; }
#xd .xd-row { position: relative; height: 56px; display: flex; align-items: center; gap: 10px; opacity: 0; transform: translateY(8px); }
#xd .xd-row .xd-t { font: 600 12px Consolas, monospace; color: #6b7a90; width: 42px; }
#xd .xd-row .xd-u { font: 700 12px "Segoe UI", system-ui; color: #2d3748; width: 46px; }
#xd .xd-row .xd-a { font: 600 12.5px "Segoe UI", system-ui; color: #1d2433; flex: 1; }
#xd .xd-row .xd-hh { font: 600 11px Consolas, monospace; background: #eef4ff; color: #1f5fae; border-radius: 6px; padding: 3px 7px; }
#xd .xd-row .xd-ln { position: absolute; left: 20px; top: -22px; width: 2px; height: 22px; background: #9dbbe6; }
#xd.s5 .xd-row { animation: xd-rowin .4s ease-out forwards; }
@keyframes xd-rowin { to { opacity: 1; transform: none; } }
#xd .xd-intact { position: absolute; left: 18px; bottom: 16px; display: flex; align-items: center; gap: 8px; font: 700 14px "Segoe UI", system-ui; color: #2f9e6b; opacity: 0; }
#xd .xd-intact b { width: 22px; height: 22px; border-radius: 50%; background: #2f9e6b; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; }
#xd.s5 .xd-intact { animation: xd-dlgin .4s 3.6s ease-out forwards; }
#xd.s6 .xd-audit { animation: none; opacity: 0; }
#xd.s6 .xd-export { animation: xd-dlgin .45s .3s ease-out forwards; }
#xd .xd-card2 { display: flex; gap: 12px; align-items: center; border: 1px solid #e3e8ef; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; opacity: 0; transform: translateY(8px); }
#xd .xd-k { font: 700 13px "Segoe UI", system-ui; } #xd .xd-s { font: 600 11.5px "Segoe UI", system-ui; color: #6b7a90; }
#xd.s6 .xd-card2 { animation: xd-rowin .4s ease-out forwards; }
#xd .xd-tree { font: 600 12.5px/1.75 Consolas, monospace; color: #2d3748; padding-left: 6px; }
#xd .xd-tree div { opacity: 0; transform: translateX(-6px); white-space: pre; }
#xd.s6 .xd-tree div { animation: xd-rowin .3s ease-out forwards; }
#xd .xd-badge { display: inline-block; margin-top: 8px; font: 700 12px "Segoe UI", system-ui; color: #fff; background: #2f9e6b; border-radius: 999px; padding: 5px 12px; opacity: 0; }
#xd.s6 .xd-badge { animation: xd-dlgin .4s 3.6s ease-out forwards; }
#xd .xd-cap { position: absolute; left: 170px; width: 1100px; top: 640px; height: 126px; display: flex; gap: 22px; align-items: center; color: #fff; }
#xd .xd-cap .xd-n { flex: 0 0 64px; height: 64px; border-radius: 50%; background: #fff; color: #123a73; display: flex; align-items: center; justify-content: center;
  font: 800 28px "Segoe UI", system-ui; box-shadow: 0 0 0 8px rgba(255,255,255,.12); }
#xd .xd-cap h3 { margin: 0 0 6px; font: 700 28px/1.15 "Segoe UI", system-ui; color: #fff; }
#xd .xd-cap p { margin: 0; font: 400 19px/1.4 "Segoe UI", system-ui; color: #dbe9ff; max-width: 860px; }
#xd .xd-cap.xd-in2 { animation: xd-capin .5s ease-out; }
@keyframes xd-capin { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
#xd .xd-prog { position: absolute; left: 170px; top: 626px; width: 1100px; height: 3px; background: rgba(255,255,255,.18); border-radius: 2px; overflow: hidden; }
#xd .xd-prog b { display: block; height: 100%; width: 0; background: #9dcbff; }
#xd .xd-prog b.xd-run { animation: xd-fill linear forwards; }
/* Abgeschlossene Szenen: sofort im Endzustand (Springen/Zurueck) */
#xd.f1 .k1, #xd.f1 .k1 *, #xd.f2 .k2, #xd.f2 .k2 *, #xd.f3 .k3, #xd.f3 .k3 *, #xd.f4 .k4, #xd.f4 .k4 *, #xd.f5 .k5, #xd.f5 .k5 *, #xd.f6 .k6, #xd.f6 .k6 * {
  animation-delay: 0s !important; animation-duration: 1ms !important; animation-play-state: running !important; }   /* auch bei Pause */
@media (prefers-reduced-motion: reduce) { #xd .xd-stage * { animation-delay: 0s !important; animation-duration: 1ms !important; } }
nav.top .org { color: var(--muted); font-size: 13px; }
nav.top .links a { margin-right: 12px; color: var(--muted); padding: 4px 0; }
nav.top .links a.active { color: var(--ink); font-weight: 600; border-bottom: 2px solid var(--accent); }
nav.top .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
nav.top .who { color: var(--muted); font-size: 13px; }
select.lang { width: auto; padding: 3px 6px; font-size: 12px; }
.demo { background: #fff4d6; color: #7a4d00; padding: 6px 16px; font-size: 13px; text-align: center; border-bottom: 1px solid #f1dfae; }
/* Schaufenster-Demo (bot4life.bot/lably/demo/): Band in einer Zeile (Editor-Hoehe rechnet mit 31 px), Bildschirm-Wasserzeichen */
.demo.schau-band { display: flex; align-items: center; justify-content: center; gap: 14px; height: 31px; box-sizing: border-box;
  padding: 0 16px; white-space: nowrap; overflow: hidden; background: linear-gradient(90deg, #4fc3f7, #a78bfa, #8b5cf6);
  color: #0a0e1a; font-weight: 600; border-bottom: none; }
.demo.schau-band .txt { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.demo.schau-band a { flex: none; color: #0a0e1a; background: rgba(255,255,255,.55); border-radius: 12px; padding: 2px 10px;
  text-decoration: none; font-weight: 700; }
.demo.schau-band a:hover { background: #fff; }
.demo.schau-admin { background: #ede9fe; color: #4c1d95; border-bottom: 1px solid #ddd6fe; font-weight: 600; }
/* Testbetrieb (1.19.0): auffaellig gestreift, eine Zeile wie das Schaufenster-Band (Editor-Hoehe rechnet mit 31 px) */
.demo.test-band { height: 31px; box-sizing: border-box; padding: 0 16px; line-height: 31px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; font-weight: 600; color: #6b2e00; border-bottom: 1px solid #f0b37a;
  background: repeating-linear-gradient(135deg, #ffe2c2 0 14px, #ffd3a3 14px 28px); }
.op-state { display: inline-block; padding: 3px 10px; border-radius: 12px; font-weight: 600; font-size: 13px; }
.op-state.test { background: #ffe2c2; color: #6b2e00; }
.op-state.live { background: #d9f2e1; color: #14532d; }
.op-word { font-family: ui-monospace, Consolas, monospace; letter-spacing: .08em; }
body.schau-on::after { content: 'DEMO'; position: fixed; left: 50%; top: 55%; transform: translate(-50%, -50%) rotate(-28deg);
  font: 800 min(22vw, 260px)/1 system-ui, 'Segoe UI', sans-serif; letter-spacing: .06em; color: rgba(220, 38, 38, .055);
  pointer-events: none; z-index: 5; user-select: none; }
.login .schau-note { text-align: center; margin: -6px 0 14px; padding: 8px 10px; border-radius: 8px; font-size: 13px; font-weight: 600;
  background: linear-gradient(90deg, rgba(79,195,247,.15), rgba(139,92,246,.15)); color: #4c1d95; }
.login form.autofill input { pointer-events: none; background: #f6f4ff; caret-color: transparent; }
.login form.autofill .btn, .login form.autofill select { pointer-events: none; }
.samples { display: flex; flex-direction: column; gap: 14px; max-height: 60vh; overflow: auto; }
.samples h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.samples .list { display: flex; flex-wrap: wrap; gap: 8px; }
.samples button.sample { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: 7px 10px; cursor: pointer; font: inherit; font-size: 13px; text-align: left; }
.samples button.sample:hover { border-color: var(--accent); background: #f4f8ff; }
.samples button.sample[disabled] { opacity: .5; cursor: wait; }
.samples .ext { flex: none; min-width: 38px; text-align: center; border-radius: 4px; padding: 2px 4px; font-size: 10px; font-weight: 700;
  color: #fff; background: #64748b; text-transform: uppercase; }
.samples .ext.docx, .samples .ext.doc { background: #2b579a; } .samples .ext.odt { background: #1f6fb2; }
.samples .ext.xlsx, .samples .ext.xls { background: #217346; } .samples .ext.ods { background: #2e8b57; }
.samples .ext.csv { background: #0f766e; } .samples .ext.txt { background: #6b7280; }
.samples .ext.pptx { background: #c4511f; } .samples .ext.pdf { background: #c0392b; }
.samples .ext.jpg, .samples .ext.jpeg, .samples .ext.png, .samples .ext.gif, .samples .ext.bmp, .samples .ext.tif,
.samples .ext.tiff, .samples .ext.webp { background: #7c3aed; }
.samples .ext.xlsm { background: #217346; } .samples .ext.ppt, .samples .ext.odp { background: #c4511f; } .samples .ext.rtf { background: #1f6fb2; }

.wrap { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
/* Listen (Protokolle, Vorlagen): die Bloecke darueber so breit wie die Tabelle — Daniel 9.10.2026: «kurze Blöcke verlängern
   anstatt Protokollansicht verkürzen». Die Seite waechst mit der Tabelle bis zur Fensterbreite; ist das Fenster schmaler,
   rollt nur die Tabelle in ihrem Kasten seitlich (die Bloecke bleiben gleich breit wie der Kasten). */
.wrap.listwrap { width: min-content; min-width: min(1100px, 100%); max-width: 100%; }
.tblscroll { overflow-x: auto; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
table.list { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-size: 12px; color: var(--muted); font-weight: 600; background: #f8f9fb; }
table.list tr.click { cursor: pointer; }
table.list td.nw { white-space: nowrap; }       /* Nummer, Datum, SOP-Nr.: nie mitten im Wort umbrechen (30.9.) */
table.list tr.click:hover td { background: #f4f8ff; }
/* Blättern (tausende Protokolle, Paket 22.9.): Bereich «1–100 von 10 234», Seitenknöpfe, Einträge pro Seite */
.pager { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0 24px; font-size: 13px; color: var(--muted); }
.pager .grow { flex: 1; }
.pager select { width: auto; padding: 4px 6px; font-size: 13px; }
.pager .btn[disabled] { opacity: .4; cursor: default; }
.filters label.f { display: flex; flex-direction: column; gap: 2px; margin: 0; font-size: 11px; min-width: 150px; flex: 1; }
.filters label.f select { padding: 4px 6px; font-size: 13px; color: var(--ink); }
/* Suchfeld mit Vorschlägen (SOP-Nr., Projekte): ersetzt sichtbar das Klappmenü, das <select> bleibt unsichtbar dahinter */
.ss-native { display: none !important; }
.ss { position: relative; display: block; width: 100%; }
.ss-input { width: 100%; box-sizing: border-box; }
.filters label.f .ss-input { padding: 4px 6px; font-size: 13px; color: var(--ink); }
.ss-list { position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 1200; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); max-height: 280px; overflow: auto; min-width: 260px; }
.ss-list[hidden] { display: none; }
.ss.up .ss-list { top: auto; bottom: calc(100% + 2px); }
.ss-item { padding: 6px 10px; cursor: pointer; font-size: 13px; color: var(--ink); }
.ss-item.on, .ss-item:hover { background: #eef4fb; }
.ss-empty, .ss-more { padding: 6px 10px; font-size: 12px; color: var(--muted); }
.assign { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 12px; }
.assign label { display: flex; flex-direction: column; gap: 2px; margin: 0; font-size: 11px; min-width: 160px; flex: 1; }
.assign label select { padding: 4px 6px; font-size: 13px; color: var(--ink); }
.assign .ro { font-size: 13px; }
.assign .ro b { font-weight: 600; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #fff; background: var(--draft); }
.badge.st-signed { background: var(--signed); }
.badge.st-countersigned { background: var(--counter); }
.badge.st-approved { background: var(--approved); }

/* Login */
.login { max-width: 360px; margin: 8vh auto; }
.login .mascot { display: block; width: 160px; height: 160px; margin: 0 auto 4px; }
.login .logo { font-size: 28px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.login .sub { text-align: center; color: var(--muted); margin-bottom: 18px; }

/* Modale + Toasts */
.modal-back { position: fixed; inset: 0; background: rgba(20,24,32,.45); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.modal { background: #fff; border-radius: 10px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal > .form, .modal > .body { padding: 16px; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }   /* umbrechen statt ueberlaufen (schmale Bildschirme) */
.toasts { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 1100; }
.toast { background: #1c1f24; color: #fff; padding: 10px 14px; border-radius: 8px; opacity: 0; transform: translateY(8px); transition: .25s; max-width: 420px; }
.toast.show { opacity: 1; transform: none; }
.toast.ok { background: var(--ok); }
/* Hilfe-Sprechblase beim Mauszeiger (Daniel 25.9.) */
.tip { position: fixed; z-index: 1300; display: none; max-width: 300px; background: #1c1f24; color: #fff; padding: 8px 11px; border-radius: 8px; font-size: 12.5px; line-height: 1.45; box-shadow: 0 8px 24px rgba(0,0,0,.25); pointer-events: none; }
.toast.error { background: var(--bad); }

/* Editor */
.editor { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - 49px); }
body.demo-on .editor { height: calc(100vh - 49px - 31px); }
.side { border-right: 1px solid var(--line); background: #fff; overflow: auto; padding: 12px; }
.main { overflow: auto; padding: 16px 24px 80px; }
.bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 14px; position: sticky; top: 0; z-index: 10; }
.bar .title { font-weight: 600; font-size: 15px; border: none; background: transparent; padding: 4px 6px; min-width: 200px; flex: 1; }
.bar .title:hover:not([readonly]) { background: #f4f6f9; }
.bar input[type=date] { width: auto; padding: 4px 6px; }
.bar .state { font-size: 12px; color: var(--muted); }
.bar .state.dirty { color: var(--warn); }
.bar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.notice { padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; font-size: 13px; }
.notice.lock { background: #eaf1ff; color: #1f4b8f; border: 1px solid #c7dbff; }
.notice.ro { background: #f3f4f6; color: var(--muted); }
/* Bearbeitungssperre (Phase A): «In Bearbeitung durch …» im Editor, Stiftsymbol in der Übersicht */
.notice.busy { background: #fff4d6; color: #7a4d00; border: 1px solid #f1dfae; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.notice.busy .grow { flex: 1; }
.busy { display: inline-block; margin-left: 6px; color: #b26a00; font-size: 14px; cursor: help; }
.busy.stale { color: #9a9a9a; }

.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 14px 10px; text-align: center; color: var(--muted); cursor: pointer; font-size: 13px; }
.dropzone.over { border-color: var(--accent); background: #f0f6ff; }
.att { border: 1px solid var(--line); border-radius: 6px; margin-top: 10px; padding: 8px; }
.att .name { font-size: 13px; font-weight: 600; word-break: break-all; }
.att .meta { font-size: 11px; color: var(--muted); }
.att .err { color: var(--bad); font-size: 12px; }
.att.link .mono { display: inline; font-size: 11px; word-break: break-all; }
/* Rohdaten: Pfad nur bei Mouseover hervorgehoben (Daniel 2026-09-21); Touch: Karte antippen (.open) */
.att.link { cursor: default; }
.att.link .hint { font-size: 11px; color: var(--muted); }
.att.link .path { display: none; background: #fff6d6; border: 1px solid #e8cf6a; border-radius: 4px; padding: 4px 6px; margin: 4px 0; font-size: 11px; }
.att.link:hover .path, .att.link.open .path { display: block; }
.att.link:hover .hint, .att.link.open .hint { display: none; }
/* Explorer fuer Rohdaten-Ablagen */
.crumbs { margin-top: 8px; }
.browse { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; margin-top: 8px; }
.browse .item { padding: 6px 10px; border-bottom: 1px solid #eee; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.browse .item:last-child { border-bottom: none; }
.browse .item:hover { background: #eef4fb; }
.browse .item.dir { font-weight: 600; }
.linkform { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.linkform input { font-size: 12px; padding: 5px 7px; }
/* Proben (1.22.0): verknüpfte als kompakte Liste (bis 100, rollbar), Auswahl darunter */
.smp-list { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: #fbfcfe; }
.smp-row { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-bottom: 1px solid #eef1f5; font-size: 12px; }
.smp-row:last-child { border-bottom: none; }
.smp-code { flex: none; font-size: 12px; font-weight: 600; }
.smp-label { flex: 1; min-width: 0; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smp-x { flex: none; padding: 0 6px; line-height: 18px; }
.smp-filter, .smp-q { width: 100%; font-size: 12px; padding: 5px 7px; margin: 0 0 6px; box-sizing: border-box; }
.smp-pick { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.smp-pick .smp-q { margin: 0; }
.smp-hits { max-height: 240px; overflow: auto; }
.smp-hits:empty { display: none; }
.smp-hits label.chk.smp-hit { margin: 0; padding: 2px 4px; font-size: 12px; align-items: center; gap: 6px; }
.smp-hits label.chk.smp-hit:hover { background: #eef4fb; }
.smp-hits label.chk.smp-hit.on { color: var(--muted); }
.smp-hits .mono { font-size: 12px; font-weight: 600; }
.smp-new { border-top: 1px dashed var(--line); margin-top: 2px; padding-top: 2px; }
.smp-new label.chk { margin: 2px 0; font-size: 12px; }
.smp-new input[type=text] { width: 100%; font-size: 12px; padding: 4px 6px; box-sizing: border-box; }
.smp-chosen:empty { display: none; }
.smp-paste { width: 100%; box-sizing: border-box; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 6; }
.smp-result details { margin: 4px 0; }
.smp-result summary { cursor: pointer; font-size: 13px; }
.smp-result details.new summary { font-weight: 600; }
.smp-result details.warn summary { color: var(--bad); }
.smp-result ul { max-height: 160px; overflow: auto; margin: 4px 0 0; padding-left: 20px; font-size: 12px; font-family: ui-monospace, Consolas, monospace; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.thumb { width: 64px; text-align: center; font-size: 10px; color: var(--muted); cursor: grab; position: relative; }
/* Zuschneiden direkt an der Miniatur, bevor eingefügt wird (Daniel 2026-09-22) */
.thumb .thumbcrop { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; padding: 0; border-radius: 4px; border: 1px solid var(--line); background: rgba(255,255,255,.92); font-size: 13px; line-height: 20px; cursor: pointer; opacity: .85; }
.thumb .thumbcrop:hover { opacity: 1; border-color: var(--accent); }
.thumb img { width: 64px; height: 84px; object-fit: contain; background: #f4f4f4; border: 1px solid var(--line); display: block; }
.thumb:active { cursor: grabbing; }

.pages { display: flex; flex-direction: column; gap: 22px; align-items: center; }
.pagewrap { display: flex; flex-direction: column; gap: 4px; }
.pagetools { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.page { position: relative; z-index: 0; background: var(--paper); box-shadow: var(--shadow); width: calc(210 * var(--mm)); height: calc(297 * var(--mm)); overflow: hidden; user-select: none; }  /* z-index 0 = eigener Stapelkontext: Block-z-Indizes bleiben in der Seite */
.page.landscape { width: calc(297 * var(--mm)); height: calc(210 * var(--mm)); }
.page .zone { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(45deg, #f7f7f7 0 6px, #f0f0f0 6px 12px); color: #9aa; font-size: 10px; padding: 4px 8px; pointer-events: none; }
.page .zone.head { top: 0; height: calc(14 * var(--mm)); border-bottom: 1px solid #e3e3e3; }
.page .zone.foot { bottom: 0; height: calc(10 * var(--mm)); border-top: 1px solid #e3e3e3; }
.page.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.block { position: absolute; border: 1px solid transparent; touch-action: none; }  /* touch-action: Finger zieht den Block, nicht die Seite */
.block:hover { border-color: #bcd6fb; }
/* Auswahl hebt den Block NICHT an (Daniel 1.10.: «nach vorne – nach hinten funktioniert nicht richtig» — die Auswahl legte
   ihn immer zuoberst, «Nach hinten» wirkte erst nach dem Abwaehlen); nur beim Schreiben liegt er oben (man sieht, was man tippt) */
.block.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
/* ueber jedem Block: Bloecke liegen bei 100 + z, der Server klemmt z auf ±1000 (Codex 1.15 R1) — die Seite ist ein eigener
   Stapelkontext, Dialoge und Meldungen liegen trotzdem darueber */
.block.editing { z-index: 2001 !important; }
/* Auswahlrahmen ueber allen Bloecken (auch ueber einem verdeckten, per Alt-Klick gewaehlten), faengt keine Klicks ab */
.selframe { position: absolute; z-index: 2000; border: 1px solid var(--accent); box-shadow: 0 0 0 1px var(--accent); pointer-events: none; }
.block .content { position: absolute; left: 50%; top: 50%; transform-origin: center; display: block; }
.block img.content { object-fit: contain; pointer-events: none; }
.block .content.crop { overflow: hidden; }
.block .content.crop img { position: absolute; max-width: none; display: block; pointer-events: none; }
.zoomctl { display: inline-flex; align-items: center; gap: 4px; }
#zoomPct { min-width: 44px; text-align: center; }

/* Schneidewerkzeug */
.cropstage { position: relative; display: inline-block; max-width: 100%; overflow: hidden; user-select: none; background: #222; }
.cropstage img { display: block; max-width: 100%; max-height: 65vh; }
.croprect { position: absolute; box-sizing: border-box; border: 2px solid var(--accent); box-shadow: 0 0 0 9999px rgba(0,0,0,.5); cursor: move; touch-action: none; }
.croprect .ch { position: absolute; width: 14px; height: 14px; background: var(--accent); border: 2px solid #fff; border-radius: 3px; }
.croprect .nw { left: -8px; top: -8px; cursor: nwse-resize; }
.croprect .ne { right: -8px; top: -8px; cursor: nesw-resize; }
.croprect .sw { left: -8px; bottom: -8px; cursor: nesw-resize; }
.croprect .se { right: -8px; bottom: -8px; cursor: nwse-resize; }
/* Textfelder: formatierbarer Inhalt (contenteditable beim Bearbeiten), Subset <b> <i> <u> <br> */
.block .content.rich { box-sizing: border-box; padding: calc(1.5 * var(--mm)); line-height: 1.25; overflow: hidden; pointer-events: none; font-family: "DejaVu Sans", Verdana, system-ui, sans-serif; white-space: pre-wrap; overflow-wrap: break-word; outline: none; }
.block .content.rich:empty::before { content: attr(data-ph); color: #9aa; }
.block.editing .content.rich { pointer-events: auto; background: #fffdf5; outline: 1px solid var(--warn); cursor: text; user-select: text; }
/* Tabellenblöcke (Daniel 2026-09-23): Zellen wie Textfelder, Spalten-/Zeilenlinien ziehbar */
.block .content.table { box-sizing: border-box; pointer-events: auto; font-family: "DejaVu Sans", Verdana, system-ui, sans-serif; }
table.tbl { width: 100%; table-layout: fixed; border-collapse: collapse; line-height: 1.25; }
table.tbl td { border: var(--tblb, 1px) solid #444; vertical-align: top; padding: calc(0.8 * var(--mm)) calc(1.2 * var(--mm));
  white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word; outline: none; }
/* «ohne Linien»: im PDF unsichtbar, im Editor beim Auswählen als feine Hilfslinie sichtbar */
table.tbl.nb td { border-color: transparent; }
.block.selected table.tbl.nb td, .block.editing table.tbl.nb td { border: 1px dashed var(--line); }
/* jede zweite Zeile sanft grau (Daniel 30.9.; gleicher Ton wie im PDF: tables.ZEBRA_RGB) — :where haelt die Regel schwach,
   damit Markierung und Bearbeitung sichtbar bleiben */
table.tbl.zebra :where(tr:nth-of-type(even)) > td { background: #ececec; }
table.tbl td.sel { background: #dbe8fa; }
.block.editing table.tbl td.editing { background: #fffdf5; cursor: text; user-select: text; }
.block.editing table.tbl td { cursor: cell; }
.tblhandles { position: absolute; inset: 0; pointer-events: none; display: none; }
.block.selected .tblhandles, .block.editing .tblhandles { display: block; }
.tblh { position: absolute; pointer-events: auto; }
.tblh.col { top: 0; bottom: 0; width: 7px; margin-left: -3.5px; cursor: col-resize; }
.tblh.row { left: 0; right: 0; height: 7px; margin-top: -3.5px; cursor: row-resize; }
.tblh:hover { background: rgba(15, 111, 222, .35); }
/* Raster zum Aufziehen beim Einfügen */
.tablemenu { display: block; padding: 8px; white-space: nowrap; }
.tgrid { display: grid; grid-template-columns: repeat(10, 16px); gap: 2px; }
.tg { width: 16px; height: 14px; border: 1px solid var(--line); background: #fff; border-radius: 2px; }
.tg.on { background: #bcd6fb; border-color: var(--accent); }
.fmt { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.fmt .btn.on { background: #dbe8fa; border-color: var(--accent); }
/* Schriftfarbe (Daniel 2026-09-22): fünf Farbpunkte, Werte aus editor.js TEXT_COLORS */
.fmt .colors { display: inline-flex; gap: 3px; align-items: center; padding: 0 3px; }
.fmt .btn.swatch { width: 18px; height: 18px; padding: 0; border-radius: 50%; background: var(--sw); border: 2px solid #fff; box-shadow: 0 0 0 1px #9aa4b2; }
.fmt .btn.swatch:hover, .fmt .btn.swatch:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
/* Grösse für markierten Text: Knopf + Menü aus Knöpfen (ein <select> nähme dem Textfeld den Fokus und die Markierung) */
.fontpick { position: relative; display: inline-flex; }
.fontmenu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 50; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); padding: 6px; display: grid; grid-template-columns: repeat(4, auto); gap: 4px; }
.fontmenu[hidden] { display: none; }
.fontmenu .btn { min-width: 52px; }
.block.text { background: rgba(255,255,255,.0); }
/* 1.21.0: Text passt nicht ganz ins Feld — im PDF wird er verkleinert, hier sichtbar markiert */
.block.text.overflow { outline: 1px dashed var(--danger, #b91c1c); outline-offset: -1px; }
.block.text.overflow::after { content: '…'; position: absolute; left: 0; bottom: 0; background: var(--danger, #b91c1c); color: #fff; font: 700 10px/1 system-ui, sans-serif; padding: 1px 3px; border-radius: 0 2px 0 0; pointer-events: none; }
.block .rz { position: absolute; right: -5px; bottom: -5px; width: 10px; height: 10px; background: var(--accent); border-radius: 2px; cursor: nwse-resize; display: none; }
@media (pointer: coarse) { .block .rz { width: 22px; height: 22px; right: -11px; bottom: -11px; } .thumb { cursor: pointer; } }
.block.selected .rz { display: block; }
.page.ro .block { cursor: default; }
.page:not(.ro) .block { cursor: move; }
/* Werkzeuge für den ausgewählten Block: eigene, immer reservierte letzte Zeile der Leiste (Daniel 2026-09-21). Früher erschien
   sie erst beim Auswählen, die klebende Leiste wurde höher und schob sich über den Block — der zweite Klick eines Doppelklicks
   landete dann in der Leiste. Jetzt bleibt die Höhe gleich, nur die Sichtbarkeit wechselt. */
.seltools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex-basis: 100%; order: 99; min-height: 30px; visibility: hidden; }
.seltools.on { visibility: visible; }
.sig { border-left: 3px solid var(--signed); padding: 4px 8px; margin: 6px 0; font-size: 13px; }
.sig .m { font-weight: 600; }
.badge.st-template { background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; }
.notice.tpl { background: #eef2ff; color: #312e81; border: 1px solid #c7d2fe; }
.sig.withdrawn { border-left-color: var(--muted, #999); opacity: .75; }
.sig.withdrawn .m { text-decoration: line-through; }
.sig .wd { color: var(--danger, #b3261e); }
/* Audit-Trail: Dialog statt Kasten unter den Seiten (Daniel 23.9.) */
.auditbox { background: #fff; padding: 16px; overflow-x: auto; }
.modal:has(> .auditbox) { width: min(1000px, 100%); }
table.audit { width: 100%; border-collapse: collapse; font-size: 12px; }
table.audit th, table.audit td { text-align: left; padding: 4px 6px; border-bottom: 1px solid #eee; vertical-align: top; }
table.audit td.v { max-width: 260px; word-break: break-word; font-family: ui-monospace, Consolas, monospace; font-size: 11px; }
.pill { display: inline-block; background: #eef2f7; border-radius: 4px; padding: 1px 6px; font-size: 11px; }
/* Stammdaten einlesen: Vorschau */
.impscroll { max-height: 50vh; overflow: auto; margin-top: 6px; border: 1px solid var(--line); border-radius: 6px; }
.impscroll table.list { margin: 0; }
.pill.st-new { background: #dff3e6; color: #17663d; }
.pill.st-update { background: #dbe8fa; color: #0b4f9e; }
.pill.st-error { background: #fbe3e0; color: #9b2c1f; }
tr.imp-error td { color: #9b2c1f; }
.upd-offer { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 8px 0; background: #f7fafc; }
.upd-offer p { margin: 4px 0; overflow-wrap: anywhere; }
.upd-run { font-weight: 600; }
.upd-run::before { content: ''; display: inline-block; width: 12px; height: 12px; margin-right: 8px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: #0b4f9e; animation: updspin 0.9s linear infinite; vertical-align: -1px; }
@keyframes updspin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) { nav.top .org, nav.top .who { display: none; } }
@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; height: auto; }
  .side { border-right: none; border-bottom: 1px solid var(--line); max-height: 40vh; }
  .main { padding: 12px; }
  .wrap { margin: 12px auto; }
}

/* --- Module (Phase C2) --- */
.modpick { margin-left: 4px; }
.fontmenu.modmenu { grid-template-columns: 1fr; min-width: 300px; max-width: 380px; gap: 2px; right: auto; }
.moditem { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 8px 10px; border: 0; border-radius: 6px; background: none; cursor: pointer; font: inherit; color: var(--ink); }
button.moditem:hover, button.moditem:focus { background: var(--bg, #f3f5f9); outline: none; }
.moditem.off strong { color: var(--muted); }
.modal.modwin { max-height: 96vh; }
.modbody { padding: 0; }
.modframe { display: block; width: 100%; border: 0; background: #fff; }
.modfault { padding: 16px 16px 0; font-weight: 600; }
.modbody > .small { padding: 0 16px 12px; }
.modlist td { vertical-align: top; }
.modlist .perm { display: inline-block; margin: 0 4px 2px 0; padding: 1px 6px; border-radius: 10px; background: #eef1f6; font-size: 12px; }

/* Rollen & Freigabe (Verwaltung, 1.14.0) */
.rs-level { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px 6px; margin: 10px 0; }
.rs-level legend { font-weight: 600; padding: 0 6px; color: var(--ink); }
.rs-level.off .rs-dim { opacity: .5; }
label.chk { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; color: var(--ink); font-size: 14px; }
label.chk > input { width: auto; margin: 3px 0 0; flex: 0 0 auto; }
.rs-warn { color: var(--bad); font-size: 13px; margin: 4px 0; }
.rs-changes { margin: 4px 0 10px; padding-left: 18px; font-size: 13px; }
/* abgewiesene Vorschau (DM1 Protokolle R3): sichtbarer Hinweis statt kaputter Miniatur, Grund im Tooltip */
.prev-err { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 4px; border: 1px dashed var(--danger, #b42318); color: var(--danger, #b42318); font-size: 12px; text-align: center; background: var(--bg, #fff); }
/* Archiv & Papierkorb (1.18.0) */
.badge.st-archived { background: #eceef1; color: #475467; border: 1px solid #d0d5dd; margin-left: 4px; }
.badge.st-trash { background: #fdecea; color: #9b1c1c; border: 1px solid #f5c2bc; margin-left: 4px; }
table.list tr.archived td { color: var(--muted); }
th.selcol, td.selcol { width: 30px; text-align: center; cursor: default; }
th.selcol input, td.selcol input { width: auto; margin: 0; cursor: pointer; }
.selbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 10px; margin-bottom: 8px; background: #fff4d6;
  border: 1px solid #f1dfae; border-radius: 6px; position: sticky; top: 0; z-index: 5; }
.selbar[hidden] { display: none; }                 /* display:flex ueberstimmt sonst das hidden-Attribut */
.notice.trash { background: #fdecea; color: #9b1c1c; border: 1px solid #f5c2bc; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.notice.arch { background: #eceef1; color: #344054; border: 1px solid #d0d5dd; }
/* Papierkorb (8.10.): breites Fenster, fester Tabellenkopf im eigenen Rollbereich, Titel/Grund hoechstens zwei Zeilen (ganzer
   Text als Sprechblase); «Papierkorb leeren» links im Fuss, Warnung nicht zu uebersehen */
.trash-scroll { max-height: 56vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.trash-scroll thead th { position: sticky; top: 0; background: #fff; z-index: 1; }
.trash-list td { vertical-align: top; }
.trash-list .trash-title { min-width: 220px; }
.trash-list .trash-reason { min-width: 160px; max-width: 280px; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: break-word; }
.trash-list .trash-by { min-width: 110px; }
.trash-tools input { min-width: 240px; }
.trash-tools select { width: auto; }
.trash-count { margin-left: auto; }
.badge.trash-keeps { margin-left: 4px; background: #ecfdf3; color: #05603a; border: 1px solid #a6f4c5; }
.modal-foot .trash-empty { margin-right: auto; }
.purge-warn { background: #fdecea; border: 2px solid var(--bad); border-radius: 8px; padding: 12px 14px; color: #7f1d1d; margin-bottom: 10px; }
.purge-warn .purge-head { display: block; font-size: 17px; font-weight: 800; color: var(--bad); margin-bottom: 6px; }
.purge-warn p { margin: 6px 0; font-weight: 700; }
.purge-warn p.purge-note { font-weight: 400; }
.btn.danger-solid { background: var(--bad); color: #fff; border-color: var(--bad); font-weight: 700; }
.btn.danger-solid:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 700px) { .trash-count { margin-left: 0; width: 100%; } }
.lc-table td, .lc-table th { padding: 4px 8px; vertical-align: top; }
.lc-table td.c { text-align: center; }
.lc-table tr.off td { color: var(--muted); }
.schau-pw { margin: 0; padding: 6px 8px; border-radius: 6px; background: #ede9fe; color: #4c1d95; }

/* Verwaltung 1.20.0 (Wunsch Daniel 5.10.): auf-/zuklappbare Bereiche, Listen mit Suche und Filtern */
.admin .adm-top { align-items: center; margin-bottom: 4px; }
.admin .adm-top h1 { margin: 0; }
.adm-group { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 8px; font-weight: 600; }
details.adm-sec { margin-bottom: 10px; padding: 0; }
details.adm-sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius); user-select: none; }
details.adm-sec > summary::-webkit-details-marker { display: none; }
details.adm-sec > summary::before { content: '▸'; color: var(--muted); font-size: 13px; width: 12px; transition: transform .12s; }
details.adm-sec[open] > summary::before { transform: rotate(90deg); }
details.adm-sec > summary:hover { background: #f7f8fa; }
details.adm-sec > summary:focus-visible { outline: 2px solid var(--accent, #0f6fde); outline-offset: -2px; }
details.adm-sec .adm-title { font-size: 17px; font-weight: 600; }
details.adm-sec .adm-count { margin-left: auto; font-size: 12px; color: var(--muted); background: #f1f3f6; border-radius: 999px; padding: 2px 10px; }
details.adm-sec .adm-count:empty { display: none; }
details.adm-sec > .adm-body { padding: 0 16px 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.adm-tools { flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.adm-tools .adm-q { min-width: 220px; }
.adm-tools .adm-f { margin: 0; gap: 4px; }
.adm-tools .adm-n { margin-left: auto; white-space: nowrap; }
.adm-scroll { overflow-x: auto; }
.own-name { margin: 2px 0 6px; }
@media (max-width: 700px) { .adm-tools .adm-n { margin-left: 0; width: 100%; } }
/* Dateiauswahl mit Lably-Knopf (9.10.2026, Mouseover in der Sprache der Oberflaeche): Abstand zum folgenden Hinweis */
.file-pick { display: inline-flex; align-items: center; gap: 6px; margin-right: 10px; vertical-align: middle; }
.file-pick .file-name { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
