  * { box-sizing: border-box; margin: 0; padding: 0; }
  /*body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }*/
  
  .demo-info {
    text-align: center;
    color: #555;
    max-width: 520px;
  }
  .demo-info h1 { font-size: 1.5rem; margin-bottom: 10px; color: #1a1a2e; }
  .demo-info p { margin-bottom: 8px; line-height: 1.5; font-size: 0.95rem; }
  .demo-info code {
    background: #e8e8e8;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    color: #333;
  }

  .ragflow-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Segoe UI', system-ui, sans-serif;
  }
	.widget-hint {
		position: absolute;
		bottom: 35px;
		right: 72px;
		background: #fff;
		color: #1A3959;
		font-size: 13px;
		font-weight: 600;
		padding: 8px 14px;
		border-radius: 12px;
		box-shadow: 0 4px 15px rgba(0,0,0,0.15);
		white-space: nowrap;
		opacity: 0;
		transform: translateX(10px) scale(0.9);
		transform-origin: right center;
		pointer-events: none;
		transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
		z-index: 9998;
	}
	.widget-hint::after {
		content: '';
		position: absolute;
		top: 50%;
		right: -6px;
		transform: translateY(-50%);
		width: 0;
		height: 0;
		border-top: 6px solid transparent;
		border-bottom: 6px solid transparent;
		border-left: 6px solid #fff;
		filter: drop-shadow(2px 0 1px rgba(0,0,0,0.05));
	}
	.widget-hint.show {
		opacity: 1;
		transform: translateX(0) scale(1);
	}
  .widget-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #222f3f;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
  }
	.widget-toggle-icon {
		width: 100%;
		height: 100%;
		object-fit: cover;
		border-radius: 50%;
		pointer-events: none;
		transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
	}
  .widget-toggle:hover { transform: scale(1.1); box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5); }
  .widget-toggle.active {
    background: #2ebc82;
  }

  .chat-window {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 400px;
    height: 560px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .chat-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
  }

  .resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 28px;
    height: 28px;
    cursor: nw-resize;
    z-index: 10;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 6px;
  }
  .resize-handle::before {
    content: '';
    width: 14px;
    height: 14px;
    border-top: 3px solid rgba(255,255,255,0.8);
    border-left: 3px solid rgba(255,255,255,0.8);
    border-radius: 2px 0 0 0;
  }
  .resize-handle:hover::before { border-color: #fff; }
  .chat-header {
    background: #1A3959;
    color: white;
    padding: 14px 18px 14px 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
  }
  .chat-header-info { display: flex; align-items: center; gap: 10px; }
	.chat-avatar {
		width: 36px; height: 36px;
		border-radius: 50%;
		background: rgba(255,255,255,0.2);
		display: flex; align-items: center; justify-content: center;
		font-size: 18px;
		overflow: hidden;
		flex-shrink: 0;
	}
	.chat-avatar img {
		width: 100%;
		height: 100%;
		object-fit: cover;
		border-radius: 50%;
	}
  .chat-title { font-weight: 600; font-size: 15px; }
  .chat-subtitle { font-size: 11px; opacity: 0.85; }
  .chat-actions { display: flex; gap: 6px; }
  .chat-actions button {
    background: rgba(255,255,255,0.15);
    border: none; color: white;
    width: 28px; height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    display: flex; align-items: center; justify-content: center;
  }
  .chat-actions button:hover { background: rgba(255,255,255,0.3); }
  .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #f8f9fa;
  }
  .chat-messages::-webkit-scrollbar { width: 5px; }
  .chat-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
  .message {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    word-wrap: break-word;
    animation: msgAppear 0.25s ease;
		position: relative;
  }
  .message-actions {
    position: absolute;
    top: -10px;
    right: 10px;
    display: none;
    gap: 2px;
    z-index: 5;
  }
  .message.user:hover .message-actions {
    display: flex;
  }
  .message-actions button {
    background: #f0f0f0;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    cursor: pointer;
    color: #555;
    opacity: 0.6;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s, transform 0.2s, background 0.2s;
  }
  .message-actions button svg {
    width: 16px;
    height: 16px;
  }	
  .message-actions button:hover {
    opacity: 1;
    transform: scale(1.15);
    background: rgba(255, 255, 255, 0.2);
  }

  .bot-copy-btn {
    position: absolute;
    bottom: 4px;
    right: 6px;
    display: none;
    background: #f0f0f0;
    border: none;
		border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    color: #555;
    opacity: 0.6;
    padding: 2px;
    transition: opacity 0.2s, transform 0.2s;
		align-items: center;
		justify-content: center;
  }
  .bot-copy-btn svg {
    width: 20px;
    height: 20px;
  }	
  .message.bot:hover .bot-copy-btn {
    display: flex;
    opacity: 1;
  }
  .bot-copy-btn:hover {
    transform: scale(1.15);
  }
	
  @keyframes msgAppear {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .message.user {
    align-self: flex-end;
    background: #2ebc82;
    color: white;
    border-bottom-right-radius: 4px;
  }
  .message.bot {
    align-self: flex-start;
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  }
  .message.bot pre {
    background: #f4f4f4;
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 12px;
    margin: 8px 0;
    border: 1px solid #e8e8e8;
  }
  .message.bot code {
    background: #f0f0f0;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 12px;
    color: #c7254e;
  }
  .message.bot h1, .message.bot h2, .message.bot h3, 
  .message.bot h4, .message.bot h5, .message.bot h6 {
    margin: 12px 0 6px 0;
    font-weight: 700;
    line-height: 1.3;
    color: #1a1a2e;
  }
  .message.bot h1:first-child, .message.bot h2:first-child, .message.bot h3:first-child { 
    margin-top: 0; 
  }
  .message.bot h1 { font-size: 1.4em; }
  .message.bot h2 { font-size: 1.25em; }
  .message.bot h3 { font-size: 1.1em; }
  .message.bot h4 { font-size: 1.05em; }
  .message.bot h5 { font-size: 1em; }
  .message.bot h6 { font-size: 0.9em; opacity: 0.85; }	
  .message.bot table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    overflow-x: auto;
    border: 1px solid #ccc;
    border-radius: 6px;
  }
  .message.bot table th, .message.bot table td {
    border: 1px solid #ccc;
    padding: 6px 10px;
    text-align: left;
    vertical-align: top;
  }
  .message.bot table th {
    background: #f4f4f4;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #bbb;
  }
  .message.bot table tbody tr:nth-child(even) {
    background: #fafafa;
  }	
  .message-time {
    font-size: 10px;
    opacity: 0.55;
    margin-top: 4px;
    text-align: right;
  }

  .doc-links-block {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #e0e0e0;
  }
  .doc-links-title {
    font-size: 11px;
    color: #888;
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }
  .doc-links-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .doc-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f0f4ff;
    color: #333;
    padding: 5px 12px;
    border-radius: 14px;
    font-size: 12px;
    text-decoration: none;
    border: 1px solid #d0d8f0;
    transition: all 0.2s;
    cursor: pointer;
    max-width: 100%;
  }
  .doc-link:hover {
    background: #e0e8ff;
    border-color: #667eea;
    transform: translateY(-1px);
  }
  .doc-link-icon { font-size: 13px; flex-shrink: 0; }
  .doc-link-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
  }

  .ref-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background: #2ebc82;
    color: white;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    margin: 0 1px;
    vertical-align: middle;
    user-select: none;
    transition: all 0.15s;
    line-height: 1;
    border: none;
  }
  .ref-badge:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(102,126,234,0.5);
  }
  .ref-badge.missing {
    background: #bbb;
  }

  .ref-modal-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 60;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
  }
  .ref-modal-overlay.open { display: flex; }
  .ref-modal {
    background: white;
    border-radius: 14px;
    width: 100%;
    max-width: 380px;
    max-height: 85%;
    overflow-y: auto;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: modalIn 0.2s ease;
  }
  @keyframes modalIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
  }
  .ref-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
  }
  .ref-modal-title { font-weight: 700; font-size: 14px; color: #1a1a2e; }
  .ref-modal-close {
    background: #f0f0f0;
    border: none;
    width: 30px; height: 30px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    color: #666;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
  }
  .ref-modal-close:hover { background: #e0e0e0; }
  .ref-modal-body { font-size: 13px; line-height: 1.5; color: #444; }
  .ref-modal-meta {
    background: #f8f9fa;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #555;
    border: 1px solid #eee;
  }
  .ref-modal-meta strong { color: #333; }
  .ref-modal-content {
    background: #f4f4f4;
    padding: 12px;
    border-radius: 8px;
    font-size: 12.5px;
    max-height: 220px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid #e8e8e8;
    line-height: 1.6;
  }
  .ref-modal-hint {
    padding: 12px;
    background: #fff3cd;
    border-radius: 8px;
    font-size: 12px;
    color: #856404;
    border: 1px solid #ffeaa7;
  }
  .doc-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(3px);
  }
  .doc-modal-overlay.open { display: flex; }
  .doc-modal {
    background: white;
    border-radius: 14px;
    width: 900px;
    height: 90%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalIn 0.2s ease;
    position: relative;
  }
  .doc-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    cursor: grab;
    user-select: none;
  }
  .doc-modal-header:active { cursor: grabbing; }
  .doc-modal-title { font-weight: 700; font-size: 15px; color: #1a1a2e; display: flex; align-items: center; gap: 8px; pointer-events: none; }
  .doc-modal-close {
    background: #f0f0f0;
    border: none;
    width: 32px; height: 32px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    color: #666;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
  }
  .doc-modal-close:hover { background: #e0e0e0; }
  .doc-modal-body {
    flex: 1;
    position: relative;
    background: #f8f9fa;
    overflow: hidden;
  }
  .doc-loading, .doc-error {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    color: #666;
  }
  .doc-error { color: #e74c3c; text-align: center; max-width: 80%; }
  .doc-download-btn {
    margin-left: auto;
    margin-right: 12px;
    background: #2ebc82;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
  }
  .doc-download-btn:hover { opacity: 0.9; }
  #docViewerContainer {
    width: 100%;
    height: 100%;
    display: none;
  }
  #docViewerContainer.show { display: block; }

  .doc-modal-resize {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 24px;
    height: 24px;
    cursor: se-resize;
    z-index: 10;
  }
  .doc-modal-resize::after {
    content: '';
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 10px;
    height: 10px;
    border-right: 3px solid #bbb;
    border-bottom: 3px solid #bbb;
    border-radius: 0 0 2px 0;
    transition: border-color 0.2s;
  }
  .doc-modal-resize:hover::after {
    border-color: #667eea;
  }

	.typing {
		display: flex;
		align-items: center;
		gap: 8px;
		background: white;
		border-radius: 14px;
		border-bottom-left-radius: 4px;
		align-self: flex-start;
		font-size: 13.5px;
	}
	.typing-label {
		color: #555;
		font-style: italic;
		white-space: nowrap;
	}
	.typing-dots {
		display: flex;
		align-items: center;
		gap: 4px;
	}
  .typing-dot {
    width: 7px; height: 7px;
    background: #999;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
  }
  .typing-dot:nth-child(1) { animation-delay: 0s; }
  .typing-dot:nth-child(2) { animation-delay: 0.2s; }
  .typing-dot:nth-child(3) { animation-delay: 0.4s; }
	.typing-dot:nth-child(4) { animation-delay: 0.6s; }
  @keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
  }

  .chat-input-area {
    padding: 12px 14px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
  }
  .chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    resize: none;
    max-height: 120px;
    min-height: 40px;
    font-family: inherit;
    transition: border-color 0.2s;
    line-height: 1.4;
  }
  .chat-input:focus { border-color: #667eea; }
  .send-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: #2ebc82;
    border: none; color: white;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
  }
  .send-btn svg {
    width: 20px;
    height: 20px;
    color: white;
  }
  .send-btn:hover:not(:disabled) { transform: scale(1.05); }

	.info-icon {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 16px;
		height: 16px;
		margin-left: 6px;
		border: 1.5px solid rgba(255,255,255,0.7);
		border-radius: 4px;
		font-size: 11px;
		font-style: italic;
		font-weight: 700;
		font-family: Georgia, 'Times New Roman', serif;
		cursor: pointer;
		vertical-align: middle;
		transition: all 0.2s;
		user-select: none;
		line-height: 1;
		position: relative;
		top: -3px;
	}
	.info-icon:hover {
		background: rgba(255,255,255,0.25);
		border-color: #fff;
		transform: scale(1.15);
	}

	.info-popup {
		position: absolute;
		top: 60px;
		left: 12px;
		right: 12px;
		background: #fff;
		color: #333;
		border-radius: 10px;
		box-shadow: 0 8px 30px rgba(0,0,0,0.25);
		padding: 14px 16px;
		font-size: 12.5px;
		line-height: 1.5;
		z-index: 50;
		display: none;
		animation: modalIn 0.2s ease;
	}
	.info-popup.open { display: block; }
	.info-popup-close {
		position: absolute;
		top: 8px;
		right: 10px;
		background: #f0f0f0;
		border: none;
		width: 22px;
		height: 22px;
		border-radius: 50%;
		cursor: pointer;
		font-size: 13px;
		color: #666;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.info-popup-close:hover { background: #e0e0e0; }
	.info-popup-body {
		max-height: calc(1.5em * 10); /* 10 строк */
		overflow-y: auto;
		padding-right: 4px;
		padding-top: 4px;
	}
	.info-popup-body article { font-size: 12.5px; line-height: 1.5; color: #333; }
	.info-popup-body h2 { font-size: 14px; margin: 0 0 8px 0; color: #1a3959; font-weight: 700; }
	.info-popup-body h3 { font-size: 12.5px; margin: 10px 0 4px 0; color: #1a3959; font-weight: 700; }
	.info-popup-body p { margin: 0 0 8px 0; }
	.info-popup-body ul { margin: 0 0 8px 18px; padding: 0; }
	.info-popup-body li { margin-bottom: 4px; }
	.info-popup-body section { margin-bottom: 6px; }
	.info-popup-body::-webkit-scrollbar { width: 5px; }
	.info-popup-body::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }	

  @media (max-width: 480px) {
    .chat-window {
      width: calc(100vw - 32px) !important;
      height: calc(100vh - 100px) !important;
      right: -12px;
    }
    .doc-modal { width: 100%; height: 95%; }
    .doc-link-name { max-width: 160px; }
  }


