:root {
  /* Rückfall (Graphit), falls /shared/system.css nicht lädt (z. B. Desktop-App offline). Gesetzte Designs (data-sys-theme) haben Vorrang. */
  --sys-sidebar: #17181b; --sys-bg: #1d1f23; --sys-surface: #24262b; --sys-surface-2: #2a2d33; --sys-input: #121315; --sys-hover: #2c2f35;
  --sys-border: rgba(228, 230, 235, 0.1); --sys-border-strong: rgba(228, 230, 235, 0.2); --sys-border-soft: rgba(228, 230, 235, 0.06);
  --sys-text: #e4e6eb; --sys-muted: #9ea3ad; --sys-faint: #6b707a; --sys-accent: #8aadf4; --sys-accent-text: #121315; --sys-danger: #f28b8b; --sys-dialog: #17181b;
  --sys-success: #7ec699; --sys-warning: #e5b567; --sys-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  --sys-accent-hover: color-mix(in srgb, var(--sys-accent) 85%, var(--sys-text));
  --sys-font: "Inter", "Google Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Cantarell", "Noto Sans", Helvetica, Arial, sans-serif;
  color-scheme: dark;
}
/* Farben kommen aus dem gemeinsamen System-Design (/shared/system.css, --sys-*). Design-Wahl: Palette-Knopf oben rechts. */
:root {
  --bg: var(--sys-bg); --bg2: var(--sys-sidebar); --bg3: var(--sys-surface-2); --line: var(--sys-border); --fg: var(--sys-text); --muted: var(--sys-muted);
  --acc: var(--sys-accent); --acc2: var(--sys-accent-hover); --acc-fg: var(--sys-accent-text); --ok: var(--sys-success); --warn: var(--sys-warning); --danger: var(--sys-danger);
  --text2: color-mix(in srgb, var(--sys-text) 80%, var(--sys-bg)); --line-strong: var(--sys-border-strong);
  --stage-bg: var(--sys-input); --stage-dot: var(--sys-border);
  --overlay: color-mix(in srgb, var(--sys-dialog) 94%, transparent);
  --sel: var(--sys-success); --sel-fg: var(--sys-bg);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--sys-font); -webkit-font-smoothing: antialiased; }
button, .btn { font: inherit; color: var(--fg); background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { border-color: var(--line-strong); }
button:disabled { opacity: .45; cursor: default; }
.primary { background: var(--acc); border-color: var(--acc); color: var(--acc-fg); font-weight: 600; }
.primary:hover { background: var(--acc2); border-color: var(--acc2); }
.ghost { background: transparent; }
.small { padding: 4px 9px; font-size: 12px; }
.wide { width: 100%; justify-content: center; padding: 11px; font-size: 15px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--danger); font-size: 13px; min-height: 1em; margin-top: 6px; }
.link { color: var(--acc2); cursor: pointer; text-decoration: underline; }
.kbd { font-size: 11px; opacity: .75; font-weight: 400; border: 1px solid color-mix(in srgb, currentColor 40%, transparent); border-radius: 4px; padding: 0 4px; }
input, textarea { font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; width: 100%; }
textarea { resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--acc); }
input[type=range] { padding: 0; accent-color: var(--acc); width: auto; flex: 1; border: 0; background: none; }
input[type=checkbox] { width: auto; accent-color: var(--acc); }

/* Login */
body.login { display: grid; place-items: center; }
.login-box { width: 300px; display: grid; gap: 12px; padding: 28px; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; }
.login-box .logo { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 6px; }

/* Kopfzeile */
body { display: flex; flex-direction: column; }
.top { height: 50px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--bg2); border-bottom: 1px solid var(--line); }
.top .logo { font-weight: 700; font-size: 16px; background: none; border: 0; padding: 4px 6px; }
.proj-name { width: 260px; background: transparent; border-color: transparent; padding: 5px 8px; }
.proj-name:hover { border-color: var(--line); }
.spacer { flex: 1; }

/* Übersicht */
.home { flex: 1; overflow: auto; padding: 24px; }
.drop { border: 2px dashed var(--line); border-radius: 16px; padding: 40px; text-align: center; margin-bottom: 24px; transition: .15s; }
.drop.over { border-color: var(--acc); background: color-mix(in srgb, var(--acc) 6%, transparent); }
.drop .big { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; position: relative; }
.card:hover { border-color: var(--acc); }
.card img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; background: #000; }
.card .meta { padding: 8px 10px; }
.card .meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .del { position: absolute; top: 6px; right: 6px; padding: 2px 8px; opacity: 0; background: rgba(0,0,0,.6); color: #fff; }
.card:hover .del { opacity: 1; }
.badge { position: absolute; top: 6px; left: 6px; background: var(--acc); color: var(--acc-fg); font-size: 11px; border-radius: 10px; padding: 2px 8px; }

/* Editor */
.editor { flex: 1; min-height: 0; display: grid; grid-template-columns: 64px 1fr 340px; grid-template-rows: 1fr 112px; }
.tools { grid-row: 1 / 3; background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; overflow-y: auto; }
.tool { width: 52px; flex-direction: column; gap: 1px; padding: 6px 0; font-size: 17px; background: transparent; border-color: transparent; }
.tool span { font-size: 10px; color: var(--muted); }
.tool.active { background: var(--bg3); border-color: var(--acc); }
.tool.off { opacity: .5; }
.tools .sep { width: 36px; height: 1px; background: var(--line); margin: 4px 0; }
.size { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.size input { writing-mode: vertical-lr; direction: rtl; height: 110px; width: 20px; flex: none; }

.stage { position: relative; overflow: hidden; background: var(--stage-bg) radial-gradient(circle, var(--stage-dot) 1px, transparent 1px) 0 0 / 18px 18px; cursor: none; touch-action: none; }
.stage.panning, .stage.tool-pan { cursor: grab; }
.stage.panning:active { cursor: grabbing; }
.board { position: absolute; left: 0; top: 0; transform-origin: 0 0; box-shadow: 0 6px 40px rgba(0,0,0,.6); }
.board img, .board canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; }
#maskCv { opacity: .45; }
#maskCv.invisible { opacity: 0; }
#lassoCv { pointer-events: none; }
.split-line { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5); pointer-events: none; }
.cursor { position: absolute; pointer-events: none; border: 1.5px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.6), inset 0 0 0 1px rgba(0,0,0,.4); transform: translate(-50%, -50%); display: none; }
.stage.tool-pan .cursor, .stage.panning .cursor, .stage.previewing .cursor { display: none !important; }
.stage.previewing, .stage.tool-lasso { cursor: crosshair; }
.stage.previewing #maskCv { opacity: 0; }
.hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); background: var(--overlay); border: 1px solid var(--line); padding: 6px 12px; border-radius: 20px; font-size: 12.5px; color: var(--text2); pointer-events: none; white-space: nowrap; }
.zoom-info { position: absolute; right: 10px; bottom: 10px; font-size: 11px; color: var(--muted); background: var(--overlay); border: 1px solid var(--line); padding: 2px 7px; border-radius: 10px; }
.load-bar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(320px, calc(100% - 32px)); background: var(--overlay); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; z-index: 6; box-shadow: 0 4px 20px rgba(0,0,0,.5); font-size: 12px; color: var(--muted); text-align: center; pointer-events: none; }
.load-bar.hidden { display: none; }
.load-track { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-bottom: 6px; position: relative; }
.load-fill { height: 100%; width: 0; background: var(--acc); border-radius: 3px; transition: width .15s linear; }
.load-bar.indet .load-fill { width: 35%; position: absolute; animation: loadind 1.1s ease-in-out infinite; }
@keyframes loadind { from { left: -35%; } to { left: 100%; } }
.preview-bar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; background: var(--overlay); border: 1px solid var(--line); padding: 6px 8px 6px 14px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,.5); z-index: 5; }
.preview-bar .ghost.on { border-color: var(--acc); }

.panel { background: var(--bg2); border-left: 1px solid var(--line); grid-row: 1 / 3; grid-column: 3; display: flex; flex-direction: column; min-height: 0; }
.panel-sec { padding: 14px; border-bottom: 1px solid var(--line); }
.panel-sec.grow { flex: 1; overflow-y: auto; min-height: 0; border-bottom: 0; }
.lbl { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; display: block; margin-bottom: 6px; }
.row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.row .lbl { margin: 0; width: 74px; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 14px; background: var(--bg3); }
.chip:hover { border-color: var(--acc); }
.seg { display: flex; flex: 1; }
.seg button { flex: 1; justify-content: center; border-radius: 0; padding: 5px 0; font-size: 13px; }
.seg button:first-child { border-radius: 8px 0 0 8px; }
.seg button:last-child { border-radius: 0 8px 8px 0; }
.seg button + button { border-left: 0; }
.seg button.on { background: var(--acc); border-color: var(--acc); color: var(--acc-fg); }
.check { display: flex; gap: 8px; align-items: center; margin: 12px 0 4px; font-size: 13px; cursor: pointer; }
.ref img { height: 34px; border-radius: 6px; }
#genBtn { margin-top: 12px; }

.jobs { display: flex; flex-direction: column; gap: 12px; }
.job { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.job-head { display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; margin-bottom: 6px; }
.job-head .txt { flex: 1; color: var(--text2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; cursor: pointer; }
.job-head button { padding: 0 6px; font-size: 12px; background: transparent; border-color: transparent; color: var(--muted); }
.job-head button:hover { color: var(--fg); }
.vars { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.var { position: relative; aspect-ratio: 3/4; border-radius: 7px; overflow: hidden; background: var(--bg3); border: 2px solid transparent; cursor: pointer; display: grid; place-items: center; font-size: 12px; color: var(--muted); text-align: center; padding: 0; }
.var img { width: 100%; height: 100%; object-fit: cover; }
.var.sel { border-color: var(--acc); }
.var.accepted::after { content: "✓"; position: absolute; top: 4px; right: 4px; background: var(--ok); color: #000; border-radius: 50%; width: 18px; height: 18px; font-size: 12px; display: grid; place-items: center; font-weight: 700; }
.var.err { color: var(--danger); padding: 6px; font-size: 11px; cursor: default; }
.spin { width: 22px; height: 22px; border: 2.5px solid var(--line); border-top-color: var(--acc); border-radius: 50%; animation: sp 0.9s linear infinite; margin: 0 auto 6px; }
@keyframes sp { to { transform: rotate(360deg); } }

.versions { grid-column: 2; background: var(--bg2); border-top: 1px solid var(--line); padding: 8px 12px; display: flex; gap: 12px; align-items: center; min-width: 0; }
.versions .lbl { writing-mode: vertical-rl; transform: rotate(180deg); margin: 0; }
.vstrip { display: flex; gap: 8px; overflow-x: auto; height: 100%; align-items: center; flex: 1; }
.ver { position: relative; flex: none; height: 92px; aspect-ratio: 3/4; border-radius: 7px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: #000; padding: 0; }
.ver img { width: 100%; height: 100%; object-fit: cover; }
.ver.cur { border-color: var(--acc); }
.ver .n { position: absolute; left: 3px; bottom: 3px; font-size: 10px; background: rgba(0,0,0,.7); color: #fff; padding: 0 5px; border-radius: 6px; }
.ver .x { position: absolute; right: 2px; top: 2px; padding: 0 5px; font-size: 11px; background: rgba(0,0,0,.7); color: #fff; border: 0; opacity: 0; }
.ver:hover .x { opacity: 1; }
.varrow { color: var(--muted); flex: none; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--sys-surface-2); box-shadow: var(--sys-shadow); border: 1px solid var(--line); padding: 9px 16px; border-radius: 10px; transition: .25s; z-index: 50; pointer-events: none; }
.toast.show { transform: translateX(-50%) translateY(0); }

@media (max-width: 900px) {
  .editor { grid-template-columns: 56px 1fr; grid-template-rows: 1fr 100px auto; }
  .panel { grid-column: 1 / 3; grid-row: 3; max-height: 45vh; }
  .tools { grid-row: 1 / 3; }
  .proj-name { width: 140px; }
}

/* Layout-Korrekturen */
html, body { overflow: hidden; }
.home { min-height: 0; }
button, .btn { white-space: nowrap; }
.panel { overflow: hidden; }
.chips { max-height: 92px; overflow-y: auto; padding-right: 2px; }
.chip { white-space: normal; text-align: left; }
.panel-sec.grow { min-height: 140px; }
.chips { margin-bottom: 4px; }

/* Bildauswahl */
.src-btns { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.src-btns > * { padding: 10px 18px; font-size: 15px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 40; display: grid; place-items: center; padding: 20px; }
.modal-box { width: min(1100px, 100%); height: min(780px, 100%); background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.modal-head { display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.modal-head .tabs { flex: 0 1 460px; margin-left: auto; }
.pick-tab { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pick-bar { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pick-bar input[type=search] { flex: 1; min-width: 220px; width: auto; }
.pick-bar .check { margin: 0; white-space: nowrap; }
.crumbs { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.crumbs button { padding: 3px 7px; background: transparent; border-color: transparent; }
.crumbs button:hover { border-color: var(--line); }
.pick-body { flex: 1; overflow-y: auto; padding: 14px; }
.folders { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.folders button { font-size: 13px; padding: 5px 10px; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pimg { padding: 0; display: block; background: var(--bg3); border-radius: 9px; overflow: hidden; border: 2px solid transparent; text-align: left; white-space: normal; }
.pimg:hover { border-color: var(--acc); }
.pimg img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #000; }
.pimg .cap { font-size: 11.5px; padding: 5px 7px; color: var(--text2); line-height: 1.3; }
.pimg .cap .t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pimg .cap small { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.pc-drop { flex: 1; margin: 20px; display: grid; place-content: center; cursor: pointer; }
.pick-empty { color: var(--muted); padding: 30px; text-align: center; }
@media (max-width: 700px) { .modal { padding: 0; } .modal-box { height: 100%; border-radius: 0; } .modal-head { flex-wrap: wrap; } .modal-head .tabs { order: 3; flex-basis: 100%; } }

/* ---------- Versionsbaum ---------- */
.view-btn { font-weight: 600; }
.editor.graph-mode .tools, .editor.graph-mode .stage, .editor.graph-mode .versions { display: none; }
.graph { grid-column: 1 / 3; grid-row: 1 / 3; position: relative; overflow: hidden; touch-action: none; cursor: grab;
  background: var(--stage-bg) radial-gradient(circle, var(--stage-dot) 1px, transparent 1px) 0 0 / 22px 22px; }
.graph.panning { cursor: grabbing; }
.graph-bar { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; gap: 8px; align-items: center; padding: 8px 12px;
  background: linear-gradient(color-mix(in srgb, var(--bg2) 93%, transparent), transparent); font-size: 12.5px; cursor: default; }
.graph-bar .ghelp { flex: 1; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.gcanvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#gsvg { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
#gsvg path { fill: none; stroke: var(--line-strong); stroke-width: 2; }
#gsvg path.on { stroke: var(--acc); stroke-width: 3; }
#gsvg path.pend { stroke-dasharray: 6 5; }
.gnode { position: absolute; width: 132px; cursor: pointer; user-select: none; }
.gimg { width: 132px; height: 176px; border-radius: 10px; overflow: hidden; background: var(--bg3); border: 2px solid var(--line);
  display: grid; place-items: center; color: var(--muted); font-size: 12px; text-align: center; transition: border-color .1s, transform .1s; }
.gimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gnode:hover .gimg { border-color: var(--sys-faint); }
.gnode.onpath .gimg { border-color: color-mix(in srgb, var(--acc) 55%, transparent); }
.gnode.cur .gimg { border-color: var(--acc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 35%, transparent), 0 8px 30px rgba(0,0,0,.6); }
.gnode.star .gimg { border-color: var(--warn); }
.gnode.cur.star .gimg { border-color: var(--acc); }
.gnode.pend { cursor: default; opacity: .8; }
.gnode.pend .gimg { border-style: dashed; }
.glab { display: flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 13px; }
.glab b { font-variant-numeric: tabular-nums; }
.gstar { color: var(--warn); }
.gprompt { font-size: 11px; color: var(--muted); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gact { position: absolute; top: 5px; right: 5px; display: flex; gap: 3px; opacity: 0; transition: opacity .1s; }
.gnode:hover .gact, .gnode.cur .gact { opacity: 1; }
.gact button { padding: 1px 6px; font-size: 12px; background: rgba(0,0,0,.72); color: #fff; border-color: transparent; border-radius: 6px; }
.gact button:hover { border-color: var(--acc); }
.gcol { position: absolute; left: 50%; bottom: -26px; transform: translateX(-50%); padding: 0 8px; font-size: 12px; border-radius: 10px; min-width: 26px; justify-content: center; z-index: 2; }
.ver.kid { height: 70px; opacity: .85; }
.ver.pend { display: grid; place-items: center; background: var(--bg3); }
.ver.pend .spin { width: 16px; height: 16px; margin: 0; }
.kids-sep { margin-left: 6px; }
.var .vlab { position: absolute; left: 4px; bottom: 4px; font-size: 11px; background: rgba(0,0,0,.72); padding: 0 6px; border-radius: 6px; color: #fff; }
.plabel { max-width: 360px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }
.preview-bar .ghost.on { border-color: var(--acc); background: color-mix(in srgb, var(--acc) 15%, transparent); }

/* ---------- Übersichtlicheres Panel & Ergebnisse ---------- */
.panel-sec.form { padding: 12px 14px; }
.form-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.form-head .lbl { margin: 0; }
.base-chip { background: var(--acc); color: var(--acc-fg); font-weight: 700; font-size: 12px; padding: 1px 9px; border-radius: 10px; }
.fold { margin-top: 8px; }
.fold summary { cursor: pointer; font-size: 12.5px; color: var(--muted); user-select: none; padding: 2px 0; list-style: none; }
.fold summary::before { content: "▸ "; }
.fold[open] summary::before { content: "▾ "; }
.fold summary:hover { color: var(--fg); }
.fold .chips { max-height: 130px; }
.grid2 { display: grid; grid-template-columns: 70px 1fr; gap: 8px 10px; align-items: center; margin-top: 10px; }
.grid2 .lbl { margin: 0; }
.note { font-size: 12px; color: var(--warn); margin-top: 6px; }
.res-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.res-head .lbl { margin: 0; }
.seg.mini { flex: none; }
.seg.mini button { padding: 2px 10px; font-size: 12px; flex: none; }
.empty { font-size: 13px; }
.jobs { gap: 8px; }
.job { padding: 8px 8px 9px; border-radius: 10px; }
.job.here { border-color: color-mix(in srgb, var(--acc) 35%, transparent); background: transparent; box-shadow: inset 3px 0 0 var(--acc); }
.job-head { margin-bottom: 2px; align-items: center; }
.job-head .txt { -webkit-line-clamp: 1; font-size: 13px; font-weight: 500; }
.job-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 7px; }
.job-meta .base { color: var(--acc2); cursor: pointer; }
.job-meta .base:hover { text-decoration: underline; }
.job-meta .run { color: var(--warn); }
.job-meta .bad { color: var(--danger); }
.vars { grid-template-columns: repeat(4, 1fr); gap: 5px; }
.var { aspect-ratio: 1; border-radius: 6px; font-size: 11px; }
.var .vlab { font-size: 10.5px; left: 3px; bottom: 3px; padding: 0 5px; }
.var.wait .spin { width: 16px; height: 16px; margin-bottom: 3px; }
.var.err { color: var(--danger); font-size: 16px; cursor: pointer; padding: 0; }
.var.gone { color: var(--muted); font-size: 10px; cursor: default; }
.var:hover:not(.gone):not(.wait) { border-color: var(--sys-faint); }
.var.sel { border-color: var(--acc); }

/* Vergleich */
.cmp { grid-column: 2; grid-row: 1 / 3; z-index: 6; background: var(--stage-bg); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.cmp-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg2); }
.cmp-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 12px; padding: 14px; }
.ctile { display: flex; flex-direction: column; gap: 8px; min-height: 0; background: var(--bg2); border: 2px solid var(--line); border-radius: 12px; padding: 8px; }
.ctile.base { border-style: dashed; opacity: .92; }
.ctile.sel { border-color: var(--acc); }
.ctile.peek { border-color: var(--warn); }
.chead { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.chead .sp { flex: 1; }
.chead .key { font-size: 11px; border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; color: var(--muted); }
.cimg { flex: 1; min-height: 0; display: grid; place-items: center; border-radius: 8px; overflow: hidden; background: #000; cursor: zoom-in; }
.cimg img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; user-select: none; -webkit-user-drag: none; }
.cimg.msg { color: var(--muted); font-size: 12px; text-align: center; padding: 10px; cursor: default; background: var(--bg3); }
.ctile .pick { justify-content: center; }
.cmp-foot { padding: 6px 14px 10px; font-size: 12px; text-align: center; }
@media (max-width: 1100px) { .cmp-grid { grid-template-columns: repeat(min(var(--n, 3), 3), minmax(0, 1fr)); overflow-y: auto; } .ctile { min-height: 320px; } }

/* Speichern */
.save-box { width: min(900px, 100%); height: auto; max-height: 100%; }
.save-body { display: grid; grid-template-columns: 240px 1fr; gap: 18px; padding: 16px; overflow-y: auto; }
.save-prev img { width: 100%; border-radius: 10px; display: block; background: #000; }
.save-prev .small { font-size: 12px; margin-top: 8px; }
.save-done { margin-top: 10px; font-size: 12px; color: var(--ok); display: grid; gap: 3px; }
.save-opts { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.row.tight { margin: 0; }
.row.tight .lbl { width: 74px; }
.save-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.sc-head { display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.sc-head .muted { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-folders { max-height: 150px; overflow-y: auto; margin: 0; }
.save-folders button { font-size: 12.5px; padding: 4px 9px; }
#saveBtn { font-weight: 600; }
.exp-badge { font-size: 10px; color: var(--ok); }
@media (max-width: 700px) { .save-body { grid-template-columns: 1fr; } .save-prev img { max-height: 220px; object-fit: contain; } }
/* feste Rasterplätze, damit sich Vergleich/Baum sauber darüberlegen */
.editor > .stage { grid-column: 2; grid-row: 1; }
.editor > .versions { grid-column: 2; grid-row: 2; }
@media (max-width: 900px) { .editor > .panel { grid-column: 1 / 3; grid-row: 3; } }
.cmp-grid { grid-auto-rows: minmax(0, 1fr); }

/* ---------- Mauszeiger: bei Pinsel/Radierer/Lasso sichtbar ---------- */
.stage { cursor: crosshair; }
.stage.tool-pan, .stage.panning { cursor: grab; }
.stage.panning:active { cursor: grabbing; }
.stage.previewing { cursor: ew-resize; }

/* ---------- Icons ---------- */
.ico { width: 17px; height: 17px; flex: none; vertical-align: -3px; }
.ico.sm { width: 12px; height: 12px; vertical-align: -1px; }
.star-c { color: var(--warn); }
button .ico + *, .btn .ico + * { margin-left: 0; }
.icon-only { padding: 7px 9px; }
.tool .ico { width: 21px; height: 21px; margin-bottom: 2px; }
.tool { color: var(--text2); }
.tool.active { color: var(--fg); }
.tool.active .ico { color: var(--acc2); }
.top .logo { display: inline-flex; align-items: center; gap: 7px; }
.top .logo .ico { width: 22px; height: 22px; color: var(--acc); }
.view-btn .ico { color: var(--acc2); }
#genBtn .ico { width: 18px; height: 18px; }
.preview-bar .ico { width: 15px; height: 15px; }
.job-head button { display: inline-grid; place-items: center; padding: 3px 5px; }
.job-head .ico { width: 15px; height: 15px; }
.gact button { display: inline-grid; place-items: center; padding: 3px 5px; }
.gact .ico { width: 14px; height: 14px; }
.gact button.star-c { color: var(--warn); }
.chead .icon-only { padding: 3px 6px; }
.chead .ico { width: 15px; height: 15px; }
.crumbs .ico, .folders .ico { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }
.sc-head .ico { color: var(--acc2); align-self: center; }
.src-btns .ico { width: 19px; height: 19px; }
.card .del { display: inline-grid; place-items: center; padding: 4px 6px; }
.card .del .ico { width: 15px; height: 15px; }
.ver .n .ico, .var .vlab .ico { margin-right: 2px; }

/* ---------- Baumprojekte ---------- */
.projsw { position: relative; }
#projSwBtn { padding: 6px 8px; gap: 5px; }
#projSwBtn .ico.sm { opacity: .7; }
.menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; width: 330px; max-height: 70vh; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 12px 40px rgba(0,0,0,.6); }
.mi { width: 100%; display: flex; align-items: center; gap: 10px; background: transparent; border-color: transparent; padding: 6px 8px; text-align: left; white-space: normal; }
.mi:hover { background: var(--bg3); }
.mi.on { background: color-mix(in srgb, var(--acc) 12%, transparent); border-color: color-mix(in srgb, var(--acc) 40%, transparent); }
.mi img { width: 34px; height: 44px; object-fit: cover; border-radius: 5px; flex: none; }
.mi .mt { display: flex; flex-direction: column; min-width: 0; }
.mi .mt b { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi small { color: var(--muted); font-size: 11.5px; }
.mi .run { color: var(--warn); }
.mi.new .ico { color: var(--acc2); }
.msep { height: 1px; background: var(--line); margin: 5px 2px; }
.menu .pad { padding: 10px; }
.home-head { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 12px; }
.home-head .lbl { margin: 0; font-size: 13px; }

/* ---------- Lokale Kopie (Desktop-App) ---------- */
.local-info { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 4px 9px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.local-info .ico { width: 14px; height: 14px; }
.local-info.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.local-info.busy .ico { animation: sp 1.2s linear infinite; }
.local-info.err { color: var(--warn); }
@media (max-width: 1200px) { .lbl-t { display: none; } }
.login-box .logo { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.login-icon { width: 72px; height: 72px; }
.top .logo .app-ico { width: 24px; height: 24px; border-radius: 6px; }

/* ---------- Auswahl & Nebeneinander-Vergleich ---------- */
.editor { position: relative; }
.gpick { position: absolute; top: 6px; left: 6px; z-index: 2; width: 26px; height: 26px; padding: 0; display: grid; place-items: center; border-radius: 7px;
  background: rgba(0,0,0,.6); border: 1.5px solid rgba(255,255,255,.55); color: #fff; font-weight: 700; font-size: 13px; opacity: 0; transition: opacity .1s; }
.gpick .ico { width: 15px; height: 15px; color: rgba(255,255,255,.75); }
.gnode:hover .gpick, .gpick.on { opacity: 1; }
.gpick.on { background: var(--sel); border-color: var(--sel); }
.gnode.picked .gimg { border-color: var(--sel); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sel) 35%, transparent); }
.gnode.picked.cur .gimg { border-color: var(--acc); }
.pick-bar { position: absolute; left: 76px; right: 352px; bottom: 122px; z-index: 8; display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: var(--overlay); border: 1px solid var(--sel); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.6); }
.editor.graph-mode .pick-bar { left: 12px; bottom: 12px; }
.pick-count { font-size: 12px; color: var(--sel); white-space: nowrap; font-weight: 600; }
.pick-list { flex: 1; display: flex; gap: 6px; overflow-x: auto; min-width: 0; padding: 2px; }
.pchip { position: relative; flex: none; display: flex; align-items: center; gap: 6px; background: var(--bg3); border: 1px solid var(--line); border-radius: 9px; padding: 3px 6px 3px 3px; cursor: grab; font-size: 12px; user-select: none; }
.pchip img { width: 26px; height: 34px; object-fit: cover; border-radius: 5px; pointer-events: none; }
.pchip.over { border-color: var(--sel); }
.pchip.drag { opacity: .4; }
.pn { background: var(--sel); color: var(--sel-fg); font-weight: 700; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: inline-grid; place-items: center; padding: 0 4px; }
.pchip .px { padding: 1px 3px; background: transparent; border: 0; color: var(--muted); }
.pchip .px .ico { width: 13px; height: 13px; }
.pchip .px:hover { color: var(--fg); }
.pickview { grid-column: 1 / 3; grid-row: 1 / 3; z-index: 9; background: var(--stage-bg); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pv-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 10px; padding: 12px; }
.pvtile { display: flex; flex-direction: column; gap: 6px; min-height: 0; min-width: 0; background: var(--bg2); border: 2px solid var(--line); border-radius: 12px; padding: 7px; }
.pvtile.sel { border-color: var(--acc); }
.pvtile .chead { gap: 6px; min-width: 0; }
.pvp { flex: 1; min-width: 0; font-size: 11.5px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pvtile .mv { padding: 1px 7px; font-size: 15px; line-height: 1; }
.pvtile .rmv .ico { width: 13px; height: 13px; }
.pvimg { flex: 1; min-height: 0; position: relative; overflow: hidden; border-radius: 8px; background: #000; cursor: grab; touch-action: none; }
.pvimg:active { cursor: grabbing; }
.pvimg img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: contain; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; }
.pvtile .pick { justify-content: center; }
#pickGo .ico { width: 16px; height: 16px; }
@media (max-width: 900px) { .pick-bar { left: 8px; right: 8px; } }

/* Nebeneinander: automatische Kachelgröße, Ausschnitt */
.pv-grid { display: grid; grid-template-columns: repeat(var(--cols, 3), var(--tw, 300px)); grid-auto-rows: max-content; justify-content: center; align-content: center; gap: 10px; padding: 12px; overflow: auto; }
.pvtile { padding: 8px; gap: 6px; width: calc(var(--tw, 300px) + 16px); box-sizing: border-box; }
.pvtile .chead { height: 28px; }
.pvimg { flex: none; width: 100%; aspect-ratio: var(--ar, .75); }
.pvin { position: absolute; inset: 0; transform-origin: 0 0; }
.pvin img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: fill; transform: none !important; }
.pv-grid.selecting .pvimg { cursor: crosshair; }
.pvsel { position: absolute; border: 2px solid var(--sel); background: color-mix(in srgb, var(--sel) 18%, transparent); box-shadow: 0 0 0 9999px rgba(0,0,0,.45); pointer-events: none; }
#pvCropBtn.on { border-color: var(--sel); background: color-mix(in srgb, var(--sel) 18%, transparent); }
.pvtile .go .ico { width: 13px; height: 13px; }
/* feste Rasterplätze auch für die Werkzeugleiste (sonst rutscht sie bei offenen Overlays nach rechts) */
.editor > .tools { grid-column: 1; grid-row: 1 / 3; }
.editor > .panel { grid-column: 3; grid-row: 1 / 3; }
/* Nebeneinander: Spalten inkl. Innenabstand, Kopfzeile darf nicht breiter als die Kachel werden */
.pv-grid { grid-template-columns: repeat(var(--cols, 3), calc(var(--tw, 300px) + 16px)); }
.pvtile .chead { min-width: 0; overflow: hidden; }
.pvtile .chead b { flex: none; }
.pvtile .chead button { flex: none; }
.pv-grid.narrow .pvtile .mv, .pv-grid.narrow .pvtile .pvp { display: none; }
.pv-grid.narrow .pvtile .chead .sp-fill { flex: 1; }

/* ---------- Vergleichs-Tab (compare.html) ---------- */
body.cmp-page { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
body.cmp-page .top .logo { text-decoration: none; color: var(--fg); }
.vtabs { display: flex; gap: 4px; overflow-x: auto; min-width: 0; max-width: 55vw; padding: 2px; }
.vtab { white-space: nowrap; padding: 5px 12px; font-size: 13px; background: transparent; border-color: transparent; border-radius: 8px; }
.vtab .muted { font-size: 11px; margin-left: 4px; }
.vtab:hover { background: var(--bg3); }
.vtab.on { background: color-mix(in srgb, var(--sel) 16%, transparent); border-color: var(--sel); color: var(--fg); font-weight: 600; }
.cp-main { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; background: var(--stage-bg); }
.cp-main .pv-grid { flex: 1; min-height: 0; }
.save-state { font-size: 11.5px; min-width: 80px; text-align: right; }
.addpanel { position: absolute; top: 49px; right: 0; bottom: 0; width: 300px; z-index: 5; background: var(--bg2); border-left: 1px solid var(--line); display: flex; flex-direction: column; box-shadow: -8px 0 30px rgba(0,0,0,.5); }
.ap-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.ap-head .muted { font-size: 11.5px; }
.ap-grid { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 3px; }
.apit { display: flex; align-items: center; gap: 8px; padding: 4px 6px; background: transparent; border-color: transparent; text-align: left; font-size: 13px; }
.apit:hover { background: var(--bg3); }
.apit img { width: 30px; height: 40px; object-fit: cover; border-radius: 5px; flex: none; }
.apit .pn { visibility: hidden; }
.apit.on { background: color-mix(in srgb, var(--sel) 14%, transparent); border-color: color-mix(in srgb, var(--sel) 50%, transparent); }
.apit.on .pn { visibility: visible; }
.apit .star-c { margin-left: auto; }
.pick-empty { grid-column: 1 / -1; }

.views-menu { position: fixed; }
.vmi .vth { display: flex; gap: 2px; flex: none; }
.vmi .vth img { width: 22px; height: 30px; }

.cp-main.adding .pv-grid { margin-right: 300px; }
.cp-main.adding .cmp-foot { margin-right: 300px; }
.ap-head { flex-wrap: wrap; }
.ap-head b { width: 100%; order: -1; }
.ap-head .spacer { display: none; }
#addClose { position: absolute; right: 8px; top: 8px; }
.ap-head { position: relative; padding-right: 50px; }

/* ---------- Drei Reiter oben: Editor | Baum | Nebeneinander ---------- */
.modetabs { display: flex; gap: 2px; padding: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 11px; margin-left: 6px; }
.modetabs button { background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 14px; color: var(--muted); font-weight: 500; gap: 7px; position: relative; }
.modetabs button:hover { color: var(--fg); background: var(--bg3); }
.modetabs button.on { background: var(--acc); border-color: var(--acc); color: var(--acc-fg); font-weight: 700; box-shadow: 0 2px 12px color-mix(in srgb, var(--acc) 45%, transparent); }
.modetabs button.on .ico { color: var(--acc-fg); }
.modetabs button.on::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: -8px; height: 3px; border-radius: 2px; background: var(--acc); }
/* Reiter „Nebeneinander“ nimmt die ganze Fläche ein */
.editor.compare-mode > .tools, .editor.compare-mode > .stage, .editor.compare-mode > .versions,
.editor.compare-mode > .panel, .editor.compare-mode > .pick-bar, .editor.compare-mode > .cmp { display: none !important; }
.cmptab { grid-column: 1 / -1; grid-row: 1 / -1; min-height: 0; background: var(--stage-bg); }
.cmptab iframe { width: 100%; height: 100%; border: 0; display: block; }
@media (max-width: 1100px) { .modetabs button { padding: 6px 9px; } .modetabs button .ico + * { display: none; } }

/* eingebettet als Reiter: keine eigene App-Kopfzeile, nur die Ansichts-Reiter */
body.embed .top { height: 44px; background: var(--bg); }
body.embed .top .logo, body.embed #cpProj { display: none; }
body.embed .vtabs::before { content: "Ansichten"; align-self: center; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-right: 6px; }
body.embed .addpanel { top: 43px; }
#queueInfo, #preInfo, #localInfo { white-space: nowrap; }

/* Baum: sauber ziehen – keine Textmarkierung, keine Bild-Drags */
.graph, .graph * { -webkit-user-select: none; user-select: none; }
.graph img { -webkit-user-drag: none; pointer-events: none; }
.graph .gnode { cursor: pointer; }
.graph.panning, .graph.panning * { cursor: grabbing !important; }

/* ---------- Bildanalyse ---------- */
.ana-box { width: min(1060px, 100%); height: min(860px, 100%); }
.ana-body { display: grid; grid-template-columns: 250px 1fr; gap: 18px; padding: 16px; overflow: hidden; flex: 1; min-height: 0; }
.ana-side { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; }
.ana-side img { width: 100%; border-radius: 10px; display: block; background: #000; }
.ana-hist { display: flex; flex-direction: column; gap: 4px; }
.ana-hist .lbl { margin-bottom: 2px; }
.ana-hist button { justify-content: space-between; font-size: 12.5px; padding: 5px 9px; background: var(--bg); }
.ana-hist button.cur { border-color: var(--acc); }
.ana-hist b { font-variant-numeric: tabular-nums; }
.ana-main { overflow-y: auto; min-width: 0; display: flex; flex-direction: column; gap: 16px; padding-right: 4px; }
.ana-empty { margin: auto; text-align: center; max-width: 460px; color: var(--muted); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.ana-empty .spin { width: 34px; height: 34px; }
.ana-scores { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ana-score { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg); }
.ana-score .v { font-size: 34px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ana-score .v small { font-size: 14px; color: var(--muted); font-weight: 400; }
.ana-score .t { font-size: 12px; color: var(--muted); }
.ana-score.main { border-color: var(--acc); }
.ana-delta { font-size: 12px; font-weight: 600; margin-left: 6px; }
.ana-delta.up { color: var(--ok); } .ana-delta.down { color: var(--acc); }
.ana-fazit { font-size: 14.5px; line-height: 1.5; }
.ana-cats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ana-cat { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); display: flex; flex-direction: column; gap: 6px; }
.ana-cat .h { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.ana-cat .h b { font-variant-numeric: tabular-nums; }
.ana-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; position: relative; }
.ana-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; }
.ana-bar::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--muted); opacity: .6; }
.ana-cat .b { font-size: 12.5px; color: var(--fg); opacity: .9; }
.ana-cat .tp { font-size: 12.5px; color: var(--muted); }
.ana-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ana-two ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; display: grid; gap: 4px; }
.ana-mass { display: flex; flex-direction: column; gap: 8px; }
.ana-m { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: var(--bg); display: flex; gap: 10px; align-items: center; }
.ana-m .tx { flex: 1; min-width: 0; font-size: 13px; }
.ana-m .tx .muted { font-size: 12px; display: block; margin-top: 2px; }
.ana-chip { font-size: 11px; border-radius: 10px; padding: 1px 8px; border: 1px solid var(--line); white-space: nowrap; }
.ana-chip.hoch { border-color: var(--ok); color: var(--ok); } .ana-chip.mittel { border-color: var(--warn); color: var(--warn); }
.ana-note { font-size: 12px; color: var(--muted); }
.ana-err { color: var(--danger); font-size: 13px; }
@media (max-width: 760px) {
  .ana-body { grid-template-columns: 1fr; grid-auto-rows: max-content; align-content: start; overflow-y: auto; }
  .ana-main { overflow: visible; }
  .ana-side { overflow: visible; }
  .ana-score { padding: 10px; }
  .ana-score .v small { display: none; }
  .ana-hist { display: none; }
  .ana-side img { max-height: 220px; object-fit: contain; }
  .ana-cats, .ana-two { grid-template-columns: 1fr; }
  .ana-score .v { font-size: 26px; }
}

/* ---------- Baum kompakt: Reihen je Auftrag, eingerückte Zweige mit Farbleiste ---------- */
.gcompact { display: none; position: absolute; inset: 44px 0 0 0; overflow: auto; padding: 10px 20px 140px; --cs: 1; }
.graph.compact .gcanvas { display: none; }
.graph.compact .gcompact { display: block; }
.graph.compact { cursor: default; background-size: 0 0; }
.gcompact .gnode.cn { position: relative; left: auto; top: auto; width: calc(104px * var(--cs)); flex: none; }
.gcompact .gnode.cn .gimg { width: 100%; height: calc(139px * var(--cs)); border-radius: 9px; }
.gcompact .gnode.cn .glab { font-size: 12px; margin-top: 3px; gap: 4px; }
.gcompact .gpick { width: 22px; height: 22px; top: 5px; left: 5px; font-size: 12px; }
.gcompact .gact { top: 4px; right: 4px; gap: 2px; }
.gcompact .gact button { padding: 2px 4px; }
.gcompact .gact .ico { width: 12px; height: 12px; }
.croot { display: flex; margin: 2px 0 6px; }
.cblock { position: relative; margin: 4px 0 12px; padding: 2px 0 2px 14px; border-left: 3px solid var(--rail); border-radius: 0 0 0 10px; }
.cblock.onpath { background: linear-gradient(90deg, color-mix(in srgb, var(--rail) 9%, transparent), transparent 60%); }
.cblock .cblock { margin-left: 2px; }
.cbh.gnode { position: relative; left: auto; top: auto; width: auto; display: flex; align-items: center; gap: 8px; margin: 2px 0 6px -14px; padding: 4px 10px 4px 8px;
  border-radius: 0 9px 9px 0; background: color-mix(in srgb, var(--rail) 16%, var(--bg2)); font-size: 12.5px; cursor: pointer; }
.cbh img { width: 22px; height: 29px; object-fit: cover; border-radius: 4px; }
.cbh b { color: var(--rail); font-size: 13px; }
.cbh .muted { font-size: 11.5px; }
.cbh .ccol { margin-left: auto; padding: 1px 8px; font-size: 11px; background: transparent; border-color: color-mix(in srgb, var(--rail) 40%, transparent); color: var(--muted); }
.cbh:hover { background: color-mix(in srgb, var(--rail) 26%, var(--bg2)); }
.cgroup { margin: 4px 0 10px; }
.cgh { font-size: 11.5px; color: var(--text2); margin: 0 0 5px; max-width: 900px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cgh::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--rail); margin-right: 6px; vertical-align: 1px; }
.crow { display: flex; flex-wrap: wrap; gap: 8px; }
.kbadge { margin-left: auto; background: var(--rail); color: #fff; font-size: 10.5px; font-weight: 700; padding: 0 6px; border-radius: 8px; line-height: 16px; cursor: pointer; }
.gcompact .gnode.cn.onpath .gimg { border-color: color-mix(in srgb, var(--acc) 55%, var(--line)); }

/* ---------- Handy: Kopfzeile passt in die Breite (nur Icons) ---------- */
@media (max-width: 760px) {
  .top { gap: 4px; padding: 0 6px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .top::-webkit-scrollbar { display: none; }
  .top > button, .top > .btn, .top > .projsw > button, .modetabs button { font-size: 0; gap: 0; padding: 7px 8px; flex: none; }
  .top > button .ico, .top > .btn .ico, .modetabs button .ico, #projSwBtn .ico { width: 18px; height: 18px; }
  .top .kbd, .top .lbl-t, #projName, #queueInfo, #preInfo, #localInfo, .top .logo { display: none !important; }
  .modetabs { margin-left: 0; flex: none; }
  .modetabs button.on::after { bottom: -6px; }
  .top .spacer { flex: 1 0 4px; }
}
@media (max-width: 760px) { #dlBtn, #projSwBtn .ico.sm { display: none !important; } }
.ana-feat { display: grid; grid-template-columns: minmax(130px, 180px) 44px 1fr 110px; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); font-size: 12.5px; }
.ana-fg { grid-column: 1 / -1; padding: 6px 10px; background: var(--bg3); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ana-fr { display: contents; }
.ana-fr > div { padding: 6px 10px; border-top: 1px solid var(--line); }
.ana-fr .n { font-weight: 600; }
.ana-fr .s { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.ana-fr .vr { font-size: 11px; color: var(--muted); }
.ana-fr .vr.nein, .ana-fr .vr.medizinisch { color: var(--danger); }
.ana-fr .vr.foto, .ana-fr .vr.pflege, .ana-fr .vr.training { color: var(--ok); }
@media (max-width: 760px) {
  .ana-feat { grid-template-columns: 1fr 40px; }
  .ana-fr .w { grid-column: 1 / -1; border-top: 0; padding-top: 0; color: var(--muted); }
  .ana-fr .vr { grid-column: 1 / -1; border-top: 0; padding-top: 0; }
}

/* ---------- Baum „Kompakt“: Generationen-Reihen, Organigramm-Verbindungen ---------- */
#gsvg path.fam { stroke-width: 2.5; opacity: .75; }
#gsvg path.fam.on { opacity: 1; stroke-width: 3.5; }
#gsvg path.fam.pend { stroke-dasharray: 5 4; }
.ghd { position: absolute; height: 17px; font-size: 11.5px; line-height: 17px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding-left: 7px; border-left: 3px solid var(--fc); pointer-events: auto; cursor: default; }
.graph.glay-compact .gnode .glab { margin-top: 3px; }
.graph.glay-compact .kbadge { margin-left: auto; }
.ghd { background: var(--stage-bg); padding-right: 6px; border-radius: 0 4px 4px 0; z-index: 1; }

/* ---------- Vergleichstabelle der Analysen ---------- */
.atab-box { width: min(1500px, 100%); height: min(920px, 100%); }
.atab-box .modal-head { flex-wrap: wrap; row-gap: 8px; }
.atab-box .modal-head .check { margin: 0; font-size: 12.5px; }
.atab-body { display: grid; grid-template-columns: 270px minmax(0, 1fr); flex: 1; min-height: 0; }
.atab-side { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.atab-sh { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 12px; }
.atab-list { overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 3px; }
.atab-proj { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 6px 4px; }
.atab-item { display: flex; align-items: center; gap: 8px; padding: 5px 7px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.atab-item:hover { background: var(--sys-hover); }
.atab-item.on { border-color: var(--line); background: var(--bg2); }
.atab-item input { width: auto; margin: 0; flex: none; accent-color: var(--acc); }
.atab-item img { width: 30px; height: 40px; object-fit: cover; border-radius: 5px; flex: none; background: #000; }
.atab-item .t { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 12.5px; line-height: 1.25; }
.atab-item .t .muted { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atab-item .sc { font-variant-numeric: tabular-nums; font-size: 13px; }
.atab-main { overflow: auto; min-width: 0; padding: 0 0 12px; }
table.atab { border-collapse: separate; border-spacing: 0; font-size: 12.5px; min-width: 100%; }
.atab th, .atab td { border-bottom: 1px solid var(--line); padding: 6px 10px; text-align: center; vertical-align: top; }
.atab th.rh { position: sticky; left: 0; z-index: 2; background: var(--bg2); text-align: left; font-weight: 500; min-width: 190px; max-width: 230px; border-right: 1px solid var(--line); }
.atab thead th { position: sticky; top: 0; z-index: 3; background: var(--bg2); vertical-align: bottom; }
.atab thead th.rh { z-index: 4; }
.atab th.ch { min-width: 120px; max-width: 170px; cursor: pointer; font-weight: 400; }
.atab th.ch:hover { background: var(--sys-hover); }
.atab th.ch img { width: 64px; height: 86px; object-fit: cover; border-radius: 7px; display: block; margin: 0 auto 6px; background: #000; }
.atab th.ch .cl { display: flex; flex-direction: column; font-size: 12.5px; }
.atab th.ch .cl .muted { font-size: 11px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.atab th.ch .cp { font-size: 11px; line-height: 1.25; max-height: 2.5em; overflow: hidden; margin-top: 2px; }
.atab th.dh, .atab td.d { min-width: 56px; font-variant-numeric: tabular-nums; }
.atab td.d.up { color: var(--ok); font-weight: 700; } .atab td.d.down { color: var(--danger); font-weight: 700; }
.atab tr.sec th { position: sticky; left: 0; text-align: left; background: var(--bg3); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 7px 10px; }
.atab tr.main td b { font-size: 18px; }
.atab td b { font-variant-numeric: tabular-nums; font-size: 13.5px; }
.atab td .w { font-size: 11px; color: var(--muted); line-height: 1.3; margin-top: 2px; text-align: left; }
.atab td.tx { font-size: 12px; }
.atab td.na { color: var(--sys-faint); }
.atab td.best { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ok) 55%, transparent); border-radius: 6px; }
.atab td.worst { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--danger) 45%, transparent); border-radius: 6px; }
.atab tbody tr:hover td, .atab tbody tr:hover th.rh { background: var(--sys-hover); }
.atab .vr { display: block; font-size: 10.5px; color: var(--muted); }
.atab .vr.nein, .atab .vr.medizinisch { color: var(--danger); }
.atab .vr.foto, .atab .vr.pflege, .atab .vr.training { color: var(--ok); }
.atab-foot { padding: 10px 12px; }
@media (max-width: 760px) {
  .atab-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: 170px minmax(0, 1fr); }
  .atab-side { border-right: 0; border-bottom: 1px solid var(--line); }
  .atab th.rh { min-width: 120px; max-width: 140px; }
  .atab th.ch { min-width: 84px; max-width: 104px; }
  .atab th.ch .cp, .atab th.ch .cl .muted { display: none; }
  .atab td .w { display: none; }
  .atab-box .modal-head { gap: 8px; }
  .atab th.ch img { width: 48px; height: 64px; }
}

/* ---------- Baum „Kompakt“ in Blockbauweise: Räume mit Wänden, Gänge als Durchgänge ---------- */
#gsvg rect.room { stroke-width: 2; opacity: .95; }
#gsvg rect.room.on { stroke-width: 3; opacity: 1; }
#gsvg rect.room.root { stroke: var(--line-strong, var(--line)); fill: var(--bg2); }
#gsvg path.hall-wall { fill: none; stroke-width: 32; stroke-linejoin: miter; stroke-linecap: butt; opacity: .95; }
#gsvg path.hall-wall.on { stroke-width: 34; opacity: 1; }
#gsvg path.hall-floor { fill: none; stroke-width: 28; stroke-linejoin: miter; stroke-linecap: butt; }
.graph.glay-compact .ghd { border-left-width: 3px; }

/* ---------- Analyse v3: Messwerte, Referenz ---------- */
.ana-scores.four { grid-template-columns: repeat(4, 1fr); }
.ana-side #anaOvImg { width: 100%; border-radius: 10px; display: block; background: #000; }
.ana-side #anaOvImg.hidden, .ana-side #anaImg.hidden { display: none; }
.ana-refbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--bg); font-size: 13px; }
.ana-meas { display: grid; grid-template-columns: minmax(180px, 1.6fr) 1fr 1fr 1fr 52px; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); font-size: 12.5px; }
.ana-meas > div { padding: 6px 10px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.ana-meas > .h { border-top: 0; background: var(--bg3); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.ana-meas .n { font-weight: 600; } .ana-meas .n .muted { display: block; font-weight: 400; font-size: 11px; }
.ana-meas .g { font-weight: 700; } .ana-meas .r, .ana-meas .i { color: var(--muted); }
.ana-meas .s { font-weight: 700; text-align: right; }
.ana-fr .vr .gw { display: block; color: var(--muted); font-size: 10.5px; }
.atab td .dref { display: block; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.atab td .dref.up { color: var(--ok); } .atab td .dref.down { color: var(--danger); }
.atab th.ch.ref { background: color-mix(in srgb, var(--acc) 14%, var(--bg2)); }
.atab th.ch .mkref { margin: 0 auto 6px; font-size: 10.5px; padding: 1px 7px; opacity: .55; }
.atab th.ch:hover .mkref, .atab th.ch.ref .mkref { opacity: 1; }
.atab th.ch.ref .mkref { background: var(--acc); color: var(--acc-fg); border-color: var(--acc); }
@media (max-width: 760px) {
  .ana-scores.four { grid-template-columns: repeat(2, 1fr); }
  .ana-meas { grid-template-columns: 1fr 64px 64px 44px; }
  .ana-meas > .h:nth-child(4), .ana-meas > .i { display: none; }
  .ana-meas .n .muted { display: none; }
}

/* Blockbauweise: dicke, neutrale Mauern (Farbe nur als kleiner Akzent an Text & Abzeichen) */
#gsvg rect.room, #gsvg rect.room.root { stroke: var(--line-strong, var(--line)); stroke-width: 8; fill: var(--bg2); opacity: 1; }
#gsvg rect.room.on { stroke: var(--muted); stroke-width: 8; }
#gsvg path.hall-wall { stroke: var(--line-strong, var(--line)); stroke-width: 42; opacity: 1; }
#gsvg path.hall-wall.on { stroke: var(--muted); stroke-width: 42; }
#gsvg path.hall-floor { stroke: var(--bg2); stroke-width: 26; }
/* Analysen löschen */
.atab-item .atab-del { padding: 3px; opacity: 0; border: 0; flex: none; }
.atab-item:hover .atab-del { opacity: .7; }
.atab-item .atab-del:hover { opacity: 1; color: var(--danger); }
.atab th.ch { position: relative; }
.atab th.ch .delcol { position: absolute; top: 4px; right: 4px; padding: 3px; border: 0; opacity: 0; }
.atab th.ch:hover .delcol { opacity: .7; }
.atab th.ch .delcol:hover { opacity: 1; color: var(--danger); }
#anaDel:hover { color: var(--danger); border-color: var(--danger); }
@media (hover: none) { .atab-item .atab-del, .atab th.ch .delcol { opacity: .6; } }
