/* One contextual row toolbar; the original editor owns all mutations and saves. */
html.ns-active { --he-panel:#142338; --he-line:#3d5b7d; --he-accent:#9dcaff; }
html.ns-active.halloween { --he-panel:#271c14; --he-line:#83502d; --he-accent:#ffb36b; }
html.ns-active.ns-editing .main-wrapper > .content { padding-bottom:calc(var(--he-dock-height,210px) + 35px); scroll-padding-bottom:calc(var(--he-dock-height,210px) + 30px); }
html.ns-active .content-page[contenteditable="true"] { outline:1px dashed var(--he-line); outline-offset:8px; box-shadow:none; padding-bottom:20px; }
html.ns-active .content-page[contenteditable="true"] .edit-card-block { padding-right:18px !important; }
html.ns-active .content-page[contenteditable="true"] :is(.edit-flex-row,.card-content-row,.wyp-item) { padding-right:84px !important; min-height:44px; }
html.ns-active .content-page[contenteditable="true"] .row-edit-tools { opacity:0 !important; pointer-events:none; right:8px; padding:3px; border:1px solid var(--he-line); border-radius:7px; background:var(--he-panel); box-shadow:0 4px 12px #0003; transition:opacity .15s; }
html.ns-active .content-page[contenteditable="true"] :is(.edit-flex-row,.edit-card-block,.card-content-row,.wyp-item):has(> .he-row-marker) { outline:1px solid var(--he-line); outline-offset:-1px; }
html.ns-active .content-page[contenteditable="true"] :is(.edit-flex-row,.edit-card-block,.card-content-row,.wyp-item):has(> .he-row-marker) > .row-edit-tools,
html.ns-active .content-page[contenteditable="true"] .row-edit-tools:focus-within { opacity:1 !important; pointer-events:auto; }
html.ns-active .content-page[contenteditable="true"] .edit-card-block:not(.edit-flex-row) > .row-edit-tools { top:9px; transform:none; }
html.ns-active .content-page[contenteditable="true"] .row-tool-btn { color:var(--he-accent); width:27px;height:27px;border-radius:4px; }
html.ns-active .content-page[contenteditable="true"] .row-tool-btn:is(:hover,:focus-visible) { background:color-mix(in srgb,var(--he-accent) 18%,transparent); color:var(--ns-copy); outline:none; }
html.ns-active .content-page[contenteditable="true"] .edit-flex-row:hover { box-shadow:none; border-color:var(--he-line) !important; }
html.ns-active .content-page[contenteditable="true"] .edit-list-add { border-color:var(--he-line); color:var(--he-accent); background:transparent; border-radius:6px; padding:9px 12px; }
html.ns-active #wysiwygBar { width:min(1000px,calc(100vw - 32px)); max-width:calc(100vw - 32px); padding:13px 16px; gap:12px; border:1px solid var(--he-line); border-radius:12px; background:var(--he-panel); box-shadow:0 12px 44px #0008; font:inherit; }
html.ns-active #wysiwygBar.open { bottom:calc(var(--ns-footer,64px) + 12px); }
html.ns-active #wysiwygBar .he-status { display:flex; align-items:center; flex-wrap:wrap; gap:8px 20px; flex:0 0 100%; padding-bottom:11px; border-bottom:1px solid var(--he-line); color:var(--ns-copy); font-size:12px; }
.he-status strong { margin-right:auto; font-size:13px; font-weight:650; }
.he-status-state { color:var(--he-accent); }
.he-status small { color:var(--ns-muted); font-size:10px; }
html.ns-active #wysiwygBar .wysiwyg-tools { min-width:0; gap:3px; }
html.ns-active #wysiwygBar .wt-btn { min-height:32px; border-radius:5px; color:var(--ns-copy); }
html.ns-active #wysiwygBar .wt-btn:is(:hover,.on,.wt-active) { background:color-mix(in srgb,var(--he-accent) 14%,transparent); color:var(--he-accent); }
html.ns-active #wysiwygBar .wt-addrow { background:color-mix(in srgb,var(--he-accent) 10%,transparent); color:var(--he-accent); border:1px solid var(--he-line); }
html.ns-active #wysiwygBar :is(.reader-preview-trigger,.wt-cancel,.wt-save) { padding:9px 13px; min-height:36px; border-radius:6px; font:600 12px/1.3 system-ui,sans-serif; }
html.ns-active #wysiwygBar :is(.reader-preview-trigger,.wt-cancel) { color:var(--ns-copy); background:transparent; border:1px solid var(--he-line); }
html.ns-active #wysiwygBar .wt-save { color:#15100c; background:var(--he-accent); border:1px solid var(--he-accent); }
html.ns-active #wysiwygBar .reader-change-label { font-size:11px; color:var(--ns-muted); }
html.ns-active #wysiwygBar #articleChangeSummary { background:color-mix(in srgb,var(--ns-ink) 70%,transparent); border-color:var(--he-line); color:var(--ns-copy); border-radius:5px; }
html.ns-active #wysiwygBar .wysiwyg-hint,html.ns-active #rowHandleHint { display:none !important; }
html.ns-active :is(#rowEditMenu,#fmtBar) { background:var(--he-panel) !important; border-color:var(--he-line) !important; color:var(--ns-copy); }
html.ns-active #rowEditMenu button { color:var(--ns-copy); }
html.ns-active #rowEditMenu button:hover { background:color-mix(in srgb,var(--he-accent) 12%,transparent); }
@media(max-width:600px) {
 html.ns-active #wysiwygBar { width:calc(100vw - 16px);max-width:calc(100vw - 16px);padding:10px;gap:8px;max-height:42dvh;overflow:auto; }
 html.ns-active #wysiwygBar.open { bottom:8px; }
 html.ns-active #wysiwygBar .wysiwyg-actions { margin-left:0; padding-left:0; border-left:0; width:100%;justify-content:flex-end; }
 .he-status small { display:none; }
 html.ns-active .content-page[contenteditable="true"] :is(.edit-flex-row,.card-content-row,.wyp-item) { padding-right:78px !important; }
}
@media(prefers-reduced-motion:reduce) { html.ns-active #wysiwygBar,html.ns-active .row-edit-tools { transition:none; } }

/* Editor workspace: one document, clear status, explicit save and reusable row actions. */
html.ns-active #wysiwygBar { width:min(1120px,calc(100vw - 40px)); max-width:calc(100vw - 40px); padding:16px 18px; border-radius:14px; background:var(--ns-panel); border-color:var(--ns-line); box-shadow:0 16px 64px #0009; }
html.ns-active #wysiwygBar:not(.open) { display:none; }
html.ns-active #wysiwygBar.open { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px 18px; max-height:60dvh; overflow:auto; }
html.ns-active #wysiwygBar .he-status { grid-column:1/-1; display:flex; justify-content:space-between; gap:12px 24px; margin:0; padding:0 0 14px; border-color:var(--ns-line); }
.he-document { display:flex; flex-wrap:wrap; align-items:center; gap:10px 18px; min-width:0; }
.he-document > strong { margin:0; color:var(--ns-copy); font:650 14px/1.4 system-ui,sans-serif; }
.he-page-label { display:flex; align-items:center; gap:9px; color:var(--ns-muted); font-size:11px; }
.he-page-select { width:190px; max-width:100%; padding:8px 26px 8px 10px; border:1px solid var(--ns-line); border-radius:7px; background:var(--ns-ink); color:var(--ns-copy); font:500 12px/1.3 system-ui,sans-serif; }
.he-session { display:grid; gap:4px; align-content:center; text-align:right; }
html.ns-active #wysiwygBar .he-status-state { color:var(--ns-muted); font-size:12px; }
.he-status[data-state="dirty"] .he-status-state::before { content:'•'; margin-right:7px; color:#c7ac7d; }
html.ns-active #wysiwygBar .he-status[data-state="error"] .he-status-state { color:#dfa8ae; }
.he-draft-state { color:var(--ns-muted); font-size:10px; }
html.ns-active #wysiwygBar .wysiwyg-tools { grid-column:1; grid-row:2; display:flex; flex-wrap:wrap; gap:4px; margin:0; }
html.ns-active #wysiwygBar .wysiwyg-actions { grid-column:2; grid-row:2; display:flex; align-items:center; gap:7px; margin:0; padding:0 0 0 16px; border-left:1px solid var(--ns-line); }
html.ns-active #wysiwygBar .wt-btn { min-width:30px; min-height:32px; font:600 12px/1 system-ui,sans-serif; }
html.ns-active #wysiwygBar :is(.wt-save,.wt-cancel,.reader-preview-trigger) { min-height:38px; padding:10px 13px; white-space:nowrap; }
html.ns-active #wysiwygBar .wt-save { background:var(--ns-copper); color:var(--ns-ink); }
html.ns-active #wysiwygBar .reader-change-label { grid-column:1/-1; display:flex; flex-wrap:wrap; align-items:center; gap:8px 16px; order:initial; margin:0; width:100%; }
html.ns-active #wysiwygBar #articleChangeSummary { flex:1; min-width:180px; max-width:none; min-height:36px; padding:9px 12px; border:1px solid var(--ns-line); background:var(--ns-ink); font:400 12px/1.4 system-ui,sans-serif; }
.he-context { grid-column:1/-1; display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:9px 14px; padding-top:12px; border-top:1px solid var(--ns-line); }
.he-context-label { color:var(--ns-muted); font-size:11px; }
.he-context > div,.he-draft-banner > div { display:flex; flex-wrap:wrap; gap:5px; }
html.ns-active :is(.he-context,.he-outline,.he-message,.he-draft-banner,.he-switch-dialog) button { padding:7px 10px; min-height:30px; border:1px solid var(--ns-line); border-radius:6px; background:var(--ns-ink); color:var(--ns-copy); font:500 11px/1.3 system-ui,sans-serif; cursor:pointer; }
html.ns-active :is(.he-context,.he-outline,.he-message,.he-draft-banner,.he-switch-dialog) button:hover { border-color:var(--ns-copper); background:var(--hs-soft); }
html.ns-active #wysiwygBar button:disabled { opacity:.4; cursor:default; }
html.ns-active :is(#wysiwygBar,.he-switch-dialog) :is(button,select,input):focus-visible { outline:2px solid var(--ns-copper); outline-offset:3px; }
.he-outline { grid-column:1/-1; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:5px; max-height:130px; overflow:auto; padding:8px; background:var(--ns-ink); border-radius:8px; color:var(--ns-muted); font-size:12px; }
.he-outline button { text-align:left; }
.he-message,.he-draft-banner { grid-column:1/-1; display:flex; justify-content:space-between; align-items:center; gap:10px 20px; padding:12px 14px; border:1px solid #795056; background:color-mix(in srgb,#ad5262 10%,var(--ns-panel)); border-radius:8px; color:#e3b5bb; font-size:12px; line-height:1.6; }
.he-draft-banner { border-color:var(--ns-line); color:var(--ns-copy); background:var(--hs-soft); }
.he-entry-notice { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; padding:14px 16px; margin-bottom:18px; border:1px solid color-mix(in srgb,var(--ns-signal-warning) 45%,var(--ns-line)); border-radius:9px; background:var(--ns-panel); color:var(--ns-signal-warning); font-size:13px; line-height:1.5; }
.he-entry-notice button { padding:8px 12px; border:1px solid var(--ns-line); border-radius:6px; background:var(--ns-ink); color:var(--ns-copy); font:600 12px/1.4 system-ui,sans-serif; cursor:pointer; }
.he-entry-notice button:focus-visible { outline:2px solid var(--ns-copper); outline-offset:3px; }
html.ns-active #wysiwygBar [hidden] { display:none !important; }
html.ns-active .content-page[contenteditable="true"] .he-selected { outline:1px solid var(--ns-copper); outline-offset:-1px; }
.he-row-tools { position:absolute; right:8px; top:8px; display:flex; gap:2px; padding:2px; border:1px solid var(--ns-line); border-radius:6px; background:var(--ns-panel); opacity:0; pointer-events:none; transition:opacity .15s; }
.he-row-tools button { display:grid; place-items:center; width:26px; height:25px; padding:0; border:0; border-radius:4px; background:transparent; color:var(--ns-copper); font:600 17px/1 system-ui,sans-serif; cursor:pointer; }
.he-row-tools button:hover { background:var(--hs-soft); }
.content-page[contenteditable="true"] .edit-flex-row:is(:hover,:focus-within,.he-selected) > .he-row-tools { opacity:1; pointer-events:auto; }
.he-switch-dialog { width:min(480px,calc(100vw - 32px)); padding:26px; border:1px solid var(--ns-line); border-radius:14px; background:var(--ns-panel); color:var(--ns-copy); box-shadow:0 24px 100px #0009; }
.he-switch-dialog::backdrop { background:#050a12bb; backdrop-filter:blur(5px); }
.he-switch-dialog h2 { margin:0 0 10px; font:650 21px/1.3 system-ui,sans-serif; }
.he-switch-dialog p { margin:0 0 22px; font:400 13px/1.7 system-ui,sans-serif; color:var(--ns-muted); }
.he-switch-dialog > div { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:7px; }
.he-switch-dialog [data-he-action="save-switch"] { background:var(--ns-copper); color:var(--ns-ink); }
html.ns-active .content-page[aria-busy="true"] { opacity:.75; cursor:progress; }
html.ns-active .content-page[contenteditable="true"] { border-radius:10px; }
@media(max-width:800px) {
 html.ns-active #wysiwygBar.open { grid-template-columns:1fr; }
 html.ns-active #wysiwygBar .wysiwyg-actions { grid-column:1; grid-row:3; justify-content:flex-end; padding:0; border:0; }
 .he-context > div { width:100%; }
}
@media(max-width:600px) {
 html.ns-active #wysiwygBar { width:calc(100vw - 16px); max-width:calc(100vw - 16px); padding:12px; }
 html.ns-active #wysiwygBar.open { max-height:46dvh; gap:10px; }
 .he-document { width:100%; gap:8px; }
 .he-document > strong { font-size:12px; width:100%; }
 .he-session { width:100%; text-align:left; }
 .he-page-label { width:100%; }
 .he-page-select { flex:1; width:auto; }
 .he-message,.he-draft-banner { flex-wrap:wrap; }
 .he-row-tools { opacity:1; pointer-events:auto; }
 .he-outline { grid-template-columns:1fr; }
}
@media(prefers-reduced-motion:reduce) { .he-row-tools { transition:none; } .he-switch-dialog::backdrop { backdrop-filter:none; } }
