.erm-node.node { border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.erm-node .node-header { position: relative; height: 100%; padding: 0 18px; border: 0; border-radius: 0; background: transparent; }
.erm-node .erm-shape { position: absolute; inset: 0; width: 100%; height: 100%; fill: var(--class-light); stroke: var(--class-dark); stroke-width: 1.5; pointer-events: none; }
.erm-node.selected .erm-shape { stroke: var(--accent); stroke-width: 3; }
.erm-node.selected { box-shadow: none; outline: none; }
.erm-node .node-name { position: relative; font-size: 17px; font-weight: 500; max-width: none; flex: 0 0 auto; overflow: visible; text-overflow: clip; }
.erm-relationship .node-header { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.erm-attribute .node-header { clip-path: ellipse(50% 50% at 50% 50%); }
.erm-primary .node-name, .erm-key-name { text-decoration: underline; text-underline-offset: 3px; }
.erm-edge { pointer-events: stroke; cursor: pointer; outline: none; }
.erm-edge path { stroke-width: 2; }
.erm-edge:hover path, .erm-edge:focus path { stroke: var(--accent); stroke-width: 4; }
.erm-edge text { pointer-events: all; }
:root[data-theme="dark"] .erm-edge text { stroke: var(--surface); }
.erm-entry { display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 6px; margin: 3px 0; }
.erm-entry.selected { background: var(--accent-soft); }
.erm-entry-name { min-width: 0; flex: 1; display: flex; gap: 10px; align-items: center; padding: 6px; text-align: left; font-size: 13px; color: var(--ink); }
.erm-entry-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.erm-symbol { flex: 0 0 18px; width: 18px; height: 12px; border: 1px solid #59b875; background: #e7f6eb; }
.erm-symbol.attribute { border-radius: 50%; }
.erm-symbol.relationship { flex-basis: 13px; width: 13px; height: 13px; transform: rotate(45deg); margin-inline: 2px 3px; }
.erm-checkbox { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 16px 0; }
.erm-checkbox input { accent-color: var(--accent); }
.erm-attribute-row { grid-template-columns: minmax(0, 1fr) 28px 24px; }
.erm-attribute-row.selected { background: var(--accent-soft); border-radius: 5px; }
.erm-primary-toggle.on { color: var(--class-dark); background: var(--accent-soft); }
.erm-primary-toggle:hover, .erm-primary-toggle:focus-visible { color: var(--class-color); }
.erm-editor .class-editor-header .icon-button { flex-shrink: 0; }
.erm-port { position: absolute; top: 50%; transform: translateY(-50%); width: 12px; height: 12px; padding: 0; border: 2px solid var(--surface-raised); border-radius: 50%; background: var(--class-color); opacity: 0; pointer-events: none; cursor: crosshair; z-index: 2; }
.erm-port.left { left: -5px; }
.erm-port.right { right: -5px; }
.erm-entity:hover .erm-port, .erm-entity:focus-within .erm-port, .erm-entity.selected .erm-port, .erm-connecting .erm-port { opacity: 1; pointer-events: auto; }
.erm-drop-target .erm-shape { stroke: var(--class-color); stroke-width: 4; }
.erm-preview { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 4; pointer-events: none; }
#erm-connection-menu { position: fixed; z-index: 50; width: 360px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow: auto; background: var(--surface-raised); color: var(--ink); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 30px rgb(var(--shadow) / .15); }
#erm-connection-menu .class-connection-endpoint select { display: block; width: 100%; padding: 2px 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-weight: 500; text-overflow: ellipsis; }
#erm-connection-menu .class-multiplicity { flex-wrap: wrap; }
@media (max-width: 480px) {
  .topbar { gap: 5px; }
  .mode-switch { min-width: 0; }
  .mode-switch button { min-width: 0; padding-inline: 4px; overflow-wrap: anywhere; }
}
