/* NextReader v5.7.0 — isolated Markdown, Excel and Word editor copies. */
:root {
  --nr-editor-border: color-mix(in srgb, var(--text-muted, #9a9a96) 22%, transparent);
  --nr-editor-border-strong: color-mix(in srgb, var(--accent-primary, #f8b800) 46%, transparent);
  --nr-editor-surface: color-mix(in srgb, var(--panel-bg, #151718) 94%, transparent);
  --nr-editor-surface-raised: color-mix(in srgb, var(--panel-bg, #1b1d1e) 88%, var(--accent-primary, #f8b800) 2%);
  --nr-editor-input: color-mix(in srgb, var(--page-bg, #080808) 82%, transparent);
  --nr-editor-ink: var(--text-main, #f1f1ed);
  --nr-editor-muted: var(--text-muted, #a7a7a2);
  --nr-editor-danger: #ff646c;
  --nr-editor-radius: 14px;
  --nr-editor-pill-safe-track: calc(318px + clamp(68px, 7vw, 88px));
}

html[data-theme="light"] {
  --nr-editor-border: color-mix(in srgb, #1f1f1f 16%, transparent);
  --nr-editor-border-strong: color-mix(in srgb, var(--accent-primary, #c69200) 52%, transparent);
  --nr-editor-surface: color-mix(in srgb, #f7f8f9 96%, transparent);
  --nr-editor-surface-raised: color-mix(in srgb, #ffffff 96%, var(--accent-primary, #c69200) 2%);
  --nr-editor-input: color-mix(in srgb, #ffffff 94%, var(--accent-primary, #c69200) 1%);
  --nr-editor-ink: #1f1f1f;
  --nr-editor-muted: #666862;
}

.document-surface-global-actions > .document-edit-toggle {
  order: -1;
  display: inline-flex;
  min-width: 47px;
  min-height: 26px;
  height: 26px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  color: var(--reader-ink-muted, var(--text-muted));
  background: transparent;
  font: 700 11px/1 var(--font-main, system-ui, sans-serif);
  white-space: nowrap;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  transition: color .2s ease, background .2s ease;
}

/* Render pass integrity — ©2026 Inspidea. Zhu-Lijianing[#JWxolw] */
/* Execution context checksum — ©2026 Inspidea. Zhu-Lijianing[#pGJitw] */
/* DOM tree attestation — ©2026 Inspidea. Zhu-Lijianing[#LQJypy] */
/* Template reference — ©2026 Inspidea. Zhu-Lijianing[#1oFMVm] */
/* Shadow boundary marker — qTIwMjYgSW5zcGlkZWEuIFpodS1MaWppYW5pbmdbI1ZVbnV2OF0= */
/* Component hash — qTIwMjYgSW5zcGlkZWEuIFpodS1MaWppYW5pbmdbI2prSnNkMF0= */
/* Character encoding seal — qTIwMjYgSW5zcGlkZWEuIFpodS1MaWppYW5pbmdbIzFTWjQxSV0= */
.document-edit-toggle[hidden] { display: none !important; }
.document-surface-global-actions > .document-edit-toggle:hover:not(:disabled) {
  color: var(--reader-ink-strong, var(--text-main));
  background: color-mix(in srgb, var(--reader-ink-muted, #999) 8%, transparent);
}
.document-surface-global-actions > .document-edit-toggle.is-active {
  color: var(--reader-ink-strong, var(--text-main));
  background: color-mix(in srgb, var(--reader-ink-muted, #999) 10%, transparent);
  box-shadow: none;
}
.document-edit-toggle:disabled { opacity: .42; cursor: not-allowed; }
.document-edit-toggle:focus-visible,
.editor-workbench :is(button, input, select, textarea, [contenteditable="true"], [tabindex]):focus-visible,
.nr-sheet-side-overlay :is(button, input, select, textarea, [tabindex]):focus-visible,
.nr-optimization-overlay :is(button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent-primary, #f8b800);
  outline-offset: 2px;
}

.reader-shell.is-editor-mode .document-surface-summary-slot,
.reader-shell.is-editor-mode .document-surface-context-actions,
.reader-shell.is-editor-mode .document-view-mode-host,
.reader-shell.is-editor-mode .document-search-panel { display: none !important; }

/* The reading HUD is a body-level sibling of the reader shell. Editing owns the
   available viewport, so suppress reading-only overlays for every editor size. */
.is-nextreader-editor-mode #reading-progress-hud,
.is-nextreader-editor-mode #reading-progress-restore,
.is-nextreader-editor-mode #reading-progress-lens,
.is-nextreader-editor-mode #reading-minimap { display: none !important; }

.editor-workbench {
  position: relative;
  display: none;
  container-type: inline-size;
  container-name: nr-editor-workbench;
  width: 100%;
  min-height: clamp(580px, calc(100vh - 190px), 940px);
  margin: 0;
  overflow: visible;
  color: var(--nr-editor-ink);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.editor-workbench.is-active { display: flex; flex-direction: column; }
.reader-shell.is-editor-mode.has-active-document .reader-paper-wrap {
  background: var(--nr-editor-surface);
}
.reader-shell.is-editor-mode.has-active-document .document-surface-toolbar {
  min-height: 0;
  margin: 0;
  padding: 0;
}
.reader-shell.is-editor-mode.has-active-document .document-surface-toolbar .document-surface-global-actions {
  position: fixed;
  top: var(--reading-layout-fixed-top, 48px);
  right: var(--reading-layout-fixed-right, 48px);
  bottom: auto;
  left: auto;
  z-index: 64;
  align-self: auto;
  max-width: calc(100vw - 32px);
  margin: 0;
  overflow-x: auto;
  transform: none;
}
.reader-shell.is-editor-mode.is-reader-layout-custom .editor-workbench {
  width: 100%;
  max-width: none;
}
.reader-shell.is-editor-mode.is-reader-layout-custom .reader-width-handle { display: block; }
.editor-workbench > .nextreader-ai-summary-placeholder { display: none !important; }

/* Render pass integrity — qTIwMjYgSW5zcGlkZWEuIFpodS1MaWppYW5pbmdbI3JxcGNGU10= */
/* Execution context checksum — qTIwMjYgSW5zcGlkZWEuIFpodS1MaWppYW5pbmdbI1ZzclNUMl0= */
/* DOM tree attestation — ©2026 Vafcvqrn. Muh-Yvwvnavat[#S45HaL] */
/* Template reference — ©2026 Vafcvqrn. Muh-Yvwvnavat[#SJIbo4] */
/* Shadow boundary marker — ©2026 Vafcvqrn. Muh-Yvwvnavat[#EJqVEx] */
/* Component hash — ©2026 Vafcvqrn. Muh-Yvwvnavat[#C8Mx78] */
/* Character encoding seal — ©2026 Vafcvqrn. Muh-Yvwvnavat[#QRQrqP] */
.nr-editor-commandbar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px 12px;
  min-height: 0;
  padding: 22px var(--nr-editor-pill-safe-track) 12px 18px;
  border: 0;
  background: transparent;
}
.nr-editor-command-controls {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}
.nr-editor-command-controls {
  flex: 0 0 auto;
  max-width: 100%;
  min-height: 40px;
  flex-wrap: wrap;
}
.nr-editor-commandbar.has-single-editor-view .nr-editor-command-controls { justify-content: flex-start; }

.nr-editor-identity {
  display: flex;
  flex: 0 1 auto;
  min-width: min(220px, 100%);
  max-width: min(100%, 720px);
  align-items: baseline;
  gap: 9px;
}
.nr-editor-copy-kicker {
  flex: 0 0 auto;
  color: var(--nr-editor-muted);
  font-size: 10px;
  line-height: 1;
  font-weight: 760;
  letter-spacing: .08em;
  white-space: nowrap;
}
.nr-editor-identity > strong {
  min-width: 0;
  overflow: hidden;
  color: var(--nr-editor-ink);
  font-size: 15px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nr-editor-mode-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  padding: 2px;
  border: 1px solid var(--nr-editor-border);
  border-radius: 999px;
  background: var(--nr-editor-input);
}
.nr-editor-mode-switch[hidden],
.nr-editor-mode-switch:empty { display: none !important; }
.nr-editor-mode-switch button {
  appearance: none;
  min-height: 32px;
  padding: 0 15px;
  border: 0;
  border-radius: 999px;
  color: var(--nr-editor-muted);
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
  cursor: pointer;
}
.nr-editor-mode-switch button.is-active {
  color: var(--accent-primary, #f8b800);
  background: color-mix(in srgb, var(--accent-primary, #f8b800) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-primary, #f8b800) 32%, transparent);
}

.nr-editor-command-actions {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  min-width: 0;
}
.nr-editor-history-actions,
.nr-editor-commit-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.nr-editor-history-actions {
  padding: 2px;
  border: 1px solid var(--nr-editor-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--nr-editor-input) 86%, transparent);
}
.nr-editor-commit-actions { gap: 7px; }
.nr-editor-save-status {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 280px;
  overflow: hidden;
  color: var(--nr-editor-muted);
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nr-editor-save-status::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-inline-end: 7px;
  border-radius: 50%;
  vertical-align: 1px;
  background: currentColor;
  opacity: .7;
}
.nr-editor-save-status[data-tone="warning"] { color: var(--accent-primary, #f8b800); }
.nr-editor-save-status[data-tone="success"] { color: #5fd7a0; }
.nr-editor-save-status[data-tone="danger"] { color: var(--nr-editor-danger); }
.nr-editor-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.nr-editor-icon-button,
.nr-editor-primary-button,
.nr-editor-danger-button,
.nr-sheet-tab {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--nr-editor-border);
  border-radius: 999px;
  color: var(--nr-editor-ink);
  background: color-mix(in srgb, var(--nr-editor-surface-raised) 82%, transparent);
  font: inherit;
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
  cursor: pointer;
}
.nr-editor-icon-button:hover:not(:disabled),
.nr-editor-primary-button:hover:not(:disabled),
.nr-sheet-tab:hover:not(:disabled) { border-color: var(--nr-editor-border-strong); color: var(--accent-primary, #f8b800); }
.nr-editor-icon-button.is-compact { min-width: 38px; padding: 0 10px; }
.nr-editor-icon-button.is-compact span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.nr-editor-primary-button { border-color: var(--nr-editor-border-strong); }
.nr-editor-primary-button.is-accent { color: #111; background: var(--accent-primary, #f8b800); }
.nr-editor-danger-button { color: var(--nr-editor-danger); border-color: color-mix(in srgb, var(--nr-editor-danger) 42%, transparent); }
.nr-editor-icon-button:disabled { opacity: .34; cursor: default; }

/* Markdown preview editing uses Milkdown/ProseMirror as the single native
   selection and caret surface. The surrounding controls remain NextReader UI. */
.nr-editor-format-menu {
  position: relative;
  z-index: 12;
  display: inline-flex;
  flex: 0 0 auto;
  min-width: 0;
}
.nr-editor-format-menu[hidden],
.nr-editor-format-menu:empty { display: none !important; }
.nr-editor-format-trigger {
  appearance: none;
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid var(--nr-editor-border);
  border-radius: 999px;
  color: var(--nr-editor-ink);
  background: color-mix(in srgb, var(--nr-editor-surface-raised) 82%, transparent);
  font: inherit;
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
  cursor: pointer;
}
.nr-editor-format-trigger:is(:hover, :focus-visible),
.nr-editor-format-menu[data-open="true"] .nr-editor-format-trigger {
  color: var(--accent-primary, #f8b800);
  border-color: var(--nr-editor-border-strong);
}
.nr-editor-format-trigger .fa-chevron-down {
  color: var(--nr-editor-muted);
  font-size: 9px;
  transition: transform .16s ease;
}
.nr-editor-format-menu[data-open="true"] .fa-chevron-down { transform: rotate(180deg); }
.nr-editor-format-popover {
  position: fixed;
  z-index: 13060;
  top: 0;
  left: 0;
  display: none;
  width: min(390px, calc(100vw - 32px));
  max-height: min(68vh, 520px);
  gap: 11px;
  padding: 13px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--nr-editor-border-strong);
  border-radius: 16px;
  background: color-mix(in srgb, var(--nr-editor-surface-raised) 97%, transparent);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .46);
  backdrop-filter: blur(18px);
}
.nr-editor-format-popover[data-open="true"] { display: grid; }
.nr-editor-format-popover section { display: grid; gap: 7px; }
.nr-editor-format-popover section + section {
  padding-top: 10px;
  border-top: 1px solid var(--nr-editor-border);
}
.nr-editor-format-popover section > strong {
  color: var(--nr-editor-muted);
  font-size: 10px;
  font-weight: 780;
  letter-spacing: .09em;
}
.nr-editor-format-popover section > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.nr-editor-format-popover button {
  appearance: none;
  display: inline-flex;
  min-width: 0;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--nr-editor-ink);
  background: transparent;
  font: inherit;
  font-size: 11px;
  font-weight: 680;
  text-align: left;
  cursor: pointer;
}
.nr-editor-format-popover button i {
  width: 15px;
  flex: 0 0 15px;
  color: var(--accent-primary, #f8b800);
  text-align: center;
}
.nr-editor-format-popover button:is(:hover, :focus-visible) {
  border-color: var(--nr-editor-border);
  background: color-mix(in srgb, var(--accent-primary, #f8b800) 9%, transparent);
}

.nr-milkdown-host {
  position: relative;
  min-width: 0;
  min-height: 520px;
  background: transparent;
}
.nr-milkdown-host > .milkdown {
  min-width: 0;
  min-height: inherit;
  background: transparent;
}
.nr-milkdown-host .ProseMirror {
  box-sizing: border-box;
  width: 100%;
  min-height: clamp(520px, calc(100vh - 210px), 980px);
  padding: clamp(42px, 6vw, 92px) clamp(24px, 7vw, 118px) 100px;
  outline: 0;
  color: var(--nr-editor-ink);
  background: transparent;
  caret-color: var(--accent-primary, #f8b800);
  font-family: var(--font-main, system-ui, sans-serif);
  font-size: inherit;
  line-height: 1.82;
  overflow-wrap: anywhere;
  /* ProseMirror requires pre-wrap for stable native caret and multi-line selection geometry. */
  white-space: pre-wrap;
  user-select: text;
  -webkit-user-select: text;
}
.nr-milkdown-host .ProseMirror ::selection {
  color: inherit;
  background: color-mix(in srgb, var(--accent-primary, #f8b800) 30%, transparent);
}
.nr-milkdown-host .ProseMirror > :first-child { margin-top: 0; }
.nr-milkdown-host .ProseMirror > :last-child { margin-bottom: 0; }
.nr-milkdown-host .ProseMirror :is(p, ul, ol, blockquote, pre, table, hr) {
  margin-block: 1.05em;
}
.nr-milkdown-host .ProseMirror :is(h1, h2, h3, h4, h5, h6) {
  margin: 1.45em 0 .62em;
  color: var(--nr-editor-ink);
  line-height: 1.24;
  text-wrap: pretty;
}
.nr-milkdown-host .ProseMirror h1 { font-size: clamp(2rem, 4vw, 3.25rem); }
.nr-milkdown-host .ProseMirror h2 { font-size: clamp(1.55rem, 3vw, 2.35rem); }
.nr-milkdown-host .ProseMirror h3 { font-size: clamp(1.25rem, 2.25vw, 1.75rem); }
.nr-milkdown-host .ProseMirror :is(h4, h5, h6) { font-size: clamp(1rem, 1.75vw, 1.25rem); }
.nr-milkdown-host .ProseMirror :is(ul, ol) { padding-inline-start: 1.7em; }
.nr-milkdown-host .ProseMirror li { margin-block: .3em; }
.nr-milkdown-host .ProseMirror blockquote {
  margin-inline: 0;
  padding: .3em 1em;
  border-inline-start: 3px solid var(--accent-primary, #f8b800);
  color: var(--nr-editor-muted);
  background: color-mix(in srgb, var(--accent-primary, #f8b800) 5%, transparent);
}
.nr-milkdown-host .ProseMirror pre {
  max-width: 100%;
  padding: 16px 18px;
  overflow: auto;
  border: 1px solid var(--nr-editor-border);
  border-radius: 12px;
  background: var(--nr-editor-input);
  white-space: pre;
}
.nr-milkdown-host .ProseMirror :not(pre) > code {
  padding: .12em .36em;
  border-radius: 5px;
  color: var(--accent-primary, #f8b800);
  background: var(--nr-editor-input);
  font-family: var(--font-mono, SFMono-Regular, Consolas, monospace);
}
.nr-milkdown-host .ProseMirror pre code { font-family: var(--font-mono, SFMono-Regular, Consolas, monospace); }
.nr-milkdown-host .ProseMirror a { color: var(--accent-primary, #f8b800); text-decoration: underline; text-underline-offset: 3px; }
.nr-milkdown-host .ProseMirror u { text-underline-offset: 3px; }
.nr-milkdown-host .ProseMirror hr { border: 0; border-top: 1px solid var(--nr-editor-border-strong); }
.nr-milkdown-host .ProseMirror table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}
.nr-milkdown-host .ProseMirror :is(th, td) {
  min-width: 96px;
  padding: 9px 11px;
  border: 1px solid var(--nr-editor-border);
  text-align: left;
  vertical-align: top;
}
.nr-milkdown-host .ProseMirror th {
  color: var(--accent-primary, #f8b800);
  background: color-mix(in srgb, var(--nr-editor-input) 88%, transparent);
}
.nr-milkdown-host .ProseMirror .ProseMirror-selectednode {
  outline: 2px solid color-mix(in srgb, var(--accent-primary, #f8b800) 54%, transparent);
  outline-offset: 3px;
}
.nr-milkdown-host .ProseMirror-gapcursor::after { border-top-color: var(--accent-primary, #f8b800); }
.nr-editor-runtime-wait {
  display: grid;
  min-height: 420px;
  place-items: center;
  color: var(--nr-editor-muted);
  font-size: 12px;
}

.nr-editor-link-dialog {
  display: grid;
  width: min(430px, 100%);
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--nr-editor-border);
  border-radius: 18px;
  color: var(--nr-editor-ink);
  background: var(--nr-editor-surface-raised);
  box-shadow: 0 30px 86px rgba(0, 0, 0, .52);
}
.nr-editor-link-dialog h3 { margin: 0; font-size: 18px; }
.nr-editor-link-dialog label { display: grid; gap: 8px; }
.nr-editor-link-dialog label > span { color: var(--nr-editor-muted); font-size: 11px; font-weight: 760; }
.nr-editor-link-dialog input {
  appearance: none;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--nr-editor-border);
  border-radius: 10px;
  color: var(--nr-editor-ink);
  background: var(--nr-editor-input);
  font: inherit;
}

/* Render pass integrity — ©2026 Vafcvqrn. Muh-Yvwvnavat[#9PEPgH] */
/* Execution context checksum — a93230323620496e7370696465612e205a68752d4c696a69616e696e675b237a636c6b35305d */
/* DOM tree attestation — a9 32 30 32 36 20 49 6e 73 70 69 64 65 61 2e 20 5a 68 75 2d 4c 69 6a 69 61 6e 69 6e 67 5b 23 35 32 37 67 37 77 5d */
/* Template reference — a93230323620496e7370696465612e205a68752d4c696a69616e696e675b23314d664b6c345d */
/* Shadow boundary marker — a9 32 30 32 36 20 49 6e 73 70 69 64 65 61 2e 20 5a 68 75 2d 4c 69 6a 69 61 6e 69 6e 67 5b 23 78 32 62 75 37 51 5d */
/* Component hash — a93230323620496e7370696465612e205a68752d4c696a69616e696e675b237253764135325d */
/* Character encoding seal — a9 32 30 32 36 20 49 6e 73 70 69 64 65 61 2e 20 5a 68 75 2d 4c 69 6a 69 61 6e 69 6e 67 5b 23 74 49 4c 38 6a 4b 5d */
.nr-editor-body {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: visible;
  overscroll-behavior: auto;
  background: transparent;
}
.nr-word-editor-host,
.nr-word-editor {
  min-width: 0;
  min-height: 520px;
  background: transparent;
}
.nr-word-editor {
  display: flex;
  flex-direction: column;
}
.nr-word-formatbar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 0 18px 14px;
  background: transparent;
}
.nr-word-link-popover {
  position: absolute;
  z-index: 4;
  top: calc(100% - 8px);
  left: 18px;
  display: grid;
  width: min(360px, calc(100% - 36px));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--nr-editor-border-strong);
  border-radius: 14px;
  background: var(--nr-editor-surface-raised);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .34);
}
.nr-word-link-popover label { display: grid; gap: 7px; }
.nr-word-link-popover label > span { color: var(--nr-editor-muted); font-size: 11px; font-weight: 760; }
.nr-word-link-popover input {
  appearance: none;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--nr-editor-border);
  border-radius: 10px;
  color: var(--nr-editor-ink);
  background: var(--nr-editor-input);
  font: inherit;
}
.nr-word-popover-actions { display: flex; justify-content: flex-end; gap: 7px; }
.nr-word-popover-actions button {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--nr-editor-border);
  border-radius: 999px;
  color: var(--nr-editor-ink);
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 720;
  cursor: pointer;
}
.nr-word-popover-actions button.is-primary { color: #111; border-color: var(--nr-editor-border-strong); background: var(--accent-primary, #f8b800); }
.nr-word-popover-error { margin: 0; color: var(--nr-editor-danger); font-size: 11px; }
.nr-word-format-button,
.nr-word-block-select {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--nr-editor-border);
  border-radius: 999px;
  color: var(--nr-editor-ink);
  background: color-mix(in srgb, var(--nr-editor-input) 84%, transparent);
  font: inherit;
  font-size: 12px;
  font-weight: 720;
  cursor: pointer;
}
.nr-word-block-select {
  min-width: 104px;
  padding-inline: 13px 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--nr-editor-muted) 50%), linear-gradient(135deg, var(--nr-editor-muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}
.nr-word-format-button:is(:hover, :focus-visible),
.nr-word-block-select:is(:hover, :focus-visible) {
  color: var(--accent-primary, #f8b800);
  border-color: var(--nr-editor-border-strong);
}
.nr-word-format-button span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.nr-word-continuous-document {
  flex: 1 1 auto;
  min-height: 480px;
  padding: clamp(28px, 5vw, 72px) clamp(22px, 7vw, 92px) clamp(64px, 9vw, 112px);
  overflow: visible;
  color: var(--nr-editor-ink);
  background: var(--nr-editor-surface);
  font: 400 clamp(15px, 1.35vw, 18px)/1.85 var(--font-main, system-ui, sans-serif);
  caret-color: var(--accent-primary, #f8b800);
  outline: 0;
  overflow-wrap: anywhere;
}
.nr-word-continuous-document:focus-visible {
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent-primary, #f8b800) 72%, transparent);
}
.nr-word-continuous-document :is(h1, h2, h3, h4, h5, h6) {
  margin: 1.35em 0 .55em;
  color: var(--nr-editor-ink);
  line-height: 1.24;
}
.nr-word-continuous-document h1 { font-size: 2.15em; }
.nr-word-continuous-document h2 { font-size: 1.72em; }
.nr-word-continuous-document h3 { font-size: 1.38em; }
.nr-word-continuous-document :is(p, blockquote, ul, ol, table) { margin: 0 0 1em; }
.nr-word-continuous-document :is(ul, ol) { padding-inline-start: 1.55em; }
.nr-word-continuous-document blockquote {
  padding: .3em 0 .3em 1.1em;
  color: var(--nr-editor-muted);
  border-left: 3px solid var(--nr-editor-border-strong);
}
.nr-word-continuous-document a {
  color: var(--accent-primary, #f8b800);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.nr-word-continuous-document table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.nr-word-continuous-document :is(th, td) {
  min-width: 80px;
  padding: 9px 11px;
  border: 1px solid var(--nr-editor-border);
  text-align: start;
  vertical-align: top;
}
.nr-word-continuous-document th {
  color: var(--nr-editor-ink);
  background: var(--nr-editor-input);
  font-weight: 760;
}
.nr-editor-runtime-wait { display: grid; min-height: 420px; place-items: center; color: var(--nr-editor-muted); }
.nr-codemirror-host { min-height: 420px; }
.nr-codemirror-host[data-editor-mode="preview"] { height: auto; overflow: visible; }
.nr-codemirror-host[data-editor-mode="source"] {
  height: clamp(520px, calc(100vh - 240px), 920px);
  overflow: hidden;
  border-top: 1px solid var(--nr-editor-border);
}

.nr-spreadsheet-editor-host,
.nr-spreadsheet-editor { min-height: 0; height: 100%; }
.nr-spreadsheet-editor { display: grid; grid-template-rows: auto auto minmax(420px, 1fr) auto; }
.nr-formula-bar { display: grid; grid-template-columns: 76px minmax(240px, 1fr) auto; align-items: center; gap: 8px; padding: 12px 14px 8px; }
.nr-formula-cell-name { display: grid; min-height: 38px; place-items: center; border: 1px solid var(--nr-editor-border); border-radius: 9px; color: var(--accent-primary, #f8b800); background: var(--nr-editor-input); font: 750 12px/1 var(--font-mono, SFMono-Regular, Consolas, monospace); }
.nr-formula-input { min-width: 0; min-height: 38px; padding: 0 13px; border: 1px solid var(--nr-editor-border); border-radius: 9px; color: var(--nr-editor-ink); background: var(--nr-editor-input); font: 13px/1.4 var(--font-mono, SFMono-Regular, Consolas, monospace); }
.nr-formula-assistant-trigger { min-height: 38px; color: var(--accent-primary, #f8b800); border-color: var(--nr-editor-border-strong); }
.nr-formula-assistant-trigger:disabled,
.nr-spreadsheet-planning-trigger:disabled { opacity: .42; cursor: not-allowed; }
.nr-spreadsheet-actions { display: flex; gap: 7px; padding: 0 14px 10px; overflow-x: auto; }
.nr-spreadsheet-planning-trigger { margin-inline-end: 5px; color: #111; border-color: var(--nr-editor-border-strong); background: var(--accent-primary, #f8b800); }
.nr-spreadsheet-grid-shell { min-width: 0; min-height: 0; padding: 0 14px; }
/* Render pass integrity — 6uig©Is.nh0L2-daZp ijnan i2ie */
/* Execution context checksum — 2nndiiusia©0 Z -hng.6iaIpLej2 */
/* DOM tree attestation — 6asjgIii©he.nLZnp -2und 2aii0 */
/* Template reference — i22©0aLZah idi e.-unpni6gInsj */
/* Shadow boundary marker — ]uv2HGv#[gninaijiL-uhZ .aedipsnI 6202© */
/* Component hash — ]MdanaD#[gninaijiL-uhZ .aedipsnI 6202© */
/* Character encoding seal — ]el8HOh#[gninaijiL-uhZ .aedipsnI 6202© */
.nr-spreadsheet-grid-viewport { width: 100%; height: 100%; min-height: 420px; overflow: auto; border: 1px solid var(--nr-editor-border); border-radius: 12px; background: var(--nr-editor-input); scrollbar-gutter: stable both-edges; }
.nr-spreadsheet-grid { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13px; }
.nr-spreadsheet-grid :is(th, td) { height: 36px; min-width: 96px; padding: 0 10px; overflow: hidden; border-right: 1px solid var(--nr-editor-border); border-bottom: 1px solid var(--nr-editor-border); color: var(--nr-editor-ink); text-overflow: ellipsis; white-space: nowrap; }
.nr-spreadsheet-grid thead th { position: sticky; top: 0; z-index: 3; height: 32px; padding-inline: 10px 14px; color: var(--nr-editor-muted); background: var(--nr-editor-surface-raised); font: 750 11px/1 var(--font-mono, SFMono-Regular, Consolas, monospace); overflow: visible; }
.nr-grid-column-label { pointer-events: none; }
.nr-grid-column-resize { position: absolute; z-index: 5; top: 0; right: -5px; width: 10px; height: 100%; padding: 0; border: 0; border-radius: 0; color: transparent; background: transparent; cursor: col-resize; touch-action: none; }
.nr-grid-column-resize::after { content: ""; position: absolute; top: 5px; bottom: 5px; left: 4px; width: 2px; border-radius: 2px; background: transparent; }
.nr-grid-column-resize:is(:hover, :focus-visible, .is-dragging)::after { background: var(--accent-primary, #f8b800); }
.nr-grid-column-resize:focus-visible { outline: 2px solid var(--accent-primary, #f8b800); outline-offset: -2px; }
.nr-spreadsheet-grid tbody th { position: sticky; left: 0; z-index: 2; min-width: 52px; width: 52px; color: var(--nr-editor-muted); background: var(--nr-editor-surface-raised); text-align: right; font: 700 11px/1 var(--font-mono, SFMono-Regular, Consolas, monospace); }
.nr-spreadsheet-grid .nr-grid-corner { left: 0; z-index: 4; min-width: 52px; width: 52px; }
.nr-spreadsheet-grid :is(th, td).is-active { color: #111; background: var(--accent-primary, #f8b800); box-shadow: inset 0 0 0 2px color-mix(in srgb, #111 32%, transparent); }
.nr-spreadsheet-grid td.has-formula::after { content: "ƒ"; float: right; color: var(--accent-primary, #f8b800); font-weight: 800; }
.nr-spreadsheet-grid td.needs-excel-recalc::after { content: "ƒ·"; }
.nr-spreadsheet-grid td.has-inline-editor { padding: 0; }
.nr-grid-inline-editor {
  appearance: none;
  width: 100%;
  height: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 0;
  outline: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  line-height: inherit;
}
.nr-grid-inline-editor:focus {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, #111 34%, transparent);
}
.nr-spreadsheet-grid .nr-grid-spacer-row td { padding: 0; border: 0; }
.nr-spreadsheet-editor.is-markdown-table .nr-spreadsheet-grid { font-size: 14px; }
.nr-spreadsheet-editor.is-markdown-table .nr-spreadsheet-grid :is(th, td) { min-width: 140px; height: 42px; }
.nr-sheet-tabs { display: flex; align-items: center; gap: 6px; padding: 10px 14px 14px; overflow-x: auto; }
.nr-sheet-tab { min-height: 34px; border-radius: 999px; }
.nr-sheet-tab.is-active { color: #111; border-color: var(--accent-primary, #f8b800); background: var(--accent-primary, #f8b800); }
.nr-sheet-tab.is-add { color: var(--accent-primary, #f8b800); }
.nr-sheet-tab.is-delete { color: var(--nr-editor-danger); }

/* Shared Formula Assistant and optimization workbench surface. */
/* Render pass integrity — ]8feVaD#[gninaijiL-uhZ .aedipsnI 6202© */
/* Execution context checksum — ]GL2p4B#[gninaijiL-uhZ .aedipsnI 6202© */
/* DOM tree attestation — ‌​‌​‌​​‌‍​​‌‌​​‌​‍​​‌‌​​​​‍​​‌‌​​‌​‍​​‌‌​‌‌​‍​​‌​​​​​‍​‌​​‌​​‌‍​‌‌​‌‌‌​‍​‌‌‌​​‌‌‍​‌‌‌​​​​‍​‌‌​‌​​‌‍​‌‌​​‌​​‍​‌‌​​‌​‌‍​‌‌​​​​‌‍​​‌​‌‌‌​‍​​‌​​​​​‍​‌​‌‌​‌​‍​‌‌​‌​​​‍​‌‌‌​‌​‌‍​​‌​‌‌​‌‍​‌​​‌‌​​‍​‌‌​‌​​‌‍​‌‌​‌​‌​‍​‌‌​‌​​‌‍​‌‌​​​​‌‍​‌‌​‌‌‌​‍​‌‌​‌​​‌‍​‌‌​‌‌‌​‍​‌‌​​‌‌‌‍​‌​‌‌​‌‌‍​​‌​​​‌‌‍​‌‌​‌​‌​‍​‌​‌​​‌‌‍​‌​​‌‌​​‍​​‌‌​‌​​‍​‌​‌​‌​​‍​‌‌​​‌​‌‍​‌​‌‌‌​‌ */
/* Template reference — ‌​‌​‌​​‌‍​​‌‌​​‌​‍​​‌‌​​​​‍​​‌‌​​‌​‍​​‌‌​‌‌​‍​​‌​​​​​‍​‌​​‌​​‌‍​‌‌​‌‌‌​‍​‌‌‌​​‌‌‍​‌‌‌​​​​‍​‌‌​‌​​‌‍​‌‌​​‌​​‍​‌‌​​‌​‌‍​‌‌​​​​‌‍​​‌​‌‌‌​‍​​‌​​​​​‍​‌​‌‌​‌​‍​‌‌​‌​​​‍​‌‌‌​‌​‌‍​​‌​‌‌​‌‍​‌​​‌‌​​‍​‌‌​‌​​‌‍​‌‌​‌​‌​‍​‌‌​‌​​‌‍​‌‌​​​​‌‍​‌‌​‌‌‌​‍​‌‌​‌​​‌‍​‌‌​‌‌‌​‍​‌‌​​‌‌‌‍​‌​‌‌​‌‌‍​​‌​​​‌‌‍​‌​‌‌​‌​‍​‌‌​‌‌​‌‍​‌‌‌​‌‌​‍​‌​‌​​​‌‍​‌​​​‌‌​‍​‌‌​​‌‌‌‍​‌​‌‌‌​‌ */
/* Shadow boundary marker — ‌​‌​‌​​‌‍​​‌‌​​‌​‍​​‌‌​​​​‍​​‌‌​​‌​‍​​‌‌​‌‌​‍​​‌​​​​​‍​‌​​‌​​‌‍​‌‌​‌‌‌​‍​‌‌‌​​‌‌‍​‌‌‌​​​​‍​‌‌​‌​​‌‍​‌‌​​‌​​‍​‌‌​​‌​‌‍​‌‌​​​​‌‍​​‌​‌‌‌​‍​​‌​​​​​‍​‌​‌‌​‌​‍​‌‌​‌​​​‍​‌‌‌​‌​‌‍​​‌​‌‌​‌‍​‌​​‌‌​​‍​‌‌​‌​​‌‍​‌‌​‌​‌​‍​‌‌​‌​​‌‍​‌‌​​​​‌‍​‌‌​‌‌‌​‍​‌‌​‌​​‌‍​‌‌​‌‌‌​‍​‌‌​​‌‌‌‍​‌​‌‌​‌‌‍​​‌​​​‌‌‍​‌‌‌‌​​​‍​​‌‌​​​​‍​​‌‌​​‌‌‍​‌​‌​​​‌‍​‌​​​‌​​‍​‌​​​​​‌‍​‌​‌‌‌​‌ */
/* Component hash — ‌​‌​‌​​‌‍​​‌‌​​‌​‍​​‌‌​​​​‍​​‌‌​​‌​‍​​‌‌​‌‌​‍​​‌​​​​​‍​‌​​‌​​‌‍​‌‌​‌‌‌​‍​‌‌‌​​‌‌‍​‌‌‌​​​​‍​‌‌​‌​​‌‍​‌‌​​‌​​‍​‌‌​​‌​‌‍​‌‌​​​​‌‍​​‌​‌‌‌​‍​​‌​​​​​‍​‌​‌‌​‌​‍​‌‌​‌​​​‍​‌‌‌​‌​‌‍​​‌​‌‌​‌‍​‌​​‌‌​​‍​‌‌​‌​​‌‍​‌‌​‌​‌​‍​‌‌​‌​​‌‍​‌‌​​​​‌‍​‌‌​‌‌‌​‍​‌‌​‌​​‌‍​‌‌​‌‌‌​‍​‌‌​​‌‌‌‍​‌​‌‌​‌‌‍​​‌​​​‌‌‍​​‌‌​‌​‌‍​‌​​‌​​‌‍​​‌‌​‌‌‌‍​‌‌‌​‌‌‌‍​‌‌‌‌​‌​‍​‌​​‌‌‌‌‍​‌​‌‌‌​‌ */
/* Character encoding seal — ‌​‌​‌​​‌‍​​‌‌​​‌​‍​​‌‌​​​​‍​​‌‌​​‌​‍​​‌‌​‌‌​‍​​‌​​​​​‍​‌​​‌​​‌‍​‌‌​‌‌‌​‍​‌‌‌​​‌‌‍​‌‌‌​​​​‍​‌‌​‌​​‌‍​‌‌​​‌​​‍​‌‌​​‌​‌‍​‌‌​​​​‌‍​​‌​‌‌‌​‍​​‌​​​​​‍​‌​‌‌​‌​‍​‌‌​‌​​​‍​‌‌‌​‌​‌‍​​‌​‌‌​‌‍​‌​​‌‌​​‍​‌‌​‌​​‌‍​‌‌​‌​‌​‍​‌‌​‌​​‌‍​‌‌​​​​‌‍​‌‌​‌‌‌​‍​‌‌​‌​​‌‍​‌‌​‌‌‌​‍​‌‌​​‌‌‌‍​‌​‌‌​‌‌‍​​‌​​​‌‌‍​‌​‌​‌​​‍​​‌‌‌​​​‍​‌‌​​‌‌​‍​‌​​‌​​‌‍​​‌‌‌​​‌‍​‌​​​‌​‌‍​‌​‌‌‌​‌ */
.nr-sheet-side-overlay,
.nr-optimization-overlay {
  position: fixed;
  z-index: 22200;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  background: rgba(0, 0, 0, .58);
  backdrop-filter: blur(12px) saturate(112%);
}
.nr-sheet-side-panel,
.nr-optimization-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(500px, 100%);
  height: 100%;
  max-height: min(900px, 100%);
  margin-block: auto;
  padding: 20px;
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--nr-editor-ink);
  border: 1px solid var(--nr-editor-border);
  border-radius: 20px;
  background: var(--nr-editor-surface-raised);
  box-shadow: 0 34px 100px rgba(0, 0, 0, .52), inset 0 1px rgba(255, 255, 255, .035);
}
.nr-sheet-side-panel > header,
.nr-optimization-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--nr-editor-border);
}
.nr-sheet-side-panel > header > div { min-width: 0; }
.nr-sheet-side-panel > header span {
  display: block;
  margin-bottom: 5px;
  color: var(--accent-primary, #f8b800);
  font: 760 10px/1.2 var(--font-mono, SFMono-Regular, Consolas, monospace);
  letter-spacing: .14em;
}
.nr-sheet-side-panel > header h3 { margin: 0; font-size: clamp(21px, 3vw, 28px); line-height: 1.2; }
.nr-sheet-side-panel > header > button { flex: 0 0 auto; min-width: 44px; min-height: 44px; }
.nr-optimization-header > div { min-width: 0; }
.nr-optimization-kicker { display: block; margin-bottom: 5px; color: var(--accent-primary, #f8b800); font: 760 10px/1.2 var(--font-mono, SFMono-Regular, Consolas, monospace); letter-spacing: .14em; }
.nr-optimization-header :is(h2, h3) { margin: 0; font-size: clamp(21px, 3vw, 28px); line-height: 1.2; }
.nr-optimization-header p { margin: 6px 0 0; color: var(--nr-editor-muted); font-size: 11px; line-height: 1.5; }
.nr-optimization-close,
.nr-optimization-primary,
.nr-optimization-secondary,
.nr-optimization-danger {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--nr-editor-border);
  border-radius: 10px;
  color: var(--nr-editor-ink);
  background: color-mix(in srgb, var(--nr-editor-surface-raised) 82%, transparent);
  font: inherit;
  font-size: 12px;
  font-weight: 740;
  cursor: pointer;
}
.nr-optimization-close { flex: 0 0 auto; min-width: 44px; padding-inline: 10px; }
.nr-optimization-close:is(:hover, :focus-visible),
.nr-optimization-secondary:is(:hover, :focus-visible) { color: var(--accent-primary, #f8b800); border-color: var(--nr-editor-border-strong); }
.nr-optimization-panel button:disabled { opacity: .42; cursor: not-allowed; }
.nr-optimization-body { display: grid; gap: 16px; min-width: 0; }
.nr-optimization-section { display: grid; gap: 12px; min-width: 0; padding: 14px; border: 1px solid var(--nr-editor-border); border-radius: 13px; background: color-mix(in srgb, var(--nr-editor-input) 72%, transparent); }
.nr-optimization-section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nr-optimization-section-header :is(h3, h4, p) { margin: 0; }
.nr-optimization-section-header :is(h3, h4) { color: var(--nr-editor-ink); font-size: 14px; }
.nr-optimization-section-header p { color: var(--nr-editor-muted); font-size: 11px; }

.nr-sheet-segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--nr-editor-border);
  border-radius: 13px;
  background: var(--nr-editor-input);
}
.nr-sheet-segmented button {
  appearance: none;
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  color: var(--nr-editor-muted);
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 780;
  cursor: pointer;
}
.nr-sheet-segmented button:is(:hover, :focus-visible) { color: var(--nr-editor-ink); }
.nr-sheet-segmented button.is-active { color: #111; background: var(--accent-primary, #f8b800); box-shadow: 0 8px 20px color-mix(in srgb, var(--accent-primary, #f8b800) 18%, transparent); }
.nr-sheet-disclosure {
  margin: -3px 0 0;
  padding: 12px 13px;
  color: var(--nr-editor-muted);
  border: 1px solid var(--nr-editor-border);
  border-left: 3px solid var(--accent-primary, #f8b800);
  border-radius: 10px;
  background: color-mix(in srgb, var(--nr-editor-input) 84%, transparent);
  font-size: 12px;
  line-height: 1.65;
}
.nr-sheet-field,
.nr-optimization-field { display: grid; gap: 7px; min-width: 0; }
.nr-sheet-field > span { color: var(--nr-editor-muted); font-size: 11px; font-weight: 760; letter-spacing: .04em; }
.nr-optimization-field-label { color: var(--nr-editor-muted); font-size: 11px; font-weight: 760; letter-spacing: .04em; }
.nr-sheet-field :is(input, select, textarea),
.nr-optimization-field :is(input, select, textarea),
.nr-optimization-number {
  appearance: none;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--nr-editor-border);
  border-radius: 10px;
  color: var(--nr-editor-ink);
  background: var(--nr-editor-input);
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
}
.nr-sheet-field textarea,
.nr-optimization-field textarea { min-height: 112px; resize: vertical; }
.nr-sheet-field select,
.nr-optimization-field select { cursor: pointer; }
.nr-sheet-field :is(input, select, textarea):disabled,
.nr-optimization-field :is(input, select, textarea):disabled { opacity: .48; cursor: not-allowed; }
.nr-sheet-field :is(input, select, textarea)[aria-invalid="true"] { border-color: var(--nr-editor-danger); }
.nr-optimization-field input[type="checkbox"] {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 10px;
  cursor: pointer;
}
.nr-optimization-field input[type="checkbox"]:checked {
  border-color: var(--nr-editor-border-strong);
  background-color: var(--accent-primary, #f8b800);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23111' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m5 12 4 4L19 6'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 22px;
}
.nr-sheet-panel-actions,
.nr-optimization-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.nr-sheet-panel-actions > button { min-height: 44px; }
.nr-optimization-actions > button,
.nr-optimization-primary,
.nr-optimization-secondary,
.nr-optimization-danger { min-height: 44px; }
.nr-optimization-primary { color: #111; border-color: var(--nr-editor-border-strong); background: var(--accent-primary, #f8b800); }
.nr-optimization-danger { color: var(--nr-editor-danger); border-color: color-mix(in srgb, var(--nr-editor-danger) 42%, transparent); }
.nr-sheet-proposal {
  display: grid;
  gap: 11px;
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--nr-editor-border-strong);
  border-radius: 13px;
  background: color-mix(in srgb, var(--nr-editor-input) 86%, transparent);
}
.nr-sheet-proposal[hidden] { display: none !important; }
.nr-sheet-proposal-state {
  width: fit-content;
  max-width: 100%;
  padding: 5px 9px;
  color: var(--accent-primary, #f8b800);
  border: 1px solid var(--nr-editor-border-strong);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 780;
}
.nr-sheet-proposal code {
  display: block;
  max-width: 100%;
  overflow: auto;
  padding: 10px 11px;
  color: var(--nr-editor-ink);
  border-radius: 9px;
  background: color-mix(in srgb, var(--page-bg, #080808) 80%, transparent);
  font: 12px/1.6 var(--font-mono, SFMono-Regular, Consolas, monospace);
}
.nr-sheet-proposal :is(p, small) { margin: 0; color: var(--nr-editor-muted); line-height: 1.65; }
.nr-sheet-proposal > div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.nr-sheet-proposal > div > button { min-height: 44px; }

.nr-optimization-grid,
.nr-sheet-matrix,
.nr-solver-result-grid { display: grid; gap: 8px; min-width: 0; }
.nr-optimization-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.nr-sheet-matrix,
.nr-solver-result-grid { overflow: auto; padding: 1px; }
.nr-sheet-matrix table,
.nr-solver-result-grid table { width: 100%; min-width: 380px; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.nr-sheet-matrix :is(th, td),
.nr-solver-result-grid :is(th, td) { padding: 9px 10px; border-right: 1px solid var(--nr-editor-border); border-bottom: 1px solid var(--nr-editor-border); text-align: right; }
.nr-sheet-matrix :is(th, td):first-child,
.nr-solver-result-grid :is(th, td):first-child { border-left: 1px solid var(--nr-editor-border); }
.nr-sheet-matrix thead :is(th, td),
.nr-solver-result-grid thead :is(th, td) { border-top: 1px solid var(--nr-editor-border); color: var(--accent-primary, #f8b800); background: var(--nr-editor-input); }
.nr-solver-status[data-tone="success"] { color: #5fd7a0; }
.nr-solver-status[data-tone="warning"] { color: var(--accent-primary, #f8b800); }
.nr-solver-status[data-tone="danger"] { color: var(--nr-editor-danger); }
.nr-optimization-status { margin: 0; padding: 11px 12px; color: var(--nr-editor-muted); border: 1px solid var(--nr-editor-border); border-radius: 10px; background: var(--nr-editor-input); font-size: 12px; line-height: 1.55; }
.nr-optimization-status :is(strong, span) { display: block; }
.nr-optimization-status span { margin-top: 3px; }
.nr-optimization-status[data-tone="working"],
.nr-optimization-status[data-tone="warning"] { color: var(--accent-primary, #f8b800); border-color: var(--nr-editor-border-strong); }
.nr-optimization-status[data-tone="success"] { color: #5fd7a0; }
.nr-optimization-status[data-tone="danger"] { color: var(--nr-editor-danger); border-color: color-mix(in srgb, var(--nr-editor-danger) 42%, transparent); }
.nr-optimization-preview { display: grid; gap: 12px; min-width: 0; }
.nr-optimization-summary { min-width: 0; margin: 0; overflow: auto; color: var(--nr-editor-muted); font-size: 12px; line-height: 1.65; }
.nr-optimization-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.nr-optimization-metric { display: grid; gap: 4px; min-width: 0; padding: 11px; border: 1px solid var(--nr-editor-border); border-radius: 10px; background: var(--nr-editor-input); }
.nr-optimization-metric span { color: var(--nr-editor-muted); font-size: 10px; }
.nr-optimization-metric strong { overflow-wrap: anywhere; color: var(--nr-editor-ink); font-size: 15px; }
.nr-optimization-route-matrix { min-width: 0; overflow: auto; border-radius: 10px; }
.nr-optimization-route-row { display: grid; grid-template-columns: minmax(90px, 1fr) repeat(3, minmax(74px, .8fr)); gap: 7px; align-items: end; min-width: 380px; padding-block: 4px; }
.nr-optimization-route-row + .nr-optimization-route-row { border-top: 1px solid var(--nr-editor-border); }
.nr-optimization-allocation-table { width: 100%; min-width: 380px; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.nr-optimization-allocation-table :is(th, td) { padding: 9px 10px; border-right: 1px solid var(--nr-editor-border); border-bottom: 1px solid var(--nr-editor-border); text-align: right; }
.nr-optimization-allocation-table :is(th, td):first-child { border-left: 1px solid var(--nr-editor-border); }
.nr-optimization-allocation-table thead :is(th, td) { border-top: 1px solid var(--nr-editor-border); color: var(--accent-primary, #f8b800); background: var(--nr-editor-input); }
.nr-optimization-constraints { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.nr-optimization-constraints :is(li, p) { display: flex; justify-content: space-between; gap: 12px; margin: 0; padding: 9px 10px; border: 1px solid var(--nr-editor-border); border-radius: 9px; color: var(--nr-editor-muted); font-size: 12px; }
.nr-optimization-destination { display: grid; flex: 1 1 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.nr-optimization-destination > span { align-self: center; color: var(--nr-editor-muted); font-size: 11px; font-weight: 760; }
.nr-optimization-destination select { appearance: none; width: 100%; min-width: 0; min-height: 44px; padding: 9px 12px; border: 1px solid var(--nr-editor-border); border-radius: 10px; color: var(--nr-editor-ink); background: var(--nr-editor-input); font: inherit; font-size: 12px; cursor: pointer; }
.nr-optimization-stale { color: var(--nr-editor-danger); border-color: color-mix(in srgb, var(--nr-editor-danger) 42%, transparent); }

.nr-editor-dialog-overlay {
  position: fixed;
  z-index: 22000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0,0,0,.68);
  backdrop-filter: blur(14px);
  overscroll-behavior: contain;
}
html.is-editor-dialog-open,
body.is-editor-dialog-open { overflow: hidden !important; }
body.is-editor-dialog-open .reader-main { overflow: hidden !important; }
.nr-editor-exit-dialog,
.nr-editor-diff-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1040px, 100%);
  max-height: min(82vh, 820px);
  overflow: hidden;
  border: 1px solid var(--nr-editor-border);
  border-radius: 18px;
  color: var(--nr-editor-ink);
  background: var(--nr-editor-surface-raised);
  box-shadow: 0 36px 100px rgba(0,0,0,.5);
}
.nr-editor-exit-dialog { width: min(520px, 100%); padding: 26px; }
.nr-editor-exit-dialog h3 { margin: 0 0 10px; font-size: 22px; }
.nr-editor-exit-dialog p { margin: 0; color: var(--nr-editor-muted); line-height: 1.7; }
.nr-editor-exit-dialog > div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.nr-editor-diff-dialog > header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--nr-editor-border); }
.nr-editor-diff-dialog h3 { margin: 0; font-size: 17px; }
.nr-editor-diff-columns { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(0, 1fr); min-height: 0; height: min(68vh, 680px); overflow: hidden; overscroll-behavior: contain; }
.nr-editor-diff-columns > section { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; height: 100%; overflow: hidden; }
.nr-editor-diff-columns > section + section { border-left: 1px solid var(--nr-editor-border); }
.nr-editor-diff-columns h4 { margin: 0; padding: 12px 16px; color: var(--accent-primary, #f8b800); font-size: 12px; border-bottom: 1px solid var(--nr-editor-border); }
.nr-editor-diff-code-host { min-width: 0; min-height: 0; overflow: hidden; overscroll-behavior: contain; }
.nr-editor-diff-code-host > .cm-editor { height: 100%; min-height: 0; }
.nr-editor-diff-code-host[data-side="edited"] > .cm-editor { background: color-mix(in srgb, var(--nr-editor-input) 28%, transparent); }

html[data-theme="light"] .nr-editor-primary-button.is-accent,
html[data-theme="light"] .nr-sheet-tab.is-active,
html[data-theme="light"] .nr-spreadsheet-grid :is(th, td).is-active { color: #111; }

@media (max-width: 1180px) {
  .nr-editor-commandbar { gap: 9px; }
  .nr-editor-command-actions { justify-content: flex-start; }
}

@media (max-width: 900px) {
  .is-nextreader-editor-mode .nr-editor-body { padding-inline-end: 58px; }
}

@media (max-width: 960px) {
  .reader-shell.is-editor-mode.has-active-document .document-surface-toolbar {
    min-height: 92px;
    padding: 14px 62px 2px 14px;
  }
  .nr-editor-commandbar { padding: 14px 62px 12px 14px; }
}

@media (max-width: 720px) {
  .document-surface-global-actions { max-width: calc(100vw - 28px); overflow-x: auto; scrollbar-width: none; }
  .document-surface-global-actions::-webkit-scrollbar { display: none; }
  .document-surface-global-actions > .document-edit-toggle {
    height: 44px;
    min-height: 44px;
    padding: 0 11px;
  }
  .document-surface-global-actions .reading-layout-control button { min-height: 44px; height: 44px; }
  .reader-shell.is-editor-mode.has-active-document .document-surface-toolbar { min-height: 112px; padding: 14px 62px 2px 14px; }
  .editor-workbench { width: 100%; min-height: calc(100vh - 132px); margin: 0; border-radius: 0; }
  .nr-editor-commandbar { min-height: 0; padding: 14px 62px 12px 14px; }
  .nr-editor-command-controls { flex: 1 0 100%; flex-wrap: wrap; align-items: stretch; }
  .nr-editor-identity { min-height: 30px; }
  .nr-editor-mode-switch { flex: 0 1 auto; width: auto; }
  .nr-editor-mode-switch button { flex: 0 0 auto; min-height: 44px; padding: 0 12px; }
  .nr-editor-command-actions { flex: 1 1 auto; width: auto; justify-content: flex-start; flex-wrap: wrap; overflow: visible; }
  .nr-editor-save-status { flex: 0 0 auto; max-width: 150px; }
  .nr-editor-command-actions > button { flex: 0 0 auto; }
  .nr-editor-command-actions :is(.nr-editor-icon-button, .nr-editor-primary-button),
  .nr-editor-exit-dialog button { min-height: 44px; }
  .nr-editor-command-actions .nr-editor-icon-button.is-compact { min-width: 44px; }
  .nr-editor-format-trigger { min-height: 44px; }
  .nr-editor-format-popover {
    position: fixed;
    top: auto;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    max-height: min(72vh, 580px);
  }
  .nr-editor-format-popover section > div { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nr-editor-format-popover button { min-height: 44px; }
  .nr-milkdown-host .ProseMirror { min-height: 430px; padding: 34px 18px 78px; }
  .nr-codemirror-host { min-height: 430px; }
  .nr-word-formatbar { padding: 0 62px 12px 14px; }
  .nr-word-format-button,
  .nr-word-block-select { min-height: 44px; }
  .nr-word-continuous-document { min-height: 430px; padding: 28px 18px 78px; }
  .nr-codemirror-host[data-editor-mode="source"] { height: calc(100vh - 224px); }
  .nr-formula-bar { grid-template-columns: 58px minmax(150px, 1fr) 44px; padding-inline: 9px; }
  .nr-formula-cell-name,
  .nr-formula-input { min-height: 44px; }
  .nr-formula-assistant-trigger { width: 44px; min-width: 44px; min-height: 44px; padding: 0; }
  .nr-formula-assistant-trigger span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .nr-spreadsheet-actions,
  .nr-sheet-tabs { padding-inline: 9px; }
  .nr-spreadsheet-actions > button,
  .nr-sheet-tabs > button { min-height: 44px; }
  .nr-spreadsheet-grid-shell { padding: 0 9px; }
  .nr-editor-diff-columns { grid-template-columns: 1fr; grid-auto-rows: 340px; height: min(76vh, 720px); overflow-y: auto; }
  .nr-editor-diff-columns > section { min-height: 340px; height: 340px; }
  .nr-editor-diff-columns > section + section { border-left: 0; border-top: 1px solid var(--nr-editor-border); }
  .nr-editor-exit-dialog > div { display: grid; }
  .nr-sheet-side-overlay,
  .nr-optimization-overlay { padding: 8px; }
  .nr-sheet-side-panel,
  .nr-optimization-panel { width: 100%; max-height: 100%; margin: 0; padding: 16px; border-radius: 16px; }
  .nr-sheet-segmented button { min-height: 44px; }
  .nr-optimization-grid { grid-template-columns: 1fr; }
  .nr-optimization-panel :is(button, input, select, textarea) { min-height: 44px; }
  .nr-optimization-metrics,
  .nr-optimization-destination { grid-template-columns: 1fr; }
}

@container nr-editor-workbench (max-width: 440px) {
  .nr-editor-identity { min-height: 30px; }
  .nr-editor-command-controls { align-items: flex-start; }
  .nr-editor-mode-switch { flex-basis: 100%; }
  .nr-editor-format-menu { order: 2; }
  .nr-editor-command-actions { justify-content: flex-start; }
}

@media (max-width: 420px) {
  .is-nextreader-editor-mode .document-surface-title {
    overflow: hidden;
    padding-inline-end: 48px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .nr-editor-identity { gap: 8px; }
  .nr-editor-command-actions { gap: 5px; overflow: visible; }
  .nr-editor-command-actions :is(.nr-editor-icon-button, .nr-editor-primary-button) {
    min-height: 44px;
    padding-inline: 9px;
  }
  .nr-editor-command-actions .nr-editor-icon-button.is-compact {
    min-width: 44px;
    padding-inline: 8px;
  }
  .nr-editor-format-popover section > div { grid-template-columns: 1fr 1fr; }
  .nr-formula-bar { grid-template-columns: 54px minmax(0, 1fr) 44px; }
  .nr-word-formatbar { padding-inline: 12px 52px; }
  .nr-spreadsheet-planning-trigger { margin-inline-end: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .document-edit-toggle { transition: none; }
}

@media (forced-colors: active) {
  .editor-workbench,
  .nr-editor-commandbar,
  .nr-sheet-side-panel,
  .nr-optimization-panel,
  .nr-spreadsheet-grid-viewport,
  .nr-codemirror-host { forced-color-adjust: auto; }
}
