/* GMT – Oberfläche (Entwurf, KI-unterstützt erstellt) */
:root {
  --bg: #eef1f3; --panel: #ffffff; --sunk: #f6f8f9; --line: #d5dbe0; --line-strong: #b9c2c9;
  --text: #1a2630; --muted: #5d6b76; --faint: #8b979f;
  --accent: #1d5c78; --accent-bg: #e1eef4; --accent-text: #134257;
  --err: #b0261c; --err-bg: #fbeae8; --warn: #865700; --warn-bg: #fdf3dc; --ok: #2c6a38; --ok-bg: #e6f2e7;
  --k-group: #6a4c9c; --k-segment: #1d5c78; --k-composite: #8a5b12; --k-field: #5d6b76; --k-message: #2c6a38;
  --hl-kw: #6a4c9c; --hl-str: #2c6a38; --hl-com: #8b979f; --hl-fn: #1d5c78; --hl-seg: #8a5b12; --hl-var: #9b2f5a;
  --ui: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15191c; --panel: #1d2226; --sunk: #181c1f; --line: #2f363b; --line-strong: #434c53;
    --text: #e3e8eb; --muted: #9aa7b0; --faint: #6c7880;
    --accent: #7fb8d4; --accent-bg: #1f3644; --accent-text: #b9dcec;
    --err: #f08f86; --err-bg: #3a1f1d; --warn: #e8b55a; --warn-bg: #3a2e16; --ok: #8fcc98; --ok-bg: #1d3221;
    --k-group: #b9a3e0; --k-segment: #7fb8d4; --k-composite: #e0b46a; --k-field: #9aa7b0; --k-message: #8fcc98;
    --hl-kw: #c3aef0; --hl-str: #9fd6a6; --hl-com: #6c7880; --hl-fn: #8cc6e2; --hl-seg: #e8b55a; --hl-var: #f0a0c0;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; display: grid; grid-template-columns: 76px minmax(0, 1fr); background: var(--bg); color: var(--text);
       font: 14px/1.45 var(--ui); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Navigation */
.rail { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: stretch; padding: 10px 0; }
.brand { font: 600 15px var(--mono); color: var(--accent); text-align: center; padding: 4px 0 14px; letter-spacing: .04em; }
.rail a { color: var(--muted); text-decoration: none; font-size: 12px; text-align: center; padding: 10px 4px; border-left: 3px solid transparent; }
.rail a:hover { color: var(--text); background: var(--sunk); }
.rail a.active { color: var(--accent-text); border-left-color: var(--accent); background: var(--accent-bg); font-weight: 600; }
.rail-foot { margin-top: auto; font-size: 10px; color: var(--faint); text-align: center; padding: 6px; line-height: 1.3; }

main { min-width: 0; height: 100vh; overflow: auto; outline: none; }
.page { padding: 20px 28px; max-width: 1200px; }
h1 { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
h2 { font-size: 15px; font-weight: 600; margin: 0; }
.sub { color: var(--muted); margin: 0 0 18px; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 12.5px; }

/* Bedienelemente */
button, select, input[type=text], input[type=search], textarea {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 5px; }
button { padding: 5px 12px; cursor: pointer; white-space: nowrap; }
button:hover { background: var(--sunk); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--panel); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.quiet { border-color: transparent; background: transparent; color: var(--muted); padding: 3px 8px; }
button.quiet:hover { color: var(--text); background: var(--sunk); }
select, input[type=text], input[type=search] { padding: 5px 8px; }
label.field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }

/* Tabellen */
table.list { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); }
table.list th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--sunk); }
table.list td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--accent-bg); }

.badge { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 4px; background: var(--sunk); color: var(--muted); border: 1px solid var(--line); }
.badge.Entwurf { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.Freigegeben { background: var(--accent-bg); color: var(--accent-text); border-color: transparent; }
.badge.Produktiv { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.err { background: var(--err-bg); color: var(--err); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }

.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; background: var(--panel); border: 1px solid var(--line); padding: 14px; margin-bottom: 16px; }
.empty { padding: 28px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line-strong); }

/* Editor-Ansicht */
.editor-page { display: grid; grid-template-rows: auto minmax(0, 1fr) 7px var(--bottom-h, 34vh); height: 100vh; }
.ed-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.ed-head .title { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.ed-head .title strong { font-size: 15px; }
.ed-head .title span { font-size: 12px; color: var(--muted); }
.ed-head select { max-width: 230px; text-overflow: ellipsis; }
.ed-head select[aria-label="Version laden"] { max-width: 110px; }   /* Optionen enthalten Datum, Ersteller, Kommentar */
.ed-cols { display: grid; grid-template-columns: minmax(220px, 0.85fr) minmax(360px, 1.6fr) minmax(220px, 0.85fr); min-height: 0; }
.pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--panel); border-right: 1px solid var(--line); }
.pane:last-child { border-right: 0; }
.pane-head { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); min-height: 38px; }
.pane-head h2 { font-size: 12.5px; color: var(--text); margin-right: auto; }
.pane-body { flex: 1; min-height: 0; overflow: auto; }
.pane-tools { padding: 6px 10px; border-bottom: 1px solid var(--line); display: flex; gap: 6px; }
.pane-tools input { flex: 1; min-width: 0; font-size: 12.5px; }
.dirty { color: var(--warn); font-size: 12px; }

/* Code-Editor */
.code { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: 46px minmax(0, 1fr); background: var(--sunk); }
.code .gutter { overflow: hidden; border-right: 1px solid var(--line); background: var(--panel); }
.code .gutter div { font: 12.5px/20px var(--mono); color: var(--faint); text-align: right; padding-right: 8px; height: 20px; }
.code .gutter div.ERROR { color: var(--err); background: var(--err-bg); font-weight: 600; }
.code .gutter div.WARNING { color: var(--warn); background: var(--warn-bg); }
.code .gutter div.INFO { color: var(--ok); }
.code .area { position: relative; min-width: 0; overflow: hidden; }
.code pre, .code textarea { position: absolute; inset: 0; margin: 0; padding: 0 12px; border: 0; border-radius: 0;
  font: 12.5px/20px var(--mono); tab-size: 4; -moz-tab-size: 4; white-space: pre; overflow: auto; letter-spacing: 0; }
.code pre { pointer-events: none; color: var(--text); overflow: hidden; }
.code textarea { background: transparent; color: transparent; caret-color: var(--text); resize: none; outline: none; }
.code textarea::selection { background: rgba(29, 92, 120, .28); color: transparent; }
.code .line-err { background: var(--err-bg); }
.code .line-warn { background: var(--warn-bg); }
.t-kw { color: var(--hl-kw); font-weight: 600; } .t-str { color: var(--hl-str); } .t-com { color: var(--hl-com); font-style: italic; }
.t-fn { color: var(--hl-fn); } .t-seg { color: var(--hl-seg); } .t-var { color: var(--hl-var); }

/* Bäume */
.tree { font-size: 12.5px; padding: 4px 0; }
.node { display: flex; align-items: center; gap: 5px; padding: 2px 8px 2px 0; cursor: pointer; white-space: nowrap; min-height: 22px; }
.node:hover { background: var(--sunk); }
.node.sel { background: var(--accent-bg); }
.node .tw { width: 14px; flex: none; text-align: center; color: var(--faint); font-size: 10px; }
.kind { flex: none; width: 15px; height: 15px; border-radius: 3px; font: 600 9.5px/15px var(--mono); text-align: center; color: var(--panel); }
.kind.group { background: var(--k-group); } .kind.segment { background: var(--k-segment); } .kind.composite { background: var(--k-composite); }
.kind.field { background: transparent; color: var(--k-field); border: 1px solid var(--line-strong); line-height: 13px; }
.kind.message { background: var(--k-message); }
.node .nm { font-family: var(--mono); }
.node .card { color: var(--faint); font-size: 11px; }
.node .val { color: var(--muted); font-family: var(--mono); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.node .cnt { font-size: 11px; color: var(--accent-text); background: var(--accent-bg); border-radius: 3px; padding: 0 4px; }
.node.absent .nm { color: var(--faint); }
.node .used { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; }
.search-hit .path { color: var(--faint); font-size: 11px; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; }

.detail { border-top: 1px solid var(--line); padding: 10px; font-size: 12.5px; max-height: 45%; overflow: auto; background: var(--panel); }
.detail h3 { font: 600 13px var(--mono); margin: 0 0 4px; }
.detail dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0; }
.detail dt { color: var(--muted); } .detail dd { margin: 0; font-family: var(--mono); }
.codes { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.codes button { font: 11.5px var(--mono); padding: 1px 6px; }

/* Untere Leiste */
.ed-bottom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); border-top: 1px solid var(--line); min-height: 0; }
.diag-list { font: 12.5px/1.5 var(--mono); padding: 4px 0; }
.diag { display: grid; grid-template-columns: 70px 64px 1fr; gap: 6px; padding: 2px 10px; cursor: pointer; }
.diag:hover { background: var(--sunk); }
.diag .lv.ERROR { color: var(--err); font-weight: 600; } .diag .lv.WARNING { color: var(--warn); } .diag .lv.INFO { color: var(--ok); }
.output { font: 12.5px/1.55 var(--mono); padding: 8px 12px; white-space: pre; margin: 0; }
.output .warnline { color: var(--warn); } .output .errline { color: var(--err); }
details.groovy summary { cursor: pointer; padding: 6px 12px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
details.groovy pre { font: 12px/1.5 var(--mono); padding: 8px 12px; margin: 0; white-space: pre; overflow: auto; max-height: 40vh; background: var(--sunk); }

/* Funktionskatalog */
.fn { background: var(--panel); border: 1px solid var(--line); padding: 12px 14px; margin-bottom: 10px; }
.fn header { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.fn .sig { font: 600 13.5px var(--mono); }
.fn .ret { font: 12.5px var(--mono); color: var(--muted); }
.fn p { margin: 6px 0; max-width: 80ch; }
.fn .ex { font: 12.5px/1.6 var(--mono); color: var(--muted); }
.fn .ex b { color: var(--text); font-weight: 400; }
.fn ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }

.schema-grid { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(260px, 0.8fr); height: calc(100vh - 110px); border: 1px solid var(--line); background: var(--panel); }
.schema-grid > div { min-height: 0; overflow: auto; }
.schema-grid > div + div { border-left: 1px solid var(--line); }

#toast { position: fixed; right: 18px; bottom: 18px; background: var(--text); color: var(--panel); padding: 8px 14px; border-radius: 5px; font-size: 13px;
         opacity: 0; transform: translateY(6px); transition: opacity .15s, transform .15s; pointer-events: none; max-width: 420px; }
#toast.show { opacity: 1; transform: none; }
#toast.err { background: var(--err); }

@media (max-width: 1100px) {
  .ed-cols { grid-template-columns: minmax(0, 1fr); grid-auto-rows: minmax(260px, auto); overflow: auto; }
  .editor-page { height: auto; grid-template-rows: auto auto auto auto; }
  .ed-split, .collapse-btn { display: none; }
  .ed-bottom { grid-template-columns: minmax(0, 1fr); }
  .pane { border-right: 0; border-bottom: 1px solid var(--line); }
}

/* Stufe 2: Regeln, Tabs, Ausgabe */
.tabs { display: flex; gap: 2px; margin-right: auto; }
.tab { border: 0; background: transparent; color: var(--muted); padding: 5px 10px; border-radius: 4px; font-size: 12.5px; }
.tab:hover { background: var(--sunk); color: var(--text); }
.tab[aria-selected="true"] { background: var(--accent-bg); color: var(--accent-text); font-weight: 600; }
.legend { font-size: 11px; color: var(--faint); display: flex; align-items: center; gap: 3px; }
.mk { flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; line-height: 1; }
.mk.rule { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.mk.below { width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid var(--ok); }
.mk.ctx { color: var(--k-group); font-weight: 700; font-size: 13px; }
.mk.err { width: 14px; height: 14px; border-radius: 3px; background: var(--err); color: var(--panel); font-weight: 700; }
.node.drop { background: var(--accent-bg); outline: 1px dashed var(--accent); outline-offset: -1px; }
.node[draggable="true"] { cursor: grab; }
.rule-panel { padding: 12px 14px; }
.rule-form { display: flex; flex-direction: column; gap: 4px; max-width: 640px; }
.rule-form h3 { font: 600 14px var(--mono); margin: 0; }
.rule-form .doc { margin: 2px 0 4px; font-size: 12.5px; }
.rule-form .lbl { font-size: 12px; color: var(--muted); margin-top: 8px; }
.rule-form input[type=text], .rule-form input[type=search] { width: 100%; }
.code-in { width: 100%; font: 12.5px/1.6 var(--mono); padding: 6px 8px; background: var(--sunk); resize: vertical;
  white-space: pre-wrap; overflow-wrap: anywhere; overflow-y: hidden; min-height: 34px; tab-size: 4; }
.info { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 4px 0; font-size: 12.5px; }
.info dt { color: var(--muted); } .info dd { margin: 0; font-family: var(--mono); overflow-wrap: anywhere; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 5px; overflow: hidden; width: max-content; }
.seg button { border: 0; border-radius: 0; padding: 4px 12px; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.on { background: var(--accent); color: var(--panel); }
.rule-diags { margin-top: 10px; font: 12px/1.5 var(--mono); }
.rule-diags .ERROR { color: var(--err); } .rule-diags .WARNING { color: var(--warn); }
button.danger { color: var(--err); }
.hint { padding: 6px 2px; max-width: 60ch; }
.hint p { margin: 0 0 8px; }
.diag { grid-template-columns: 64px minmax(90px, 210px) 1fr; }
.diag .where { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
.out-actions { display: flex; gap: 4px; }
.seg-view div { padding: 0 4px; border-radius: 3px; }
.seg-view div[data-seg] { cursor: pointer; }
.seg-view div[data-seg]:hover { background: var(--sunk); }
.seg-view div.hit { background: var(--accent-bg); color: var(--accent-text); }
.side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); height: 100%; }
.side > pre { overflow: auto; border-right: 1px solid var(--line); }
.code-view { font-size: 12px; }
table.vars { border: 0; }
.mk.err-below { width: 7px; height: 7px; border-radius: 50%; background: var(--err); }

/* Hervorgehobene ISY-Felder im Regel-Formular */
.icode { position: relative; background: var(--sunk); border: 1px solid var(--line-strong); border-radius: 5px; }
.icode:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.icode pre, .icode textarea { margin: 0; padding: 6px 8px; border: 0; font: 12.5px/20px var(--mono); tab-size: 4; -moz-tab-size: 4;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; letter-spacing: 0; }
.icode pre { position: absolute; inset: 0; pointer-events: none; color: var(--text); overflow: hidden; }
.icode textarea { position: relative; display: block; width: 100%; background: transparent; color: transparent; caret-color: var(--text);
  resize: none; overflow: hidden; outline: none; border-radius: 5px; }
.icode textarea::placeholder { color: var(--faint); }
.icode textarea::selection { background: rgba(29, 92, 120, .28); color: transparent; }
a.btn { display: inline-block; padding: 5px 12px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--panel);
        color: var(--text); text-decoration: none; white-space: nowrap; font-size: 14px; }
a.btn:hover { background: var(--sunk); }

/* Tools */
.page-tabs { margin-top: 10px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.page-tabs a.tab { text-decoration: none; font-size: 13.5px; }
.card-box { background: var(--panel); border: 1px solid var(--line); padding: 12px 14px; margin-bottom: 12px; min-width: 0; }
.card-box h3 { font-size: 13.5px; margin: 0 0 8px; }
.script-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 12px; align-items: start; }
.code-box { padding: 0; max-height: calc(100vh - 170px); overflow: auto; position: sticky; top: 10px; }
.code-ro { margin: 0; font: 12.5px/20px var(--mono); tab-size: 4; padding: 6px 0; }
.code-ro div { white-space: pre; padding-right: 12px; }
.code-ro .ln { display: inline-block; width: 44px; padding-right: 10px; text-align: right; color: var(--faint); user-select: none; }
.code-ro .m-ERROR { background: var(--err-bg); } .code-ro .m-WARNING { background: var(--warn-bg); }
.code-ro div.flash { background: var(--accent-bg); }
.checks { display: flex; flex-direction: column; gap: 3px; max-height: 160px; overflow: auto; }
table.list.mini td { padding: 4px 8px; font-size: 12.5px; }
.ln-link { margin-right: 6px; font-family: var(--mono); font-size: 12px; }
.chip { display: inline-block; margin: 0 6px 3px 0; font-size: 12px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; text-decoration: none; color: var(--accent-text); background: var(--accent-bg); }
h2.sec { font-size: 15px; margin: 4px 0 10px; }
.form-row.flat { border: 0; padding: 0; background: transparent; margin-bottom: 8px; }
.rfc-rows { display: flex; flex-direction: column; gap: 6px; }
.rfc-row { display: grid; grid-template-columns: 170px 130px minmax(0, 1fr); gap: 8px; align-items: center; }
.rfc-preview { background: var(--sunk); border: 1px solid var(--line); border-radius: 5px; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 40px; }
.lbl { font-size: 12px; color: var(--muted); margin-top: 8px; }
.snip-grid { display: grid; grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.4fr); gap: 12px; align-items: start; }
.snip-list, .snip-pick { display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 230px); overflow: auto; }
.snip-pick { max-height: 60vh; margin-top: 8px; }
.snip-item { text-align: left; white-space: normal; padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; }
.snip-code { margin: 4px 0 0; font-size: 11.5px; color: var(--muted); white-space: pre-wrap; max-height: 60px; overflow: hidden; }
.field-wrap { display: flex; flex-direction: column; }
.field-tools { display: flex; gap: 2px; justify-content: flex-end; margin-top: 2px; }
.field-tools button { font-size: 11.5px; padding: 1px 6px; }
.prep-tools { display: flex; gap: 4px; padding: 3px 8px; border-bottom: 1px solid var(--line); background: var(--panel); }
.prep-tools button { font-size: 12px; }
.modal-back { position: fixed; inset: 0; background: rgba(10, 16, 20, .45); display: flex; align-items: flex-start; justify-content: center; padding-top: 8vh; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--line-strong); border-radius: 8px; width: min(560px, 94vw); max-height: 84vh; display: flex; flex-direction: column;
         box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.modal.wide { width: min(820px, 96vw); }
.modal-head { display: flex; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin-right: auto; font-size: 15px; }
.modal-body { padding: 14px; overflow: auto; }
.modal-body input[type=search] { width: 100%; }
@media (max-width: 1100px) { .script-grid, .snip-grid { grid-template-columns: minmax(0, 1fr); } .code-box { position: static; } }
.paste-area { width: 100%; height: 46vh; font: 12.5px/1.5 var(--mono); tab-size: 4; -moz-tab-size: 4; background: var(--sunk); padding: 8px; resize: vertical; white-space: pre; }
.paste .checks { max-height: 120px; }

/* Splashscreen (Logo bleibt auf heller Fläche, da der Schriftzug dunkel gesetzt ist) */
#splash { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
          background: #ffffff; cursor: pointer; transition: opacity .4s ease; }
#splash.hide { opacity: 0; pointer-events: none; }
html.no-splash #splash { display: none; }
.splash-card { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 28px 40px 32px; border-radius: 14px; background: #ffffff; }
.splash-card img { width: min(600px, 80vw); height: auto; display: block; }
.splash-bar { width: 180px; height: 4px; border-radius: 2px; background: #e3edf5; overflow: hidden; }
.splash-bar span { display: block; width: 40%; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #0B3D91, #00A8E8, #00C2A8);
                   animation: splash-run 1.1s ease-in-out infinite; }
@keyframes splash-run { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-color-scheme: dark) {
  #splash { background: #15191c; }
  .splash-card { box-shadow: 0 16px 50px rgba(0, 0, 0, .45); }
}
@media (prefers-reduced-motion: reduce) { .splash-bar span { animation: none; width: 100%; } #splash { transition: none; } }

/* Mehrfachauswahl als Dropdown */
.ms { position: relative; min-width: 300px; }
.ms-btn { width: 100%; min-width: 300px; display: flex; align-items: center; gap: 8px; text-align: left; padding: 5px 10px; }
.ms-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-caret { color: var(--muted); font-size: 11px; }
.ms-panel { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; min-width: 100%; width: max-content; max-width: 480px;
            background: var(--panel); border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); padding: 6px; }
.ms-panel input[type=search] { width: 100%; margin-bottom: 4px; }
.ms-list { max-height: 260px; overflow: auto; display: flex; flex-direction: column; }
.ms-opt { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.ms-opt:hover { background: var(--sunk); }
.ms-foot { display: flex; gap: 4px; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.form-row .field > span { font-size: 12px; color: var(--muted); }
.form-row > .field { display: flex; flex-direction: column; gap: 3px; }

/* Script bearbeiten */
.script-edit { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.script-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--panel); }
.script-name { font: 600 14px var(--ui); min-width: 220px; flex: 0 1 360px; }
.script-code { flex: 1; min-height: 320px; display: flex; }
.code-box.editing { padding: 0; height: calc(100vh - 170px); display: flex; flex-direction: column; overflow: hidden; }
.code-box.editing .script-code { min-height: 0; }
.scripts-panel { display: flex; flex-direction: column; padding: 0; }
.scripts-top { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.script-host { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.script-host > .script-edit { flex: 1; }
.rail-foot .ver-app { color: var(--muted); font-weight: 600; margin-bottom: 2px; }

/* App-Icon, Startseite, Profilaktionen */
.rail .brand { display: flex; justify-content: center; padding: 2px 0 12px; border-left: 0; background: transparent; }
.rail .brand img { width: 44px; height: 44px; border-radius: 10px; display: block; }
.rail .brand:hover { background: transparent; }
.welcome-hero { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.welcome-logo { background: #ffffff; border-radius: 14px; padding: 14px 22px; border: 1px solid var(--line); }
.welcome-logo img { width: min(420px, 80vw); height: auto; display: block; }
.welcome-text { flex: 1; min-width: 260px; }
.welcome-text h1 { font-size: 24px; }
.welcome-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.welcome-action { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line);
                  border-left: 3px solid var(--accent); text-decoration: none; color: var(--text); border-radius: 4px; }
.welcome-action:hover { background: var(--accent-bg); }
.welcome-cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(220px, 0.8fr); gap: 12px; }
@media (max-width: 900px) { .welcome-cols { grid-template-columns: minmax(0, 1fr); } }
td.row-actions { white-space: nowrap; text-align: right; }
td.row-actions button { font-size: 12.5px; padding: 2px 8px; }
button.danger-solid { background: var(--err); border-color: var(--err); color: var(--panel); font-weight: 600; }
button.danger-solid:disabled { opacity: .45; cursor: not-allowed; }
.badge.msg { background: var(--accent-bg); color: var(--accent-text); border-color: transparent; }

/* Integrierte Hilfe */
.rail-help { margin: 6px 8px 0; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; color: var(--muted);
             border: 0; background: transparent; padding: 8px 2px; border-radius: 6px; }
.rail-help:hover { background: var(--sunk); color: var(--text); }
.rail-help[aria-expanded="true"] { background: var(--accent-bg); color: var(--accent-text); font-weight: 600; }
.rail-help .q { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid currentColor; font: 700 13px/19px var(--ui); text-align: center; }
#help-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(900px, 94vw); z-index: 45; background: var(--panel);
              border-left: 1px solid var(--line-strong); box-shadow: -10px 0 30px rgba(0, 0, 0, .18); display: flex; flex-direction: column; }
#help-panel[hidden] { display: none; }
.help-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.help-head h2 { font-size: 16px; }
.help-head input { margin-left: auto; width: 260px; }
.help-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 210px minmax(0, 1fr); }
.help-toc { overflow: auto; border-right: 1px solid var(--line); padding: 8px 0; background: var(--sunk); }
.help-group { margin-bottom: 8px; }
.help-gt { font-size: 11px; font-weight: 600; color: var(--faint); padding: 4px 14px; }
.help-link { display: block; padding: 5px 14px; color: var(--text); text-decoration: none; font-size: 13px; border-left: 3px solid transparent; }
.help-link:hover { background: var(--panel); }
.help-link.on { border-left-color: var(--accent); background: var(--accent-bg); color: var(--accent-text); font-weight: 600; }
.help-article { overflow: auto; padding: 16px 24px 40px; font-size: 14px; line-height: 1.55; outline: none; }
.help-article h2 { font-size: 20px; margin: 0 0 10px; }
.help-article h3 { font-size: 15px; margin: 18px 0 6px; }
.help-article p, .help-article ul, .help-article ol { margin: 6px 0; max-width: 72ch; }
.help-article li { margin: 3px 0; }
.help-article code { font: 12.5px var(--mono); background: var(--sunk); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; }
.help-article pre { font: 12.5px/1.5 var(--mono); background: var(--sunk); border: 1px solid var(--line); border-radius: 5px; padding: 8px 10px; overflow: auto; white-space: pre; }
.help-article table { border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.help-article th, .help-article td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; vertical-align: top; }
.help-article th { background: var(--sunk); }
.help-article figure { margin: 10px 0 14px; }
.help-article figure img { max-width: 100%; height: auto; border: 1px solid var(--line-strong); border-radius: 4px; cursor: zoom-in; display: block; }
.help-article figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
.help-article a[data-topic] { color: var(--accent-text); }
kbd { font: 12px var(--mono); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--panel); }
@media (max-width: 700px) { .help-body { grid-template-columns: minmax(0, 1fr); } .help-toc { display: none; } }
.node .tw { cursor: pointer; border-radius: 3px; }
.node .tw:hover { background: var(--accent-bg); color: var(--accent-text); }

/* Navigation als Buttons mit Symbolen */
.rail .nav-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 2px 8px; padding: 8px 2px 7px;
                 border: 0; border-left: 0; border-radius: 9px; background: transparent; color: var(--muted);
                 font: 12px/1.2 var(--ui); text-decoration: none; text-align: center; cursor: pointer; transition: background .12s, color .12s; }
.rail .nav-btn:hover { background: var(--sunk); color: var(--text); }
.rail .nav-btn.active, .rail .nav-btn[aria-expanded="true"] { background: var(--accent-bg); color: var(--accent-text); font-weight: 600; }
.rail .nav-btn.active .nav-ico { stroke-width: 2.1; }
.rail .nav-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.nav-ico { width: 22px; height: 22px; display: block; flex: none; }
.rail .rail-help { margin-top: 8px; border-top: 0; }
.rail-help .q { display: none; }

/* Anmeldung und Benutzerverwaltung */
body.logged-out .rail, body.logged-out main { display: none; }
#login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 90; padding: 20px; }
.login-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 26px 28px;
              display: flex; flex-direction: column; gap: 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, .08); }
.login-card h1 { font-size: 18px; margin: 4px 0 0; }
.login-logo { width: 220px; max-width: 100%; align-self: center; background: #fff; border-radius: 8px; padding: 6px; }
.login-card input { width: 100%; padding: 8px 10px; font-size: 15px; }
.login-card button.primary { padding: 9px 12px; font-size: 15px; }
.login-msg { color: var(--err); font-size: 13px; min-height: 18px; }
.pw-form { display: flex; flex-direction: column; gap: 8px; }
.pw-form input[type=password], .pw-form input[type=text], .pw-form select { width: 100%; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 6px; }
.perm-group { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px 8px; margin: 0; }
.perm-group legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
.perm { display: block; font-size: 13px; padding: 2px 0; }
.rail .user-btn { margin-top: 6px; }
.rail .user-btn span { max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.readonly-badge { font-size: 12px; }

/* Verschiebbarer unterer Bereich (Befunde und Ausgabe) */
.ed-split { cursor: row-resize; background: var(--sunk); border-top: 1px solid var(--line); position: relative; touch-action: none; }
.ed-split::after { content: ""; position: absolute; left: 50%; top: 2px; width: 44px; height: 3px; margin-left: -22px; border-radius: 2px; background: var(--line-strong); }
.ed-split:hover, .ed-split:focus-visible, .resizing .ed-split { background: var(--accent-bg); }
.ed-split:hover::after, .ed-split:focus-visible::after, .resizing .ed-split::after { background: var(--accent); }
.ed-split:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.resizing { cursor: row-resize; user-select: none; }
.ed-bottom { overflow: hidden; }
.ed-bottom > .pane { min-height: 0; overflow: hidden; }
.bottom-collapsed .ed-bottom .pane-body { display: none; }
.collapse-btn { margin-left: auto; font-size: 14px; padding: 2px 8px; }

/* Vorkommen: Blätterer im Quellbaum und Tabelle */
.occ { display: inline-flex; align-items: center; gap: 1px; margin-left: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 0 2px; font-size: 11.5px; color: var(--muted); background: var(--panel); }
.occ.on { border-color: var(--accent); color: var(--accent-text); background: var(--accent-bg); }
.occ-b { border: 0; background: transparent; padding: 0 4px; font-size: 13px; line-height: 16px; color: inherit; cursor: pointer; border-radius: 6px; }
.occ-b:hover { background: var(--sunk); color: var(--text); }
.occ-t { font-size: 12px; }
.occ-l { font-family: var(--mono); padding: 0 2px; cursor: default; }
.val.note { color: var(--faint); font-style: normal; }
.occ-head { display: flex; align-items: center; gap: 10px; padding: 6px 10px; flex-wrap: wrap; }
.occ-head input { width: 220px; }
.occ-wrap { overflow: auto; }
.occ-table { font-size: 12.5px; }
.occ-table th { position: sticky; top: 0; background: var(--sunk); white-space: nowrap; font-family: var(--mono); font-size: 11.5px; }
.occ-table td { white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.occ-table tr.sel td { background: var(--accent-bg); }
.occ-v { cursor: copy; }
.occ-f.ok { color: var(--ok, #2e7d32); }
.occ-f.no { color: var(--faint); }
.pane-actions { margin-left: auto; display: flex; gap: 2px; }
.tree-btn { font-size: 12px; padding: 2px 6px; white-space: nowrap; }
table.list tr.sel td { background: var(--accent-bg); }
.rule-diags .INFO { color: var(--ok); }
.isy-view div.click { cursor: pointer; } .isy-view div.click:hover { background: var(--accent-bg); }
.isy-view div.isy-sep { border-top: 1px dashed var(--line-strong); }
.isy-info { font-size: 12px; color: var(--muted); padding: 6px 12px; border-bottom: 1px solid var(--line); }
/* Ausgabe: Reiter scrollen waagerecht, Kopieren/Herunterladen bleiben sichtbar */
.ed-bottom .pane-head > .tabs { flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.ed-bottom .pane-head > .tabs .tab { white-space: nowrap; }
.ed-bottom .out-actions { flex: none; display: flex; gap: 4px; }
.ed-bottom > .pane, .ed-bottom .pane-head { min-width: 0; }
/* Großes Fenster für Ausgabe-Reiter (Doppelklick) */
.modal.output-pop { width: min(1280px, 95vw); height: 88vh; max-height: 88vh; }
.modal.output-pop .modal-body { flex: 1; min-height: 0; display: flex; padding: 0; overflow: hidden; }
.pop-wrap { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; }
.pop-bar { display: flex; gap: 8px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pop-view { flex: 1; min-height: 0; overflow: auto; user-select: text; }
.pop-view.wrap div { white-space: pre-wrap; word-break: break-all; padding-left: 54px; text-indent: -54px; }
/* Codevorschläge */
.sug-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.sug-list button.sug { font-size: 12px; padding: 3px 8px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line-strong); }
.sug-list button.sug b { font-family: var(--mono); }
.sug-list button.sug.on { background: var(--accent-bg); border-color: var(--accent); }
.sug-list button.sug.off { opacity: .5; text-decoration: line-through; }
.sug-list .sug-mark { margin-left: 4px; color: var(--warn, #b26a00); font-weight: 600; }
.tree .qual, .qual { margin-left: 6px; font-size: 11px; color: var(--accent); white-space: nowrap; }
