:root { --amber: var(--accent); }
/* Clear hierarchy and restrained strokes, following the Schola shell. */
[hidden] { display: none !important; }
.node, .node.is-child, .node.has-children { border-radius: 3px; border: 1.5px solid #213633; box-shadow: none; padding: 12px; background: white; }
.node-label { text-align: center; font-size: 16px; line-height: 19px; overflow-wrap: anywhere; }
.node.selected { border-color: #c76842; outline: 2px solid #c7684255; }
.edge-path { pointer-events: none; }
#endpointOverlay { z-index: 6; pointer-events: none; }
.endpoint-handle { fill: #fff; stroke: #c76842; stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: all; cursor: grab; }
.group { pointer-events: none; background: transparent !important; }
.group > span, .group-resize-handle { pointer-events: auto; cursor: move; }
.group-resize-handle { cursor: nwse-resize; }
.group[data-kind="level"] { border-top: 2px dotted #65736e; }
.group[data-kind="branch"] { border: 0; }
.group.selected { outline: 1px dashed #c76842; }
button:disabled { opacity: .4; cursor: default; }
#precisionPanel h3 { font-size: 16px; }
#precisionPanel p { font-size: 14px; color: #65736e; }
#frameworkButton { margin-top: 10px; }
.app-head.topbar { display: flex; flex-wrap: wrap; }
.app-head .head-actions { margin-left: auto; }
.canvas-toolbar { flex-wrap: wrap; }
.canvas-toolbar p { flex: 1; font-size: 14px; }
.workspace { grid-template-columns: 230px minmax(0,1fr) 280px; }
@media (max-width: 1100px) { .workspace { grid-template-columns: 190px minmax(0,1fr) 250px; } .workspace .inspector { position: static; width: auto; } .canvas-panel { margin: 0; } }
.empty-state[hidden] { display: none !important; }
.canvas { background: #fafaf6; }
.canvas.is-panning { cursor: grabbing; }
.canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.node { min-height: 54px; padding: 13px 16px; }
.node-label { margin-top: 0; }
.node.connection-ready { cursor: pointer; }
.node.connection-ready::after { display: none; }
.palette-item.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px #c7684226; }
.palette-inspector h3 { margin: 14px 0 8px; font-size: 1.25rem; }
.palette-inspector p { margin: 0; color: #53635d; }
.palette-inspector section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.palette-inspector h4 { margin: 0 0 5px; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.palette-inspector .palette-info-lead { color: var(--ink); font-size: 1rem; line-height: 1.5; }
.palette-inspector .palette-drag-hint { margin-top: 20px; padding: 12px; border-radius: 9px; background: #e7ebe6; font-size: .88rem; }
.node.has-children { width: 220px; align-items: flex-start; background: #fdfdf9; }
.node.is-child { width: 184px; min-height: 34px; padding: 7px 11px; border-width: 1.5px; border-radius: 6px; background: #fff; font-size: .9rem; }
.group { border: 1.5px solid #84948d; border-radius: 4px; background: #f8f8f36b; }
.group[data-kind="level"] { border-width: 2px 0 0; border-style: solid; background: transparent; }
.group[data-kind="branch"] { border-style: dashed; background: #ffffff45; }
.group[data-kind="institution"] { border-style: solid; background: #e9ede74d; }
.group > span { margin: -15px 0 0 12px; border: 0; background: #fafaf6; font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; }
.group-resize-handle { position: absolute; right: -1px; bottom: -1px; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 0; background: linear-gradient(135deg, transparent 45%, #65736e 46% 57%, transparent 58% 66%, #65736e 67% 78%, transparent 79%); cursor: nwse-resize; pointer-events: auto; }
.alignment-guide { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; opacity: .8; }
.edge-label { fill: #78837f; pointer-events: auto; cursor: ew-resize; }
.edge-label-control .edge-label-bg { fill: #dfe4df; opacity: 0; pointer-events: none; transition: opacity .14s ease; }
.edge-label-control.has-source .edge-label { fill: var(--ink); }
.edge-label-control.has-source .edge-label-bg { pointer-events: all; cursor: pointer; }
.edge-label-control.has-source:hover .edge-label-bg, .edge-label-control.has-source:focus-within .edge-label-bg { opacity: .92; }
.edge-label-control.has-source:hover .edge-label { cursor: pointer; }
.layout-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin: 18px 0 4px; padding: 12px 0 0; border: 0; border-top: 1px solid var(--line); }
.layout-tools legend { grid-column: 1 / -1; padding: 0 0 7px; font-size: .78rem; font-weight: 720; text-transform: uppercase; letter-spacing: .08em; }
.layout-tools button { padding: .45rem .25rem; font-size: .78rem; }
.diagram-title { position: absolute; z-index: 5; top: 22px; left: 50%; margin: 0; transform: translateX(-50%); font: 700 1.6rem/1.2 SourceSans, Arial, sans-serif; pointer-events: none; }
.export-dialog { max-width: 600px; }
.export-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 18px; }
.export-options label { display: grid; gap: 5px; font-size: .8rem; font-weight: 720; }
.export-formats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.export-validation { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: #edf1ec; color: #53635d; font-size: .88rem; }
.export-validation.has-warnings { background: #fff2d9; color: #725019; }
@media(max-width:600px){.export-options{grid-template-columns:1fr}}
.canvas-viewport { position: absolute; inset: 0 auto auto 0; transform-origin: 0 0; background-color: #fafaf6; background-image: radial-gradient(#9daaa3 1px, transparent 1px); background-size: 24px 24px; will-change: transform; backface-visibility: hidden; }
.canvas-viewport > svg, .canvas-viewport > #groupLayer, .canvas-viewport > #nodeLayer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.canvas-viewport > svg { pointer-events: none; }
.canvas-viewport > #groupLayer, .canvas-viewport > #nodeLayer { pointer-events: none; }
.zoom-control { display: flex !important; align-items: center; gap: 0 !important; margin-left: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.zoom-control button { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--ink); font-size: 1.15rem; }
.zoom-control output { min-width: 58px; padding: 0 6px; color: #65736e; font-size: .78rem; font-weight: 700; text-align: center; }
.canvas-toolbar > p + .zoom-control { margin-left: auto; }
.canvas-tool-button { display: inline-grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.canvas-tool-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.canvas-action-menu { position: relative; flex: 0 0 auto; }
.canvas-action-menu summary { list-style: none; font-size: 1.45rem; line-height: 1; user-select: none; cursor: pointer; }
.canvas-action-menu summary::-webkit-details-marker { display: none; }
.canvas-action-menu[open] summary { background: var(--ink); color: #fff; border-color: var(--ink); }
.canvas-action-popover { position: absolute; z-index: 30; top: calc(100% + 7px); right: 0; display: grid; min-width: 154px; padding: 6px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); box-shadow: var(--shadow); }
.canvas-action-popover button { width: 100%; padding: .55rem .7rem; border: 0; border-radius: 6px; background: transparent; color: var(--ink); text-align: left; }
.canvas-action-popover button:hover, .canvas-action-popover button:focus-visible { background: #e7ebe6; filter: none; }
.generator-dialog { max-width: 760px; }
.generator-dialog form > p { margin: .45rem 0 1.2rem; color: #596963; }
.generator-dialog label { display: grid; gap: 6px; margin: 14px 0; font-size: .82rem; font-weight: 720; }
.generator-dialog input, .generator-dialog textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: .65rem; background: #fff; }
.generator-dialog textarea { min-height: 260px; resize: vertical; font: .82rem/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; }
.generated-prompt { margin-top: 18px; padding-top: 4px; border-top: 1px solid var(--line); }
.prompt-copy-row { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.prompt-copy-row span { margin-right: auto; color: #53635d; font-size: .82rem; }
.import-choice-dialog { max-width: 600px; }
.import-choice-dialog form > p, .json-import-dialog form > p:not(.import-error) { color: #596963; }
.import-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.import-choice-grid button { display: grid; align-content: start; gap: 5px; min-height: 116px; padding: 16px; background: #fff; color: var(--ink); border-color: var(--line); text-align: left; }
.import-choice-grid button:hover, .import-choice-grid button:focus-visible { border-color: var(--accent); background: #fbf5f1; filter: none; }
.import-choice-grid strong { font-size: 1rem; }
.import-choice-grid span { color: #64726d; font-size: .84rem; font-weight: 400; }
.json-import-dialog { max-width: 760px; }
.json-import-dialog label { display: block; margin: 16px 0 6px; font-size: .82rem; font-weight: 720; }
.json-import-dialog textarea { width: 100%; min-height: 330px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; background: #172421; color: #edf3ef; tab-size: 2; font: .82rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.import-error { margin: 10px 0 0; padding: 9px 11px; border-left: 3px solid var(--accent); background: #fff1eb; color: #8f351f; font-size: .86rem; }
@media (max-width: 560px) { .import-choice-grid { grid-template-columns: 1fr; } }

.app-head.topbar {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  min-height: 64px;
  padding: 5px 18px;
  z-index: 20;
}
.brand-plate, .brand-mark { display: flex; align-items: center; }
.brand-plate { gap: 12px; min-width: 0; }
.brand-mark { gap: 10px; }
.brand-home-link { display: inline-flex; align-items: center; border-radius: 8px; }
.brand-home-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.brand-bird { display: block; width: 46px; height: 46px; object-fit: contain; }
.brand-name { font: 700 clamp(1.15rem, 2vw, 1.55rem)/1 Arial, Helvetica, sans-serif; letter-spacing: -.025em; }
.app-head .mode-switch { margin: 0 0 0 auto; }
.app-head .head-actions { justify-content: flex-end; }
.menu-overlay { position: fixed; inset: 0; background: #17242155; z-index: 40; }
.side-menu { position: fixed; inset: 0 auto 0 0; z-index: 50; transform: translateX(-105%); transition: transform .2s ease; }
.side-menu.is-open { transform: translateX(0); }
.project-choice-list { display: grid; gap: 7px; }
.project-choice { display: block; padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none; background: #f2f4f3; }

@media (max-width: 1000px) { .inspector { top: 64px; } }
@media (max-width: 760px) {
  .app-head.topbar { display: flex; }
  .app-head .mode-switch { margin-left: auto; }
}

/* Final diagram rules override legacy card and mobile editor styling. */
.node, .node.is-child, .node.has-children { border-radius: 3px; border: 1.5px solid #213633; box-shadow: none; padding: 12px; background: white; }
.node .node-label { text-align: center; font-size: 16px; line-height: 19px; margin: 0; }
.node.selected { border-color: #c76842; outline: 2px solid #c7684255; }
.group { pointer-events: none; background: transparent; }
.group[data-kind="branch"] { border: 0; }
.group[data-kind="level"] { border-top: 2px dotted #65736e; }
.group > span { font-size: 16px; letter-spacing: 0; text-transform: none; }
.group > span, .group-resize-handle { pointer-events: auto; }
.edge-path { pointer-events: none; }
.app-head.topbar { display: flex; flex-wrap: wrap; }
.app-head .head-actions { margin-left: auto; }
.workspace { grid-template-columns: 230px minmax(0,1fr) 280px; }
@media (max-width: 1100px) { .workspace { grid-template-columns: 190px minmax(0,1fr) 250px; } .workspace .inspector { position: static; width: auto; } .canvas-panel { margin: 0; } }
@media (max-width: 760px) { .workspace { display: flex; flex-direction: column; overflow: auto; } .canvas-panel { min-height: 60vh; } }
.node[data-type="constitution"] { border-width: 2px; }
/* Fixed-distance attachment grid and orthogonal wire editing. */
.port-markers { opacity: 0; pointer-events: none; }
.port-markers.active { opacity: 1; }
.port-marker { fill: #fff; stroke: #83938b; stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: all; cursor: pointer; }
.port-marker.is-hot, .port-marker:hover { fill: #c76842; stroke: #fff; stroke-width: 2; }
.segment-handle { stroke: transparent; stroke-width: 12; vector-effect: non-scaling-stroke; pointer-events: stroke; }
.segment-handle:hover { stroke: #d65d3240; }
.corner-handle { fill: white; stroke: #c76842; stroke-width: 1.5; vector-effect: non-scaling-stroke; pointer-events: all; cursor: move; }
.corner-handle.protected { fill: #f3e7df; cursor: ns-resize; }
.corner-handle:hover, .snap-preview { fill: #c76842; stroke: white; stroke-width: 2; vector-effect: non-scaling-stroke; }
.edge-source-mark {
  font-size: 12px;
  font-weight: 700;
  fill: var(--ink);
  paint-order: stroke;
  stroke: #fafaf6;
  stroke-width: 7px;
  stroke-linejoin: round;
  pointer-events: auto;
  cursor: pointer;
  transition: fill .14s ease, stroke-width .14s ease;
}
.edge-source-mark:hover { fill: var(--accent); stroke-width: 10px; }
.source-info-dialog { max-width: 560px; }
.source-info-dialog h2 { margin-top: .45rem; font-size: 1.45rem; line-height: 1.2; }
.source-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: .35rem 0 14px; }
.source-dialog-heading h2 { margin: 0; }
.source-navigation { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.source-navigation button { width: 34px; height: 34px; padding: 0; border-radius: 50%; }
.source-navigation output { min-width: 46px; color: #65736e; font-size: .78rem; font-weight: 700; text-align: center; }
.source-navigation button:disabled { opacity: .3; cursor: default; }
.source-citation, .source-note, .source-link { margin-top: 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: #f8f8f3; }
.source-citation span, .source-note span, .source-link span { display: block; margin-bottom: 5px; color: #65736e; font-size: .72rem; font-weight: 760; letter-spacing: .09em; text-transform: uppercase; }
.source-citation strong { color: var(--accent); font-size: 1.12rem; }
.source-note p { margin: 0; white-space: pre-wrap; }
.source-link a { color: var(--blue); font-weight: 720; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.edge-path.edge-invalid { stroke: var(--accent); opacity: .28; stroke-dasharray: 6 5; }
.snap-preview { pointer-events: none; }
.node { display: flex; align-items: center; justify-content: center; }
.node .node-label { display: block; width: 100%; }
.node-heading, .node-title-copy { display: grid; align-content: center; width: 100%; text-align: center; }
.node-term { display: block; margin-top: 3px; font-size: 13px; font-weight: 400; line-height: 17px; text-align: center; }
.node.is-collection { display: flex; align-items: center; padding: 8px 10px 8px 14px; }
.node-collection-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px; width: 100%; }
.collection-toggle { display: inline-grid; place-items: center; min-width: 34px; height: 30px; padding: 0 8px; border: 1px solid #cbd2cb; border-radius: 999px; background: #f5f6f2; color: #42534e; font-size: 12px; font-weight: 780; line-height: 1; cursor: pointer; }
.collection-toggle:hover, .collection-toggle:focus-visible, .collection-toggle[aria-expanded="true"] { border-color: #8f9d95; background: #e9ede7; outline: 0; }
.node.is-collection:has(.node-source-mark) .node-collection-heading { padding-left: 26px; }
.node.is-collection .node-source-mark { right: auto; left: 5px; top: 50%; transform: translateY(-50%); }
.collection-menu { position: absolute; z-index: 40; display: flex; flex-direction: column; overflow: hidden; border: 1px solid #aeb9b2; border-radius: 9px; background: #fffffc; box-shadow: 0 12px 32px #21363335; color: var(--ink); pointer-events: auto; }
.collection-menu[hidden] { display: none; }
.collection-menu header { display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto; min-height: 38px; padding: 8px 12px; border-bottom: 1px solid #d9ded8; background: #f4f5f1; color: #60706a; font-size: 11px; font-weight: 760; letter-spacing: .07em; text-transform: uppercase; }
.collection-menu header strong { min-width: 24px; padding: 1px 6px; border-radius: 999px; background: #dfe5df; color: var(--ink); text-align: center; }
.collection-menu ul { min-height: 0; margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; list-style: none; }
.collection-menu li { padding: 10px 13px; border-bottom: 1px solid #e5e8e3; font-size: 14px; line-height: 1.3; text-align: left; hyphens: auto; overflow-wrap: break-word; }
.collection-menu li > span, .collection-menu li > small { display: block; }
.collection-menu li > small { margin-top: 2px; color: #65736e; font-size: 12px; font-weight: 400; }
.collection-menu li:last-child { border-bottom: 0; }
.collection-menu li:nth-child(even) { background: #fafbf8; }
.node-label { hyphens: auto; overflow-wrap: normal; word-break: normal; }
.node.has-children { align-items: flex-start; }
.node.has-children > .node-heading { display: grid; align-content: center; height: calc(var(--node-header-height, 54px) - 24px); }
.node, .node.connection-ready { cursor: move; }
.node.has-children { background: transparent; }
.node.has-children { pointer-events: none; }
.node.has-children > .node-heading, .node.has-children > .node-collection-heading { pointer-events: auto; cursor: move; }
.field-hint { margin: -7px 0 13px; color: #65736e; font-size: .78rem; line-height: 1.35; }
.collection-editor-field { display: grid; gap: 7px; margin: 13px 0; font-size: .8rem; font-weight: 720; }
.collection-editor-field .field-hint { margin: 0; font-weight: 400; }
.collection-list-dialog { width: min(760px, calc(100% - 32px)); max-width: 760px; }
.collection-list-dialog form { display: flex; flex-direction: column; max-height: min(760px, calc(100dvh - 32px)); }
.collection-list-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin: .35rem 0 16px; }
.collection-list-heading h2 { margin: 0; }
.collection-list-heading p { margin: 4px 0 0; color: #65736e; font-size: .82rem; }
.collection-list-heading > button { flex: 0 0 auto; white-space: nowrap; }
.collection-editor-list { display: grid; gap: 8px; min-height: 0; padding: 2px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.collection-editor-row { display: grid; grid-template-columns: 28px minmax(180px, 1fr) minmax(120px, .42fr) auto; align-items: end; gap: 9px; padding: 10px; border: 1px solid #d9ded8; border-radius: 10px; background: #fafbf8; }
.collection-row-number { align-self: center; color: #77837e; font-size: .72rem; font-weight: 760; text-align: center; }
.collection-editor-row label { display: grid; gap: 4px; margin: 0; color: #53615c; font-size: .7rem; font-weight: 720; }
.collection-editor-row label small { color: #7b8782; font-size: inherit; font-weight: 400; }
.collection-editor-row input { min-width: 0; }
.collection-row-actions { display: flex; align-items: center; gap: 4px; padding-bottom: 1px; }
.collection-row-actions button { width: 34px; height: 34px; padding: 0; border-radius: 8px; }
.collection-row-actions button:disabled { opacity: .28; cursor: default; }
.collection-row-actions .collection-row-delete { color: #9d3e27; font-size: 1.15rem; }
.collection-editor-empty { margin: 2px 0; padding: 28px 18px; border: 1px dashed #bdc5bd; border-radius: 10px; color: #65736e; text-align: center; }
@media (max-width: 650px) {
  .collection-list-heading { align-items: stretch; flex-direction: column; }
  .collection-list-heading > button { align-self: flex-start; }
  .collection-editor-row { grid-template-columns: 24px minmax(0, 1fr) auto; }
  .collection-short-field { grid-column: 2 / 3; }
  .collection-row-actions { grid-column: 3; grid-row: 1 / span 2; flex-direction: column; align-self: center; }
}
.node.is-collection-group > .node-collection-heading { display: grid; align-content: center; grid-template-columns: minmax(0,1fr) auto; height: calc(var(--node-header-height, 72px) - 18px); margin: 9px; padding: 0 8px; background: white; pointer-events: auto; cursor: move; }
.node.is-collection-group > .node-collection-heading .node-label { margin: 0; }
.collection-group-toggle:disabled { opacity: .55; cursor: default; }
.collection-group-empty { position: absolute; right: 12px; bottom: 12px; left: 12px; display: grid; place-items: center; height: 72px; border: 2px solid #aeb9b2; border-radius: 3px; background: #fff; color: #7b8782; font-size: 13px; font-weight: 600; pointer-events: none; }
.collection-menu li[role="button"] { cursor: pointer; }
.collection-menu li[role="button"]:hover, .collection-menu li[role="button"]:focus-visible { background: #e9ede7; outline: 0; }
.canvas-dimensions { position: absolute; z-index: 20; top: 14px; left: 14px; display: grid; gap: 13px; max-width: min(300px, calc(100% - 28px)); pointer-events: auto; }
.level-filters { display: grid; gap: 6px; }
.relation-layer-filter { position: absolute; z-index: 20; top: 14px; right: 14px; display: grid; gap: 4px; min-width: 210px; padding: 8px 10px; border: 1px solid #cbd2cb; border-radius: 8px; background: #fafaf6eF; box-shadow: 0 3px 12px #21363312; color: #65736e; font-size: .68rem; font-weight: 760; letter-spacing: .08em; text-transform: uppercase; pointer-events: auto; }
.relation-layer-filter select { width: 100%; border: 0; border-top: 1px solid #d8ddd7; padding: 5px 20px 1px 0; background: transparent; color: var(--ink); font-size: .82rem; font-weight: 700; letter-spacing: 0; text-transform: none; }
#customRelationInspectorField[hidden] { display: none; }
.level-filter { position: relative; display: flex; align-items: center; gap: 8px; width: fit-content; max-width: 100%; padding: 5px 9px; border: 1px solid #bdc5bd; border-radius: 5px; background: #fafaf6ee; box-shadow: 0 2px 8px #21363312; font-size: 13px; font-weight: 650; }
.level-filter input { margin: 0; accent-color: #c76842; }
.level-name { overflow: hidden; min-width: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; font-size: inherit; font-weight: inherit; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: grab; }
.level-name:active { cursor: grabbing; }
.level-filter.is-dragging { opacity: .45; }
.level-filter.drop-before::before, .level-filter.drop-after::after { position: absolute; right: 0; left: 0; height: 2px; border-radius: 2px; background: var(--accent); content: ''; }
.level-filter.drop-before::before { top: -5px; }
.level-filter.drop-after::after { bottom: -5px; }
.level-filter.selected { border-color: #c76842; }
.branch-filters { display: grid; gap: 5px; }
.dimension-caption { color: #65736e; font-size: 10px; font-weight: 780; letter-spacing: .1em; text-transform: uppercase; }
.branch-filter { display: grid; grid-template-columns: 16px minmax(0,1fr); align-items: center; gap: 7px; width: fit-content; max-width: 100%; padding: 5px 9px; border: 1px solid #bdc5bd; border-radius: 5px; background: #fafaf6ee; box-shadow: 0 2px 8px #21363312; font-size: 13px; font-weight: 650; cursor: pointer; }
.branch-filter input { width: 14px; height: 14px; margin: 0; accent-color: var(--branch-color); }
.branch-filter.selected { border-color: #c76842; }
.branch-filter span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node.has-branch { border-color: var(--branch-color); background: color-mix(in srgb, var(--branch-color) 10%, white); }
.node.has-branch[data-branch="legislative"] { background: color-mix(in srgb, var(--branch-color) 18%, white); }
.node.has-branch[data-branch="executive"] { background: color-mix(in srgb, var(--branch-color) 8%, white); }
.node.has-branch[data-branch="judiciary"] { background: color-mix(in srgb, var(--branch-color) 16%, white); }
.node.has-children.has-branch { background: transparent; }
.node.has-children.has-branch > .node-heading, .node.has-children.has-branch > .node-collection-heading { background: color-mix(in srgb, var(--branch-color) 10%, white); }
.node.branch-inactive { border-color: #213633; background: white; }
.node.has-children.branch-inactive { background: transparent; }
.node.has-children.branch-inactive > .node-heading, .node.has-children.branch-inactive > .node-collection-heading { background: white; }
.branch-color-field { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 10px; }
.branch-color-field input[type="color"] { width: 52px; height: 38px; padding: 3px; cursor: pointer; }
.branch-color-field output { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }
.node, .node.is-child, .node.has-children, .node[data-type="constitution"] { border-width: 3px; }
.edge-path { stroke-width: 3px; }
.node.level-muted { opacity: .32; filter: grayscale(1); pointer-events: none; }
.edge-hit.level-muted, .edge-label-control.level-muted { pointer-events: none; }
.edge-path.level-muted, .edge-label-control.level-muted { opacity: .25; }
.canvas-toolbar > div:has(#modelTitle) { flex: 1 1 240px; min-width: 100px; }
.canvas-toolbar #modelTitle { width: 100%; max-width: none; }
.workspace { --left-panel-width: 230px; --right-panel-width: 280px; grid-template-columns: var(--left-panel-width) minmax(0,1fr) var(--right-panel-width); transition: grid-template-columns .22s ease; }
.workspace > .panel { min-width: 0; transition: transform .22s ease, opacity .22s ease, padding .22s ease; }
.workspace.hide-left-panel { --left-panel-width: 0px; }
.workspace.hide-right-panel { --right-panel-width: 0px; }
.workspace.hide-left-panel > .palette { transform: translateX(-100%); }
.workspace.hide-right-panel > .inspector { transform: translateX(100%); }
.workspace.hide-left-panel > .palette, .workspace.hide-right-panel > .inspector { padding-left: 0; padding-right: 0; border: 0; opacity: 0; overflow: hidden; pointer-events: none; }
.panel-toggle,
.panel-toggle.quiet { flex: 0 0 32px; width: 32px; height: 36px; padding: 0; border-color: var(--ink); background: var(--ink); color: #fff; font-size: 25px; line-height: 1; }
.panel-toggle:hover,
.panel-toggle:focus-visible { border-color: var(--ink); background: var(--ink); color: #fff; filter: brightness(1.12); }
#toggleInspector { margin-left: auto; }
@media (max-width: 1100px) { .workspace { --left-panel-width: 190px; --right-panel-width: 250px; } }
@media (max-width: 760px) { .workspace.hide-left-panel > .palette, .workspace.hide-right-panel > .inspector { max-height: 0; padding: 0; } }
@media (prefers-reduced-motion: reduce) { .workspace, .workspace > .panel { transition: none; } }

/* Kopfzeile nach der ruhigen Typografie und Maßordnung der DNA-App. */
.app-head.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 14px;
  min-height: 90px;
  padding: 18px clamp(14px, 3vw, 38px);
  border-bottom: 0;
  background: transparent;
  font-family: Arial, Helvetica, sans-serif;
}
.app-head .brand-plate { display: flex; align-items: center; gap: 14px; min-width: 0; }
.app-head .brand-home-link, .app-head .brand-bird { display: block; width: 44px; height: 44px; }
.app-head .brand-bird { object-fit: contain; filter: brightness(0) saturate(100%) invert(20%) sepia(18%) saturate(673%) hue-rotate(122deg) brightness(92%) contrast(90%); }
.app-head .app-title { min-width: 0; }
.app-head .app-title h1 { margin: 0; font-size: 1.25rem; line-height: 1.1; }
.app-head .app-title .eyebrow { margin-bottom: 3px; color: #78817c; font-size: .66rem; font-weight: 700; letter-spacing: .12em; }
.app-head .header-icon-button { flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border-color: rgba(33,54,51,.14); border-radius: 11px; background: rgba(250,250,245,.86); color: var(--ink); }
.app-head .mode-picker { display: flex; align-items: center; margin-left: auto; }
.app-head .mode-switch { display: flex; margin: 0; padding: 3px; border: 1px solid rgba(33,54,51,.14); border-radius: 11px; background: rgba(250,250,245,.86); }
.app-head .mode-switch button { min-height: 36px; padding: 7px 12px; border: 0; border-radius: 8px; font-size: .78rem; font-weight: 700; }
.app-head #saveState { display: none; }
@media (max-width: 620px) {
  .app-head.topbar { min-height: 82px; padding: 14px 12px; gap: 10px; }
  .app-head .brand-plate { gap: 9px; }
  .app-head .app-title .eyebrow { display: none; }
  .app-head .app-title h1 { font-size: 1.05rem; }
  .app-head .mode-switch button { padding-inline: 9px; }
}
#connectionHint { display: none; }
.node-source-mark {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: .9rem;
  font-weight: 800;
  line-height: 1;
  opacity: .68;
  pointer-events: auto;
  cursor: pointer;
}
.node-source-mark:hover,
.node-source-mark:focus-visible {
  background: #f3e7df;
  color: var(--accent);
  opacity: 1;
}
