/* 
 * NDM Medical Assistant Styles
 * Версия 3.2 - Полностью без быстрых кнопок
 */

/* ========== ОСНОВНЫЕ СТИЛИ ========== */
.ndm-assistant-widget {
    position: fixed;
    bottom: var(--ndm-safe-bottom, 20px);
    right: var(--ndm-safe-right, 20px);
    --ndm-assistant-toggle-size: 60px;
    --ndm-assistant-mobile-inline-gap: clamp(0.875rem, 3vw, 1.125rem);
    --ndm-assistant-mobile-bottom-gap: calc(var(--ndm-mobile-safe-bottom, var(--ndm-safe-bottom, 15px)) + var(--ndm-mobile-gap, clamp(0.625rem, 1.25vmax, 1rem)));
    --ndm-assistant-mobile-floating-bottom: var(--ndm-mobile-floating-bottom, calc(var(--ndm-assistant-mobile-bottom-gap) + clamp(3.75rem, 8svh, 5rem)));
    --ndm-assistant-mobile-max-inline: min(28rem, calc(min(100dvw, calc(var(--ndm-scene-vw, 1vw) * 100)) - var(--ndm-safe-left, env(safe-area-inset-left)) - var(--ndm-safe-right, env(safe-area-inset-right)) - (var(--ndm-assistant-mobile-inline-gap) * 2)));
    --ndm-assistant-mobile-max-block: min(42rem, calc(min(100dvh, calc(var(--ndm-vh, 1vh) * 100)) - env(safe-area-inset-top) - var(--ndm-safe-bottom, env(safe-area-inset-bottom)) - clamp(5.5rem, 12svh, 7rem)));
    --ndm-assistant-window-offset: calc(var(--ndm-assistant-toggle-size) + clamp(0.75rem, 2.4vw, 1rem));
    /* Keep the widget above the fullscreen overlay/backdrop.
       If the overlay shares the same z-index, it may end up above the widget
       (depending on DOM order) and capture all taps/clicks, causing the panel
       to close immediately. */
    z-index: 10020;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none;
}

.ndm-assistant-widget > * {
    pointer-events: auto;
}

/* Полностью скрываем быстрые кнопки (запрет на показ) */
.ndm-assistant-quick-buttons {
    display: none !important;
}

/* ========== КНОПКА ПЕРЕКЛЮЧЕНИЯ ========== */
.ndm-assistant-toggle {
    position: relative;
    width: var(--ndm-assistant-toggle-size);
    height: var(--ndm-assistant-toggle-size);
    border-radius: 50%;
    background: linear-gradient(135deg, #2ECC71 0%, #27AE60 100%);
    border: 2px solid rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(46, 204, 113, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 10001;
    flex-shrink: 0;
}

.ndm-assistant-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(46, 204, 113, 0.4);
}

.ndm-assistant-toggle:active {
    transform: scale(0.95);
}

.ndm-assistant-icon {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.ndm-assistant-pulse {
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    background: rgba(46, 204, 113, 0.3);
    animation: ndm-assistant-pulse 2s infinite;
    z-index: -1;
    pointer-events: none;
}

.ndm-assistant-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #FF4757;
    color: white;
    font-size: 11px;
    font-weight: bold;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #1a1a1a;
    animation: ndm-assistant-badge-pulse 1.5s infinite;
    pointer-events: none;
}

@keyframes ndm-assistant-pulse {
    0% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(1.2); opacity: 0; }
}

@keyframes ndm-assistant-badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ========== ОКНО ЧАТА ========== */
.ndm-assistant-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-height: 600px;
    background: rgba(26, 32, 44, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10001;
}

.ndm-assistant-window.ndm-assistant-window-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ========== ЗАГОЛОВОК ========== */
.ndm-assistant-header {
    padding: 20px;
    background: linear-gradient(135deg, rgba(30, 42, 30, 0.9) 0%, rgba(18, 18, 18, 0.9) 100%);
    border-bottom: 1px solid rgba(46, 204, 113, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.ndm-assistant-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.ndm-assistant-avatar {
    width: 40px;
    height: 40px;
    background: rgba(46, 204, 113, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(46, 204, 113, 0.3);
    flex-shrink: 0;
}

.ndm-assistant-avatar svg {
    width: 24px;
    height: 24px;
    fill: #2ECC71;
}

.ndm-assistant-title h3 {
    margin: 0;
    color: white;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ndm-assistant-status {
    color: #2ECC71;
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
    display: block;
}

.ndm-assistant-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ndm-assistant-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.ndm-assistant-close svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* ========== ОБЛАСТЬ СООБЩЕНИЙ ========== */
.ndm-assistant-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.ndm-assistant-messages::-webkit-scrollbar {
    width: 6px;
}

.ndm-assistant-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.ndm-assistant-messages::-webkit-scrollbar-thumb {
    background: rgba(46, 204, 113, 0.3);
    border-radius: 3px;
}

.ndm-assistant-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(46, 204, 113, 0.5);
}

/* ========== СООБЩЕНИЯ ========== */
.ndm-assistant-message {
    display: flex;
    gap: 12px;
    animation: ndm-assistant-message-appear 0.3s ease-out;
    max-width: 100%;
}

@keyframes ndm-assistant-message-appear {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ndm-assistant-message-assistant .ndm-assistant-message-avatar {
    background: rgba(46, 204, 113, 0.1);
    border-color: rgba(46, 204, 113, 0.3);
}

.ndm-assistant-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.ndm-assistant-message-avatar svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.ndm-assistant-message-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ndm-assistant-message-text {
    background: rgba(45, 45, 45, 0.8);
    padding: 12px 16px;
    border-radius: 15px;
    color: white;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid rgba(255, 255, 255, 0.05);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ndm-assistant-message-assistant .ndm-assistant-message-text {
    background: rgba(46, 204, 113, 0.1);
    border-color: rgba(46, 204, 113, 0.2);
    border-radius: 15px 15px 15px 0;
}

.ndm-assistant-message-user {
    flex-direction: row-reverse;
}

.ndm-assistant-message-user .ndm-assistant-message-text {
    background: linear-gradient(135deg, #2ECC71 0%, #27AE60 100%);
    border-radius: 15px 15px 0 15px;
    color: white;
}

.ndm-assistant-message-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 4px;
    text-align: right;
}

/* ========== ОБЛАСТЬ ВВОДА ========== */
.ndm-assistant-input-area {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(18, 18, 18, 0.8);
    flex-shrink: 0;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

.ndm-assistant-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 12px;
}

.ndm-assistant-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    color: white;
    font-size: 16px;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    transition: all 0.2s;
    font-family: inherit;
    line-height: 1.4;
}

.ndm-assistant-input:focus {
    outline: none;
    border-color: #2ECC71;
    box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.2);
}

.ndm-assistant-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.ndm-assistant-send {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #2ECC71 0%, #27AE60 100%);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ndm-assistant-send:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

.ndm-assistant-send:active:not(:disabled) {
    transform: translateY(0);
}

.ndm-assistant-send svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.ndm-assistant-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ========== ИНДИКАТОР НАБОРА ========== */
.ndm-assistant-typing {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    justify-content: center;
    align-items: center;
    height: 20px;
}

.ndm-assistant-typing span {
    width: 8px;
    height: 8px;
    background: #2ECC71;
    border-radius: 50%;
    animation: ndm-assistant-typing 1.4s infinite ease-in-out;
}

.ndm-assistant-typing span:nth-child(1) { animation-delay: -0.32s; }
.ndm-assistant-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes ndm-assistant-typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ========== ЯЗЫКОВЫЕ ПЕРЕКЛЮЧАТЕЛИ ========== */
.ndm-assistant-languages {
    display: none !important;
}

.ndm-ai-language-switcher,
.ndm-ai-lang-btn {
    display: none !important;
}

.ndm-assistant-lang {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-weight: 500;
    min-width: 44px;
    text-align: center;
}

.ndm-assistant-lang.active {
    background: rgba(46, 204, 113, 0.2);
    border-color: #2ECC71;
    color: #2ECC71;
}

.ndm-assistant-lang:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* =========================================
   АДАПТИВНОСТЬ
   ========================================= */

@media (max-width: 768px) {
    .ndm-assistant-widget {
        right: var(--ndm-safe-right, 15px);
        bottom: var(--ndm-assistant-mobile-bottom-gap);
        --ndm-assistant-toggle-size: clamp(3.25rem, 8.8vw, 3.6rem);
    }
    
    .ndm-assistant-toggle {
        width: var(--ndm-assistant-toggle-size);
        height: var(--ndm-assistant-toggle-size);
    }
    
    .ndm-assistant-window {
        position: absolute;
        right: 0;
        width: min(var(--ndm-assistant-mobile-max-inline), calc((var(--ndm-scene-vw, 1vw) * 100) - var(--ndm-safe-right, 15px) - var(--ndm-safe-left, 15px) - (var(--ndm-assistant-mobile-inline-gap) * 2)));
        max-width: none;
        bottom: var(--ndm-assistant-window-offset);
        left: var(--ndm-safe-left, 15px);
        max-height: min(var(--ndm-assistant-mobile-max-block), calc((var(--ndm-vh, 1vh) * 100) - var(--ndm-safe-bottom, 15px) - env(safe-area-inset-top) - var(--ndm-assistant-window-offset) - clamp(0.75rem, 2.4vw, 1rem)));
        border-radius: clamp(1rem, 2.8vw, 1.15rem);
    }
    
    .ndm-assistant-header {
        padding: clamp(0.9rem, 3vw, 1rem);
    }
    
    .ndm-assistant-title h3 {
        font-size: 15px;
    }
    
    .ndm-assistant-messages {
        padding: clamp(0.9rem, 3vw, 1rem);
    }
    
    /*
      Полноценный mobile layout ("как приложение").
      Включается классом .ndm-mobile-open на .ndm-assistant-widget (ставится из JS).
      Причины:
      - 100vh на мобилках прыгает из-за адресной строки/клавиатуры
      - нужен safe-area на iPhone
    */
    .ndm-assistant-widget.ndm-mobile-open {
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        top: 0 !important;
        width: min(100dvw, calc(var(--ndm-scene-vw, 1vw) * 100));
        height: min(100dvh, calc(var(--ndm-vh, 1vh) * 100));
        pointer-events: auto;
    }

    .ndm-assistant-widget.ndm-mobile-open .ndm-assistant-window {
        position: fixed;
        inset: 0;
        width: min(100dvw, calc(var(--ndm-scene-vw, 1vw) * 100));
        height: min(100dvh, calc(var(--ndm-vh, 1vh) * 100));
        max-height: none;
        border-radius: 0;
        bottom: 0;
        right: 0;
        left: 0;
        box-shadow: none;
        transform: none;
    }

    .ndm-assistant-widget.ndm-mobile-open .ndm-assistant-header {
        padding-top: calc(16px + env(safe-area-inset-top));
    }

    .ndm-assistant-widget.ndm-mobile-open .ndm-assistant-input-area {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .ndm-assistant-widget.ndm-mobile-open .ndm-assistant-messages {
        -webkit-overflow-scrolling: touch;
    }

    /* На мобилке кнопка-тоггл мешает, когда окно открыто */
    .ndm-assistant-widget.ndm-mobile-open .ndm-assistant-toggle {
        display: none;
    }
}

/*
  PHONE FULLSCREEN MODE
  Below ~650px the window can become partially offscreen on some mobile browsers
  (especially when the viewport changes due to URL bar / safe areas).
  We force the assistant to be fullscreen when open.
*/
@media (max-width: 650px) {
  .ndm-assistant-widget.ndm-mobile-open {
    transform: none !important;
  }

  .ndm-assistant-widget.ndm-mobile-open .ndm-assistant-window {
    position: fixed;
    top: max(0px, env(safe-area-inset-top));
    right: max(0px, env(safe-area-inset-right));
    bottom: max(0px, env(safe-area-inset-bottom));
    left: max(0px, env(safe-area-inset-left));
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    border-radius: 0;
    margin: 0;
  }

  /* Keep content usable and avoid hidden bottom input on iOS */
  .ndm-assistant-widget.ndm-mobile-open .ndm-assistant-chat {
    height: 100%;
    max-height: 100%;
  }

  /* Hide the floating toggle while open (close via X in header) */
  .ndm-assistant-widget.ndm-mobile-open .ndm-assistant-toggle {
    display: none !important;
  }
}

/* Оверлей (создаётся JS), чтобы закрывать тапом снаружи + блокировать фон */
.ndm-assistant-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    /* Must be lower than .ndm-assistant-widget (see note above). */
    z-index: 10010;
}

/* Блокировка скролла фона, пока чат открыт на мобилке */
body.ndm-assistant-no-scroll {
    overflow: hidden !important;
    touch-action: none;
}

@media (max-width: 768px) and (orientation: landscape) {
    .ndm-assistant-widget {
        --ndm-assistant-toggle-size: clamp(3rem, 7vw, 3.25rem);
        --ndm-assistant-mobile-max-inline: min(24rem, calc((var(--ndm-scene-vw, 1vw) * 100) - var(--ndm-safe-left, 15px) - var(--ndm-safe-right, 15px) - (var(--ndm-assistant-mobile-inline-gap) * 1.5)));
        --ndm-assistant-mobile-max-block: min(30rem, calc((var(--ndm-vh, 1vh) * 100) - env(safe-area-inset-top) - var(--ndm-safe-bottom, 15px) - clamp(4.5rem, 10svh, 5.5rem)));
    }

    .ndm-assistant-window {
        width: var(--ndm-assistant-mobile-max-inline);
        right: 0;
        left: auto;
        top: max(env(safe-area-inset-top), clamp(0.45rem, 1.5vw, 0.8rem));
        bottom: auto;
        max-height: var(--ndm-assistant-mobile-max-block);
    }

    .ndm-assistant-header {
        padding: clamp(0.65rem, 1.8vw, 0.8rem) clamp(0.8rem, 2vw, 0.95rem);
    }

    .ndm-assistant-header-content {
        gap: 0.55rem;
    }

    .ndm-assistant-avatar {
        width: 32px;
        height: 32px;
        border-radius: 10px;
    }

    .ndm-assistant-avatar svg {
        width: 18px;
        height: 18px;
    }

    .ndm-assistant-title h3 {
        font-size: 13px;
    }

    .ndm-assistant-status {
        font-size: 11px;
        margin-top: 1px;
    }

    .ndm-assistant-close {
        padding: 6px;
    }

    .ndm-assistant-messages {
        padding: clamp(0.75rem, 1.8vw, 0.9rem);
        gap: 0.75rem;
        min-height: clamp(9rem, 34vh, 18rem);
    }

    .ndm-assistant-message {
        gap: 0.55rem;
    }

    .ndm-assistant-message-avatar {
        width: 30px;
        height: 30px;
        border-radius: 9px;
    }

    .ndm-assistant-message-avatar svg {
        width: 16px;
        height: 16px;
    }

    .ndm-assistant-message-text {
        padding: 10px 12px;
        font-size: 13px;
        line-height: 1.5;
    }

    .ndm-assistant-input-area {
        padding: 0.6rem 0.8rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
    }

    .ndm-assistant-input-wrapper {
        gap: 8px;
        margin-bottom: 0;
    }

    .ndm-assistant-input {
        min-height: 40px;
        max-height: 96px;
        padding: 10px 12px;
        font-size: 15px;
    }

    .ndm-assistant-send {
        width: 40px;
        height: 40px;
    }

    .ndm-assistant-typing {
        height: 16px;
        margin-bottom: 8px;
    }
}

@media (max-width: 360px) {
    .ndm-assistant-toggle {
        width: clamp(3rem, 14vw, 3.2rem);
        height: clamp(3rem, 14vw, 3.2rem);
    }
    
    .ndm-assistant-window {
        bottom: var(--ndm-assistant-window-offset);
        max-height: min(var(--ndm-assistant-mobile-max-block), calc((var(--ndm-vh, 1vh) * 100) - env(safe-area-inset-top) - var(--ndm-safe-bottom, 15px) - clamp(4.75rem, 11svh, 5.75rem)));
    }
    
    .ndm-assistant-message-text {
        font-size: 13px;
    }
}

@media (min-width: 1025px) {
    .ndm-assistant-window {
        width: 380px;
        right: 0;
        left: auto;
    }
}

/* Светлая тема */
.light-theme .ndm-assistant-window {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.light-theme .ndm-assistant-header {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.1) 0%, rgba(255, 255, 255, 0.9) 100%);
    border-bottom: 1px solid rgba(46, 204, 113, 0.2);
}

.light-theme .ndm-assistant-title h3 {
    color: #1a1a1a;
}

.light-theme .ndm-assistant-message-text {
    background: rgba(245, 245, 245, 0.9);
    color: #1a1a1a;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.light-theme .ndm-assistant-message-assistant .ndm-assistant-message-text {
    background: rgba(46, 204, 113, 0.1);
    border-color: rgba(46, 204, 113, 0.2);
}

.light-theme .ndm-assistant-input-area {
    background: rgba(250, 250, 250, 0.9);
}

.light-theme .ndm-assistant-input {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1a1a1a;
}

.light-theme .ndm-assistant-input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

.light-theme .ndm-assistant-lang {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.6);
}

.light-theme .ndm-assistant-lang:hover:not(.active) {
    background: rgba(0, 0, 0, 0.06);
    color: #1a1a1a;
}

/* ========== СТИЛИ ДЛЯ АВТОМАТИЧЕСКИХ СООБЩЕНИЙ ========== */
.ndm-assistant-message-auto {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.08) 0%, rgba(46, 204, 113, 0.03) 100%);
    border-left: 3px solid rgba(46, 204, 113, 0.6);
}

.ndm-assistant-message-auto .ndm-assistant-message-text {
    background: rgba(46, 204, 113, 0.08);
    border-color: rgba(46, 204, 113, 0.15);
    font-style: italic; /* Можно добавить легкий наклон для текста */
}

/* ========== MESSAGE ACTIONS (COPY / TTS) ========== */
.ndm-assistant-message-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.ndm-assistant-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.88);
    font-size: 12px;
    line-height: 1;
    transition: transform 0.15s ease, background 0.15s ease;
}

.ndm-assistant-action-btn:hover {
    background: rgba(255, 255, 255, 0.10);
    transform: translateY(-1px);
}

.ndm-assistant-action-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.ndm-assistant-action-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    opacity: 0.95;
}

.light-theme .ndm-assistant-action-btn {
    border: 1px solid rgba(0, 0, 0, 0.10);
    background: rgba(0, 0, 0, 0.03);
    color: rgba(0, 0, 0, 0.75);
}

.light-theme .ndm-assistant-action-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* Mobile 3D viewer controls use the bottom edge; hide only the floating closed-state assistant button there. */
@media (max-width: 768px) {
    html[data-ndm-scene-screen="phone"] .ndm-assistant-widget:not(.ndm-mobile-open) {
        display: none !important;
    }
}

/* Mobile Toolbar V2/V3/V4 pages: keep the closed launcher visible above the bottom toolbar. */
@media (max-width: 920px), (pointer: coarse) {
    html[data-ndm-mobile-toolbar-v2="1"] .ndm-assistant-widget:not(.ndm-mobile-open) {
        display: flex !important;
        right: max(16px, env(safe-area-inset-right)) !important;
        bottom: calc(max(10px, env(safe-area-inset-bottom)) + 108px) !important;
        --ndm-assistant-toggle-size: 48px !important;
    }

    html[data-ndm-mobile-toolbar-v2="1"] .ndm-assistant-widget:not(.ndm-mobile-open) .ndm-assistant-toggle {
        width: 48px !important;
        height: 48px !important;
    }
}
