.rich-text-draft-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.rich-text-draft-help {
  margin: 6px 0 0;
  color: var(--ui-text-muted);
  font-size: 12px;
  line-height: 1.5;
}

#note-text[readonly] {
  background: var(--ui-surface-subtle);
}

#note-text[hidden],
#rich-text-editor:empty {
  display: none;
}

#rich-text-editor {
  display: flex;
  min-height: 190px;
  flex-direction: column;
  overflow: visible;
  border: 1px solid var(--ui-input-border);
  border-radius: 3px;
  background: var(--ui-input-bg);
}

#rich-text-editor .ql-toolbar {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 6px;
  border: 0;
  border-bottom: 1px solid var(--ui-border);
  background: var(--ui-surface-subtle);
}

#rich-text-editor .ql-toolbar .ql-formats {
  display: inline-flex;
  flex: none;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  margin: 0 4px 0 0;
  vertical-align: middle;
}

#rich-text-editor .ql-toolbar button {
  display: inline-flex;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  flex: none;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

#rich-text-editor .ql-toolbar button svg {
  display: block;
  width: 18px;
  height: 18px;
  max-width: 18px;
  max-height: 18px;
  flex: none;
}

#rich-text-editor .ql-toolbar .ql-picker {
  height: 32px;
  min-height: 32px;
  max-width: 112px;
  flex: none;
  font-size: 14px;
  line-height: 20px;
}

#rich-text-editor .ql-toolbar .ql-picker-label {
  display: inline-flex;
  width: 100%;
  max-width: 104px;
  height: 100%;
  align-items: center;
  padding: 4px 20px 4px 6px;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  white-space: nowrap;
}

#rich-text-editor .ql-toolbar .ql-picker-label > svg {
  width: 14px;
  height: 14px;
  max-width: 14px;
  max-height: 14px;
  flex: none;
}

#rich-text-editor .ql-toolbar .ql-picker-options {
  z-index: 20;
  min-width: 100%;
  max-height: min(240px, 50vh);
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.4;
}

#rich-text-editor .ql-toolbar .ql-picker-item {
  min-height: 32px;
}

#rich-text-editor .ql-toolbar button:focus-visible,
#rich-text-editor .ql-toolbar .ql-picker-label:focus-visible {
  outline: 2px solid var(--ui-focus);
  outline-offset: 1px;
}

#rich-text-editor .ql-toolbar button:disabled {
  opacity: 0.55;
}

#rich-text-editor .ql-container {
  min-height: 0;
  flex: 1;
  border: 0;
  color: var(--ui-text);
  font: inherit;
  font-size: 14px;
}

#rich-text-editor .ql-editor {
  min-height: 150px;
  max-height: 360px;
  padding: 12px;
  overflow-y: auto;
  color: var(--ui-text);
  line-height: 1.65;
}

#rich-text-editor .ql-editor.ql-blank::before {
  color: var(--ui-text-muted);
  font-style: normal;
}

#rich-text-editor .ql-snow .ql-stroke {
  stroke: var(--ui-text-soft);
}

#rich-text-editor .ql-snow .ql-fill {
  fill: var(--ui-text-soft);
}

#rich-text-editor .ql-snow .ql-picker {
  color: var(--ui-text-soft);
}

#rich-text-editor .ql-snow .ql-toolbar button.ql-active .ql-stroke {
  stroke: var(--ui-primary);
}

#rich-text-editor .ql-snow .ql-toolbar button.ql-active .ql-fill {
  fill: var(--ui-primary);
}

#rich-text-editor .ql-tooltip::before {
  content: "Visit URL:";
}

#rich-text-editor .ql-tooltip[data-mode="link"]::before {
  content: "Enter link:";
}

#rich-text-editor .ql-tooltip a.ql-action::after {
  content: "Edit";
}

#rich-text-editor .ql-tooltip.ql-editing a.ql-action::after {
  content: "Save";
}

#rich-text-editor .ql-tooltip a.ql-remove::before {
  content: "Remove";
}

#rich-text-editor[data-language="zh"] .ql-tooltip::before {
  content: "访问链接：";
}

#rich-text-editor[data-language="zh"] .ql-tooltip[data-mode="link"]::before {
  content: "输入链接：";
}

#rich-text-editor[data-language="zh"] .ql-tooltip a.ql-action::after {
  content: "编辑";
}

#rich-text-editor[data-language="zh"] .ql-tooltip.ql-editing a.ql-action::after {
  content: "保存";
}

#rich-text-editor[data-language="zh"] .ql-tooltip a.ql-remove::before {
  content: "移除";
}

#rich-text-status {
  min-height: 20px;
  margin: 5px 0 0;
  color: var(--ui-text-muted);
  font-size: 12px;
  line-height: 1.5;
}

#rich-text-status[data-kind="error"],
.rich-text-format-error {
  color: var(--ui-danger);
}

.research-inline-image {
  display: inline-block;
  max-width: 100%;
  height: auto;
  vertical-align: middle;
  box-shadow: 0 0 0 1px var(--ui-border);
}

.note-rich-content {
  margin: 0 0 12px;
  overflow-wrap: anywhere;
  line-height: 1.6;
}

.note-rich-content p {
  margin: 0 0 8px;
}

.note-rich-content p:last-child,
.note-rich-content ul:last-child,
.note-rich-content ol:last-child {
  margin-bottom: 0;
}

.note-rich-content h1,
.note-rich-content h2 {
  margin: 12px 0 7px;
  font-weight: 650;
  line-height: 1.35;
}

.note-rich-content h1 {
  font-size: 20px;
}

.note-rich-content h2 {
  font-size: 17px;
}

.note-rich-content ul,
.note-rich-content ol {
  margin: 6px 0 10px;
  padding-left: 26px;
}

.note-rich-content a {
  color: var(--ui-primary);
  overflow-wrap: anywhere;
}

.note-rich-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 8px 0;
  box-shadow: 0 0 0 1px var(--ui-border);
}

.rich-text-plain-fallback {
  white-space: pre-wrap;
}

.rich-text-format-error {
  margin: 7px 0 0;
  font-size: 12px;
  line-height: 1.5;
}

.assistant-proposal-rich.note-rich-content {
  margin: 0;
}

@media (max-width: 480px) {
  #rich-text-editor {
    min-height: 180px;
  }

  #rich-text-editor .ql-toolbar {
    padding: 4px;
  }

  #rich-text-editor .ql-toolbar button,
  #rich-text-editor .ql-toolbar .ql-picker {
    min-height: 44px;
  }

  #rich-text-editor .ql-toolbar button {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  #rich-text-editor .ql-toolbar .ql-picker {
    height: 44px;
  }

  #rich-text-editor .ql-editor {
    min-height: 140px;
    padding: 12px;
    font-size: 16px;
    line-height: 1.6;
  }
}
