/* ===== КНОПКИ ===== */
.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  flex: 1;
  white-space: nowrap;
}

.btn-primary {
  background: #0000ff;
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(0, 0, 255, 0.18);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0, 0, 255, 0.22);
}

.btn-secondary {
  background: #ffffff;
  color: #1b1f24;
  border: 1px solid #e5e7eb;
}

.btn-secondary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.btn-success {
  background: #10b981;
  color: #ffffff;
}

.btn-success:hover:not(:disabled) {
  background: #0ea771;
}

.btn-danger {
  background: #ef4444;
  color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
  flex: 0 0 auto;
}

/* Кнопка «Пауза» во время записи */
.btn-get-text {
  background: #10b981;
  color: white;
}

.btn-get-text:hover {
  background: #059669;
}

/* ===== УМНОЕ ПОЛЕ ВВОДА ===== */
.edit-method-text {
  margin-top: 4px;
}

.edit-method-text label {
  font-size: 13px;
  font-weight: 500;
  color: #646b75;
  margin-bottom: 8px;
  display: block;
}

.smart-input-container {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.smart-textarea {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.4;
  font-family: inherit;
  resize: none;
  background: #ffffff;
  transition: all 0.15s ease;
  min-height: 48px;
  max-height: 120px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.smart-textarea::-webkit-scrollbar {
  display: none;
}

.smart-textarea:focus {
  outline: none;
  border-color: #0000ff;
  box-shadow: 0 0 0 2px rgba(0, 0, 255, 0.1);
}

.smart-textarea::placeholder {
  color: #9ca3af;
}

/* Две кнопки рядом */
.smart-action-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: #0000ff;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.smart-action-btn:hover {
  transform: scale(1.05);
  background: #0000d6;
  box-shadow: 0 4px 12px rgba(0, 0, 255, 0.25);
}

.smart-action-btn:active {
  transform: scale(0.95);
}

.smart-action-btn .action-icon {
  width: 24px;
  height: 24px;
  display: block;
}

.smart-action-btn.send-mode {
  background: #10b981;
}

.smart-action-btn.send-mode:hover {
  background: #0ea771;
}

.smart-action-btn.mic-mode {
  background: #0000ff;
}

/* Анимация при отправке */
.smart-action-btn.sending {
  animation: btnPulse 0.3s ease;
}

@keyframes btnPulse {
  0% { transform: scale(1); }
  50% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* ===== КНОПКА-МИКРОФОН (старая, оставлена для совместимости) ===== */
.voice-mic-btn {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #0000ff;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.voice-mic-btn svg {
  width: 24px;
  height: 24px;
  display: block;
}

.voice-mic-btn:hover:not(:disabled) {
  background: #eef2ff;
  border-color: #0000ff;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,255,0.15);
}

.voice-mic-btn.recording {
  background: #ef4444;
  color: white;
  border-color: #dc2626;
  animation: micPulse 1.5s infinite;
}

.voice-mic-btn.recording:hover:not(:disabled) {
  background: #dc2626;
}

.voice-mic-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@keyframes micPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.voice-status {
  font-size: 12px;
  color: #0000ff;
  font-weight: 500;
  min-height: 20px;
}

.edit-status {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
}

.edit-status.success {
  background: #ecfdf5;
  color: #047857;
  border-left: 4px solid #10b981;
}

.edit-status.error {
  background: #fef2f2;
  color: #b91c1c;
  border-left: 4px solid #ef4444;
}

.edit-status.loading {
  background: #eef2ff;
  color: #0000ff;
  border-left: 4px solid #0000ff;
}

/* ===== МОДАЛЬНОЕ ОКНО ПОДТВЕРЖДЕНИЯ ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px 22px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
  animation: modalSlideIn 0.15s ease-out;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-dialog h2 {
  margin: 0 0 10px 0;
  color: #1b1f24;
  font-size: 18px;
}

.modal-dialog p {
  color: #646b75;
  margin: 0 0 20px 0;
  font-size: 14px;
  line-height: 1.6;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-buttons .btn {
  flex: 1;
  padding: 10px 14px;
}

/* ===== ЭКСПОРТ ===== */
.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-weight: 600;
}

.export-icon {
  display: block;
  flex-shrink: 0;
}

.btn-primary.export-btn {
  background: #0000ff;
  color: white;
  border: none;
}

.btn-primary.export-btn:hover {
  background: #0000d6;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 255, 0.25);
}

.export-format-select {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #1b1f24;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231b1f24' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  min-width: 150px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.export-format-select:hover {
  border-color: #0000ff;
}

.export-format-select:focus {
  outline: none;
  border-color: #0000ff;
  box-shadow: 0 0 0 3px rgba(0,0,255,0.1);
}

.export-format-select option {
  padding: 8px;
  background: white;
  color: #1b1f24;
}

/* ===== БАННЕР ПОДТВЕРЖДЕНИЙ ===== */
#confirmation,
.confirmation {
  display: none;
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #0000ff;
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 999px;
  z-index: 2100;
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.4);
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
  .smart-textarea {
    font-size: 14px;
    padding: 10px 14px;
    min-height: 44px;
  }
  
  .smart-action-btn {
    width: 44px;
    height: 44px;
  }
  
  .smart-action-btn .action-icon {
    width: 20px;
    height: 20px;
  }
}

/* ===== ТЕКСТОВЫЙ РЕДАКТОР ===== */
.text-editor {
  width: 100%;
  background: #ffffff;
  border: 1.5px solid #e5e7eb;
  border-radius: 16px;
  padding: 18px 20px;
  font-size: 15px;
  line-height: 1.7;
  font-family: 'SF Mono', 'Fira Code', 'Segoe UI', monospace;
  min-height: 300px;
  max-height: 500px;
  overflow-y: auto;
  color: #1b1f24;
  resize: vertical;
  word-wrap: break-word;
  white-space: pre-wrap;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.text-editor:focus {
  outline: none;
  border-color: #0000ff;
  box-shadow: 0 0 0 4px rgba(0, 0, 255, 0.08);
}

.text-editor::placeholder {
  color: #9ca3b0;
  font-weight: 400;
  font-style: italic;
}

/* ===== ФОРМАТИРУЕМЫЙ РЕДАКТОР (TipTap) ===== */
.text-editor.rich-editor {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  white-space: normal;
  /* Без рамки: мягкая заливка обозначает область ввода, вся зона кликабельна */
  border: none;
  background: #f7f8fa;
  border-radius: 14px;
  min-height: 340px;
  max-height: 100%;
  resize: none;
  cursor: text;
  transition: background 0.12s ease, box-shadow 0.12s ease;
  isolation: isolate;
}

.text-editor.rich-editor.text-editor-expanded {
  flex: 1;
  min-height: 0;
}

.text-editor.rich-editor:focus-within {
  background: #ffffff;
  box-shadow: inset 0 0 0 1.5px #e6e9f2;
}

.rich-editor .ProseMirror {
  flex: 1;
  min-height: 340px;
  padding: 18px 14px 18px 20px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  outline: none;
  cursor: text;
  color: #1b1f24;
  font-size: 15px;
  line-height: 1.7;
  word-wrap: break-word;
  border-radius: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 255, 0.32) transparent;
}

.text-editor-expanded.rich-editor .ProseMirror {
  min-height: 0;
}

/* «Живой» хвост речи: ещё не обработанный текст в редакторе */
.rich-editor .ProseMirror .live-speech-text {
  color: #9ca3b0;
  transition: color 0.25s ease;
}

.rich-editor .ProseMirror .live-speech-widget {
  pointer-events: none;
  user-select: none;
}

/* Точка вставки новой речи в режиме «Мысли» (во время записи) */
.rich-editor .ProseMirror.thought-speech-anchor-mode {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M12 3v14' stroke='%230000ff' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M8 7h8' stroke='%230000ff' stroke-width='1.5' stroke-linecap='round' opacity='0.45'/%3E%3Ccircle cx='12' cy='20' r='2' fill='%230000ff'/%3E%3C/svg%3E") 12 12, text;
}

.rich-editor .ProseMirror::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.rich-editor .ProseMirror {
  scrollbar-width: none;
}

.rich-editor .ProseMirror::-webkit-scrollbar-track,
.rich-editor .ProseMirror::-webkit-scrollbar-thumb,
.rich-editor .ProseMirror::-webkit-scrollbar-thumb:hover,
.rich-editor .ProseMirror::-webkit-scrollbar-thumb:active,
.rich-editor .ProseMirror::-webkit-scrollbar-corner {
  background: transparent;
}

.rich-editor .ProseMirror:focus {
  outline: none;
}

.rich-editor .ProseMirror > * + * {
  margin-top: 0.6em;
}

.rich-editor .ProseMirror p.is-empty::before,
.rich-editor .ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: #9ca3b0;
  font-style: italic;
  pointer-events: none;
  height: 0;
}

.rich-editor .ProseMirror.thought-recording-active p.is-empty::before,
.rich-editor .ProseMirror.thought-recording-active p.is-editor-empty:first-child::before {
  content: none !important;
}

.rich-editor .ProseMirror h1 {
  font-size: 1.6em;
  font-weight: 700;
  line-height: 1.25;
  margin-top: 0.8em;
}

.rich-editor .ProseMirror h2 {
  font-size: 1.35em;
  font-weight: 700;
  line-height: 1.3;
  margin-top: 0.7em;
}

.rich-editor .ProseMirror h3 {
  font-size: 1.15em;
  font-weight: 600;
  line-height: 1.35;
  margin-top: 0.6em;
}

.rich-editor .ProseMirror ul,
.rich-editor .ProseMirror ol {
  padding-left: 1.4em;
}

.rich-editor .ProseMirror ul li,
.rich-editor .ProseMirror ol li {
  margin: 0.2em 0;
}

.rich-editor .ProseMirror blockquote {
  border-left: 4px solid #0000ff;
  background: #f2f4ff;
  border-radius: 0 12px 12px 0;
  padding: 10px 16px;
  margin: 0.6em 0;
  color: #1b1f24;
}

.rich-editor .ProseMirror mark {
  background: #fff3a3;
  border-radius: 3px;
  padding: 0.05em 0.15em;
  box-decoration-break: clone;
}

.rich-editor .ProseMirror a,
.rich-editor .ProseMirror a.rich-editor-link {
  color: #0000ff;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.rich-editor .ProseMirror a:hover {
  color: #0000d6;
}

/* ===== ПОПАП ГИПЕРССЫЛКИ ===== */
.link-popover-float {
  position: absolute;
  z-index: 40;
  min-width: 260px;
  max-width: min(360px, calc(100% - 16px));
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 255, 0.04);
}

.link-popover-float[hidden] {
  display: none !important;
}

.lp-header {
  font-size: 12px;
  font-weight: 600;
  color: #0000ff;
  margin-bottom: 8px;
}

.lp-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1.5px solid #e5e7eb;
  border-radius: 9px;
  font-size: 13px;
  color: #1b1f24;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.lp-input:focus {
  border-color: #0000ff;
  box-shadow: 0 0 0 3px rgba(0, 0, 255, 0.1);
}

.lp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.lp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  background: #ffffff;
  color: #3a4150;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.lp-btn:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #0000ff;
}

.lp-btn-primary {
  background: #0000ff;
  border-color: #0000ff;
  color: #ffffff;
}

.lp-btn-primary:hover {
  background: #0000d6;
  border-color: #0000d6;
  color: #ffffff;
}

.lp-btn-ghost {
  color: #646b75;
}

.lp-btn-ghost:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #ef4444;
}

/* ===== НАСТРОЙКИ ТАБЛИЦЫ ===== */
.table-settings-trigger {
  position: absolute;
  z-index: 25;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #ffffff;
  color: #0000ff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: background 0.12s ease, box-shadow 0.12s ease;
}

.table-settings-trigger[hidden] {
  display: none !important;
}

.table-settings-trigger:hover,
.table-settings-trigger.is-open {
  background: #eef2ff;
  box-shadow: 0 4px 12px rgba(0, 0, 255, 0.12);
}

.table-settings-menu {
  position: absolute;
  z-index: 35;
  min-width: 180px;
  padding: 6px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.table-settings-menu[hidden] {
  display: none !important;
}

.tsm-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #1b1f24;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.tsm-item:hover {
  background: #eef2ff;
  color: #0000ff;
}

.tsm-item-danger {
  color: #ef4444;
}

.tsm-item-danger:hover {
  background: #fef2f2;
  color: #dc2626;
}

.tsm-sep {
  display: block;
  height: 1px;
  margin: 4px 6px;
  background: #eef2ff;
}


.rich-editor .ProseMirror hr {
  border: none;
  border-top: 2px dashed #d3d8e8;
  margin: 1.1em 0;
}

.rich-editor .ProseMirror img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin-top: 0.35em;
  margin-bottom: 0.35em;
}

/* Отдельной строкой (блочное) */
.rich-editor .ProseMirror img[data-wrap="block"],
.rich-editor .ProseMirror img:not([data-wrap]) {
  display: block;
  clear: both;
}

.rich-editor .ProseMirror img[data-wrap="block"][data-align="left"],
.rich-editor .ProseMirror img:not([data-wrap])[data-align="left"] {
  margin-left: 0;
  margin-right: auto;
}

.rich-editor .ProseMirror img[data-wrap="block"][data-align="center"],
.rich-editor .ProseMirror img:not([data-wrap])[data-align="center"] {
  margin-left: auto;
  margin-right: auto;
}

.rich-editor .ProseMirror img[data-wrap="block"][data-align="right"],
.rich-editor .ProseMirror img:not([data-wrap])[data-align="right"] {
  margin-left: auto;
  margin-right: 0;
}

/* Обтекание текстом */
.rich-editor .ProseMirror img[data-wrap="left"] {
  display: block;
  float: left;
  clear: none;
  margin: 0.35em 1.1em 0.6em 0;
}

.rich-editor .ProseMirror img[data-wrap="right"] {
  display: block;
  float: right;
  clear: none;
  margin: 0.35em 0 0.6em 1.1em;
}

/* В строке с текстом */
.rich-editor .ProseMirror img[data-wrap="inline"] {
  display: inline;
  vertical-align: middle;
  float: none;
  clear: none;
  margin: 0 0.25em;
  border-radius: 6px;
}

.rich-editor .ProseMirror h1,
.rich-editor .ProseMirror h2,
.rich-editor .ProseMirror h3,
.rich-editor .ProseMirror hr {
  clear: both;
}

.rich-editor .ProseMirror p::after {
  content: "";
  display: table;
  clear: both;
}

.rich-editor .ProseMirror img.ProseMirror-selectednode {
  outline: 3px solid rgba(0, 0, 255, 0.4);
}

/* Чек-лист */
.rich-editor .ProseMirror ul[data-type="taskList"] {
  list-style: none;
  padding-left: 0.2em;
}

.rich-editor .ProseMirror ul[data-type="taskList"] li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.rich-editor .ProseMirror ul[data-type="taskList"] li > label {
  margin-top: 0.2em;
  user-select: none;
}

.rich-editor .ProseMirror ul[data-type="taskList"] li > div {
  flex: 1;
}

.rich-editor .ProseMirror ul[data-type="taskList"] li[data-checked="true"] > div {
  color: #9ca3b0;
  text-decoration: line-through;
}

/* Таблицы */
.rich-editor .ProseMirror table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.8em 0;
  overflow: hidden;
}

.rich-editor .ProseMirror th,
.rich-editor .ProseMirror td {
  border: 1px solid #d3d8e8;
  padding: 8px 10px;
  vertical-align: top;
  min-width: 3em;
}

.rich-editor .ProseMirror th {
  background: #f2f4ff;
  font-weight: 600;
  text-align: left;
}

.rich-editor .ProseMirror .selectedCell::after {
  background: rgba(0, 0, 255, 0.08);
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.rich-editor .ProseMirror .tableWrapper {
  position: relative;
  overflow-x: auto;
}

/* ===== ПАНЕЛЬ ФОРМАТИРОВАНИЯ ===== */
.rich-format-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 6px;
  background: #ffffff;
  border: 1.5px solid #e5e7eb;
  border-radius: 14px;
  overflow: visible;
}

.rf-row {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-width: 0;
}

.rf-row-format {
  flex-wrap: wrap;
  row-gap: 4px;
  overflow: visible;
}

.rich-format-toolbar .rf-group {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.rich-format-toolbar .rf-sep {
  width: 1px;
  height: 22px;
  background: #e5e7eb;
  margin: 0 4px;
  flex-shrink: 0;
}

.rf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: #3a4150;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s ease, color 0.12s ease;
}

.rf-btn.rf-text {
  font-size: 13px;
  font-weight: 700;
}

.rf-btn.rf-italic {
  font-style: italic;
}

.rf-btn.rf-underline {
  text-decoration: underline;
}

.rf-btn:hover {
  background: #eef2ff;
  color: #0000ff;
}

.rf-btn.is-active {
  background: #e0e5ff;
  color: #0000ff;
}

.rf-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.rf-spacer {
  flex: 1;
  min-width: 8px;
}

.rf-btn-continue {
  width: auto;
  padding: 0 12px;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  background: #0000ff;
}

.rf-btn-continue:hover {
  background: #0000d6;
  color: #ffffff;
}

.rf-btn-continue svg {
  stroke: #ffffff;
  flex-shrink: 0;
}

.rf-btn-danger {
  width: auto;
  padding: 0 10px;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #646b75;
}

.rf-btn-danger:hover {
  background: #fef2f2;
  color: #ef4444;
}

.rf-btn-export {
  width: auto;
  padding: 0 12px;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  background: #0000ff;
}

.rf-btn-export:hover {
  background: #0000d6;
  color: #ffffff;
}

.rf-btn-export svg {
  flex-shrink: 0;
}

.rf-export-wrap {
  position: relative;
  flex-shrink: 0;
}

.rf-export-dropdown {
  right: 0;
  left: auto;
}

.rf-heading-dropdown {
  position: relative;
  flex-shrink: 0;
}

.rf-heading-dropdown > summary {
  list-style: none;
}

.rf-heading-dropdown > summary::-webkit-details-marker {
  display: none;
}

.rf-heading-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 10px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: #3a4150;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.rf-heading-toggle:hover {
  background: #eef2ff;
  color: #0000ff;
}

.rf-heading-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  min-width: 160px;
  padding: 6px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.rf-heading-dropdown:not([open]) .rf-heading-menu {
  display: none;
}

.rf-heading-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #1b1f24;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.rf-heading-item:hover {
  background: #eef2ff;
  color: #0000ff;
}

.rf-heading-item.is-active {
  background: #e0e5ff;
  color: #0000ff;
  font-weight: 600;
}

/* Split-кнопка списков (как в Word): иконка + стрелка */
.rf-list-split {
  display: inline-flex;
  align-items: stretch;
  flex-shrink: 0;
  border-radius: 9px;
}

.rf-list-split:hover .rf-list-main,
.rf-list-split:hover .rf-list-chevron {
  background: #eef2ff;
  color: #0000ff;
}

.rf-list-split.is-active .rf-list-main {
  background: #e0e5ff;
  color: #0000ff;
}

.rf-list-split.is-active-alt .rf-list-chevron {
  background: #e0e5ff;
  color: #0000ff;
}

.rf-btn.rf-list-main {
  width: 30px;
  border-radius: 9px 0 0 9px;
}

.rf-list-dropdown {
  position: relative;
}

.rf-list-dropdown > summary {
  list-style: none;
}

.rf-list-dropdown > summary::-webkit-details-marker {
  display: none;
}

.rf-list-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 0 9px 9px 0;
  background: transparent;
  color: #3a4150;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.rf-list-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  min-width: 210px;
  padding: 6px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.rf-list-dropdown:not([open]) .rf-list-menu {
  display: none;
}

.rf-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #1b1f24;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.rf-list-item svg {
  flex-shrink: 0;
  color: #3a4150;
}

.rf-list-item:hover {
  background: #eef2ff;
  color: #0000ff;
}

.rf-list-item:hover svg {
  color: #0000ff;
}

.rf-list-item.is-active {
  background: #e0e5ff;
  color: #0000ff;
  font-weight: 600;
}

.rf-list-item.is-active svg {
  color: #0000ff;
}

.rf-session-actions {
  gap: 4px;
}

.rf-menu-btn {
  border: 1.5px solid #e5e7eb;
  background: #ffffff;
}

.rich-format-toolbar .toolbar-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
}

/* ===== ПЛАВАЮЩАЯ ПАНЕЛЬ НАСТРОЕК ИЗОБРАЖЕНИЯ (внутри редактора) ===== */
.image-settings-float {
  position: absolute;
  z-index: 30;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px 10px;
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 255, 0.04);
  pointer-events: auto;
  max-width: calc(100% - 16px);
  white-space: nowrap;
}

.image-settings-float[hidden] {
  display: none !important;
}

.isb-title {
  font-size: 12px;
  font-weight: 600;
  color: #0000ff;
  flex-shrink: 0;
}

.isb-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.isb-label {
  font-size: 11px;
  color: #646b75;
  flex-shrink: 0;
}

.isb-btns {
  display: flex;
  align-items: center;
  gap: 3px;
}

.isb-sep {
  width: 1px;
  height: 22px;
  background: #e5e7eb;
  flex-shrink: 0;
}

.isb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 28px;
  padding: 0 7px;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  background: #ffffff;
  color: #3a4150;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.isb-btn:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #0000ff;
}

.isb-btn.is-active {
  background: #e0e5ff;
  border-color: #0000ff;
  color: #0000ff;
}

.isb-group.is-hidden,
.isb-sep.is-hidden {
  display: none !important;
}

.isb-btns.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* Мобильная компоновка редактора и панели форматирования */
@media (max-width: 600px) {
  .rich-editor .ProseMirror {
    padding: 16px 12px 16px 16px;
    font-size: 15px;
    line-height: 1.6;
  }

  .rich-editor .ProseMirror::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }

  .rich-editor .ProseMirror::-webkit-scrollbar-track {
    margin: 0;
  }

  .rich-format-toolbar {
    gap: 4px;
    padding: 5px;
    border-radius: 12px;
  }

  .rf-row-format {
    gap: 2px;
  }

  .rich-format-toolbar .rf-sep {
    margin: 0 2px;
  }

  .rf-btn {
    width: 36px;
    height: 36px;
  }

  .image-settings-float {
    flex-wrap: wrap;
    justify-content: center;
    max-width: calc(100% - 12px);
    padding: 7px 8px;
    gap: 6px;
  }

  .isb-sep {
    display: none;
  }
}

/* ===== НАСТРОЙКИ ТОНА ОБЩЕНИЯ ===== */
.tone-settings-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tone-settings-option {
  display: block;
  border: 1.5px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.tone-settings-option.active {
  border-color: #0000ff;
  background: #f6f8ff;
}

.tone-settings-option input {
  margin-right: 8px;
}

.tone-settings-option-title {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

.tone-settings-option-text {
  display: block;
  color: #646b75;
  font-size: 13px;
  line-height: 1.45;
}

/* ===== Selection floating toolbar (Мысли) ===== */
.selection-toolbar {
  position: fixed;
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 0, 255, 0.1);
  box-shadow:
    0 10px 28px -12px rgba(15, 23, 42, 0.22),
    0 2px 8px -2px rgba(15, 23, 42, 0.08);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transform: translateX(-50%);
  max-width: calc(100vw - 16px);
}

.selection-toolbar[hidden] {
  display: none !important;
}

.selection-toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #1b1f24;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}

.selection-toolbar-btn:hover,
.selection-toolbar-btn:focus-visible {
  background: #f0f3ff;
  color: #0000ff;
  outline: none;
}

.selection-toolbar-btn svg {
  flex-shrink: 0;
}

.selection-toolbar-btn--format {
  padding: 0 8px;
  gap: 2px;
}

.selection-toolbar-aa {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.selection-toolbar-chevron {
  opacity: 0.55;
}

.selection-toolbar-format {
  position: relative;
}

.selection-toolbar-format > summary {
  list-style: none;
}

.selection-toolbar-format > summary::-webkit-details-marker {
  display: none;
}

.selection-toolbar-format-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 255, 0.1);
  box-shadow: 0 8px 20px -10px rgba(15, 23, 42, 0.25);
}

.selection-toolbar-format-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #3a4150;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.selection-toolbar-format-item.rf-italic {
  font-style: italic;
}

.selection-toolbar-format-item.rf-underline {
  text-decoration: underline;
}

.selection-toolbar-format-item:hover,
.selection-toolbar-format-item.is-active {
  background: #f0f3ff;
  color: #0000ff;
}

@media (max-width: 600px) {
  .selection-toolbar {
    gap: 0;
    padding: 3px;
    border-radius: 12px;
  }

  .selection-toolbar-btn {
    min-height: 36px;
    padding: 0 8px;
    font-size: 11px;
  }

  .selection-toolbar-btn span {
    display: none;
  }

  .selection-toolbar-btn--format span.selection-toolbar-aa {
    display: inline;
  }
}

/* Тост «Добавлено в заметку» поверх выделения */
.selection-toast {
  position: fixed;
  z-index: 60;
  transform: translate(-50%, 6px) scale(0.96);
  padding: 8px 14px;
  border-radius: 999px;
  background: #1b1f24;
  color: #f8fafc;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: 0 10px 24px -10px rgba(15, 23, 42, 0.35);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.selection-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.selection-toast--error {
  background: #7f1d1d;
}

.selection-toast[hidden] {
  display: none !important;
}