/* 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; }
.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; }

/* 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-Film */
.demo-stage { position: relative; height: 340px; background: #f3f5f8; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); font-size: 12px; }
.demo-stage .side { position: absolute; left: 14px; top: 14px; bottom: 14px; width: 150px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px; overflow: hidden; }
.demo-stage .side h4 { margin: 0 0 6px; font-size: 10px; letter-spacing: .05em; color: var(--muted); }
.demo-stage .file { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 5px; margin-bottom: 6px; background: #fff; opacity: 0; transform: translateX(-30px); animation: d-in .5s forwards; }
.demo-stage .file .ic { width: 22px; height: 26px; border-radius: 3px; flex: none; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 8px; font-weight: 700; }
.ic.doc { background: #2b579a; } .ic.xls { background: #217346; } .ic.pdf { background: #c0392b; } .ic.img { background: #7c3aed; }
.demo-stage .a4 { position: absolute; left: 190px; top: 14px; width: 232px; height: 312px; background: #fff; box-shadow: var(--shadow); border: 1px solid var(--line); }
.demo-stage .a4 .zone { position: absolute; left: 0; right: 0; height: 14px; background: repeating-linear-gradient(45deg, #f7f7f7 0 4px, #efefef 4px 8px); font-size: 7px; color: #999; padding: 2px 5px; }
.demo-stage .a4 .zone.foot { bottom: 0; } .demo-stage .a4 .zone.head { top: 0; }
.demo-stage .blk { position: absolute; border: 1px solid #bcd6fb; background: #f0f6ff; display: flex; align-items: center; justify-content: center; color: #1f4b8f; font-size: 10px; font-weight: 600; }
.demo-stage .blk.photo { background: linear-gradient(135deg, #dfe9f7, #f5e6cc); color: #7c3aed; }
.demo-stage .blk.txt { background: #fffdf5; border-color: var(--warn); color: var(--ink); font-weight: 400; text-align: left; padding: 4px; align-items: flex-start; font-size: 9px; line-height: 1.3; }
.demo-stage .panel { position: absolute; right: 14px; top: 14px; width: 250px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 10px; box-shadow: var(--shadow); }
.demo-stage .panel h4 { margin: 0 0 8px; font-size: 12px; }
.demo-stage .row-a { display: flex; gap: 6px; align-items: center; padding: 4px 0; border-bottom: 1px solid #eee; font-size: 10px; opacity: 0; animation: d-in .4s forwards; }
.demo-stage .row-a .hash { font-family: ui-monospace, Consolas, monospace; color: var(--muted); font-size: 9px; }
.demo-stage .pill-lock { position: absolute; left: 190px; top: 150px; width: 232px; text-align: center; background: rgba(15,111,222,.92); color: #fff; padding: 8px; font-weight: 700; opacity: 0; animation: d-in .5s forwards; }
.demo-stage .dialog { position: absolute; left: 130px; top: 90px; width: 300px; background: #fff; border-radius: 8px; box-shadow: 0 12px 40px rgba(0,0,0,.25); padding: 12px; opacity: 0; animation: d-in .4s forwards; }
.demo-stage .dialog .in { border: 1px solid var(--line); border-radius: 4px; padding: 5px 8px; margin: 6px 0; font-family: monospace; min-height: 24px; }
.demo-stage .dialog .ok { background: var(--accent); color: #fff; border-radius: 4px; padding: 5px 10px; display: inline-block; margin-top: 4px; }
.demo-stage .zipbox { position: absolute; right: 14px; top: 40px; width: 250px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 10px; font-family: ui-monospace, Consolas, monospace; font-size: 10px; line-height: 1.7; }
.demo-stage .zipbox b { font-family: inherit; }
.demo-stage .zipbox div { opacity: 0; animation: d-in .35s forwards; }
.demo-stage .move { animation: d-move 1.4s ease-in-out forwards; }
.demo-stage .grow { animation: d-grow .6s ease-out forwards; }
.demo-stage .spin { animation: d-spin .8s ease-in-out forwards; }
.demo-stage .cursor { position: absolute; width: 14px; height: 14px; border-left: 2px solid #111; border-top: 2px solid #111; transform: rotate(-30deg); pointer-events: none; }
@keyframes d-in { to { opacity: 1; transform: none; } }
@keyframes d-grow { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes d-move { from { transform: translate(var(--fx), var(--fy)) scale(.4); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes d-spin { from { transform: rotate(0deg); } to { transform: rotate(90deg); } }
.demo-caption { margin: 12px 0 6px; }
.demo-caption h3 { margin: 0 0 4px; font-size: 15px; color: var(--ink); text-transform: none; letter-spacing: 0; }
.demo-caption p { margin: 0; color: var(--muted); font-size: 13px; }
.demo-ctrl { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.demo-ctrl .dots { display: flex; gap: 5px; margin: 0 auto; }
.demo-ctrl .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); display: block; cursor: pointer; }
.demo-ctrl .dots i.on { background: var(--accent); }
.demo-bar { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.demo-bar i { display: block; height: 100%; background: var(--accent); width: 0; }
.demo-bar i.run { animation: d-bar linear forwards; }
@keyframes d-bar { from { width: 0; } to { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .demo-stage * { animation-duration: .01s !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; }

.wrap { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
.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 tr.click:hover td { background: #f4f8ff; }
.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; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.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); }
.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); }

.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; }
.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; }
.block.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); z-index: 999 !important; }
.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); }
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); }
.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; }
/* 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; }

@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; }
}
