/* Плавающий AI-чат (Qwen) — только страницы hyperformula */
.neuroege-ai-chat {
  --ne-ai-chat-surface: rgba(35, 40, 45, 0.92);
  --ne-ai-chat-border: rgba(255, 255, 255, 0.12);
  position: fixed;
  right: 1rem;
  bottom: 1.25rem;
  z-index: 10060;
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 0.875rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: min(100vw - 2rem, calc(22rem * 1.3));
  pointer-events: none;
}

/* Ширина: якорь из JS (task9 в окне — .task-solve__right; иначе условие ×1.3) */
.neuroege-ai-chat.neuroege-ai-chat--anchored {
  max-width: none;
}

.neuroege-ai-chat.neuroege-ai-chat--anchored .neuroege-ai-chat__panel {
  width: 100%;
  max-width: none;
}

.neuroege-ai-chat.neuroege-ai-chat--dock-right {
  align-items: stretch;
  gap: 0;
}

.neuroege-ai-chat.neuroege-ai-chat--dock-right .neuroege-ai-chat__panel {
  width: 100%;
  height: 100%;
  max-height: none;
}

.neuroege-ai-chat.neuroege-ai-chat--dock-right .neuroege-ai-chat__resize-handle {
  display: none;
}

.neuroege-ai-chat * {
  pointer-events: auto;
}

/* Панель не должна перехватывать клики вне своих блоков (flex-gap и т.п.) — иначе перекрывает chrome Calc, кнопка «Развернуть». */
.neuroege-ai-chat .neuroege-ai-chat__panel.neuroege-ai-chat__panel--open {
  pointer-events: none;
}

.neuroege-ai-chat .neuroege-ai-chat__panel.neuroege-ai-chat__panel--open > * {
  pointer-events: auto;
}

/* Colibre chrome выше панели чата (10060), чтобы клик доходил без обходного pointerdown в JS где возможно */
#libreoffice-sheet-calc-container > .univer-libre-title-bar {
  z-index: 10070;
}

#libreoffice-sheet-calc-container > .libreoffice-lo-menubar {
  z-index: 10075;
}

#libreoffice-sheet-calc-container > .univer-libre-toolbar.libreoffice-lo-toolbar {
  z-index: 10072;
}

.neuroege-ai-chat__fab {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  border: 1px solid var(--ne-ai-chat-border);
  background: var(--green, #05b87d);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  line-height: 1;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.neuroege-ai-chat__fab:hover {
  transform: scale(1.04);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.neuroege-ai-chat__fab:focus-visible {
  outline: 2px solid var(--green, #05b87d);
  outline-offset: 2px;
}

.neuroege-ai-chat__fab[aria-expanded="true"] {
  display: none;
}

/* HF taskN / OGE variant-exam: FAB в строке premium-действий */
body.libreoffice-page-task9 #neuroege-ai-chat.neuroege-ai-chat--fab-inline,
body.variant-exam-body--oge #neuroege-ai-chat.neuroege-ai-chat--fab-inline {
  position: static;
  right: auto;
  bottom: auto;
  top: auto;
  left: auto;
  width: auto;
  max-width: none;
  height: auto;
  flex-direction: row;
  align-items: center;
  gap: 0;
  pointer-events: none;
}

body.libreoffice-page-task9 #neuroege-ai-chat.neuroege-ai-chat--fab-inline .neuroege-ai-chat__fab--inline,
body.variant-exam-body--oge #neuroege-ai-chat.neuroege-ai-chat--fab-inline .neuroege-ai-chat__fab--inline,
html.has-answer-row-parity #neuroege-ai-chat.neuroege-ai-chat--fab-inline .neuroege-ai-chat__fab--inline {
  pointer-events: auto;
}

body.libreoffice-page-task9 .neuroege-ai-chat__fab--inline.libreoffice-hf-action-btn,
body.variant-exam-body--oge .neuroege-ai-chat__fab--inline.libreoffice-hf-action-btn,
html.has-answer-row-parity .neuroege-ai-chat__fab--inline.libreoffice-hf-action-btn {
  width: auto;
  height: auto;
  min-width: 0;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

body.libreoffice-page-task9 .neuroege-ai-chat__fab--inline.libreoffice-hf-action-btn--ai-agent:hover,
body.variant-exam-body--oge .neuroege-ai-chat__fab--inline.libreoffice-hf-action-btn--ai-agent:hover,
html.has-answer-row-parity .neuroege-ai-chat__fab--inline.libreoffice-hf-action-btn--ai-agent:hover {
  transform: translateY(-1px);
}

body.libreoffice-page-task9 .neuroege-ai-chat__fab--inline .neuroege-ai-agent-btn__icon,
body.variant-exam-body--oge .neuroege-ai-chat__fab--inline .neuroege-ai-agent-btn__icon,
html.has-answer-row-parity .neuroege-ai-chat__fab--inline .neuroege-ai-agent-btn__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

body.libreoffice-page-task9 .neuroege-ai-chat__fab--inline .neuroege-ai-agent-btn__svg,
body.variant-exam-body--oge .neuroege-ai-chat__fab--inline .neuroege-ai-agent-btn__svg,
html.has-answer-row-parity .neuroege-ai-chat__fab--inline .neuroege-ai-agent-btn__svg {
  display: block;
}

html.has-answer-row-parity #neuroege-ai-chat.neuroege-ai-chat--fab-inline {
  position: static;
  right: auto;
  bottom: auto;
  top: auto;
  left: auto;
  width: auto;
  max-width: none;
  height: auto;
  flex-direction: row;
  align-items: center;
  gap: 0;
  pointer-events: none;
}

html.has-answer-row-parity .neuroege-ai-chat.neuroege-ai-chat--floating {
  z-index: 10130;
}

.neuroege-ai-chat__panel {
  display: none;
  flex-direction: column;
  min-height: 0;
  position: relative;
  width: min(100vw - 2rem, calc(22rem * 1.3));
  max-height: min(70vh, 28rem);
  border-radius: 12px;
  border: 1px solid var(--ne-ai-chat-border);
  background: var(--ne-ai-chat-surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.neuroege-ai-chat__panel--open {
  display: flex;
}

.neuroege-ai-chat__resize-handle {
  flex-shrink: 0;
  height: 8px;
  margin: -2px 0 0;
  padding: 2px 0;
  box-sizing: content-box;
  cursor: ns-resize;
  touch-action: none;
  background: transparent;
  position: relative;
}

.neuroege-ai-chat__resize-handle::after {
  content: "";
  position: absolute;
  left: 25%;
  right: 25%;
  top: 50%;
  transform: translateY(-50%);
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.neuroege-ai-chat__resize-handle:hover::after {
  background: rgba(5, 184, 125, 0.55);
}

[data-theme="light"] .neuroege-ai-chat__resize-handle::after {
  background: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .neuroege-ai-chat__resize-handle:hover::after {
  background: rgba(5, 184, 125, 0.45);
}

.neuroege-ai-chat__resize-handle--edge-bottom {
  margin: 0 0 -2px;
  order: 99;
}

.neuroege-ai-chat__resize-handle--edge-right {
  position: absolute;
  top: 2.5rem;
  right: 0;
  bottom: 1.25rem;
  width: 8px;
  height: auto;
  margin: 0;
  padding: 0 2px 0 0;
  cursor: ew-resize;
  z-index: 3;
}

.neuroege-ai-chat__resize-handle--edge-right::after {
  left: auto;
  right: 2px;
  top: 12%;
  bottom: 12%;
  width: 3px;
  height: auto;
  transform: none;
}

.neuroege-ai-chat__resize-handle--corner {
  position: absolute;
  right: 0;
  bottom: 6px;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  cursor: nwse-resize;
  z-index: 4;
}

.neuroege-ai-chat__resize-handle--corner::after {
  left: auto;
  right: 4px;
  bottom: 4px;
  top: auto;
  width: 10px;
  height: 10px;
  transform: none;
  border-right: 2px solid rgba(255, 255, 255, 0.35);
  border-bottom: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 0 0 3px 0;
  background: transparent;
}

.neuroege-ai-chat__resize-handle--corner:hover::after {
  border-color: rgba(5, 184, 125, 0.75);
}

.neuroege-ai-chat--floating .neuroege-ai-chat__panel {
  height: 100%;
}

[data-theme="light"] .neuroege-ai-chat__resize-handle--corner::after {
  border-color: rgba(0, 0, 0, 0.22);
}

[data-theme="light"] .neuroege-ai-chat__resize-handle--corner:hover::after {
  border-color: rgba(5, 184, 125, 0.55);
}

[data-theme="light"] .neuroege-ai-chat {
  --ne-ai-chat-surface: rgba(255, 255, 255, 0.95);
  --ne-ai-chat-border: rgba(0, 0, 0, 0.1);
}

.neuroege-ai-chat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--ne-ai-chat-border);
  color: var(--white, #fff);
  font-weight: 600;
}

.neuroege-ai-chat__panel--open .neuroege-ai-chat__head {
  cursor: grab;
  touch-action: none;
}

.neuroege-ai-chat__head--dragging {
  cursor: grabbing !important;
}

.neuroege-ai-chat--floating {
  position: fixed !important;
  z-index: 10065;
  margin: 0;
  align-items: stretch;
}

.neuroege-ai-chat--floating .neuroege-ai-chat__panel {
  width: 100%;
  max-width: none;
}

.neuroege-ai-chat--floating .neuroege-ai-chat__close {
  cursor: pointer;
}

.neuroege-ai-chat--floating .neuroege-ai-chat__clear {
  cursor: pointer;
}

.neuroege-ai-chat__head-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.neuroege-ai-chat__clear {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border-radius: 6px;
  opacity: 0.75;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.neuroege-ai-chat__clear:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}

.neuroege-ai-chat__clear-icon {
  display: block;
  width: 0.95rem;
  height: 0.95rem;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4h8v2'/%3E%3Cpath d='M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6'/%3E%3Cpath d='M10 11v6'/%3E%3Cpath d='M14 11v6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4h8v2'/%3E%3Cpath d='M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6'/%3E%3Cpath d='M10 11v6'/%3E%3Cpath d='M14 11v6'/%3E%3C/svg%3E") center / contain no-repeat;
}

[data-theme="light"] .neuroege-ai-chat__clear:hover {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .neuroege-ai-chat__head {
  color: var(--white, #1d1d1f);
}

.neuroege-ai-chat__close {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
  opacity: 0.75;
}

.neuroege-ai-chat__close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .neuroege-ai-chat__close:hover {
  background: rgba(0, 0, 0, 0.06);
}

.neuroege-ai-chat__messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: var(--white, #fff);
}

[data-theme="light"] .neuroege-ai-chat__messages {
  color: var(--white, #1d1d1f);
}

.neuroege-ai-chat__msg {
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  line-height: 1.45;
  white-space: normal;
  word-break: break-word;
}

.neuroege-ai-chat__msg strong {
  font-weight: 700;
}

.neuroege-ai-chat__msg em {
  font-style: italic;
}

.neuroege-ai-chat__msg code {
  font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace;
  font-size: 0.84em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  word-break: break-all;
}

[data-theme="light"] .neuroege-ai-chat__msg code {
  background: rgba(0, 0, 0, 0.08);
}

.neuroege-ai-chat__pre {
  margin: 0.35rem 0;
  padding: 0.5rem 0.55rem;
  max-width: 100%;
  overflow-x: auto;
  border-radius: 6px;
  border: 1px solid var(--ne-ai-chat-border, rgba(255, 255, 255, 0.15));
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.neuroege-ai-chat__pre code {
  display: block;
  padding: 0;
  background: transparent;
  white-space: pre-wrap;
  word-break: break-word;
}

[data-theme="light"] .neuroege-ai-chat__pre {
  background: rgba(0, 0, 0, 0.06);
}

.neuroege-ai-chat__msg--user {
  align-self: flex-end;
  background: rgba(5, 184, 125, 0.25);
  max-width: 92%;
}

.neuroege-ai-chat__msg--assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
  max-width: 100%;
}

.neuroege-ai-chat__msg--assistant.neuroege-ai-chat__msg--streaming {
  min-height: 2.25rem;
}

.neuroege-ai-chat__stream-tail {
  white-space: pre-wrap;
  word-break: break-word;
}

[data-theme="light"] .neuroege-ai-chat__msg--assistant {
  background: rgba(0, 0, 0, 0.06);
}

.neuroege-ai-chat__thinking {
  align-self: flex-start;
  display: inline-flex;
  align-items: baseline;
  gap: 0.2rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted, rgba(255, 255, 255, 0.55));
  font-size: 0.875rem;
  line-height: 1.4;
}

[data-theme="light"] .neuroege-ai-chat__thinking {
  background: rgba(0, 0, 0, 0.05);
  color: rgba(29, 29, 31, 0.55);
}

.neuroege-ai-chat__thinking-label {
  font-style: italic;
}

.neuroege-ai-chat__thinking-dots span {
  display: inline-block;
  animation: neuroege-ai-thinking-dot 1.05s ease-in-out infinite;
  opacity: 0.25;
}

.neuroege-ai-chat__thinking-dots span:nth-child(1) {
  animation-delay: 0s;
}

.neuroege-ai-chat__thinking-dots span:nth-child(2) {
  animation-delay: 0.18s;
}

.neuroege-ai-chat__thinking-dots span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes neuroege-ai-thinking-dot {
  0%,
  100% {
    opacity: 0.2;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.neuroege-ai-chat__foot {
  padding: 0.5rem 0.6rem 0.65rem;
  border-top: 1px solid var(--ne-ai-chat-border);
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.4rem;
}

.neuroege-ai-chat__voice-viz {
  flex: 1 1 100%;
  display: none;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.18);
  box-sizing: border-box;
  overflow: hidden;
}

.neuroege-ai-chat__voice-viz--visible {
  display: flex;
}

.neuroege-ai-chat__voice-viz--loading {
  border-style: dashed;
  opacity: 0.92;
}

.neuroege-ai-chat__voice-viz-pulse {
  flex-shrink: 0;
  position: relative;
  width: 1.75rem;
  height: 1.75rem;
}

.neuroege-ai-chat__voice-viz-pulse::before,
.neuroege-ai-chat__voice-viz-pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(5, 184, 125, 0.55);
  animation: neuroege-ai-voice-viz-ring 1.6s ease-out infinite;
}

.neuroege-ai-chat__voice-viz-pulse::after {
  animation-delay: 0.55s;
}

.neuroege-ai-chat__voice-viz-pulse-dot {
  position: absolute;
  inset: 0.45rem;
  border-radius: 50%;
  background: var(--green, #05b87d);
  box-shadow: 0 0 10px rgba(5, 184, 125, 0.55);
}

.neuroege-ai-chat__voice-viz-bars {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 2rem;
  min-width: 0;
}

.neuroege-ai-chat__voice-viz-bar {
  --bar-h: 14%;
  flex: 1;
  max-width: 0.45rem;
  height: var(--bar-h);
  min-height: 3px;
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.95) 0%,
    var(--green, #05b87d) 55%,
    rgba(5, 184, 125, 0.35) 100%
  );
  transform-origin: bottom center;
  transition: height 0.05s linear;
  will-change: height;
}

.neuroege-ai-chat__voice-viz--loading .neuroege-ai-chat__voice-viz-bar {
  height: 100%;
  transform: scaleY(0.2);
  transform-origin: bottom center;
  animation: neuroege-ai-voice-viz-idle 1.1s ease-in-out infinite;
  animation-delay: calc(var(--bar-i, 0) * 0.05s);
  transition: none;
}

.neuroege-ai-chat__voice-viz-label {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
}

.neuroege-ai-chat__voice-viz-stop {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  margin-left: auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.28);
  color: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.neuroege-ai-chat__voice-viz-stop:hover {
  background: rgba(225, 29, 72, 0.22);
  border-color: rgba(225, 29, 72, 0.45);
  transform: translateY(-1px);
}

.neuroege-ai-chat__voice-viz-stop:focus-visible {
  outline: 2px solid rgba(244, 114, 182, 0.75);
  outline-offset: 2px;
}

[data-theme="light"] .neuroege-ai-chat__voice-viz {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .neuroege-ai-chat__voice-viz-label {
  color: rgba(0, 0, 0, 0.55);
}

@keyframes neuroege-ai-voice-viz-ring {
  0% {
    transform: scale(0.55);
    opacity: 0.85;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

@keyframes neuroege-ai-voice-viz-idle {
  0%,
  100% {
    transform: scaleY(0.18);
    opacity: 0.55;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

.neuroege-ai-chat__input {
  flex: 1;
  line-height: 1.45;
  min-height: calc(2 * 1.45em + 0.9rem);
  max-height: min(38vh, 12rem);
  height: auto;
  resize: none;
  overflow-y: hidden;
  border-radius: 8px;
  border: 1px solid var(--ne-ai-chat-border);
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  padding: 0.45rem 0.55rem;
  font: inherit;
  box-sizing: border-box;
}

[data-theme="light"] .neuroege-ai-chat__input {
  background: rgba(255, 255, 255, 0.9);
}

.neuroege-ai-chat__input:focus {
  outline: 2px solid var(--green, #05b87d);
  outline-offset: 0;
}

.neuroege-ai-chat__send {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  padding: 0 0.5rem;
  border-radius: 8px;
  border: none;
  background: var(--green, #05b87d);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.neuroege-ai-chat__send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.neuroege-ai-chat__voice {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--ne-ai-chat-border);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.neuroege-ai-chat__voice:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
}

.neuroege-ai-chat__voice:disabled,
.neuroege-ai-chat__voice--unsupported {
  opacity: 0.45;
  cursor: not-allowed;
}

.neuroege-ai-chat__voice-icon {
  display: block;
  width: 1rem;
  height: 1rem;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2a3 3 0 0 1 3 3v6a3 3 0 0 1-6 0V5a3 3 0 0 1 3-3z'/%3E%3Cpath d='M19 10v1a7 7 0 0 1-14 0v-1'/%3E%3Cpath d='M12 18v4'/%3E%3Cpath d='M8 22h8'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2a3 3 0 0 1 3 3v6a3 3 0 0 1-6 0V5a3 3 0 0 1 3-3z'/%3E%3Cpath d='M19 10v1a7 7 0 0 1-14 0v-1'/%3E%3Cpath d='M12 18v4'/%3E%3Cpath d='M8 22h8'/%3E%3C/svg%3E") center / contain no-repeat;
}

.neuroege-ai-chat__voice--active {
  border-color: rgba(244, 114, 182, 0.65);
  background: rgba(244, 114, 182, 0.18);
}

.neuroege-ai-chat__voice--loading {
  opacity: 0.75;
  cursor: wait;
  animation: neuroege-ai-voice-loading 1s ease-in-out infinite;
}

@keyframes neuroege-ai-voice-loading {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

.neuroege-ai-chat__input--voice-active {
  border-color: rgba(244, 114, 182, 0.65) !important;
  box-shadow: 0 0 0 3px rgba(244, 114, 182, 0.2) !important;
}

/* Режим «Стоп»: та же кнопка, что отправка — во время запроса и вывода ответа */
.neuroege-ai-chat__send.neuroege-ai-chat__stop {
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
  border: 1px solid var(--ne-ai-chat-border);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
}

.neuroege-ai-chat__stop-icon {
  display: block;
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 2px;
  background: #e11d48;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

[data-theme="light"] .neuroege-ai-chat__send.neuroege-ai-chat__stop {
  background: rgba(0, 0, 0, 0.06);
}

.neuroege-ai-chat__send.neuroege-ai-chat__stop:hover {
  background: rgba(255, 255, 255, 0.14);
}

.neuroege-ai-chat__send.neuroege-ai-chat__stop:hover .neuroege-ai-chat__stop-icon {
  filter: brightness(1.08);
}

[data-theme="light"] .neuroege-ai-chat__send.neuroege-ai-chat__stop:hover {
  background: rgba(0, 0, 0, 0.1);
}

.neuroege-ai-chat__hint {
  padding: 0 0.75rem 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted, rgba(255, 255, 255, 0.55));
  line-height: 1.35;
}

body.neuroege-ai-chat-confirm-open {
  overflow: hidden;
}

.neuroege-ai-chat-confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 10200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.neuroege-ai-chat-confirm-modal--anchored-panel {
  inset: auto;
  padding: 0.75rem;
  border-radius: 1.15rem;
  overflow: hidden;
}

.neuroege-ai-chat-confirm-modal--anchored-panel .neuroege-ai-chat-confirm-modal__backdrop {
  border-radius: inherit;
}

.neuroege-ai-chat-confirm-modal[hidden] {
  display: none !important;
}

.neuroege-ai-chat-confirm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.58);
  backdrop-filter: blur(8px);
}

.neuroege-ai-chat-confirm-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 23rem);
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(
    165deg,
    rgba(28, 34, 44, 0.98) 0%,
    rgba(14, 18, 26, 0.98) 100%
  );
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  overflow: hidden;
  animation: neuroege-ai-chat-confirm-in 0.22s ease-out;
}

@keyframes neuroege-ai-chat-confirm-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.neuroege-ai-chat-confirm-modal__header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.9rem 1rem 0.6rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.neuroege-ai-chat-confirm-modal__icon {
  flex: 0 0 2.35rem;
  width: 2.35rem;
  height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
}

.neuroege-ai-chat-confirm-modal__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #f8fafc;
}

.neuroege-ai-chat-confirm-modal__body {
  margin: 0;
  padding: 0.8rem 1rem 1rem;
  font-size: 0.84rem;
  line-height: 1.5;
  color: rgba(203, 213, 225, 0.95);
}

.neuroege-ai-chat-confirm-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.65rem 1rem 0.85rem;
  background: rgba(0, 0, 0, 0.14);
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.neuroege-ai-chat-confirm-modal__btn {
  min-width: 5.75rem;
  padding: 0.48rem 0.9rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(51, 65, 85, 0.75);
  color: #f1f5f9;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.neuroege-ai-chat-confirm-modal__btn:hover {
  background: rgba(71, 85, 105, 0.95);
  border-color: rgba(148, 163, 184, 0.5);
}

.neuroege-ai-chat-confirm-modal__btn:active {
  transform: translateY(1px);
}

.neuroege-ai-chat-confirm-modal__btn--danger {
  border-color: rgba(225, 29, 72, 0.45);
  background: linear-gradient(145deg, #fb7185 0%, #e11d48 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.28);
}

.neuroege-ai-chat-confirm-modal__btn--danger:hover {
  background: linear-gradient(145deg, #fda4af 0%, #f43f5e 100%);
  border-color: rgba(251, 113, 133, 0.65);
}

.neuroege-ai-chat-confirm-modal__btn:focus-visible {
  outline: 2px solid rgba(244, 114, 182, 0.75);
  outline-offset: 2px;
}

[data-theme="light"] .neuroege-ai-chat-confirm-modal__backdrop {
  background: rgba(15, 23, 42, 0.32);
}

[data-theme="light"] .neuroege-ai-chat-confirm-modal__dialog {
  border-color: rgba(0, 0, 0, 0.08);
  background: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%);
  box-shadow:
    0 24px 48px rgba(15, 23, 42, 0.14),
    0 0 0 1px rgba(255, 255, 255, 0.9) inset;
}

[data-theme="light"] .neuroege-ai-chat-confirm-modal__title {
  color: #0f172a;
}

[data-theme="light"] .neuroege-ai-chat-confirm-modal__body {
  color: #475569;
}

[data-theme="light"] .neuroege-ai-chat-confirm-modal__footer {
  background: rgba(241, 245, 249, 0.88);
}

[data-theme="light"] .neuroege-ai-chat-confirm-modal__btn {
  background: #fff;
  color: #334155;
  border-color: rgba(148, 163, 184, 0.55);
}

/* /python/: открытый чат на всю высоту правой колонки */
body.neuroege-python-playground-page.libreoffice-page-task9
  .libreoffice-task9-page.task-solve-page
  > .task-solve__right {
  position: relative;
}
body.neuroege-python-playground-page.libreoffice-page-task9
  .libreoffice-task9-page.task-solve-page
  > .task-solve__right
  #neuroege-ai-chat.neuroege-ai-chat--anchored.neuroege-ai-chat--dock-right {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  width: auto;
  max-width: none;
  height: auto;
}

/* /python/: FAB в углу окна, если панель закрыта и сработала привязка к колонке (остаточные стили) */
body.neuroege-python-playground-page.libreoffice-page-task9
  #neuroege-ai-chat:not(.neuroege-ai-chat--anchored):not(.neuroege-ai-chat--dock-right) {
  position: fixed !important;
  right: 1rem !important;
  bottom: 1.25rem !important;
  top: auto !important;
  left: auto !important;
  width: auto !important;
  max-width: min(100vw - 2rem, calc(22rem * 1.3)) !important;
  height: auto !important;
}

