/* Der Editor nutzt die ganze Fensterbreite. */
.portal-container:has(.ed-layout) { max-width: none; }
.ed-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.ed-top button, .ed-side button, .ed-panel button { padding: 4px 10px; border: 1px solid #c9c9d6; border-radius: 4px; background: #fff; cursor: pointer; }
.ed-top button:disabled { opacity: .45; cursor: default; }
.ed-status { margin-left: auto; color: #555; }
.ed-error { color: #c62828; font-weight: 600; }
.ed-banner { background: #ffe0b2; padding: 10px 14px; border-radius: 4px; }
.ed-layout { display: flex; gap: 12px; align-items: flex-start; }
.ed-side { width: 270px; flex: none; background: #fff; border: 1px solid #e0e0e6; border-radius: 6px; padding: 10px; max-height: calc(100vh - 190px); overflow: auto; font-size: 13px; }
.ed-side h4 { margin: 10px 0 6px; font-size: 14px; }
.ed-side h5 { margin: 12px 0 4px; font-size: 13px; }
.ed-side input, .ed-side select, .ed-side textarea { min-width: 0; padding: 3px 6px; border: 1px solid #c9c9d6; border-radius: 4px; font: inherit; }
.ed-side input[type=color] { width: 32px; padding: 0; height: 26px; flex: none; }
.ed-side input[type=checkbox] { width: auto; }
.ed-list { list-style: none; margin: 0 0 8px; padding: 0; }
.ed-side .ed-list button { width: 100%; text-align: left; border-color: transparent; }
.ed-side .ed-list button.ed-active { background: var(--aq-yellow-soft); border-color: var(--aq-navy); }
.ed-row { display: flex; gap: 6px; align-items: center; margin: 4px 0; }
.ed-row input[type=text], .ed-row input[type=number], .ed-row select { flex: 1; width: 100%; }
.ed-col { display: flex; flex-direction: column; gap: 2px; margin: 6px 0; }
.ed-col .ed-label { flex: none; }
.ed-check { display: flex; gap: 6px; align-items: center; margin: 4px 0; }
.ed-label { flex: 0 0 82px; color: #555; }
.ed-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 8px; }
.ed-grid .ed-label { flex-basis: 58px; }
.ed-stage-wrap { flex: 1; min-width: 0; overflow: auto; max-height: calc(100vh - 190px); padding: 28px 12px 12px; background: #ececf1; border-radius: 6px; }
.ed-stage { position: relative; margin: 0 auto; user-select: none; touch-action: none; outline: none; }
.ed-stage:focus-visible { box-shadow: 0 0 0 3px var(--aq-navy); }
.ed-overlay { position: absolute; inset: 0; }
.ed-box { position: absolute; box-sizing: border-box; cursor: move; outline: 1px dashed rgba(255, 255, 255, .28); }
.ed-box:hover { outline: 1px solid rgba(255, 255, 255, .75); }
.ed-box.ed-selected { outline: 2px solid var(--aq-yellow); z-index: 5; }
.ed-handle { position: absolute; width: 10px; height: 10px; margin: -5px; background: #fff; border: 2px solid var(--aq-navy); border-radius: 2px; }
.ed-h-topleft { left: 0; top: 0; cursor: nwse-resize; }
.ed-h-top { left: 50%; top: 0; cursor: ns-resize; }
.ed-h-topright { left: 100%; top: 0; cursor: nesw-resize; }
.ed-h-right { left: 100%; top: 50%; cursor: ew-resize; }
.ed-h-bottomright { left: 100%; top: 100%; cursor: nwse-resize; }
.ed-h-bottom { left: 50%; top: 100%; cursor: ns-resize; }
.ed-h-bottomleft { left: 0; top: 100%; cursor: nesw-resize; }
.ed-h-left { left: 0; top: 50%; cursor: ew-resize; }
.ed-handle.ed-rotate { left: 50%; top: -24px; border-radius: 50%; cursor: grab; }
.ed-guide-v, .ed-guide-h { position: absolute; pointer-events: none; background: #ff4081; z-index: 6; }
.ed-guide-v { top: 0; bottom: 0; width: 1px; }
.ed-guide-h { left: 0; right: 0; height: 1px; }
.ed-hint { color: #666; font-size: 12px; text-align: center; }
.ed-block { position: absolute; box-sizing: border-box; outline: 1px dotted rgba(0, 200, 230, .6); pointer-events: none; }
.ed-block.ed-selected { outline: 2px solid #00c8e6; z-index: 4; }
.ed-block .ed-handle { pointer-events: auto; }
.ed-tag { position: absolute; left: 0; top: -18px; padding: 0 6px; font-size: 11px; line-height: 17px; background: #00c8e6; color: #222; border-radius: 3px 3px 0 0; cursor: move; pointer-events: auto; white-space: nowrap; }
.ed-cell { cursor: pointer; outline-color: rgba(255, 255, 255, .16); }
.ed-cell.ed-selected { cursor: move; }
.ed-cellmode, .ed-findings { border-bottom: 1px solid #e0e0e6; padding-bottom: 8px; margin-bottom: 8px; }
.ed-findings h4 { display: flex; justify-content: space-between; align-items: center; }
.ed-finding { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin: 8px 0; }
.ed-presets { margin-top: 10px; }
.ed-presets summary { cursor: pointer; font-weight: 600; }
.ed-presets select, .ed-presets input[type=text] { flex: 1; width: 100%; }
.ed-side .ed-list button { display: block; text-align: left !important; }
.ed-side .ed-list li.ed-row input[type=checkbox] + button { flex: 1; }
/* Ohne Pfeilknöpfe passen auch Werte wie 1038,4 in die schmalen Zahlenfelder. */
.ed-side input[type=number] { appearance: textfield; -moz-appearance: textfield; }
.ed-side input[type=number]::-webkit-inner-spin-button, .ed-side input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ed-grid .ed-label { flex-basis: 52px; }
.ed-media { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.ed-media .ed-label { flex: none; }
.ed-media > img { max-width: 100%; max-height: 80px; object-fit: contain; background: #222; border-radius: 4px; }
.ed-media-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-media input[type=file] { border: 0; padding: 0; font-size: 12px; }
.ed-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; max-height: 220px; overflow: auto; }
.ed-side .ed-gallery button { padding: 2px; height: 62px; }
.ed-gallery img { width: 100%; height: 100%; object-fit: contain; background: #222; }
.ed-module details { margin: 8px 0; }
.ed-module summary { cursor: pointer; font-weight: 600; }
.ed-result { border: 1px solid #e0e0e6; border-radius: 4px; padding: 6px; margin: 6px 0; }
.ed-modal { position: fixed; inset: 0; z-index: 2000; background: rgba(20, 20, 30, .55); display: flex; align-items: center; justify-content: center; }
.ed-dialog { background: #fff; border-radius: 8px; padding: 14px; width: min(1000px, 94vw); height: min(760px, 92vh); display: flex; flex-direction: column; gap: 8px; }
.ed-dialog .ed-dialog-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ed-dialog .ql-container { flex: 1; min-height: 0; overflow: auto; }
.ed-dialog .ql-editor { font-size: 16px; }
.ed-dialog textarea { flex: 1; width: 100%; font-family: "Cascadia Mono", Consolas, monospace; font-size: 13px; padding: 8px; }
.ed-dialog button { padding: 5px 12px; border: 1px solid #c9c9d6; border-radius: 4px; background: #fff; cursor: pointer; }
.ed-dialog button.ed-primary { background: var(--aq-yellow); color: var(--aq-navy); border-color: var(--aq-yellow); font-weight: 600; }
.ed-dialog .ed-media { flex-direction: row; align-items: center; flex-wrap: wrap; }
.ed-dialog .ed-gallery { width: 100%; grid-template-columns: repeat(8, 1fr); max-height: 150px; }
.ed-dialog .ed-gallery button { height: 62px; padding: 2px; }
.ed-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.ed-head h1 { margin: 0; font-size: 19px; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-top { background: #fff; border: 1px solid var(--aq-line); border-radius: 8px; padding: 6px 10px; }
.ed-sep { width: 1px; align-self: stretch; background: var(--aq-line); }
.ed-status { margin-left: 0; }
.ed-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ed-ok { background: #DDF3E0; }
.ed-side h4 { border-bottom: 2px solid var(--aq-yellow); padding-bottom: 3px; }
@media (max-width: 900px) {
    .ed-layout { flex-wrap: wrap; }
    .ed-side { width: 100%; max-height: none; }
    .ed-stage-wrap { order: -1; flex-basis: 100%; }
}

/* KI-Unterstützung */
.ed-ai { display: flex; flex-direction: column; gap: 6px; }
.ed-ai textarea, .ed-dialog .ed-ai textarea { flex: none; width: 100%; padding: 8px; font: inherit; resize: vertical; }
.ed-ai p { margin: 0; }
.ed-ai progress { width: 140px; }
.ed-ai button, .ed-ai-layout button { padding: 5px 12px; border: 1px solid #c9c9d6; border-radius: 4px; background: #fff; cursor: pointer; }
.ed-ai button.ed-primary { background: var(--aq-yellow); color: var(--aq-navy); border-color: var(--aq-yellow); font-weight: 600; }
.ed-ai button:disabled { opacity: .55; cursor: default; }
.ed-ai-layout { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; padding: 10px 14px; background: #fff; border: 1px solid #c9c9d6; border-radius: 6px; }
.ed-ai-preview { display: flex; justify-content: center; overflow: auto; }
.ed-dialog .ed-ai-preview img { max-width: 100%; max-height: 100%; margin: auto; object-fit: cover; }
.ed-top[inert], .ed-side[inert] { opacity: .55; }
