/* UrsusIT Manuals – nur app-spezifische Stile; Grunddesign kommt aus ursus-core (assets/core/ursus.css). Farben nur über Variablen. */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:root { --internal: #6b4fbb; --internal-soft: #efeafb; --customer: #1a8a4a; --customer-soft: #e3f6eb; --doc-width: 820px; }
[data-theme="dark"] { --internal: #b7a3f0; --internal-soft: #251f3c; --customer: #4cc47f; --customer-soft: #133423; }
@media (prefers-color-scheme: dark) { [data-theme="system"] { --internal: #b7a3f0; --internal-soft: #251f3c; --customer: #4cc47f; --customer-soft: #133423; } }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.text-down { color: var(--down); } .text-warn { color: var(--warn); } .text-ok { color: var(--up); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--brand-2); font: inherit; font-size: .85rem; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.crumbs { margin: 0 0 4px; font-size: .85rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.subhead { font-size: .9rem; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.section-title { font-size: 1rem; margin: 24px 0 10px; }
.container-wide { max-width: 1500px; }

/* Sichtbarkeit: immer Symbol + Text, nie nur Farbe */
.vis { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; vertical-align: middle; }
.vis.vis-internal { background: var(--internal-soft); color: var(--internal); }
.vis.vis-customer { background: var(--customer-soft); color: var(--customer); }
h1 .vis { font-size: .75rem; }

/* Menü: Dokumentation */
.sb-scope { margin: 12px 0 4px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.18); }
.sb-scope-head { display: flex; align-items: center; gap: 12px; padding: 6px 12px; color: #fff; }
.sb-scope-head small { display: block; font-size: .72rem; opacity: .75; font-weight: 400; }
.sb-scope-head b { display: block; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; }
.sb-switch { display: block; padding: 4px 8px 8px; }
.sb-switch .combo-input, .sb-switch select { width: 100%; padding: 6px 9px; border-radius: 8px; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.12); color: #fff; font: inherit; font-size: .85rem; }
.sb-switch .combo-input::placeholder { color: rgba(255,255,255,.7); }
.sb-switch .combo-list { color: var(--text); }
.sb-collapsed .sb-switch, .sb-collapsed .sb-empty { display: none; }
.sb-count { margin-left: auto; font-size: .68rem; font-weight: 700; min-width: 18px; padding: 1px 6px; border-radius: 9px; background: rgba(255,255,255,.22); text-align: center; }
.sb-empty { display: block; padding: 4px 14px; font-size: .8rem; opacity: .65; }
.sb-role { display: block; font-size: .7rem; opacity: .75; }

/* Kopfleiste mit Suche */
.appbar-search { display: flex; align-items: center; gap: 6px; margin-right: auto; flex: 1 1 auto; max-width: 460px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--muted); }
.appbar-search input { border: 0; background: transparent; color: var(--text); font: inherit; padding: 7px 0; width: 100%; outline: none; }
.appbar-search:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent); }

/* Übersicht */
.fav-col { width: 36px; }
.fav { color: var(--none); }
.fav.on { color: #e8890c; }
.fav.on svg { fill: currentColor; }
.home-cards, .area-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); }
.card-link { display: block; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
.card-link:hover { border-color: var(--brand); text-decoration: none; transform: translateY(-1px); }
.card-link .card-title { margin-bottom: 4px; }
.filter-form { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-form input[type=search] { min-width: 260px; }

/* Steckbrief */
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 12px 24px; margin: 0; }
.kv-grid dt { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kv-grid dd { margin: 2px 0 0; font-weight: 500; }

/* Seite lesen: Inhalt links, Kommentare rechts */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .doc-layout { grid-template-columns: 1fr; } }
.doc { max-width: var(--doc-width); width: 100%; padding: 22px 28px; }
.container-wide .doc { max-width: none; }
.doc-body { line-height: 1.65; overflow-wrap: anywhere; }
.doc-body > :first-child { margin-top: 0; }
.doc-body h2 { font-size: 1.3rem; margin: 1.6em 0 .5em; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.doc-body h3 { font-size: 1.1rem; margin: 1.3em 0 .4em; }
.doc-body h4 { font-size: 1rem; margin: 1.1em 0 .3em; }
.doc-body ul, .doc-body ol { padding-left: 1.4em; }
.doc-body blockquote { margin: 1em 0; padding: 4px 14px; border-left: 4px solid var(--border); color: var(--muted); }
.doc-body code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 0 4px; font-size: .9em; }
.doc-body pre, .doc-body .code-block { background: #1b2430; color: #e6ebf2; border-radius: 9px; padding: 12px 14px; overflow-x: auto; font-size: .88rem; line-height: 1.5; position: relative; }
.doc-body pre code { background: none; border: 0; padding: 0; color: inherit; }
.doc-body .code-lang { position: absolute; top: 4px; right: 10px; font-size: .7rem; opacity: .6; text-transform: uppercase; }
.doc-body table, .doc-body .doc-table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: .92rem; display: block; overflow-x: auto; }
.doc-body th, .doc-body td { border: 1px solid var(--border); padding: 6px 9px; text-align: left; vertical-align: top; min-width: 60px; }
.doc-body th { background: var(--surface-2); }
.doc-body hr { border: 0; border-top: 1px solid var(--border); margin: 1.5em 0; }
.doc-body ul[data-type="taskList"], .doc-body ul.task-list { list-style: none; padding-left: .2em; }
.doc-body ul[data-type="taskList"] li, .doc-body ul.task-list li { display: flex; gap: 8px; align-items: flex-start; }
.doc-body ul[data-type="taskList"] li > label { margin-top: 2px; }
.doc-body ul[data-type="taskList"] li > div { flex: 1; }
.doc-body a { color: var(--brand-2); }
.callout { position: relative; margin: 1em 0; padding: 10px 14px 6px; display: flex; gap: 10px; border-radius: 9px; border-left: 4px solid var(--info); background: var(--info-soft); }
.doc-edit .callout { display: block; padding-top: 26px; }
.callout-ico { flex: none; color: var(--info); padding-top: 2px; } .callout > div { min-width: 0; flex: 1; }
.callout-tip .callout-ico { color: var(--up); } .callout-warning .callout-ico { color: var(--warn); } .callout-danger .callout-ico { color: var(--down); }
.doc-edit .callout::before { content: attr(data-label); position: absolute; top: 6px; left: 14px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--info); }
.callout-tip { border-color: var(--up); background: var(--up-soft); } .callout-tip::before { color: var(--up); }
.callout-warning { border-color: var(--warn); background: var(--warn-soft); } .callout-warning::before { color: var(--warn); }
.callout-danger { border-color: var(--down); background: var(--down-soft); } .callout-danger::before { color: var(--down); }
.callout > :last-child, .internal-block > :last-child { margin-bottom: 4px; }
.internal-block { position: relative; margin: 1em 0; padding: 8px 14px 8px; border-radius: 9px; border: 2px dashed var(--internal); background: var(--internal-soft); }
.internal-label { display: flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 700; color: var(--internal); margin-bottom: 4px; }
.doc-edit .internal-block { padding-top: 26px; }
.doc-edit .internal-block::before { content: '🔒 ' attr(data-label); position: absolute; top: 6px; left: 14px; font-size: .72rem; font-weight: 700; color: var(--internal); }
.sec-h { position: relative; }
.sec-h.vis-customer::after { content: 'Kunde'; margin-left: 8px; font-size: .66rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--customer-soft); color: var(--customer); vertical-align: middle; text-transform: uppercase; letter-spacing: .04em; }
.doc-edit .sec-h.vis-internal::after { content: '🔒 Intern'; margin-left: 8px; font-size: .66rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--internal-soft); color: var(--internal); vertical-align: middle; }
.sec-tools { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: middle; }
.sec-btn { display: inline-flex; align-items: center; gap: 3px; font-size: .72rem; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 1px 8px; cursor: pointer; }
.sec-btn.has-open { color: var(--warn); border-color: var(--warn); }
.sec-btn:hover { color: var(--brand-2); border-color: var(--brand); }
.toc { float: right; margin: 0 0 12px 20px; max-width: 260px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); font-size: .88rem; }
.toc ol { margin: 6px 0 0; padding-left: 1.1em; }
.toc .toc-3 { margin-left: 12px; list-style: circle; }
@media (max-width: 700px) { .toc { float: none; margin: 0 0 12px; max-width: none; } .doc { padding: 16px; } }
.doc-foot { margin-top: 20px; }
.children ul { list-style: none; padding: 0; }
.children li { padding: 3px 0; }
mark { background: color-mix(in srgb, #e8890c 30%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* Kommentare (Zeitleiste pro Abschnitt) */
.comments { position: sticky; top: 72px; max-height: calc(100vh - 90px); overflow-y: auto; }
@media (max-width: 1100px) { .comments { position: static; max-height: none; } }
.thread { border-top: 1px solid var(--border); padding: 8px 0; }
.thread:first-of-type { border-top: 0; }
.thread > summary { cursor: pointer; display: flex; gap: 8px; align-items: center; list-style: none; font-weight: 600; }
.thread > summary::-webkit-details-marker { display: none; }
.thread > summary::before { content: '▸'; color: var(--muted); }
.thread[open] > summary::before { content: '▾'; }
.thread-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-title.lvl3 { font-weight: 500; padding-left: 10px; }
.thread-archived .thread-title { text-decoration: line-through; color: var(--muted); }
.thread.is-target { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 6px; }
.cm-replyform > summary { list-style: none; display: inline; }
.cm-replyform > summary::-webkit-details-marker { display: none; }
.cm-replyform form { margin-top: 6px; }
.cm-new textarea, .cm-replyform textarea { width: 100%; }
.cm-new-row { display: flex; gap: 6px; flex-wrap: wrap; }
.cm-new-row select { flex: 1 1 120px; }

/* Seitenverzeichnis */
.new-page { display: flex; gap: 8px; flex-wrap: wrap; }
.new-page input { min-width: 240px; padding: 8px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; }
.tree { list-style: none; margin: 0; padding: 0; }
.tree-row { display: flex; align-items: center; gap: 8px; padding: 8px 6px 8px calc(6px + var(--depth, 0) * 26px); border-bottom: 1px solid var(--border); }
.tree-row:last-child { border-bottom: 0; }
.tree-row:hover { background: var(--surface-2); }
.tree-title { font-weight: 600; }
.tree-meta { margin-left: auto; white-space: nowrap; }
.tree-move { display: none; gap: 2px; }
.tree-row:hover .tree-move, .tree-row:focus-within .tree-move { display: inline-flex; }
.tree-row.dragging { opacity: .4; }
.tree-row.drop-before { box-shadow: inset 0 3px 0 var(--brand); }
.tree-row.drop-into { background: var(--info-soft); }
.grip { cursor: grab; color: var(--muted); display: inline-flex; }
@media (max-width: 700px) { .tree-meta { display: none; } .tree-move { display: inline-flex; } }

/* Struktur */
.reg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.inline-edit { display: inline-flex; gap: 6px; align-items: center; }
.inline-edit input { padding: 5px 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); font: inherit; }
.inline-edit .btn { display: none; }
.inline-edit:focus-within .btn { display: inline-flex; }
.area-list { list-style: none; margin: 0; padding: 0; min-height: 30px; }
.area-list li { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.area-list li.dragging { opacity: .4; }
.area-move, .reg-move { display: inline-flex; gap: 2px; margin-left: auto; align-items: center; }
.area-move select { font-size: .8rem; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }

/* Editor */
.editor-head { align-items: flex-end; }
.editor-title { flex: 1; min-width: 0; }
.title-input { width: 100%; font-size: 1.6rem; font-weight: 700; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--text); padding: 2px 0; }
.title-input:focus { outline: none; border-bottom-color: var(--brand); }
.editor-card { padding: 0; overflow: visible; }
.tt-toolbar { position: sticky; top: 56px; z-index: 5; display: flex; flex-wrap: wrap; gap: 3px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface); border-radius: var(--radius) var(--radius) 0 0; }
.tt-toolbar button, .tt-toolbar select { font: inherit; font-size: .85rem; min-height: 32px; padding: 3px 9px; border: 1px solid transparent; background: transparent; color: var(--text); border-radius: 7px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.tt-toolbar select { border-color: var(--border); width: auto; flex: none; }
.tt-context select { width: auto; }
.tt-toolbar button:hover { background: var(--surface-2); border-color: var(--border); }
.tt-toolbar button.on { background: var(--info-soft); color: var(--info); border-color: var(--info); }
.tt-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.tt-context { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 6px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: .85rem; }
.tt-context > span { display: inline-flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.tt-context .chip { cursor: pointer; }
.tt-context .chip.on { background: var(--info-soft); color: var(--info); border-color: var(--info); }
.tt-context .chip[data-vis="customer"].on { background: var(--customer-soft); color: var(--customer); border-color: var(--customer); }
.tt-context .chip[data-vis="internal"].on { background: var(--internal-soft); color: var(--internal); border-color: var(--internal); }
.tt-context .chip:disabled { opacity: .45; cursor: not-allowed; }
.doc-edit { padding: 18px 28px 40px; min-height: 55vh; }
.doc-edit .ProseMirror { outline: none; min-height: 50vh; }
.doc-edit .ProseMirror p.is-editor-empty:first-child::before { content: attr(data-placeholder); color: var(--muted); float: left; height: 0; pointer-events: none; }
.doc-edit .selectedCell { background: var(--info-soft); }
.publish-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.publish-bar .grow { flex: 1 1 320px; margin: 0; }
.publish-bar .grow { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .9rem; }
.publish-bar .grow input { width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; font-weight: 400; }
.publish-bar { padding: 14px 18px; }
.publish-bar p { flex-basis: 100%; margin: 0; }
.save-state { white-space: nowrap; }

/* Versionen und Vergleich */
.inline-radio { font-size: .85rem; margin-right: 8px; }
.diff { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86rem; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.diff-line { display: flex; gap: 8px; padding: 2px 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-op { width: 12px; flex: none; color: var(--muted); }
.diff-add { background: var(--up-soft); } .diff-del { background: var(--down-soft); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--down) 50%, transparent); }
.diff-gap { padding: 2px 10px; color: var(--muted); background: var(--surface-2); }

/* Suche */
.search-row { display: flex; gap: 8px; flex-wrap: wrap; }
.search-row input[type=search] { flex: 1 1 280px; }
.result-list { list-style: none; margin: 0; padding: 0; }
.result-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.result-list li:last-child { border-bottom: 0; }
.snippet { margin: 4px 0 0; color: var(--muted); }

@media print {
  .sidebar, .appbar, .comments, .sec-tools, .actions, .toolbar { display: none !important; }
  .doc-layout { display: block; }
  .doc { box-shadow: none; border: 0; padding: 0; max-width: none; }
}

.home-cards .card, .area-cards .card { margin: 0; }

/* ---------- Phase 2: Editor-Elemente (Anzeige) ---------- */
.code-block { padding: 0 !important; overflow: hidden !important; }
.code-head { display: flex; align-items: center; gap: 8px; padding: 5px 10px; background: #111821; color: #9fb0c3; font-size: .76rem; }
.code-head > span:first-child { font-weight: 600; color: #d5dde8; margin-right: auto; }
.code-lang { text-transform: uppercase; letter-spacing: .05em; }
.code-copy { border: 0; background: transparent; color: #9fb0c3; cursor: pointer; padding: 2px 4px; border-radius: 4px; display: inline-flex; }
.code-copy:hover, .code-copy.ok { color: #fff; background: #2a3646; }
.code-block pre { margin: 0; padding: 12px 14px; overflow-x: auto; background: transparent; color: inherit; }
.code-block pre code, .doc-body pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }
.code-block.with-ln pre { display: flex; gap: 12px; } .ln-gutter { white-space: pre; text-align: right; color: #5d6b7c; user-select: none; min-width: 2ch; }
.hljs-comment, .hljs-quote { color: #7f8c9b; font-style: italic; } .hljs-keyword, .hljs-selector-tag, .hljs-built_in { color: #c792ea; }
.hljs-string, .hljs-attr-value, .hljs-regexp { color: #c3e88d; } .hljs-number, .hljs-literal { color: #f78c6c; } .hljs-title, .hljs-section, .hljs-function { color: #82aaff; }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable, .hljs-params { color: #ffcb6b; } .hljs-meta, .hljs-symbol { color: #89ddff; } .hljs-type, .hljs-class { color: #ffcb6b; }
.hljs-deletion { color: #ff5370; } .hljs-addition { color: #c3e88d; }
.doc-details { margin: 1em 0; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.doc-details > summary { cursor: pointer; padding: 8px 12px; font-weight: 600; }
.doc-details > div { padding: 0 12px 8px; }
.vault-ref { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: .8em 0; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--internal); background: var(--internal-soft); color: var(--text); font-size: .92rem; }
.vault-ref svg { color: var(--internal); }
.doc-image { margin: 1em 0; position: relative; } .doc-image img { max-width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--border); display: block; }
.doc-image.w-25 { width: 25%; } .doc-image.w-50 { width: 50%; } .doc-image.w-75 { width: 75%; } .doc-image.w-100 { width: 100%; }
.doc-image figcaption, .drawing figcaption, .caption { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.img-vis { position: absolute; top: 6px; left: 6px; background: var(--internal-soft); color: var(--internal); border-radius: 6px; padding: 2px 4px; display: inline-flex; }
.drawing { margin: 1em 0; } .drawing img { max-width: 100%; height: auto; background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 6px; }
.drawing.empty { padding: 18px; border: 1px dashed var(--border); border-radius: 9px; text-align: center; }
.file-card { display: inline-flex; align-items: center; gap: 8px; margin: .4em 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.file-ico { color: var(--muted); display: inline-flex; }
.include-box { margin: 1em 0; padding: 6px 12px 4px; border-left: 3px solid var(--brand); background: color-mix(in srgb, var(--brand) 5%, transparent); border-radius: 0 9px 9px 0; }
.include-head { display: flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--muted); margin-bottom: 2px; }
.include-box.dead { border-color: var(--down); background: var(--down-soft); color: var(--down); padding: 8px 12px; display: flex; gap: 6px; align-items: center; }
.section-form { margin: 1em 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.sf-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.sf-progress { font-size: .72rem; padding: 1px 8px; border-radius: 999px; background: var(--up-soft); color: var(--up); font-weight: 600; }
.sf-progress.open { background: var(--warn-soft); color: var(--warn); }
.sf-hints { list-style: none; padding: 0; margin: 6px 0 0; font-size: .85rem; color: var(--warn); } .sf-hints li { display: flex; gap: 5px; align-items: center; }
.kv-table { border-collapse: collapse; width: 100%; } .doc-body .kv-table td, .doc-body .kv-table th { border: 0; border-bottom: 1px solid var(--border); padding: 4px 8px; }
.doc-body .kv-table th { background: none; width: 34%; color: var(--muted); font-weight: 600; font-size: .88rem; }
.form-group-title { margin: .8em 0 .2em; font-size: .9rem; }
.port-view { display: flex; flex-wrap: wrap; gap: 3px; margin: 6px 0 10px; padding: 8px; background: #1b2430; border-radius: 8px; max-width: 100%; }
.port { --port: #5d6b7c; width: 30px; height: 26px; border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; font-size: .68rem; font-weight: 700;
  color: #fff; background: var(--port); border: 2px solid transparent; }
.port.tagged { border-color: #fff; border-style: dashed; }
.swatch { --c: #888; display: inline-block; width: 11px; height: 11px; border-radius: 3px; background: var(--c); margin-right: 6px; vertical-align: -1px; }
.live-box { margin: 1em 0; padding: 8px 12px; border: 1px dashed var(--border); border-radius: 9px; }
.live-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.live-box .table-wrap { margin: 4px 0 0; } .live-box p:last-child { margin-bottom: 0; }
/* ---------- Phase 4: Live-Daten, Geräte ---------- */
.page-kpis { margin-bottom: 16px; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.kpi { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; }
.kpi b { font-size: 1.4rem; line-height: 1.2; } .kpi span { color: var(--muted); font-size: .8rem; }
.device-card { margin: 0 0 1em; padding: 10px 12px; border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: 9px; background: var(--surface-2); }
.device-card.inactive { border-left-color: var(--warn); }
.device-card .kv-table td, .device-card .kv-table th { border: 0; border-bottom: 1px solid var(--border); padding: 3px 8px; text-align: left; }
.device-card .kv-table th { width: 34%; color: var(--muted); font-weight: 600; font-size: .85rem; }
.live-box .doc-table th { white-space: nowrap; } .live-box .doc-table td { overflow-wrap: break-word; }
.inline-select select { max-width: 100%; font-size: .85rem; padding: 2px 6px; }
.var { border-bottom: 1px dotted var(--brand); } .var-placeholder { font-family: ui-monospace, monospace; font-size: .88em; color: var(--brand-2); }
.var-missing { font-family: ui-monospace, monospace; font-size: .88em; color: var(--down); background: var(--down-soft); border-radius: 4px; padding: 0 3px; }
/* ---------- Phase 2: Editor (Bearbeiten) ---------- */
.nv { margin: 1em 0; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); user-select: none; }
.nv.ProseMirror-selectednode { outline: 2px solid var(--focus); outline-offset: 2px; }
.nv-head { display: flex; align-items: center; gap: 6px; padding: 5px 8px 5px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: 9px 9px 0 0; font-size: .8rem; }
.nv-label { font-weight: 700; margin-right: auto; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-size: .7rem; }
.nv-body { padding: 8px 12px; } .nv-body > :first-child { margin-top: 0; } .nv-body .section-form, .nv-body .include-box, .nv-body .drawing { margin: 0; }
.nv-vaultRef, .nv-live { border-color: var(--internal); }
.doc-edit details, .doc-edit [data-type="details"] { border: 1px solid var(--border); border-radius: 9px; padding: 6px 12px; margin: 1em 0; }
.doc-edit pre { background: #1b2430; color: #e6ebf2; border-radius: 9px; padding: 12px 14px; }
.tt-hint { margin-left: 4px; white-space: nowrap; }
.slash-menu { position: absolute; z-index: 60; min-width: 250px; max-height: 320px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 4px; }
.slash-item { display: flex; width: 100%; gap: 6px; align-items: baseline; text-align: left; border: 0; background: none; color: var(--text); padding: 6px 10px; border-radius: 7px; cursor: pointer; font: inherit; font-size: .9rem; }
.slash-item.on, .slash-item:hover { background: var(--surface-2); }
.modal { border: 1px solid var(--border); border-radius: 14px; padding: 0; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal::backdrop { background: rgba(15, 23, 32, .45); }
.modal > form { padding: 18px 22px; margin: 0; } .modal-title { margin: 0 0 12px; font-size: 1.15rem; }
.modal .form-actions { margin-top: 14px; display: flex; gap: 8px; }
.ed-dialog { width: min(820px, 94vw); } .ed-dialog .modal-body { max-height: 66vh; overflow-y: auto; }
.stack-field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; font-weight: 400 !important; } .stack-field > span { font-size: .82rem; font-weight: 600; color: var(--muted); }
.stack-field input:not([type="checkbox"]), .stack-field select, .stack-field textarea { width: 100%; }
.pick-list { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; margin-top: 6px; }
.pick-item { display: block; width: 100%; text-align: left; border: 1px solid transparent; background: none; color: var(--text); padding: 6px 10px; border-radius: 7px; cursor: pointer; font: inherit; font-size: .9rem; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.pick-item:hover, .pick-item:focus { background: var(--surface-2); border-color: var(--border); } .pick-item.sub { font-size: .85rem; color: var(--muted); }
.sf-group { border: 1px solid var(--border); border-radius: 9px; padding: 8px 12px; margin: 0 0 10px; } .sf-group legend { font-weight: 700; font-size: .85rem; padding: 0 4px; }
.sf-label { font-size: .82rem; font-weight: 600; color: var(--muted); margin: 6px 0 3px; }
.sf-table-edit td { padding: 2px; } .sf-table-edit input:not([type=checkbox]), .sf-table-edit select { width: 100%; min-width: 84px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; font-size: .88rem; }
.sf-bar { display: flex; gap: 6px; margin: 6px 0 10px; flex-wrap: wrap; }
.drawio-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.5); }
.drawio-overlay iframe { position: absolute; inset: 2vh 2vw; width: 96vw; height: 96vh; border: 0; border-radius: 10px; background: #fff; }
.field-row td { padding: 3px; vertical-align: top; } .field-row input, .field-row select, .field-row textarea { width: 100%; min-width: 60px; }
@media print { .code-copy, .no-print, .sec-tools { display: none !important; } .doc-details > div { display: block; } }
.vis-btn { border: 0; background: none; padding: 0; cursor: pointer; }
.check-list { list-style: none; padding: 0; margin: 4px 0 12px; display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }
.check-list li { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; } .check-list .check-block svg { color: var(--down); } .check-list li > svg { flex: none; color: var(--warn); }
.export-run { margin-top: 10px; }
.api-form { margin-bottom: 12px; }
