.page-editor main { max-width: 1440px; }
.page-editor { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.editor-heading, .editor-toolbar, .editor-save, .node-title, .node-actions, .editor-file-actions, .dialog-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.editor-heading { justify-content: space-between; margin: 16px 0; }
.editor-heading h1 { font-family: Georgia, serif; }
.editor-mode { padding: 12px 16px; border: 1px solid #685633; background: #211e17; font-size: 13px; }
.editor-mode.local { border-color: #375c47; background: #14241b; }
.editor-toolbar { position: sticky; top: 65px; z-index: 5; padding: 12px 0; background: var(--bg); border-bottom: 1px solid var(--line); }
.editor-toolbar > label { display: flex; align-items: center; gap: 10px; margin: 0; }
.editor-save { margin-left: auto; }
#dirty-status { font-size: 12px; color: var(--muted); }
.page-editor button, .file-button { padding: 9px 12px; border: 1px solid #44434a; border-radius: 4px; background: #222126; color: var(--text); cursor: pointer; font: 500 12px/1.5 -apple-system, sans-serif; }
.page-editor button.primary { background: #c8222c; border-color: #e43c46; }
.page-editor button:disabled { opacity: .45; cursor: not-allowed; }
.page-editor input, .page-editor textarea, .page-editor select { width: 100%; padding: 10px; border: 1px solid #44434a; border-radius: 3px; color: var(--text); background: #101014; font: 14px/1.5 -apple-system, sans-serif; }
.page-editor input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.page-editor input[readonly] { color: var(--muted); background: var(--panel); }
.page-editor label { display: block; font-size: 12px; color: var(--text-2); margin: 12px 0; }
.page-editor label > input, .page-editor label > textarea, .page-editor label > select { display: block; margin-top: 5px; }
.page-editor .check-group label > input { display: inline; margin-right: 5px; }
.editor-tabs { display: flex; gap: 8px; margin: 20px 0; }
.editor-tabs [aria-selected="true"] { background: #442127; border-color: #e9515b; }
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.page-editor fieldset { border: 1px solid var(--line); margin: 0 0 16px; padding: 18px; background: var(--panel); }
.page-editor legend { font-size: 15px; font-weight: 650; padding: 0 7px; }
.editor-wide { grid-column: 1 / -1; }
.check-group { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; margin: 10px 0; }
.check-group > span { width: 100%; font-size: 12px; color: var(--muted); }
.check-group label { margin: 2px 0; }
.editor-hint { font-size: 12px; color: var(--muted); line-height: 1.7; }
#image-preview { max-width: 100%; width: 190px; height: 190px; object-fit: contain; background: #0a090c; }
.map-fields { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; }
.map-paste { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.map-paste label { flex: 1; min-width: 220px; margin-bottom: 0; }
#map-preview iframe { width: 100%; height: 270px; margin-top: 12px; border: 1px solid var(--line); }
.link-row { display: grid; grid-template-columns: 1fr 1.6fr auto; align-items: end; gap: 8px; margin-bottom: 16px; }
.link-row label { margin: 0; }
.editor-file-actions { margin: 28px 0; border-top: 1px solid var(--line); padding-top: 20px; }
.file-button { margin: 0 !important; position: relative; overflow: hidden; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
#editor-feedback { font-size: 13px; white-space: pre-wrap; padding: 0; }
#editor-feedback:not(:empty) { padding: 14px; margin-top: 12px; background: #1b2d23; border: 1px solid #406c51; }
#editor-feedback.error { background: #341a20; border-color: #ac5b66; }
.ontology-workspace { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; }
.node-library { border-right: 1px solid var(--line); padding-right: 16px; }
#node-list { max-height: 660px; overflow-y: auto; margin-top: 14px; }
#node-list button { display: block; width: 100%; text-align: left; margin-bottom: 5px; background: transparent; border-color: transparent; }
#node-list button[aria-pressed="true"] { background: #3c2229; border-color: #75404b; }
#node-list small { display: block; color: var(--muted); font-size: 10px; }
.node-title { justify-content: space-between; }
.node-title h2 { margin: 0; font-size: 25px; }
#node-id { display: block; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.node-actions { margin: 20px 0; }
.node-workspace { display: grid; grid-template-columns: minmax(250px, 1fr) 370px; align-items: start; gap: 18px; }
.node-inspector { padding: 16px; background: var(--panel); border: 1px solid var(--line); max-height: 85vh; overflow-y: auto; position: sticky; top: 140px; }
.node-inspector fieldset { padding: 10px; }
.node-inspector .relation-form, .node-inspector .property-form { grid-template-columns: 1fr; }
.graph-board { position: sticky; top: 145px; }
.graph-navigation { display: flex; gap: 8px; align-items: center; }
#graph-stats { color: var(--muted); font-size: 11px; margin-left: auto; }
.node-graph svg { width: 100%; min-height: 390px; display: block; }
.node-graph svg [role="button"] { cursor: pointer; }
.node-graph svg [role="button"]:focus { outline: none; }
.node-graph svg [role="button"]:focus rect { stroke: white; stroke-width: 3; }
.inspector-image { width: 100%; max-height: 150px; object-fit: contain; background: #080809; }
.node-inspector .node-title h2 { font-size: 23px; }
.node-inspector .node-actions button { padding: 7px 9px; }
.node-inspector h3 { font-size: 13px; }
.node-inspector .connection-row { align-items: start; }
.node-inspector .connection-row .explore-node { color: #eaa6ad; padding: 3px; background: transparent; border: none; text-align: left; }
.node-inspector .property-row { flex-wrap: wrap; }
.node-inspector .property-row input { max-width: none; }
.node-graph { padding: 20px; background: #111115; border: 1px solid var(--line); margin: 14px 0 20px; }
.graph-lane { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.graph-lane button { border-radius: 18px; max-width: 210px; overflow-wrap: anywhere; }
.graph-focus { margin: 16px auto; padding: 14px; background: #44232c; border: 1px solid #a25165; max-width: 320px; text-align: center; border-radius: 6px; }
.graph-caption { display: block; text-align: center; color: var(--muted); font-size: 11px; margin: 5px 0; }
.connection-row, .property-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 10px 0; font-size: 12px; overflow-wrap: anywhere; }
.connection-row button, .property-row button { flex-shrink: 0; }
.property-row input { max-width: 240px; }
.relation-form, .property-form { display: grid; grid-template-columns: 1fr 1.3fr auto; gap: 10px; align-items: end; }
.relation-form label, .property-form label { margin-bottom: 0; }
.property-form { grid-template-columns: 1fr .8fr 1fr auto; }
.managed-relations pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; padding: 14px; background: var(--panel); }
.managed-relations summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.page-editor dialog { background: var(--panel); color: var(--text); border: 1px solid #64606b; border-radius: 8px; width: min(520px, 95vw); padding: 24px; }
.page-editor dialog::backdrop { background: #000b; }
.page-editor dialog h2 { margin-top: 0; }
.dialog-actions { justify-content: flex-end; margin-top: 22px; }
#persistence-note { font-size: 11px; color: var(--muted); }
@media (max-width: 1150px) { .ontology-workspace { grid-template-columns: 160px minmax(0, 1fr); gap: 14px; } .node-workspace { grid-template-columns: 1fr; } .node-inspector, .graph-board { position: static; max-height: none; } .relation-form, .property-form { grid-template-columns: 1fr; } }
@media (max-width: 650px) {
  .editor-grid, .ontology-workspace, .map-fields { grid-template-columns: 1fr; }
  .editor-toolbar { position: static; }
  .editor-toolbar > label { width: 100%; }
  .editor-save { margin-left: 0; }
  .node-library { border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 12px; }
  #node-list { max-height: 160px; }
  .link-row { grid-template-columns: 1fr auto; }
  .link-row label:first-child { grid-column: 1 / -1; }
}
