/* H2APEX PDF-Formulare */
:root {
  --brand: #14a0de;
  --brand-dark: #1186ba;
  --brand-50: #e8f5fc;
  --ink: #1d1d1b;
  --ink-2: #4a4f55;
  --muted: #7a818a;
  --line: #e2e6ea;
  --bg: #f4f6f8;
  --card: #ffffff;
  --danger: #c93b3b;
  --ok: #1f9d55;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 14px; line-height: 1.45; }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; color: var(--ink); }
.inline { display: inline; }
kbd { font: 11px/1 ui-monospace, monospace; background: #f1f3f5; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 2px 4px; }

/* ---------- Formularelemente & Buttons */
input, select, textarea {
  font: inherit; color: inherit; width: 100%;
  padding: 7px 10px; border: 1px solid #cfd6dd; border-radius: 7px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(20, 160, 222, .18); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
input[type=range] { padding: 0; accent-color: var(--brand); }
input[type=color] { padding: 2px; height: 34px; width: 46px; flex: none; }
textarea { resize: vertical; }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.stack > * + * { margin-top: 12px; }
.stack label input, .stack label select, .stack label textarea { margin-top: 4px; font-weight: 400; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 13px; line-height: 1;
  padding: 8px 14px; border-radius: 7px; border: 1px solid #cfd6dd; background: #fff; color: var(--ink);
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: #f3f6f8; text-decoration: none; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-icon { padding: 6px 9px; min-width: 32px; }
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover { background: #fdf0f0; border-color: #f0c4c4; }
.linkbtn { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; opacity: .85; }
.linkbtn:hover { opacity: 1; text-decoration: underline; }

.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 99px; border: 0; cursor: pointer; }
.badge-ok { background: #e3f6ea; color: var(--ok); }
.badge-draft { background: #eef0f3; color: var(--ink-2); }
.badge-admin { background: var(--brand-50); color: var(--brand-dark); }

.alert { padding: 10px 14px; border-radius: 8px; background: #eef2f5; margin: 10px 0; }
.alert-error { background: #fdecec; color: #8f2424; }
.alert-success { background: #e5f6ec; color: #1b6c3c; }
.flash { max-width: 1200px; margin: 14px auto 0; padding: 10px 16px; border-radius: 8px; }
.flash-success { background: #e5f6ec; color: #1b6c3c; }
.flash-error { background: #fdecec; color: #8f2424; }

/* ---------- Seitenlayout */
.topnav {
  display: flex; align-items: center; gap: 28px; height: 56px; padding: 0 24px;
  background: #fff; border-bottom: 1px solid var(--line); border-top: 3px solid var(--brand);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; }
.brand span { padding-left: 10px; border-left: 1px solid var(--line); font-size: 14px; }
.brand:hover { text-decoration: none; }
.topnav nav { display: flex; gap: 4px; flex: 1; }
.topnav nav a, .usermenu > a { padding: 7px 12px; border-radius: 7px; color: var(--ink-2); font-weight: 500; }
.topnav nav a:hover, .usermenu > a:hover { background: var(--bg); text-decoration: none; }
.topnav nav a.active, .usermenu > a.active { background: var(--brand-50); color: var(--brand-dark); }
.usermenu { display: flex; align-items: center; gap: 12px; font-size: 13px; }

.page { max-width: 1200px; margin: 0 auto; padding: 28px 24px 60px; }
.page-narrow { max-width: 760px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { width: 280px; }
.filterbar { display: flex; gap: 8px; margin-bottom: 14px; }
.filterbar input { max-width: 320px; }
.filterbar select { max-width: 180px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.empty { padding: 40px; text-align: center; }
.table-card { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfc; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- Login */
.auth { background: linear-gradient(160deg, #eaf6fc 0%, #f4f6f8 60%); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; padding: 32px; }
.auth-card h1 { font-size: 18px; margin: 14px 0 20px; color: var(--ink-2); font-weight: 600; }
.auth-logo { height: 32px; }
.auth-card .btn { width: 100%; padding: 11px; }

/* ================================================================ Editor */
.editor-body { overflow: hidden; }
.editor {
  display: grid; height: 100vh;
  grid-template-columns: 232px 1fr 320px;
  grid-template-rows: 56px 1fr;
  grid-template-areas: "top top top" "pal canvas props";
}
.ed-top {
  grid-area: top; display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: #fff; border-bottom: 1px solid var(--line); border-top: 3px solid var(--brand);
}
.ed-back { font-size: 20px; color: var(--ink-2); padding: 4px 10px; border-radius: 7px; }
.ed-back:hover { background: var(--bg); text-decoration: none; }
.ed-name { max-width: 380px; font-weight: 600; font-size: 15px; border-color: transparent; }
.ed-name:hover { border-color: var(--line); }
.ed-status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ed-status.dirty { color: #b7791f; }
.ed-status.dirty::before { content: "● "; }
.ed-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.zoom { display: flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.zoom .btn { border: 0; }
.zoom span { font-size: 12px; min-width: 42px; text-align: center; color: var(--ink-2); }
.dropdown { position: relative; }
.dropdown-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 250px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px;
}
.dropdown-menu.open { display: block; }
.dropdown-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; font: inherit; padding: 9px 12px; border-radius: 6px; cursor: pointer; }
.dropdown-menu button:hover { background: var(--brand-50); }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* Palette */
.ed-palette { grid-area: pal; background: #fff; border-right: 1px solid var(--line); overflow-y: auto; padding: 14px 12px 24px; }
.ed-palette h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 4px 8px; }
.pal-group h4 { font-size: 12px; margin: 12px 4px 6px; color: var(--ink-2); font-weight: 600; }
.pal-items { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pal-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  font-size: 11.5px; padding: 10px 4px 8px; border: 1px solid var(--line); border-radius: 8px;
  background: #fbfcfd; cursor: grab; user-select: none; line-height: 1.2;
}
.pal-item:hover { border-color: var(--brand); background: var(--brand-50); }
.pal-icon { font-size: 17px; line-height: 1; color: var(--brand-dark); }
.palette-struct { display: grid; gap: 6px; }
.pal-btn { font: inherit; font-size: 12.5px; padding: 8px; border: 1px dashed #b9c4ce; border-radius: 8px; background: #fff; cursor: pointer; }
.pal-btn:hover { border-color: var(--brand); color: var(--brand-dark); }
.hint { font-size: 11.5px; color: var(--muted); margin: 14px 4px 0; }

/* Canvas */
.ed-canvas { grid-area: canvas; overflow: auto; padding: 32px; background: #e9edf1; }
.pv-page {
  --mm: 3.7795px;
  position: relative; margin: 0 auto; background: #fff; display: flex; flex-direction: column;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .12); color: #1d1d1b; line-height: 1.3;
}
.pv-header { position: relative; flex: none; }
.pv-accent { position: absolute; left: 0; right: 0; top: 0; }
.pv-hinner { position: absolute; display: flex; align-items: center; justify-content: space-between; gap: calc(var(--mm) * 8); }
.pv-htext { flex: 1; line-height: 1.3; }
.pv-hline { position: absolute; height: 0; }
.pv-content { flex: 1; position: relative; }
.pv-footer { position: relative; flex: none; }
.pv-fline { position: absolute; top: 0; height: 0; }
.pv-fcols { position: absolute; display: grid; grid-template-columns: 1fr 1fr 1fr; line-height: 1.35; }

.pv-row { position: relative; outline: 1px dashed transparent; outline-offset: calc(var(--mm) * 1.2); border-radius: 2px; }
.pv-row:hover { outline-color: #b9d9ea; }
.pv-row.selected { outline: 2px solid var(--brand); }
.pv-cols { display: flex; align-items: flex-start; }
.pv-col { min-width: 0; min-height: calc(var(--mm) * 9); border-radius: 3px; }
.pv-col:empty { background: repeating-linear-gradient(45deg, #f6f9fb, #f6f9fb 6px, #eef4f8 6px, #eef4f8 12px); outline: 1px dashed #bcd3e0; }
.pv-col:empty::after { content: "Element hierher ziehen"; display: flex; height: calc(var(--mm) * 9); align-items: center; justify-content: center; font: 11px/1 -apple-system, sans-serif; color: #7b95a6; }

.row-tools {
  position: absolute; right: 0; top: calc(var(--mm) * -1.2 - 24px); z-index: 5; display: none; gap: 2px;
  background: var(--brand); border-radius: 6px 6px 0 0; padding: 2px 4px;
}
.pv-row:hover > .row-tools, .pv-row.selected > .row-tools { display: flex; }
.row-tools button, .row-tools span { font: 600 11px/1 -apple-system, sans-serif; color: #fff; background: none; border: 0; padding: 5px 7px; border-radius: 4px; cursor: pointer; }
.row-tools button:hover { background: rgba(255, 255, 255, .2); }
.row-handle { cursor: grab; }

/* Klickfläche größer als das Element (::before liegt hinter dem Inhalt), ohne das Layout
   zu verschieben – die Vorschau bleibt maßgleich mit dem PDF. */
.pv-el { position: relative; z-index: 0; cursor: pointer; border-radius: 3px; outline: 1px solid transparent; outline-offset: 6px; }
.pv-el::before { content: ""; position: absolute; inset: -6px -7px; z-index: -1; border-radius: 5px; transition: background .12s; }
.pv-el:hover::before { background: rgba(20, 160, 222, .07); }
.pv-el.selected::before { background: rgba(20, 160, 222, .09); }
.pv-el:last-child { margin-bottom: 0 !important; }
.pv-el:hover { outline-color: #9fd3ec; }
.pv-el.selected { outline: 2px solid var(--brand); }
/* Im Header/Footer liegen Elemente enger beieinander */
.pv-zone .pv-el { outline-offset: 3px; }
.pv-zone .pv-el::before { inset: -3px -5px; }
.el-tools {
  position: absolute; left: -7px; top: -32px; z-index: 6; display: none; align-items: center; gap: 1px;
  background: var(--ink); border-radius: 6px; padding: 2px 3px 2px 8px; white-space: nowrap;
}
.pv-el.selected > .el-tools { display: flex; }
.el-tools span { font: 600 11px/1 -apple-system, sans-serif; color: #fff; margin-right: 4px; }
.el-tools button { font-size: 11px; color: #fff; background: none; border: 0; padding: 4px 6px; border-radius: 4px; cursor: pointer; }
.el-tools button:hover { background: rgba(255, 255, 255, .2); }

.pv-pagebreak {
  display: flex; align-items: center; gap: 10px; margin: calc(var(--mm) * 4) 0; padding: 6px 10px;
  border-top: 2px dashed #9fb3c1; color: #5c7384; font: 600 11px/1 -apple-system, sans-serif; text-transform: uppercase; letter-spacing: .05em;
}
.pv-pagebreak.selected { color: var(--brand); border-color: var(--brand); }
.pv-pagebreak .row-del { margin-left: auto; border: 0; background: none; cursor: pointer; color: inherit; }
.pv-dropzone {
  margin-top: calc(var(--mm) * 4); padding: calc(var(--mm) * 4); border: 1.5px dashed #bcd3e0; border-radius: 6px;
  text-align: center; font: 12px/1.4 -apple-system, sans-serif; color: #7b95a6; min-height: calc(var(--mm) * 14);
}
.pv-dropzone .pal-item, .pv-col .pal-item { margin: 4px auto; max-width: 160px; }
.drag-ghost { opacity: .45; background: var(--brand-50) !important; }

/* Element-Vorschau */
.pv-heading { font-weight: 700; line-height: 1.25; }
.pv-label { font-weight: 700; color: #555; }
.pv-field {
  position: relative; display: flex; align-items: center; padding: 0 calc(var(--mm) * 1.2);
  background: #f4f9fc; border: calc(var(--mm) * .3) solid #aabecd;
}
.pv-ph { color: #a0a8ae; }
.pv-caret { position: absolute; right: calc(var(--mm) * 2); color: #7a8a96; font-size: calc(var(--mm) * 3); }
.pv-choices { display: flex; flex-direction: column; }
.pv-choices.inline { flex-direction: row; flex-wrap: wrap; }
.pv-choice { display: inline-flex; align-items: center; }
.pv-box, .pv-radio { display: inline-block; flex: none; border: calc(var(--mm) * .3) solid #96aab9; background: #f4f9fc; }
.pv-radio { border-radius: 50%; }
.pv-sig { display: flex; align-items: flex-end; }
.pv-sigline { border-top: calc(var(--mm) * .35) solid #5a5a5a; transform: translateY(100%); color: #6e6e6e; padding-top: 1px; }
.pv-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.pv-table th { text-align: left; font-weight: 700; color: #282828; border: 1px solid #aab9c3; }
.pv-table td { border: 1px solid #aab9c3; }
.pv-notice { line-height: 1.35; }
.pv-spacer { background: repeating-linear-gradient(0deg, transparent, transparent 3px, #f0f4f7 3px, #f0f4f7 4px); }
.pv-placeholder { padding: 14px; border: 1px dashed #bcd3e0; color: #7b95a6; font: 12px -apple-system, sans-serif; text-align: center; }

/* Eigenschaften-Panel */
.ed-props { grid-area: props; background: #fff; border-left: 1px solid var(--line); overflow-y: auto; padding-bottom: 40px; }
.props-section { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.props-section h3 { margin: 0 0 12px; font-size: 14px; display: flex; align-items: baseline; justify-content: space-between; }
.props-section h3 small { font-size: 11px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.ctl { margin-bottom: 12px; }
.ctl > label { margin-bottom: 4px; }
.ctl .help { display: block; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.ctl label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.ctl-range output { float: right; color: var(--muted); font-weight: 500; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.color-row { display: flex; gap: 6px; }
.props-actions { display: flex; gap: 8px; margin-top: 16px; }
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.preset { display: flex; gap: 3px; height: 30px; padding: 5px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; }
.preset i { background: #cfdde6; border-radius: 2px; }
.preset:hover { border-color: var(--brand); }
.preset.active { border-color: var(--brand); background: var(--brand-50); }
.preset.active i { background: var(--brand); }
.widths { display: flex; gap: 6px; }
.widths input { text-align: center; padding: 6px 4px; }
.cols-editor { display: grid; gap: 6px; margin-bottom: 8px; }
.col-line { display: grid; grid-template-columns: 1fr 64px auto; gap: 6px; }
.tips { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--ink-2); }
.tips li + li { margin-top: 6px; }

.asset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; max-height: 220px; overflow-y: auto; }
.asset-tile { height: 58px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; font-size: 12px; color: var(--muted); }
.asset-tile img { max-width: 100%; max-height: 100%; object-fit: contain; }
.asset-tile.sel { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(20, 160, 222, .3); }
.upload-btn { cursor: pointer; }

/* Modal & Toast */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(20, 30, 40, .45); display: grid; place-items: center; padding: 30px; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 12px; width: min(640px, 100%); max-height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal.wide .modal-box { width: min(1100px, 100%); height: 100%; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px; overflow: auto; flex: 1; }
.modal.wide .modal-body { padding: 0; }
.pdf-frame { width: 100%; height: 100%; border: 0; display: block; border-radius: 0 0 12px 12px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 200;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; transition: .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

@media (max-width: 1100px) {
  .editor { grid-template-columns: 200px 1fr 280px; }
}
@media (max-width: 800px) {
  .topnav { gap: 12px; padding: 0 12px; overflow-x: auto; }
  .brand span { display: none; }
  .page { padding: 20px 16px 40px; }
  .inline-form input { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .editor-body { overflow: auto; }
  .editor { display: block; height: auto; }
  .ed-top { flex-wrap: wrap; height: auto; padding: 8px; }
  .ed-actions { margin-left: 0; flex-wrap: wrap; }
  .ed-palette, .ed-props { border: 0; }
  .ed-canvas { padding: 16px; }
}
.sortable-fallback { opacity: .9 !important; box-shadow: var(--shadow-lg); }
.tpl-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.tpl-fields .ctl { grid-column: 1 / -1; }
.tpl-fields .ctl.half { grid-column: auto; }
.stack-labels label input, .stack-labels label select { margin-top: 4px; font-weight: 400; }
.pw-reset { position: relative; display: inline-block; }
.pw-reset summary { list-style: none; }
.pw-reset summary::-webkit-details-marker { display: none; }
.pw-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; display: flex; gap: 6px; width: 340px; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); }
.col-line { grid-template-columns: 1fr 86px 54px auto; }
.col-line select { padding: 7px 4px; }
.pv-table .pv-num { text-align: center; font-weight: 700; color: #5a5a5a; }
.pv-table .pv-amount { text-align: right; padding-right: calc(var(--mm) * 1.5); }
.pv-table .pv-sumlabel { text-align: right; font-weight: 700; padding-right: calc(var(--mm) * 3); font-size: 1.15em; }
.pv-table td .pv-ph { padding-left: calc(var(--mm) * 1.5); font-size: .8em; }

/* ---------- Header/Footer-Bereiche im Editor */
.pv-zone { position: relative; flex: none; cursor: pointer; }
.pv-zone::after { content: ""; position: absolute; inset: 0; pointer-events: none; outline: 1px dashed transparent; outline-offset: -1px; transition: outline-color .12s, background .12s; }
.pv-zone:hover::after { outline-color: #9fd3ec; background: rgba(20, 160, 222, .035); }
.pv-zone.selected::after { outline: 2px solid var(--brand); outline-offset: -2px; }
.pv-zone.locked .pv-header, .pv-zone.locked .pv-footer { opacity: .75; }
.zone-badge {
  position: absolute; right: 6px; z-index: 7; display: none; pointer-events: none;
  font: 600 10.5px/1 -apple-system, sans-serif; color: #fff; background: var(--brand); padding: 4px 8px; border-radius: 4px;
}
.pv-zone[data-zone="header"] .zone-badge { bottom: 4px; }
.pv-zone[data-zone="footer"] .zone-badge { top: 4px; }
.pv-zone:hover .zone-badge, .pv-zone.selected .zone-badge { display: block; }
.pv-zone.locked .zone-badge { background: #5c7384; }
.pv-zone-area { position: absolute; left: var(--ml); right: var(--mr); display: flex; flex-direction: column; }
.pv-zone-area .pv-rows > .pv-row:last-child { margin-bottom: 0 !important; }
.pv-zone .row-tools { top: -22px; }
.pv-zone-drop { display: none; margin-top: calc(var(--mm) * 1); padding: calc(var(--mm) * 1.5); min-height: 0; font-size: 11px; }
.pv-zone-drop.empty, .dragging .pv-zone.editable .pv-zone-drop { display: block; }
.pv-zone-off { display: flex; align-items: center; justify-content: center; font: 11px -apple-system, sans-serif; color: #9aa8b2; background: repeating-linear-gradient(45deg, #fafbfc, #fafbfc 6px, #f2f5f7 6px, #f2f5f7 12px); }
.pv-locked { opacity: .45; pointer-events: none; }
.pv-body-note { margin-top: calc(var(--mm) * 6); padding: 10px; text-align: center; font: 12px -apple-system, sans-serif; color: #7b95a6; border: 1.5px dashed #bcd3e0; border-radius: 6px; }
.pal-item.pal-disabled { opacity: .35; }
.dragging, .dragging * { cursor: grabbing !important; }

/* ---------- Betriebsanweisung: Vorschau */
.pv-ba { background: #fff; }
.pv-ba-title { display: flex; align-items: center; gap: calc(var(--mm) * 4); font-weight: 700; line-height: 1.2; }
.pv-ba-row { display: flex; }
.pv-ba-box { flex: 1 1 0; display: flex; align-items: flex-start; min-width: 0; }
.pv-ba-box img { flex: none; object-fit: contain; }
.pv-ba-text { flex: 1; min-width: 0; line-height: 1.3; }
.pv-ba-text ul, .pv-ba-text ol { margin: 0; padding-left: calc(var(--mm) * 5); }
.pv-ba-text p { margin: 0; }
.pv-facts { width: 100%; border-collapse: collapse; table-layout: fixed; }
.pv-facts th, .pv-facts td { border: 1px solid #aab9c3; padding: calc(var(--mm) * 1.5); text-align: left; vertical-align: middle; height: calc(var(--mm) * 7); }
.pv-facts th { font-weight: 700; color: #3c3c3c; }

/* ---------- Betriebsanweisung: Eingabe */
.swatches { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.swatch { width: 24px; height: 24px; border-radius: 5px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch.active { box-shadow: 0 0 0 2px var(--ink); }
.swatches input[type=color] { width: 30px; height: 26px; }
.symbol-pick { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 1px solid #cfd6dd; border-radius: 8px; background: #fff; cursor: pointer; font: inherit; text-align: left; }
.symbol-pick img { width: 36px; height: 36px; object-fit: contain; }
.symbol-pick span { flex: 1; font-size: 12.5px; }
.symbol-pick b { font-size: 12px; color: var(--brand-dark); }
.facts-editor { display: grid; gap: 6px; margin-bottom: 8px; }
.fact-line { display: grid; grid-template-columns: 1fr 1.2fr auto; gap: 6px; }
.ba-editor { display: grid; gap: 10px; }
.ba-ed-row { border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: #fafbfc; display: grid; gap: 8px; }
.ba-ed-head { display: flex; align-items: center; gap: 4px; font-size: 12px; }
.ba-ed-head b { margin-right: auto; }
.ba-ed-head button { border: 1px solid var(--line); background: #fff; border-radius: 5px; padding: 3px 7px; cursor: pointer; font-size: 11.5px; }
.ba-ed-head button:disabled { opacity: .35; cursor: default; }
.ba-ed-head .seg { display: inline-flex; margin-right: 6px; }
.ba-ed-head .seg button { border-radius: 0; margin-left: -1px; }
.ba-ed-head .seg button:first-child { border-radius: 5px 0 0 5px; }
.ba-ed-head .seg button:last-child { border-radius: 0 5px 5px 0; }
.ba-ed-head .seg button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.ba-ed-box { display: grid; grid-template-columns: 46px 1fr; gap: 8px; align-items: start; }
.ba-ed-sym { width: 46px; height: 46px; border: 1px dashed #b9c4ce; border-radius: 6px; background: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 16px; color: var(--muted); padding: 2px; }
.ba-ed-sym small { font-size: 9px; }
.ba-ed-sym img { width: 40px; height: 40px; object-fit: contain; }
.rte { border: 1px solid #cfd6dd; border-radius: 7px; background: #fff; overflow: hidden; }
.rte:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(20, 160, 222, .18); }
.rte-bar { display: flex; gap: 2px; padding: 3px; border-bottom: 1px solid var(--line); background: #f6f8fa; }
.rte-bar button { border: 0; background: none; border-radius: 4px; padding: 3px 7px; cursor: pointer; font-size: 11.5px; }
.rte-bar button:hover { background: #e6ecf0; }
.rte-area { min-height: 54px; padding: 6px 8px; font-size: 13px; line-height: 1.4; outline: none; }
.rte-area ul, .rte-area ol { margin: 2px 0; padding-left: 20px; }

/* ---------- Symbolauswahl */
.modal.picker .modal-box { height: min(720px, 100%); }
.modal.picker .modal-body { padding: 0; display: flex; flex-direction: column; }
.picker-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.picker-top input[type=search] { flex: 1; min-width: 200px; }
.picker-tabs { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; }
.picker-tabs button { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; }
.picker-tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.picker-grid { flex: 1; overflow-y: auto; padding: 14px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; align-content: start; }
.picker-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font-size: 11px; line-height: 1.25; text-align: center; }
.picker-item:hover { border-color: var(--brand); background: var(--brand-50); }
.picker-item.sel { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(20, 160, 222, .3); }
.picker-item img { width: 56px; height: 56px; object-fit: contain; }
.picker-assets { grid-column: 1 / -1; }
.picker-note { padding: 0 16px 12px; margin: 0; }

/* ---------- Frei positionierte Bilder/Symbole */
.pv-abs { position: absolute; z-index: 4; line-height: 0; }
.pv-abs img { cursor: pointer; }
.pv-el:hover .pv-abs, .pv-el.selected .pv-abs { outline: 1.5px dashed var(--brand); outline-offset: 2px; }
/* Marker als Anfasser an der Stelle im Layout – belegt wie im PDF keinen Platz */
.pv-abs-marker { position: absolute; left: 0; top: -2px; z-index: 3; white-space: nowrap; font: 600 10px/1.6 -apple-system, sans-serif; color: #5c7384; background: #eef4f8; border: 1px dashed #bcd3e0; border-radius: 4px; padding: 0 6px; }
.pv-el:has(> .pv-abs) { margin-bottom: 0 !important; min-height: 0; }
