/* Generated from Notipad Electron rich editor CSS. Do not add web preview styling here. */

/* Source of truth: Notipad desktop editor CSS. Regenerate with npm run sync:editor-renderer. */



/* Source: src\src\core\editor-surface.styles.css */
:root {
  --editor-reading-column-target: 920px;
  --editor-reading-padding-inline-max: 72px;
  --editor-reading-padding-block: clamp(14px, 2.4vw, 28px);
  --editor-reading-padding-inline: clamp(
    10px,
    calc((100% - var(--editor-reading-column-target)) / 2),
    var(--editor-reading-padding-inline-max)
  );
  --editor-scrollbar-thumb: rgba(212, 212, 212, 0.2);
  --editor-scrollbar-thumb-hover: rgba(212, 212, 212, 0.32);
}

.editor-preview-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
}

.editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: #1e1e1e;
  min-width: 0;
  min-height: 0;
  --document-outline-width: 248px;
  --document-outline-height: 220px;
  --style-panel-width: 328px;
  --style-panel-height: 300px;
  --editor-side-panel-width: 0px;
  --editor-bottom-panel-height: 0px;
  --editor-reading-column-target: 920px;
  --editor-reading-padding-inline-max: 72px;
  --editor-reading-padding-block: clamp(14px, 2.4vw, 28px);
}

.editor-panel.has-document-outline {
  --editor-side-panel-width: var(--document-outline-width);
  --editor-reading-column-target: 780px;
  --editor-reading-padding-inline-max: 28px;
  --editor-reading-padding-block: clamp(12px, 2vw, 20px);
}

.editor-panel.has-style-panel-docked {
  --editor-side-panel-width: var(--style-panel-width);
  --editor-reading-column-target: 780px;
  --editor-reading-padding-inline-max: 28px;
  --editor-reading-padding-block: clamp(12px, 2vw, 20px);
}

.editor-panel:is(.has-document-outline, .has-style-panel-docked) .editor-corner-bookmark-actions {
  width: calc(100% - var(--editor-side-panel-width) - 24px);
}

.editor-panel:is(.has-document-outline, .has-style-panel-docked) :is(textarea.editor, .rich-editor, .editor-highlight, .editor-image-viewer) {
  width: calc(100% - var(--editor-side-panel-width));
  max-width: calc(100% - var(--editor-side-panel-width));
  align-self: flex-start;
}

.editor-corner-bookmark-actions {
  position: sticky;
  top: 12px;
  z-index: 5;
  display: flex;
  align-self: stretch;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 6px;
  width: calc(100% - 24px);
  height: 0;
  margin: 0 12px;
  white-space: nowrap;
  overflow: visible;
  isolation: isolate;
  pointer-events: none;
}

.editor-corner-bookmark-actions > * {
  pointer-events: auto;
}

.editor-corner-tag-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

.editor-corner-bookmark-btn,
.editor-corner-bookmark-tag-btn {
  position: relative;
}

.editor-corner-document-outline-btn {
  position: relative;
  top: auto;
  right: auto;
  z-index: 1;
}

.editor-corner-bookmark-btn,
.editor-corner-bookmark-tag-btn,
.editor-bookmark-tag-inline {
  z-index: 1;
}

.editor-corner-document-outline-btn[aria-pressed='true'] {
  background: rgba(70, 126, 199, 0.14) !important;
  border-color: rgba(107, 156, 226, 0.36) !important;
  color: #b7d5ff !important;
}

.editor-corner-mode-toggle-btn {
  position: relative;
  height: var(--app-icon-button-size, 32px);
}

.bookmark-tag-action-btn {
  --bookmark-tag-color: transparent;
}

.bookmark-tag-indicator {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  border: 1px solid rgba(18, 19, 24, 0.9);
  background: transparent;
  opacity: 0;
  pointer-events: none;
}

.bookmark-tag-action-btn.is-assigned {
  background: rgba(70, 126, 199, 0.14) !important;
  border-color: rgba(107, 156, 226, 0.36) !important;
  color: #b7d5ff !important;
}

.bookmark-tag-action-btn.is-assigned .bookmark-tag-indicator {
  opacity: 1;
  background: var(--bookmark-tag-color, #6b9ce2);
}

.editor-bookmark-tag-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: min(420px, calc(100% - 12px));
  margin-left: 2px;
  padding: 3px 6px;
  border: 1px solid rgba(62, 62, 66, 0.95);
  border-radius: 8px;
  background: rgba(24, 25, 30, 0.96);
  overflow: hidden;
}

.editor-bookmark-tag-select-row,
.editor-bookmark-tag-create-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.editor-bookmark-tag-select,
.editor-bookmark-tag-input,
.editor-bookmark-tag-color {
  height: 24px;
  border: 1px solid #3e3e42;
  border-radius: 5px;
  background: #1f2025;
  color: #d4d4d4;
}

.editor-bookmark-tag-select {
  width: 150px;
  padding: 0 6px;
}

.editor-bookmark-tag-input {
  width: 110px;
  padding: 0 6px;
}

.editor-bookmark-tag-color {
  width: 28px;
  padding: 1px;
}

.editor-bookmark-tag-back-btn,
.editor-bookmark-tag-open-create-btn,
.editor-bookmark-tag-submit-btn {
  width: 24px !important;
  min-width: 24px !important;
  height: 24px !important;
}

.editor-panel.is-collapsed {
  display: none;
}

.editor-toolbar {
  flex: 0 0 auto;
  border-bottom: 1px solid #3e3e42;
  overflow: visible;
  position: relative;
  z-index: 8;
}

:is(.editor-toolbar, .editor-context-menu) .icon-btn:not(.icon-btn-text) {
  width: var(--app-icon-button-size, 32px);
  min-width: var(--app-icon-button-size, 32px);
  height: var(--app-icon-button-size, 32px);
  padding: 0;
  background: transparent !important;
  border: 1px solid transparent !important;
  border-radius: var(--app-icon-button-radius, 6px);
  color: var(--app-icon-color, #d4d4d4);
}

:is(.editor-toolbar, .editor-context-menu) .icon-btn:not(.icon-btn-text):hover {
  background: var(--app-icon-btn-hover-bg, #3a3d44) !important;
  border-color: var(--app-icon-btn-hover-border, #5a6170) !important;
  color: var(--app-icon-hover-color, #ffffff);
}

:is(.editor-toolbar, .editor-context-menu) .icon-btn:not(.icon-btn-text):active {
  background: var(--app-icon-btn-bg, #2d2d30) !important;
  border-color: var(--app-icon-btn-border, #3e3e42) !important;
  color: var(--app-icon-hover-color, #ffffff);
}

:is(.editor-toolbar, .editor-context-menu) .icon-btn:not(.icon-btn-text):focus-visible {
  background: transparent !important;
  border-color: var(--app-icon-btn-hover-border, #5a6170) !important;
  box-shadow: 0 0 0 2px rgba(90, 97, 112, 0.22);
  color: var(--app-icon-hover-color, #ffffff);
}

:is(.editor-toolbar, .editor-context-menu) :is(.icon-btn:not(.icon-btn-text) i, .btn-icon) {
  font-size: var(--app-icon-size, 14px);
}

:is(.editor-toolbar, .editor-context-menu) .toolbar-separator {
  height: 16px;
}

.editor-mode-toggle-footer {
  width: 100%;
  flex: 0 0 auto;
  border-radius: 0;
  border-top: 1px solid #3e3e42;
  border-bottom: 0;
  border-left: 0;
  border-right: 0;
  background: var(--app-button-bg, #0e639c);
  opacity: 0.7;
  min-height: 40px;
  font-family: var(--app-primary-button-font-family, 'Noto Sans', sans-serif);
  font-weight: var(--app-primary-button-font-weight, 200);
  font-size: var(--app-primary-button-font-size, 12px);
}

.editor-mode-toggle-footer:hover,
.editor-mode-toggle-footer:active {
  opacity: 0.7;
}

.editor {
  flex: 1;
  background: #1e1e1e;
  color: #d4d4d4;
  border: none;
  padding: 15px;
  font-family: 'JetBrains Mono', 'JetBrains Mono', Consolas, Monaco, 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  outline: none;
  tab-size: 2;
}

.editor.mode-hidden {
  display: none;
}

.editor::placeholder {
  color: #555;
  opacity: 0.7;
}

textarea.editor {
  width: 100%;
  box-sizing: border-box;
  padding-top: var(--editor-reading-padding-block);
  padding-bottom: var(--editor-reading-padding-block);
  padding-left: var(--editor-reading-padding-inline);
  padding-right: var(--editor-reading-padding-inline);
  padding-block: var(--editor-reading-padding-block);
  padding-inline: var(--editor-reading-padding-inline);
}

.rich-editor {
  flex: 1;
  width: 100%;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  white-space: normal;
  word-break: break-word;
  line-height: 1.6;
  font-family: 'Inter', sans-serif;
  background: transparent;
  color: #d4d4d4;
  caret-color: #d4d4d4;
  cursor: text;
}

.rich-editor:focus {
  outline: none;
}

:is(textarea.editor, .rich-editor) {
  padding-top: var(--editor-reading-padding-block);
  padding-bottom: var(--editor-reading-padding-block);
  padding-left: var(--editor-reading-padding-inline);
  padding-right: var(--editor-reading-padding-inline);
  padding-block: var(--editor-reading-padding-block);
  padding-inline: var(--editor-reading-padding-inline);
}

:is(textarea.editor, .rich-editor) {
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 212, 212, 0.22) transparent;
  scrollbar-gutter: stable;
}

:is(textarea.editor, .rich-editor)::-webkit-scrollbar {
  width: 6px;
}

:is(textarea.editor, .rich-editor)::-webkit-scrollbar-track {
  background: transparent;
}

:is(textarea.editor, .rich-editor)::-webkit-scrollbar-thumb {
  background: var(--editor-scrollbar-thumb);
}

:is(textarea.editor, .rich-editor)::-webkit-scrollbar-thumb:hover {
  background: var(--editor-scrollbar-thumb-hover);
}

.rich-editor:empty::before {
  content: "Escribe tu contenido aqui...";
  color: #555;
  opacity: 0.7;
}

.rich-editor[contenteditable='false'] {
  pointer-events: auto;
  opacity: 1;
  cursor: default;
  user-select: text;
}

.rich-editor p {
  margin: 0 0 0.9em 0;
}

/* Source: src\styles\editor\mermaid-render-presets.css */
/* Shared Mermaid render presets for editor, preview, and web reader output. */

:root,
.rich-editor,
.rendered-markdown,
.notipad-document-embed,
[data-mermaid-render-preset="transparent"] {
  --notipad-mermaid-container-bg: transparent;
  --notipad-mermaid-container-border: transparent;
  --notipad-mermaid-container-shadow: none;
  --notipad-mermaid-container-min-height: 360px;
  --notipad-mermaid-svg-min-width: 720px;
  --notipad-mermaid-svg-bg: transparent;
  --notipad-mermaid-external-text-color: #eef4fb;
  --notipad-mermaid-external-line-color: #a7b8cc;
  --notipad-mermaid-wardley-grid-color: #6d839e;
  --notipad-mermaid-edge-label-bg: #202b38;
  --notipad-mermaid-cluster-bg: #2d3b4d;
  --notipad-mermaid-cluster-border: #7c93ad;
  --notipad-mermaid-node-bg: #243447;
  --notipad-mermaid-node-border: #6f8bb0;
  --notipad-mermaid-node-text-color: #eef4fb;
}

/* Source: src\styles\editor\rich-editor.css */
/* Rich editor block and editing affordance styles extracted from styles/editor.css. */

.rich-editor img {
  display: block;
  max-width: 100%;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
  border-radius: 4px;
  margin: 10px 0;
}

.rich-editor .rich-image-wrap {
  position: relative;
  display: block;
  max-width: var(--rich-image-max-width, 100%);
  width: var(--rich-image-wrap-width, fit-content);
  max-height: 100%;
  padding-top: 34px;
  vertical-align: top;
  user-select: text;
}

.rich-editor .rich-image-wrap > img {
  width: auto !important;
  max-width: 100%;
  height: auto !important;
  margin: 10px 0;
  filter: var(--rich-image-filter, none);
  user-select: auto;
  -webkit-user-drag: none;
}

.rich-editor .rich-image-toolbar {
  padding: 0;
  gap: 4px;
  z-index: 20;
}

.rich-editor[contenteditable='false'] .rich-image-toolbar {
  display: none;
}

.rich-editor .rich-image-wrap:hover > .rich-image-toolbar,
.rich-editor .rich-image-wrap:focus-within > .rich-image-toolbar,
.rich-editor .rich-image-wrap.is-editing > .rich-image-toolbar {
  opacity: 1;
  pointer-events: auto;
}

.rich-editor .rich-image-select {
  height: 26px;
  width: auto;
  min-width: 0;
  max-width: none;
  flex: 0 0 auto;
  margin: 0;
  padding: 0 18px 0 6px;
  border-radius: 6px;
  border: 1px solid #3e3e42;
  background: #1f2025 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E") no-repeat right 6px center;
  color: #d4d4d4;
  font-size: 12px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.rich-editor .rich-image-size-select {
  padding-right: 16px;
  padding-left: 4px;
  text-align: center;
  background-position: right 5px center;
}

.rich-editor .rich-image-select:hover {
  border-color: #515866;
  background-color: #262933;
}

.rich-editor .rich-image-select:focus-visible {
  outline: 1px solid #007acc;
  outline-offset: -1px;
}

.rich-editor .rich-image-select.is-locked {
  opacity: 0.7;
  border-style: dashed;
}

.rich-editor .rich-image-select:disabled {
  cursor: not-allowed;
}

.rich-editor ul,
.rich-editor ol {
  margin: 0 0 0.9em 1.5em;
}

.rich-editor li.task-list-item {
  list-style: none;
}

.rich-editor li.task-list-item > input[type='checkbox'] {
  margin: 0 0.55em 0 0;
  vertical-align: text-top;
  pointer-events: none;
}

/* Source: src\styles\editor\rich-editor-columns.css */
/* Rich editor columns */
.rich-editor .md-columns {
  --md-columns-count: 2;
  display: grid;
  grid-template-columns: repeat(var(--md-columns-count), minmax(0, 1fr));
  gap: 16px;
  align-items: start;
  margin: 16px 0;
}

.rich-editor .md-column {
  min-width: 0;
}

.rich-editor .md-column[contenteditable="true"] {
  padding: 8px;
  border-radius: 4px;
  border: 1px solid transparent;
  outline: none;
}

.rich-editor .md-column[contenteditable="true"]:focus {
  border-color: #3e3e42;
}

.rich-editor .md-column > :first-child {
  margin-top: 0;
}

.rich-editor .md-column > :last-child {
  margin-bottom: 0;
}

.rich-editor .rich-columns-wrap {
  position: relative;
  margin: 20px 0;
}

.rich-editor .rich-columns-count-btn {
  width: auto;
  min-width: 28px;
  padding: 0 6px;
}

.rich-editor .rich-columns-count-btn .columns-count-icon {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 28px;
}

.rich-editor .rich-columns-count-btn .col-bar {
  display: block;
  width: 3px;
  height: 14px;
  border-radius: 1px;
  background: currentColor;
}

@media (hover: hover) {
  .rich-editor .rich-columns-wrap > .rich-block-toolbar {
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
  }
  .rich-editor .rich-columns-wrap:hover > .rich-block-toolbar {
    opacity: 1;
    pointer-events: auto;
  }
}

/* Source: src\styles\editor\rich-editor-block-toolbar.css */
/* Generic block toolbar (tables, details) */
.rich-editor .rich-block-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 20;
  max-width: 100%;
  flex-wrap: wrap;
}

@media (hover: hover) {
  .rich-editor .rich-block-toolbar {
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
  }
  .rich-editor .rich-table-wrap:hover > .rich-block-toolbar,
  .rich-editor .rich-table-wrap:focus-within > .rich-block-toolbar,
  .rich-editor .rich-table-wrap.is-panel-open > .rich-block-toolbar,
  .rich-editor .rich-image-wrap:hover > .rich-block-toolbar,
  .rich-editor .rich-image-wrap:focus-within > .rich-block-toolbar,
  .rich-editor .rich-image-wrap.is-editing > .rich-block-toolbar,
  .rich-editor .rich-object-tree-wrap:hover > .rich-block-toolbar,
  .rich-editor .rich-object-tree-wrap:focus-within > .rich-block-toolbar,
  .rich-editor details.md-collapsible:hover > .rich-block-toolbar {
    opacity: 1;
    pointer-events: auto;
  }
}

/* Alert wrap: split layout (alert left, editor panel right) */
/* Alert wrap: toolbar floats above the blockquote */
.rich-editor .rich-alert-wrap {
  position: relative;
  margin: 16px 0;
  padding-top: 38px;
}

.rich-editor .rich-alert-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 20;
  max-width: 100%;
  flex-wrap: wrap;
}

@media (hover: hover) {
  .rich-editor .rich-alert-toolbar {
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
  }
  .rich-editor .rich-alert-wrap:hover > .rich-alert-toolbar,
  .rich-editor .rich-alert-wrap:focus-within > .rich-alert-toolbar,
  .rich-editor .rich-alert-wrap.is-editing > .rich-alert-toolbar {
    opacity: 1;
    pointer-events: auto;
  }
}

.rich-editor .rich-alert-wrap > blockquote.md-alert {
  margin: 0;
}

/* Alert visual styles in rich editor (mirrored from .rendered-markdown) */
.rich-editor blockquote.md-alert {
  padding: 12px 14px;
  border-left-width: 4px;
  border-left-style: solid;
  border-radius: 8px;
  font-style: normal;
  color: #d4d4d4;
}

.rich-editor .md-alert-title {
  display: flex;
  align-items: center;
  margin: 0 0 8px 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}

.rich-editor blockquote.md-alert > p {
  margin: 6px 0;
}

.rich-editor blockquote.md-alert > :last-child {
  margin-bottom: 0;
}

.rich-editor blockquote.md-alert-note {
  border-left-color: #539bf5;
  background: rgba(83, 155, 245, 0.08);
}
.rich-editor blockquote.md-alert-note .md-alert-title { color: #539bf5; }

.rich-editor blockquote.md-alert-info {
  border-left-color: #0ea5e9;
  background: rgba(14, 165, 233, 0.1);
}
.rich-editor blockquote.md-alert-info .md-alert-title { color: #0ea5e9; }

.rich-editor blockquote.md-alert-tip {
  border-left-color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
}
.rich-editor blockquote.md-alert-tip .md-alert-title { color: #22c55e; }

.rich-editor blockquote.md-alert-warning {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}
.rich-editor blockquote.md-alert-warning .md-alert-title { color: #f59e0b; }

.rich-editor blockquote.md-alert-important {
  border-left-color: #f97316;
  background: rgba(249, 115, 22, 0.1);
}
.rich-editor blockquote.md-alert-important .md-alert-title { color: #f97316; }

.rich-editor blockquote.md-alert-caution {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}
.rich-editor blockquote.md-alert-caution .md-alert-title { color: #ef4444; }

.rich-editor blockquote.md-alert-success {
  border-left-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}
.rich-editor blockquote.md-alert-success .md-alert-title { color: #10b981; }

.rich-editor .rich-alert-type-select {
  height: 26px;
  padding: 0 24px 0 8px;
  border-radius: 6px;
  border: 1px solid #3e3e42;
  background: #1f2025 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E") no-repeat right 8px center;
  color: #d4d4d4;
  font-size: 12px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.rich-editor .rich-alert-type-select:hover {
  border-color: #515866;
  background-color: #262933;
}

.rich-editor .rich-alert-type-select:focus {
  outline: 1px solid #007acc;
  outline-offset: -1px;
}

/* Alert: source editor below */
.rich-editor .rich-alert-source-editor {
  padding: 8px 10px;
  border-top: 1px solid #3e3e42;
  background: rgba(31, 32, 37, 0.96);
  margin-top: 4px;
  border-radius: 0 0 8px 8px;
}

.rich-editor .rich-alert-source-editor.hidden {
  display: none;
}

.rich-editor .rich-alert-source-editor-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7a8494;
  margin-bottom: 6px;
}

.rich-editor .rich-alert-source-editor .rich-mermaid-source-textarea {
  min-height: 60px;
  resize: vertical;
}

/* Source: src\styles\editor\rich-editor-code-blocks.css */
/* ─── Code block wrapper ──────────────────────────────────────────────────── */

.rich-editor .rich-code-wrap {
  position: relative;
  margin: 16px 0;
  border: 1px solid #2f3440;
  border-radius: 10px;
  background: rgba(24, 26, 32, 0.72);
  overflow: hidden;
}

.rich-editor .rich-code-wrap > pre {
  margin: 0;
  border-left: 0;
  border-radius: 0;
}

.rich-editor .rich-code-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 20;
  max-width: calc(100% - 16px);
  flex-wrap: wrap;
}

@media (hover: hover) {
  .rich-editor .rich-code-toolbar {
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
  }
  .rich-editor .rich-code-wrap:hover > .rich-code-toolbar,
  .rich-editor .rich-code-wrap:focus-within > .rich-code-toolbar,
  .rich-editor .rich-code-wrap.is-editing > .rich-code-toolbar {
    opacity: 1;
    pointer-events: auto;
  }
}

.rich-editor .rich-code-header {
  min-height: 40px;
  padding: 8px clamp(132px, 45%, 320px) 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #2f3440;
  background: rgba(31, 35, 44, 0.96);
  color: #d8dee9;
  cursor: pointer;
  user-select: none;
}

.rich-editor .rich-code-toggle {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid #3e4656;
  border-radius: 6px;
  background: #20242d;
  color: #d4d4d4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.rich-editor .rich-code-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rich-editor .rich-code-wrap.is-collapsed > pre,
.rich-editor .rich-code-wrap.is-collapsed > .rich-code-source-editor {
  display: none;
}

.rich-editor .rich-code-wrap.is-collapsed .rich-code-toggle i {
  transform: rotate(-90deg);
}

.rich-editor .rich-code-lang-select {
  height: 26px;
  padding: 0 24px 0 8px;
  border-radius: 6px;
  border: 1px solid #3e3e42;
  background: #1f2025 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E") no-repeat right 8px center;
  color: #d4d4d4;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.rich-editor .rich-code-lang-select:hover {
  border-color: #515866;
  background-color: #262933;
}

.rich-editor .rich-code-lang-select:focus {
  outline: 1px solid #007acc;
  outline-offset: -1px;
}

/* Code block: source editor below */
.rich-editor .rich-code-source-editor {
  padding: 8px 10px;
  border-top: 1px solid #3e3e42;
  background: rgba(31, 32, 37, 0.96);
}

.rich-editor .rich-code-source-editor.hidden {
  display: none;
}

.rich-editor .rich-code-source-editor-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7a8494;
  margin-bottom: 6px;
}

.rich-editor .rich-code-source-editor .rich-mermaid-source-textarea {
  min-height: 80px;
  resize: vertical;
  font-family: 'JetBrains Mono', Consolas, Monaco, 'Courier New', monospace;
  font-size: 12px;
}

/* Source: src\styles\editor\rich-editor-tables.css */
/* ─── Rich table: standalone (no wrapper bg/border) ──────────────────────── */

.rich-editor .rich-table-wrap {
  margin: 14px 0;
  position: relative;
  padding-top: 38px;
}

.rich-editor .rich-table-layout {
  display: flex;
  gap: 0;
  overflow: hidden;
}

.rich-editor .rich-table-container {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  position: relative;
}

.rich-editor .rich-table-container::-webkit-scrollbar {
  height: 6px;
}

.rich-editor .rich-table-container::-webkit-scrollbar-track {
  background: transparent;
}

.rich-editor .rich-table-container::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(148, 160, 183, 0.35);
}

/* ─── Table source editor (below table, like mermaid) ──────────────────────── */

.rich-editor .rich-table-source-editor {
  padding: 8px 10px;
  border-top: 1px solid #3e3e42;
  background: rgba(31, 32, 37, 0.96);
}

.rich-editor .rich-table-source-editor.hidden {
  display: none;
}

.rich-editor .rich-table-source-editor-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7a8494;
  margin-bottom: 6px;
}

/* ─── Table right-side panels (alignment, style) ─────────────────────────── */

.rich-editor .rich-table-align-panel,
.rich-editor .rich-table-style-panel {
  flex: 0 0 220px;
  max-width: 220px;
  border-left: 1px solid #3e3e42;
  background: rgba(31, 32, 37, 0.96);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.rich-editor .rich-table-align-panel.hidden,
.rich-editor .rich-table-style-panel.hidden {
  display: none;
}

.rich-editor .rich-table-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid #3e3e42;
  flex-shrink: 0;
}

.rich-editor .rich-table-panel-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #b9c3d3;
}

.rich-editor .rich-table-panel-close {
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  color: #9aa5b1;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.rich-editor .rich-table-panel-close:hover {
  background: #2a2d35;
  color: #d4d4d4;
}

/* Column alignment controls */
.rich-editor .rich-table-align-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
}

.rich-editor .rich-table-align-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.rich-editor .rich-table-align-label {
  font-size: 11px;
  color: #b0b8c4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.rich-editor .rich-table-align-btn-group {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.rich-editor .rich-table-align-btn {
  width: 26px;
  height: 24px;
  padding: 0;
  border: 1px solid #3e3e42;
  border-radius: 4px;
  background: #1f2025;
  color: #7a8494;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rich-editor .rich-table-align-btn:hover {
  background: #262933;
  border-color: #515866;
  color: #d4d4d4;
}

.rich-editor .rich-table-align-btn.is-active {
  background: #0e639c;
  border-color: #0e639c;
  color: #ffffff;
}

/* Style panel body */
.rich-editor .rich-table-style-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rich-editor .rich-table-style-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rich-editor .rich-table-style-label {
  font-size: 11px;
  color: #9aa5b1;
}

.rich-editor .rich-table-style-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.rich-editor .rich-table-style-color-picker {
  width: 32px;
  height: 28px;
  flex: 0 0 32px;
  padding: 2px;
  border: 1px solid #3e3e42;
  border-radius: 6px;
  background: #1f2025;
  cursor: pointer;
}

.rich-editor .rich-table-style-input {
  height: 28px;
  flex: 1;
  min-width: 0;
  padding: 0 8px;
  border: 1px solid #3e3e42;
  border-radius: 6px;
  background: #1f2025;
  color: #d4d4d4;
  font-size: 12px;
  box-sizing: border-box;
}

.rich-editor .rich-table-style-input:focus-visible {
  outline: none;
  border-color: rgba(137, 183, 242, 0.45);
  box-shadow: 0 0 0 2px rgba(47, 86, 142, 0.22);
}

/* ─── Cell hover add-buttons ───────────────────────────────────────────────── */

.rich-editor .rich-table-cell-menu-anchor {
  position: absolute;
  z-index: 7;
  opacity: 0;
  pointer-events: none;
}

.rich-editor .rich-table-cell-menu-trigger {
  min-width: 28px;
  width: 28px;
  height: 28px;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.12s, background 0.1s, border-color 0.1s, color 0.1s;
}

.rich-editor .rich-table-cell-menu-trigger i {
  font-size: 12px;
  line-height: 1;
}

.rich-editor .rich-table-cell-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  min-width: 196px;
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(94, 121, 169, 0.28);
  border-radius: 12px;
  background: rgba(19, 23, 31, 0.98);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
}

.rich-editor .rich-table-cell-menu-anchor.is-open .rich-table-cell-menu {
  display: flex;
}

.rich-editor .rich-table-cell-menu-anchor.is-visible,
.rich-editor .rich-table-cell-menu-anchor.is-open {
  opacity: 1;
  pointer-events: auto;
}

.rich-editor .rich-table-cell-menu-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rich-editor .rich-table-cell-menu-heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(210, 223, 245, 0.72);
}

.rich-editor .rich-table-cell-menu-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.rich-editor .rich-table-cell-menu-item {
  min-height: 32px;
  min-width: 32px;
  padding: 6px;
  border: 1px solid rgba(95, 126, 183, 0.28);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--toolbar-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
}

.rich-editor .rich-table-cell-menu-item:hover:not(:disabled),
.rich-editor .rich-table-cell-menu-item:focus-visible:not(:disabled) {
  background: rgba(95, 126, 183, 0.18);
  border-color: rgba(95, 126, 183, 0.42);
  transform: translateY(-1px);
  outline: none;
}

.rich-editor .rich-table-cell-menu-item:disabled {
  opacity: 0.35;
  cursor: default;
}

.rich-editor .rich-table-cell-menu-item i {
  font-size: 11px;
}

.rich-editor .rich-table-cell-menu-anchor.is-visible > .rich-table-cell-menu-trigger,
.rich-editor .rich-table-cell-menu-anchor.is-open > .rich-table-cell-menu-trigger {
  opacity: 1;
  pointer-events: auto;
}

.rich-editor .rich-table-cell-menu-anchor.is-visible > .rich-table-cell-menu-trigger:hover,
.rich-editor .rich-table-cell-menu-anchor.is-open > .rich-table-cell-menu-trigger {
  transform: translateY(-1px);
}

@media (hover: none) {
  .rich-editor .rich-table-cell-menu-trigger {
    opacity: 0.5;
    pointer-events: auto;
  }
}

/* ─── Table cells ──────────────────────────────────────────────────────────── */

.rich-editor table.md-rich-table,
.rich-editor table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  margin: 0;
  background: transparent;
  border-radius: 8px;
  overflow: hidden;
}

.rich-editor table.md-rich-table th,
.rich-editor table th {
  background: var(--md-table-header-bg-override, var(--app-table-header-bg, #242730));
  color: var(--md-table-header-text-override, var(--app-table-header-text, #dce8f8));
  border-bottom: 1px solid var(--md-table-border-color-override, var(--app-table-border-color, #3e3e42));
  font-weight: 700;
}

.rich-editor table.md-rich-table td,
.rich-editor table td {
  background: var(--md-table-cell-bg-override, var(--app-table-cell-bg, #20232b));
  color: var(--md-table-cell-text-override, var(--app-table-cell-text, #d4d4d4));
}

.rich-editor table.md-rich-table th,
.rich-editor table.md-rich-table td,
.rich-editor table th,
.rich-editor table td {
  min-width: 80px;
  padding: 8px 10px;
  border-right: 1px solid var(--md-table-border-color-override, var(--app-table-border-color, #3e3e42));
  border-bottom: 1px solid var(--md-table-border-color-override, var(--app-table-border-color, #3e3e42));
}

.rich-editor table.md-rich-table tbody tr:nth-child(even) td,
.rich-editor table tbody tr:nth-child(even) td {
  background: var(--md-table-cell-alt-bg-override, var(--app-table-cell-alt-bg, #1c1f26));
}

.rich-editor table.md-rich-table tr > *:last-child,
.rich-editor table tr > *:last-child {
  border-right: 0;
}

.rich-editor table.md-rich-table tr:last-child > *,
.rich-editor table tr:last-child > * {
  border-bottom: 0;
}

/* No-border variant */
.rich-editor table.md-rich-table.no-border th,
.rich-editor table.md-rich-table.no-border td {
  border-right: none;
  border-bottom: none;
}

.rich-editor table.md-rich-table td:focus,
.rich-editor table.md-rich-table th:focus,
.rich-editor table td:focus,
.rich-editor table th:focus {
  outline: 2px solid rgba(99, 180, 255, 0.65);
  outline-offset: -2px;
  background: var(--app-table-focus-bg, #2a3140);
}

/* Style panel sections */
.rich-editor .rich-table-style-section {
  padding: 8px 10px;
  border-bottom: 1px solid #2e3038;
}

.rich-editor .rich-table-style-section:last-child {
  border-bottom: none;
}

.rich-editor .rich-table-style-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7a8494;
  margin-bottom: 6px;
}

.rich-editor .rich-table-style-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 11px;
  color: #b0b8c4;
  margin-top: 4px;
}

.rich-editor .rich-table-style-toggle input[type="checkbox"] {
  accent-color: #0e639c;
  cursor: pointer;
}

.rich-editor h1,
.rich-editor h2,
.rich-editor h3,
.rich-editor h4,
.rich-editor h5,
.rich-editor h6,
.rich-editor p,
.rich-editor li,
.rich-editor strong,
.rich-editor em,
.rich-editor blockquote {
  color: #d4d4d4;
}

.rich-editor strong {
  font-weight: 700;
}

.rich-editor em {
  font-style: italic;
}

.rich-editor h1,
.rich-editor h2 {
  border-bottom-color: #3e3e42;
}

.rich-editor a {
  color: #d4d4d4;
  border-bottom: 1px dotted rgba(212, 212, 212, 0.35);
  text-decoration: none;
}

.rich-editor a:hover {
  color: #ffffff;
  border-bottom-color: rgba(255, 255, 255, 0.5);
}

.rich-editor code {
  color: #d4d4d4;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 5px;
  border-radius: 3px;
  font-family: 'Consolas', monospace;
  font-size: 0.9em;
}

.rich-editor pre {
  background: #1e1e1e;
  padding: 15px;
  border-radius: 4px;
  overflow-x: auto;
  margin: 15px 0;
  border-left: 3px solid #0e639c;
}

.rich-editor pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

.rich-editor blockquote:not(.md-alert) {
  border-left-color: #3e3e42;
}

/* Source: src\styles\editor\rich-editor-math.css */
/* --- Rich editor: block math (Mermaid-like layout) --- */

.rich-editor .rich-math-block {
  position: relative;
  margin: 20px 0;
  padding-top: 38px;
}

.rich-editor .rich-math-block-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 20;
  max-width: 100%;
  flex-wrap: wrap;
}

@media (hover: hover) {
  .rich-editor .rich-math-block-toolbar {
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
  }
  .rich-editor .rich-math-block:hover > .rich-math-block-toolbar,
  .rich-editor .rich-math-block:focus-within > .rich-math-block-toolbar,
  .rich-editor .rich-math-block.is-editing > .rich-math-block-toolbar {
    opacity: 1;
    pointer-events: auto;
  }
}

/* Math block: output area */
.rich-editor .rich-math-block-output {
  text-align: center;
  padding: 12px 16px;
  min-height: 48px;
  overflow-x: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rich-editor .rich-math-block-output .katex {
  font-size: 1.2em;
}

/* Math block: source editor below (like mermaid) */
.rich-editor .rich-math-source-editor {
  padding: 8px 10px;
  border-top: 1px solid #3e3e42;
  background: rgba(31, 32, 37, 0.96);
}

.rich-editor .rich-math-source-editor.hidden {
  display: none;
}

.rich-editor .rich-math-source-editor-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7a8494;
  margin-bottom: 6px;
}

.rich-editor .rich-math-source-editor .rich-mermaid-source-textarea {
  min-height: 60px;
  resize: vertical;
}

/* --- Rich editor: inline math hover/click --- */

.rich-editor .math-inline {
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s, box-shadow 0.15s;
}

.rich-editor .math-inline:hover {
  background: rgba(137, 183, 242, 0.08);
  box-shadow: 0 0 0 2px rgba(137, 183, 242, 0.18);
}

.rich-editor .math-inline.is-math-editing {
  display: inline-block;
  min-width: 280px;
  background: rgba(31, 32, 37, 0.95);
  box-shadow: 0 0 0 2px rgba(47, 86, 142, 0.35);
  padding: 8px;
  border-radius: 8px;
}

/* Rich inline math editor panel (inside math-inline element) */
.rich-math-editor {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid #3e3e42;
  border-radius: 8px;
  background: rgba(31, 32, 37, 0.96);
}

.rich-math-editor-label {
  margin-bottom: 6px;
  color: #b9c3d3;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rich-math-editor-input {
  width: 100%;
  height: 32px;
  border-radius: 6px;
  border: 1px solid #3e3e42;
  background: #17181d;
  color: #d4d4d4;
  padding: 4px 10px;
  font: 13px/1.4 'JetBrains Mono', Consolas, Monaco, 'Courier New', monospace;
  outline: none;
  box-sizing: border-box;
}

.rich-math-editor-input:focus {
  border-color: rgba(137, 183, 242, 0.45);
  box-shadow: 0 0 0 2px rgba(47, 86, 142, 0.22);
}

.rich-math-editor-preview {
  margin-top: 8px;
  min-height: 24px;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(23, 24, 29, 0.7);
  text-align: center;
  overflow-x: auto;
}

.rich-math-editor-preview:not(.has-content) {
  display: none;
}

.rich-math-editor-preview .katex {
  font-size: 1.15em;
}

.rich-math-editor-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.rich-math-editor-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid #3e3e42;
  background: #1f2025;
  color: #d4d4d4;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.rich-math-editor-btn:hover {
  background: #262933;
  border-color: #515866;
  color: #ffffff;
}

.rich-math-editor-btn.is-primary {
  border-color: #0e639c;
  background: #0e639c;
  color: #ffffff;
  font-family: var(--app-primary-button-font-family, 'Noto Sans', sans-serif);
  font-weight: var(--app-primary-button-font-weight, 200);
  font-size: var(--app-primary-button-font-size, 12px);
}

.rich-math-editor-btn.is-primary:hover {
  background: #1177bb;
  border-color: #1177bb;
}

.rich-math-editor-btn.is-danger {
  color: #d7534a;
  border-color: #5a2525;
}

.rich-math-editor-btn.is-danger:hover {
  background: #3a1a1a;
  border-color: #d7534a;
  color: #ff6b6b;
}

.rich-editor .rich-object-tree-wrap {
  position: relative;
  margin: 18px 0;
  background: linear-gradient(180deg, rgba(30, 34, 43, 0.92), rgba(22, 25, 33, 0.92));
}

.rich-editor .rich-object-tree-preview {
  display: block;
  padding: 30px 14px 10px;
}

.rich-editor .rich-object-tree-preview-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0 16px;
  border-left: 1px solid rgba(126, 180, 255, 0.12);
}

.rich-editor .rich-object-tree-preview > .rich-object-tree-preview-list {
  padding-left: 0;
  border-left: none;
}

.rich-editor .rich-object-tree-preview-item {
  position: relative;
  margin: 0;
}

.rich-editor .rich-object-tree-preview-item > .rich-object-tree-preview-list {
  margin: 0 0 0 6px;
  padding-left: 12px;
}

.rich-editor .rich-object-tree-preview-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 2px 0;
  line-height: 1.6;
}

.rich-editor .rich-object-tree-preview-icon {
  flex: 0 0 auto;
  min-width: 14px;
  text-align: center;
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
  font-size: 0.78rem;
  color: #6a7a94;
}

.rich-editor .rich-object-tree-preview-item[data-kind='object'] > .rich-object-tree-preview-line > .rich-object-tree-preview-icon {
  color: #7eb4ff;
}

.rich-editor .rich-object-tree-preview-item[data-kind='array'] > .rich-object-tree-preview-line > .rich-object-tree-preview-icon {
  color: #6ec9a0;
}

.rich-editor .rich-object-tree-preview-name {
  color: #dce4f0;
  font-size: 0.88rem;
}

.rich-editor .rich-object-tree-preview-item[data-kind='object'] > .rich-object-tree-preview-line > .rich-object-tree-preview-name,
.rich-editor .rich-object-tree-preview-item[data-kind='array'] > .rich-object-tree-preview-line > .rich-object-tree-preview-name {
  font-weight: 600;
  color: #edf2ff;
}

.rich-editor .rich-object-tree-preview-type {
  color: #6a7a94;
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
  font-size: 0.78rem;
}

.rich-object-tree-kind-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(126, 180, 255, 0.16);
  color: #bcd7ff;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rich-editor .rich-object-tree-wrap > .rich-block-toolbar .rich-mermaid-action-btn {
  height: 30px;
}

/* Source: src\styles\editor\rich-editor-block-focus.css */
/* ─── Unified block focus/border behavior ─────────────────────────────────── */
/* All block wrappers: no border when inactive, border when hovered/editing/focused */

.rich-editor .rich-mermaid-block,
.rich-editor .rich-math-block,
.rich-editor .rich-code-wrap,
.rich-editor .rich-alert-wrap,
.rich-editor .rich-table-wrap,
.rich-editor .rich-columns-wrap,
.rich-editor .rich-object-tree-wrap,
.rich-editor .rich-image-wrap,
.rich-editor details.md-collapsible {
  position: relative;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

@media (hover: hover) {
  .rich-editor .rich-mermaid-block:hover,
  .rich-editor .rich-math-block:hover,
  .rich-editor .rich-code-wrap:hover,
  .rich-editor .rich-alert-wrap:hover,
  .rich-editor .rich-table-wrap:hover,
  .rich-editor .rich-columns-wrap:hover,
  .rich-editor .rich-object-tree-wrap:hover,
  .rich-editor details.md-collapsible:hover {
    border-color: rgba(127, 138, 161, 0.26);
  }
}

/* Show border when any panel is open */
.rich-editor .rich-mermaid-block.is-visual-editor-open,
.rich-editor .rich-math-block.is-editing,
.rich-editor .rich-code-wrap.is-editing,
.rich-editor .rich-alert-wrap.is-editing,
.rich-editor .rich-table-wrap.is-panel-open,
.rich-editor .rich-columns-wrap.is-editing,
.rich-editor .rich-object-tree-wrap.is-editing,
.rich-editor .rich-image-wrap.is-editing,
.rich-editor details.md-collapsible.is-editing {
  border-color: #3e3e42;
  box-shadow: 0 0 0 1px rgba(62, 62, 66, 0.35);
}

/* Show border on focus-within (keyboard navigation) */
.rich-editor .rich-mermaid-block:focus-within,
.rich-editor .rich-math-block:focus-within,
.rich-editor .rich-code-wrap:focus-within,
.rich-editor .rich-alert-wrap:focus-within,
.rich-editor .rich-table-wrap:focus-within,
.rich-editor .rich-columns-wrap:focus-within,
.rich-editor .rich-object-tree-wrap:focus-within,
.rich-editor .rich-image-wrap:focus-within,
.rich-editor details.md-collapsible:focus-within {
  border-color: rgba(99, 180, 255, 0.45);
}

/* Show toolbar when any panel is open (all blocks) */
@media (hover: hover) {
  .rich-editor .rich-mermaid-block.is-visual-editor-open > .rich-mermaid-block-toolbar,
  .rich-editor .rich-math-block.is-editing > .rich-math-block-toolbar,
  .rich-editor .rich-code-wrap.is-editing > .rich-code-toolbar,
  .rich-editor .rich-alert-wrap.is-editing > .rich-alert-toolbar,
  .rich-editor .rich-columns-wrap.is-editing > .rich-block-toolbar,
  .rich-editor .rich-object-tree-wrap.is-editing > .rich-block-toolbar,
  .rich-editor details.md-collapsible.is-editing > .rich-block-toolbar {
    opacity: 1;
    pointer-events: auto;
  }
}

/* Syntax highlighting */
.hljs {
  background: #1e1e1e !important;
  color: #d4d4d4 !important;
}

.hljs-string {
  color: #ce9178 !important;
}

.hljs-number {
  color: #b5cea8 !important;
}

.hljs-attr {
  color: #9cdcfe !important;
}

.hljs-keyword {
  color: #569cd6 !important;
}

.hljs-function {
  color: #dcdcaa !important;
}

.hljs-inline {
  background: #1e1e1e;
  color: #ce9178;
  padding: 3px 6px;
  border-radius: 3px;
  font-family: 'Consolas', monospace;
  font-size: 13px;
}

/* Source: src\styles\editor\mermaid.css */
/* Mermaid render and visual editor styles extracted from styles/editor.css. */

/* Mermaid diagram styling */
.rendered-markdown .mermaid,
.notipad-document-embed .mermaid {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  margin: 20px 0;
  min-height: var(--notipad-mermaid-container-min-height, 360px);
  max-width: 100%;
  background: var(--notipad-mermaid-container-bg, transparent);
  padding: 15px;
  border-radius: 8px;
  border: 1px solid var(--notipad-mermaid-container-border, transparent);
  box-shadow: var(--notipad-mermaid-container-shadow, none);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.rendered-markdown .mermaid svg,
.notipad-document-embed .mermaid svg {
  flex: 0 0 auto;
  min-width: var(--notipad-mermaid-svg-min-width, 720px);
  max-width: 100%;
  height: auto;
  background: var(--notipad-mermaid-svg-bg, transparent) !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid svg :is(
  .edgePath .path,
  .flowchart-link,
  .messageLine0,
  .messageLine1,
  .relation,
  .transition,
  .task-line,
  .relationshipLine,
  .em-relation,
  .treeView-node-line,
  .wardley-link,
  .wardley-trend line,
  .wardley-annotation-line,
  .wardley-pipeline-box,
  .wardley-pipeline-evolution-link,
  .architecture-edges .edge
) {
  stroke: var(--notipad-mermaid-external-line-color, #cbd5e1) !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid svg :is(
  marker path,
  marker polygon,
  .arrowheadPath,
  #statediagram-barbEnd,
  #dependencyStart,
  #dependencyEnd,
  #compositionStart,
  #compositionEnd,
  .dependency,
  .composition
) {
  fill: var(--notipad-mermaid-external-line-color, #cbd5e1) !important;
  stroke: var(--notipad-mermaid-external-line-color, #cbd5e1) !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid svg :is(
  #extensionStart,
  #extensionEnd,
  #aggregationStart,
  #aggregationEnd,
  .extension,
  .aggregation
) {
  fill: transparent !important;
  stroke: var(--notipad-mermaid-external-line-color, #cbd5e1) !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid svg :is(
  .edgeLabel,
  .edgeLabel *,
  .edgeTerminals,
  .messageText,
  .loopText,
  .labelText,
  .relationLabel,
  .stateLabel,
  .stateLabel *,
  .taskTextOutsideRight,
  .taskTextOutsideLeft,
  .sectionTitle,
  .taskText,
  .taskTextInsideRight,
  .taskTextInsideLeft,
  .pieTitleText,
  .legend text,
  .legend tspan,
  .legendText,
  .branch-label,
  .branch-label *,
  .commit-label,
  .tag-label,
  .gitTitleText,
  .xychart-title,
  .xychart-x-axis-title,
  .xychart-y-axis-title,
  .xychart-axis-label,
  .radar-title,
  .radar-legend text,
  .radar-axis-label,
  .packetTitle,
  .packetLabel,
  .packetByte,
  .architecture-service-label,
  .treeView-node-label,
  .em-swimlane text,
  .wardley-axis-label,
  .wardley-stage-label,
  .wardley-node-label,
  .wardley-link-label,
  .wardley-notes text,
  .titleText
) {
  color: var(--notipad-mermaid-external-text-color, #e7edf7) !important;
  fill: var(--notipad-mermaid-external-text-color, #e7edf7) !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid svg :is(
  .tick line,
  .domain,
  .grid .tick,
  .radar-axis,
  .radar-grid,
  .wardley-axes line,
  .wardley-grid line,
  .wardley-stages line,
  .architecture-edge,
  .architecture-edges .edge,
  .node-bkg,
  path[stroke-dasharray],
  line[stroke-dasharray],
  rect[stroke-dasharray],
  .packetBlock
) {
  stroke: var(--notipad-mermaid-external-line-color, #cbd5e1) !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid svg :is(
  .node .label,
  .node .label *,
  .node .nodeLabel,
  .node .nodeLabel *,
  .cluster-label,
  .cluster-label *,
  text.actor,
  text.actor *,
  .actor text,
  .actor text *,
  .classTitle,
  .classTitle *,
  .classText,
  .entityLabel,
  .entityLabel *,
  .stateGroup text,
  .stateGroup tspan
) {
  color: var(--notipad-mermaid-node-text-color, #eef4fb);
  fill: var(--notipad-mermaid-node-text-color, #eef4fb);
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid svg :is(
  .edgeLabel,
  .edgeLabel .label,
  .edgeLabel rect,
  .labelBkg
) {
  background-color: var(--notipad-mermaid-edge-label-bg, transparent) !important;
  fill: var(--notipad-mermaid-edge-label-bg, transparent) !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-er svg :is(
  .entityBox,
  .node rect
) {
  fill: var(--notipad-mermaid-node-bg, #243447) !important;
  stroke: var(--notipad-mermaid-node-border, #6f8bb0) !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-er svg :is(
  .relationshipLabelBox,
  .edgeLabel rect,
  .labelBkg
) {
  fill: var(--notipad-mermaid-edge-label-bg, #202b38) !important;
  background-color: var(--notipad-mermaid-edge-label-bg, #202b38) !important;
  opacity: 1 !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-er svg :is(
  .entityLabel,
  .entityLabel *,
  .attributeBoxOdd,
  .attributeBoxEven,
  .label text
) {
  color: var(--notipad-mermaid-node-text-color, #eef4fb) !important;
  fill: var(--notipad-mermaid-node-text-color, #eef4fb) !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-pie svg :is(
  .legend rect,
  .legend circle,
  .legend polygon,
  .legend path
) {
  stroke: var(--notipad-mermaid-external-line-color, #cbd5e1) !important;
  stroke-width: 1px !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-c4 svg :is(
  line,
  path[stroke],
  marker path
) {
  stroke: var(--notipad-mermaid-c4-line-color, #f1c453) !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-c4 svg :is(
  marker path
) {
  fill: var(--notipad-mermaid-c4-line-color, #f1c453) !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-c4 svg text {
  fill: var(--notipad-mermaid-external-text-color, #eef4fb) !important;
  color: var(--notipad-mermaid-external-text-color, #eef4fb) !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-kanban svg .items :is(
  .node rect,
  .node path,
  .kanbanItem rect,
  .kanbanItem path
) {
  fill: #3f566c !important;
  stroke: #8fa3bd !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-kanban svg .sections :is(
  rect,
  path
) {
  stroke: #7890ac !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-architecture svg :is(
  .architecture-edges .edge,
  .edge,
  .node-bkg,
  path[stroke-dasharray],
  line[stroke-dasharray],
  rect[stroke-dasharray]
) {
  stroke: var(--notipad-mermaid-external-line-color, #a7b8cc) !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-architecture svg .arrow {
  fill: var(--notipad-mermaid-external-line-color, #a7b8cc) !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-kanban svg :is(
  .kanban-label,
  .cluster-label,
  .label,
  text
) {
  fill: #eef4fb !important;
  color: #eef4fb !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-eventmodeling svg :is(
  .em-swimlane rect,
  .background
) {
  fill: #202b38 !important;
  stroke: #415366 !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-eventmodeling svg .em-box rect {
  stroke-width: 1.25px !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-eventmodeling svg :is(
  .em-box foreignObject,
  .em-box div,
  .em-box span
) {
  color: var(--notipad-mermaid-external-text-color, #eef4fb) !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-wardley svg :is(
  .wardley-background,
  .wardley-annotation rect
) {
  fill: transparent !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-wardley svg :is(
  .wardley-grid line,
  .wardley-stages line
) {
  stroke: var(--notipad-mermaid-wardley-grid-color, #6d839e) !important;
  opacity: 0.9 !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-wardley svg :is(
  .wardley-link,
  .wardley-link--dashed,
  .wardley-trend line,
  .wardley-annotation-line,
  .wardley-pipeline-box,
  .wardley-pipeline-evolution-link
) {
  stroke: #a7b8cc !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-wardley svg :is(
  .wardley-build-overlay,
  .wardley-market circle
) {
  fill: #334257 !important;
  stroke: #8fa3bd !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-treeview svg :is(
  .treeView-node-label,
  text
) {
  fill: var(--notipad-mermaid-external-text-color, #eef4fb) !important;
  color: var(--notipad-mermaid-external-text-color, #eef4fb) !important;
}

:is(.rendered-markdown, .rich-editor, .notipad-document-embed) .mermaid.mermaid-diagram-treeview svg .treeView-node-line {
  stroke: var(--notipad-mermaid-external-line-color, #cbd5e1) !important;
}

.rendered-markdown .mermaid.mermaid-diagram-xychart,
.rich-editor .mermaid.mermaid-diagram-xychart {
  justify-content: flex-start;
  align-items: flex-start;
  overflow-x: auto;
}

.rendered-markdown .mermaid.mermaid-diagram-xychart svg,
.rich-editor .mermaid.mermaid-diagram-xychart svg {
  min-width: 860px;
  max-width: none !important;
  overflow: visible;
}

.rendered-markdown .mermaid.mermaid-diagram-gantt {
  justify-content: flex-start;
  align-items: flex-start;
  overflow-x: auto;
}

.rendered-markdown .mermaid.mermaid-diagram-gantt svg {
  width: 100% !important;
  min-width: 980px;
  max-width: none !important;
  height: auto;
}

.rich-editor .rich-mermaid-block {
  position: relative;
  margin: 20px 0;
  padding-top: 38px;
}

.rich-editor .rich-mermaid-block-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 20;
  max-width: 100%;
  flex-wrap: wrap;
}

@media (hover: hover) {
  .rich-editor .rich-mermaid-block-toolbar {
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
  }
  .rich-editor .rich-mermaid-block:hover > .rich-mermaid-block-toolbar,
  .rich-editor .rich-mermaid-block:focus-within > .rich-mermaid-block-toolbar,
  .rich-editor .rich-mermaid-block.is-visual-editor-open > .rich-mermaid-block-toolbar {
    opacity: 1;
    pointer-events: auto;
  }
}

.rich-editor .rich-mermaid-action-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid #3e3e42;
  background: #1f2025;
  color: #d4d4d4;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.rich-editor .rich-mermaid-action-btn:hover {
  background: #262933;
  border-color: #515866;
  color: #f4f7fb;
}

.rich-editor .rich-mermaid-action-btn:active {
  background: #20242d;
  border-color: #475061;
}

.rich-editor .rich-mermaid-action-btn:disabled {
  opacity: 0.48;
  cursor: default;
}

.rich-editor .rich-mermaid-action-btn:disabled:hover {
  background: #1f2025;
  border-color: #3e3e42;
  color: #d4d4d4;
}

.rich-editor .rich-mermaid-action-btn.is-primary {
  border-color: #0e639c;
  background: #0e639c;
  color: #f4f7fb;
  font-family: var(--app-primary-button-font-family, 'Noto Sans', sans-serif);
  font-weight: var(--app-primary-button-font-weight, 200);
  font-size: var(--app-primary-button-font-size, 12px);
}

.rich-editor .rich-mermaid-action-btn.is-primary:hover {
  background: #1177bb;
  border-color: #0e639c;
}

.rich-editor .rich-mermaid-direction-btn {
  width: 28px;
  padding: 0;
  font-size: 16px;
  text-align: center;
  font-weight: 600;
  line-height: 28px;
}

.rich-editor .rich-mermaid-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid #333947;
  border-radius: 7px;
  background: rgba(23, 25, 32, 0.9);
}

.rich-editor .rich-mermaid-zoom-btn {
  width: 28px;
  padding: 0;
  text-align: center;
}

.rich-editor .rich-mermaid-action-btn.is-danger {
  border-color: #5f304f;
  color: #d4d4d4;
  font-size: 12px;
  padding: 0 8px;
}

.rich-editor .rich-mermaid-action-btn.is-danger:hover {
  background: #4a1a2e;
  border-color: #e05270;
  color: #f2a8d1;
}

.rich-editor .rich-mermaid-source-editor {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #3e3e42;
  border-radius: 8px;
  background: rgba(31, 32, 37, 0.92);
}

.rich-editor .rich-mermaid-source-editor.hidden {
  display: none;
}

.rich-editor .rich-mermaid-source-editor-label {
  margin-bottom: 6px;
  color: #b9c3d3;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rich-editor .rich-mermaid-source-textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border-radius: 6px;
  border: 1px solid #3e3e42;
  background: #17181d;
  color: #d4d4d4;
  padding: 10px;
  font: 12px/1.45 'JetBrains Mono', Consolas, Monaco, 'Courier New', monospace;
  outline: none;
  box-sizing: border-box;
}

.rich-editor .rich-mermaid-source-textarea:focus {
  border-color: rgba(137, 183, 242, 0.45);
  box-shadow: 0 0 0 2px rgba(47, 86, 142, 0.22);
}

.rich-editor .rich-mermaid-source-editor-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.rich-editor .mermaid {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  margin: 0;
  min-height: var(--notipad-mermaid-container-min-height, 360px);
  max-width: 100%;
  padding: 12px;
  background: var(--notipad-mermaid-container-bg, transparent);
  border: 1px solid var(--notipad-mermaid-container-border, transparent);
  border-radius: 8px;
  box-shadow: var(--notipad-mermaid-container-shadow, none);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.rich-editor .rich-mermaid-block.is-mermaid-zoomed .mermaid {
  max-height: min(72vh, 760px);
  overflow: auto;
}

.rich-editor .mermaid svg {
  display: block;
  flex: 0 0 auto;
  min-width: var(--notipad-mermaid-svg-min-width, 720px);
  max-width: 100%;
  height: auto;
  background: var(--notipad-mermaid-svg-bg, transparent) !important;
}

.rich-editor .mermaid[data-mermaid-zoom] svg {
  max-width: none !important;
}

@media (max-width: 900px) {
  .rendered-markdown,
  .rich-editor,
  .notipad-document-embed {
    --notipad-mermaid-container-min-height: 420px;
    --notipad-mermaid-svg-min-width: 820px;
  }
}

.rich-editor .mermaid.mermaid-diagram-gantt {
  justify-content: flex-start;
  align-items: flex-start;
  overflow-x: auto;
}

.rich-editor .mermaid.mermaid-diagram-gantt svg {
  width: 100% !important;
  min-width: 980px;
  max-width: none !important;
  height: auto;
}

/* Source: src\styles\editor\mermaid-focus.css */
@media (hover: hover) {
  .rich-editor .rich-mermaid-block:hover > .rich-mermaid-block-toolbar,
  .rich-editor .rich-mermaid-block.is-visual-editor-open > .rich-mermaid-block-toolbar,
  .rich-editor .rich-mermaid-block.is-mermaid-focused > .rich-mermaid-block-toolbar,
  .rich-editor .rich-mermaid-block:focus-within > .rich-mermaid-block-toolbar {
    opacity: 1;
    pointer-events: auto;
  }
}

.rich-editor .rich-mermaid-block.is-mermaid-focused {
  border-color: #3e3e42;
  box-shadow: 0 0 0 1px rgba(62, 62, 66, 0.35);
}

