/* Deepseek — чат-интерфейс в стиле DeepSeek (синие акценты только внутри чата) */

.ds-chat-layout {
  --accent: #0066ff;
  --accent-hover: #0052cc;
  display: flex;
  height: calc(100vh - 70px);
  min-height: 0;
  overflow: hidden;
}

.ds-sidebar {
  width: 260px;
  min-width: 260px;
  flex-shrink: 0;
  border-right: 1px solid var(--border, #e8e8e8);
  background: var(--bg, #fff);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ds-sidebar-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 12px 8px;
}
.ds-sidebar-title {
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text, #1a1a1a);
  border-bottom: none;
  min-width: 0;
}
.ds-sidebar-header-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.ds-chat-search-toggle {
  display: flex;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--border-light, #f0f0f0);
  color: var(--text, #1a1a1a);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.ds-chat-search-toggle:hover {
  background: var(--border, #e0e0e0);
}
.ds-sidebar-close {
  display: none;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--border-light, #f0f0f0);
  color: var(--text, #1a1a1a);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.ds-sidebar-close:hover {
  background: var(--border, #e0e0e0);
}
.ds-chats-burger {
  display: none;
  position: fixed;
  top: 78px;
  left: 12px;
  z-index: 50;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
  transition: background 0.2s, box-shadow 0.2s;
  touch-action: manipulation;
}
.ds-chats-burger:hover {
  background: var(--border-light, #f5f5f5);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.ds-chats-burger::before {
  content: '→';
  font-size: 1.35rem;
  line-height: 1;
  color: var(--text, #1a1a1a);
}
body.ds-sidebar-open .ds-chats-burger::before {
  content: '←';
}
.ds-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: 70px;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s, visibility 0.2s;
}
.ds-sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.ds-new-chat {
  flex-shrink: 0;
  margin: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 12px;
  background: var(--border-light, #f5f5f5);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text, #1a1a1a);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ds-new-chat::before {
  content: '+';
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg, #fff);
  border: 1px solid var(--border, #e0e0e0);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1;
}

.ds-new-chat:hover {
  background: var(--border-light, #f5f5f5);
  border-color: var(--accent, #0066ff);
  color: var(--accent, #0066ff);
}

.ds-chat-search-panel {
  flex-shrink: 0;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--border, #e0e0e0);
}
.ds-chat-search-panel.hidden {
  display: none;
}
.ds-chat-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ds-chat-search-input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 10px;
  font-size: 0.875rem;
  background: var(--bg, #fff);
  color: var(--text, #1a1a1a);
}
.ds-chat-search-input:focus {
  outline: none;
  border-color: var(--accent, #0066ff);
}
.ds-chat-search-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: var(--border-light, #f0f0f0);
  color: var(--text, #1a1a1a);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.ds-chat-search-close:hover {
  background: var(--border, #e0e0e0);
}
.ds-chat-search-status {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-muted, #666);
  min-height: 1em;
}
.ds-chat-search-results {
  margin-top: 8px;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ds-chat-search-hit {
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 10px;
  background: var(--bg, #fff);
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--text, #1a1a1a);
  transition: border-color 0.15s, background 0.15s;
}
.ds-chat-search-hit:hover {
  border-color: var(--accent, #0066ff);
  background: var(--border-light, #f5f5f5);
}
.ds-chat-search-hit-title {
  display: block;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--text, #1a1a1a);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ds-chat-search-hit-meta {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted, #888);
  margin-top: 2px;
}
.ds-chat-search-hit-snippet {
  font-size: 0.78rem;
  color: var(--text-secondary, #555);
  margin-top: 4px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ds-chat-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 8px 12px;
}
.ds-chat-group-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted, #888);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 12px 4px 6px;
  margin: 0;
}
.ds-chat-group-title:first-child {
  padding-top: 4px;
}

.ds-chat-item {
  display: flex;
  align-items: center;
  border-radius: 10px;
  margin-bottom: 4px;
  position: relative;
}

.ds-chat-item:hover .ds-chat-item-actions {
  opacity: 1;
}

.ds-chat-item.active {
  background: var(--border-light, #f0f0f0);
}

.ds-chat-item-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 12px;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text, #1a1a1a);
  border-radius: 10px;
  min-width: 0;
}

.ds-chat-item-btn:hover {
  background: var(--border-light, #f5f5f5);
}

.ds-chat-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-weight: 500;
}

.ds-chat-item-date {
  font-size: 0.75rem;
  color: var(--text-muted, #888);
  margin-top: 2px;
}

.ds-chat-item-actions {
  opacity: 0;
  display: flex;
  gap: 2px;
  padding: 0 4px;
  transition: opacity 0.2s;
}

.ds-chat-rename,
.ds-chat-delete {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted, #888);
  transition: color 0.2s, background 0.2s;
}

.ds-chat-rename:hover,
.ds-chat-delete:hover {
  color: var(--text, #1a1a1a);
  background: var(--border-light, #eee);
}

.ds-chat-delete:hover {
  color: #c62828;
}

/* Мини-подтверждение удаления чата (fixed у кнопки ×) */
.text-chat-delete-confirm {
  position: fixed;
  z-index: 10050;
  min-width: 200px;
  max-width: min(280px, calc(100vw - 16px));
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg, #fff);
  border: 1px solid var(--border, #e8e8e8);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.03);
  font-size: 0.875rem;
  box-sizing: border-box;
  line-height: 1.4;
}

.text-chat-delete-confirm__title {
  margin: 0 0 6px;
  font-weight: 600;
  color: var(--text, #1a1a1a);
  font-size: 0.9rem;
}

.text-chat-delete-confirm__hint {
  margin: 0 0 12px;
  font-size: 0.8125rem;
  color: var(--text-muted, #666);
}

.text-chat-delete-confirm__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.text-chat-delete-confirm__btn {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--border, #e0e0e0);
  background: var(--border-light, #f5f5f5);
  color: var(--text, #1a1a1a);
  transition: background 0.15s, border-color 0.15s;
}

.text-chat-delete-confirm__btn:hover {
  background: var(--border, #e8e8e8);
}

.text-chat-delete-confirm__btn--danger {
  background: #c62828;
  border-color: #b71c1c;
  color: #fff;
}

.text-chat-delete-confirm__btn--danger:hover {
  background: #b71c1c;
  border-color: #a01515;
}

/* Два блока: сообщения (скролл) + поле ввода (статично) */
.ds-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-page, #fafafa);
}

.ds-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ds-messages::-webkit-scrollbar {
  display: none;
}

.ds-scroll-to-bottom {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  color: #0066FF;
  font-size: 1.25rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity 0.2s, transform 0.2s;
}

.ds-scroll-to-bottom.visible {
  display: inline-flex;
  animation: ds-scroll-btn-in 0.3s ease-out;
}

.ds-scroll-to-bottom:hover {
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

@keyframes ds-scroll-btn-in {
  0% { opacity: 0; transform: translateY(-50%) scale(0.8); }
  60% { transform: translateY(-50%) scale(1.05); }
  100% { opacity: 1; transform: translateY(-50%) scale(1); }
}

.ds-input-area {
  flex: 0 0 auto;
  border-top: 1px solid var(--border, #e5e5e5);
  background: var(--bg, #fff);
  padding: 20px 24px;
  position: relative;
}

.ds-welcome {
  flex: 1;
  min-height: 40vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-muted, #888);
}

.ds-welcome.hidden {
  display: none;
}

.ds-welcome-icon {
  font-size: 4rem;
  opacity: 0.9;
}

.ds-welcome-text {
  font-size: 1rem;
  font-weight: 500;
}

.ds-msg {
  display: flex;
  gap: 12px;
  max-width: 800px;
  align-self: flex-start;
  align-items: flex-start;
  scroll-margin-top: 12px;
}

@keyframes ds-msg-highlight-pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 102, 255, 0.35); }
  100% { box-shadow: 0 0 0 8px rgba(0, 102, 255, 0); }
}
.ds-msg.ds-msg--highlight {
  animation: ds-msg-highlight-pulse 1.2s ease-out 2;
}

.ds-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ds-msg-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  background: var(--border-light, #eee);
  border-radius: 10px;
  overflow: hidden;
  box-sizing: border-box;
}

.ds-msg-user .ds-msg-avatar {
  border-radius: 50%;
  background: rgba(0, 102, 255, 0.12);
  font-weight: 600;
  color: var(--accent, #0066ff);
}

.ds-msg-user .ds-msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.ds-msg-user .ds-msg-avatar-pro-wrap {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 2px;
  border-radius: 50%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, #ffcba4 0%, #e8a0bf 50%, #9b59b6 100%);
  box-shadow: 0 0 10px rgba(155, 89, 182, 0.35);
}

.ds-msg-user .ds-msg-avatar-pro-wrap .ds-msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  box-sizing: border-box;
}

.ds-msg-content {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.9375rem;
  line-height: 1.6;
  word-break: break-word;
}

.ds-msg-user .ds-msg-content {
  background: var(--accent, #0066ff);
  color: #fff;
  border-radius: 12px;
  border-bottom-right-radius: 4px;
}

/* Ответ нейросети — один блок-карточка как в оригинале DeepSeek, без полос */
.ds-msg-assistant {
  width: 100%;
  max-width: 100%;
}
.ds-msg-assistant .ds-msg-avatar {
  display: none;
}
.ds-msg-assistant-body {
  flex: 1;
  min-width: 0;
  max-width: 100%;
}
.ds-msg-assistant .ds-msg-content {
  background: #fff;
  border: 1px solid var(--border, #e8e8e8);
  border-radius: 12px;
  padding: 14px 18px;
  color: var(--text, #1a1a1a);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  overflow-x: hidden;
  overflow-y: visible;
}
.ds-msg-assistant .ds-msg-content::-webkit-scrollbar,
.ds-msg-assistant .ds-msg-content pre::-webkit-scrollbar {
  display: none;
}
.ds-msg-assistant .ds-msg-content pre {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.ds-msg-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.ds-msg-assistant:hover .ds-msg-actions {
  opacity: 1;
}
.ds-msg-action {
  position: relative;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary, #666);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.ds-msg-action:hover {
  background: var(--border-light, #f0f0f0);
  color: var(--text, #1a1a1a);
}
.ds-msg-action[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%) translateY(-6px);
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #fff;
  background: rgba(0, 0, 0, 0.85);
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 20;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.ds-msg-action[title]:hover::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%) translateY(2px);
  border: 5px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.85);
  pointer-events: none;
  z-index: 21;
}
.ds-msg-action svg {
  display: block;
}

.ds-msg-content.ds-msg-content--streaming {
  min-height: 1.5em;
}
.ds-msg-content.ds-msg-content--streaming::after {
  content: '|';
  display: inline;
  margin-left: 2px;
  color: var(--accent, #0066ff);
  animation: ds-cursor-blink 1s step-end infinite;
  vertical-align: text-bottom;
}
.ds-msg-content.ds-msg-content--no-cursor::after {
  display: none;
}
@keyframes ds-cursor-blink {
  50% { opacity: 0; }
}

/* Иерархия заголовков — как задумано нейросетью (# ## ###) */
.ds-msg-content h1 {
  margin: 1em 0 0.35em;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}
.ds-msg-content h2 {
  margin: 0.9em 0 0.3em;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.35;
}
.ds-msg-content h3, .ds-msg-content h4, .ds-msg-content h5, .ds-msg-content h6 {
  margin: 0.75em 0 0.25em;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}
.ds-msg-content h1:first-child, .ds-msg-content h2:first-child,
.ds-msg-content h3:first-child, .ds-msg-content h4:first-child,
.ds-msg-content h5:first-child, .ds-msg-content h6:first-child { margin-top: 0; }

/* Абзацы */
.ds-msg-content p {
  margin: 0 0 0.75em 0;
  line-height: 1.6;
}
.ds-msg-content p:first-child { margin-top: 0; }
.ds-msg-content p:last-child { margin-bottom: 0; }

/* Разделитель --- от нейросети */
.ds-msg-content hr {
  margin: 1.25em 0;
  border: none;
  border-top: 1px solid var(--border-light, #eee);
}

/* Списки (- или 1. 2. 3.) */
.ds-msg-content ul, .ds-msg-content ol {
  margin: 0.5em 0;
  padding-left: 1.5em;
  line-height: 1.55;
}
.ds-msg-content li {
  margin: 0.2em 0;
}
.ds-msg-content ul { list-style-type: disc; }
.ds-msg-content ol { list-style-type: decimal; }

/* Цитаты > */
.ds-msg-content blockquote {
  margin: 0.75em 0;
  padding: 0.5em 0 0.5em 1em;
  border-left: 4px solid var(--border, #ddd);
  background: var(--border-light, #f8f8f8);
  color: var(--text-secondary, #555);
  border-radius: 0 6px 6px 0;
}

/* Выделения **жирный** *курсив* ~~зачёркнутый~~ */
.ds-msg-content strong { font-weight: 700; }
.ds-msg-content em { font-style: italic; }
.ds-msg-content del,
.ds-msg-content s { text-decoration: line-through; }
.ds-msg-content mark { background: rgba(255, 193, 7, 0.35); padding: 0 0.15em; border-radius: 2px; }

/* Ссылки [текст](url) */
.ds-msg-content a {
  color: #0066ff;
  text-decoration: none;
}
.ds-msg-content a:hover {
  text-decoration: underline;
}

/* Таблицы (markdown) */
.ds-msg-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75em 0;
  font-size: 0.9rem;
}
.ds-msg-content thead {
  background: var(--border-light, #f0f0f0);
}
.ds-msg-content th,
.ds-msg-content td {
  border: 1px solid var(--border, #e0e0e0);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}
.ds-msg-content th {
  font-weight: 600;
  color: var(--text, #1a1a1a);
}
.ds-msg-content tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}
.ds-msg-content pre {
  margin: 0.75em 0;
  padding: 12px 14px;
  background: #f6f6f6;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.5;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.ds-msg-content pre::-webkit-scrollbar {
  display: none;
}

.ds-msg-content code {
  font-family: ui-monospace, 'SF Mono', Monaco, monospace;
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.ds-msg-content pre code {
  background: none;
  padding: 0;
}

.ds-msg-user .ds-msg-content pre {
  background: rgba(255,255,255,0.2);
}

.ds-typing {
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 8px 0 16px;
  background: var(--bg-page, #fafafa);
  box-sizing: border-box;
}
.ds-typing-inner {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  padding: 0 32px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
}
.ds-typing-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  background: var(--border-light, #eee);
  border-radius: 10px;
  flex-shrink: 0;
}

.ds-typing-dots {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: 0;
  flex-shrink: 0;
  min-width: 0;
}

.ds-typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted, #888);
  animation: ds-typing-bounce 1.4s ease-in-out infinite both;
}

.ds-typing-dots span:nth-child(1) { animation-delay: 0s; }
.ds-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.ds-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ds-typing-bounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1.2); opacity: 1; }
}

.ds-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 800px;
  margin: 0 auto;
  padding: 12px 16px 12px 12px;
  background: var(--bg, #fff);
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ds-input-wrap:focus-within {
  border-color: #0066ff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 0 0 2px rgba(0, 102, 255, 0.35), 0 0 16px rgba(0, 102, 255, 0.2), 0 0 32px rgba(0, 102, 255, 0.08);
}

.ds-input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light, #f0f0f0);
}

.ds-mobile-active-badges {
  display: none;
}

.ds-mobile-active-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  opacity: 0.92;
}

.ds-input-cost {
  font-size: 0.7rem;
  color: #666;
  margin: 0;
  min-height: 1.2em;
  flex-shrink: 0;
}

.ds-input-disclaimer {
  max-width: 800px;
  margin: 8px auto 0;
  padding: 0;
  font-size: 0.75rem;
  color: var(--text-muted, #888);
  text-align: center;
}

.ds-mobile-plus-menu {
  display: none;
}

.ds-mobile-search-toggle {
  display: none;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text, #1a1a1a);
}

.ds-input-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.ds-input-options {
  display: flex;
  align-items: center;
}

.ds-input {
  flex: 1;
  min-width: 0;
  min-height: 24px;
  max-height: 200px;
  padding: 12px 16px 12px 20px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text, #1a1a1a);
  resize: none;
  outline: none;
  overflow-y: auto;
}

.ds-input:focus {
  outline: none;
}

.ds-input::placeholder {
  color: var(--text-muted, #888);
}

.ds-send {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #0066ff;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ds-send-icon {
  display: block;
}

.ds-send:hover:not(:disabled) {
  background: #0052cc;
  transform: scale(1.05);
}

.ds-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ds-option-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--text-secondary, #666);
  cursor: pointer;
  user-select: none;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}

.ds-option-toggle:hover {
  background: var(--border-light, #f5f5f5);
  color: var(--text, #1a1a1a);
}

.ds-option-toggle.active {
  background: rgba(0, 102, 255, 0.08);
  color: #0066ff;
}

.ds-option-toggle input {
  width: 14px;
  height: 14px;
  cursor: pointer;
  margin: 0;
}

.ds-thinking-select {
  border: 1px solid var(--border, #e0e0e0);
  background: #fff;
  color: var(--text, #1a1a1a);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.8125rem;
}

@media (max-width: 768px) {
  html {
    height: 100%;
    overflow: hidden;
  }
  body {
    height: 100%;
    overflow: hidden;
    overflow-x: hidden;
    min-height: 0;
  }

  .ds-chat-layout {
    height: calc(100vh - 70px);
    height: var(--text-chat-inner-height, calc(100dvh - 70px));
    overflow: hidden;
    overflow-x: hidden;
    min-height: 0;
    max-width: 100vw;
    display: flex;
    flex-direction: column;
  }

  .ds-sidebar-overlay {
    display: block;
  }

  .ds-chats-burger {
    display: flex;
    align-items: center;
    justify-content: center;
    left: max(12px, env(safe-area-inset-left, 12px));
    z-index: 60;
  }

  body.ds-sidebar-open {
    overflow: hidden;
  }

  .ds-sidebar {
    position: fixed;
    left: 0;
    top: 70px;
    bottom: 0;
    width: min(320px, 100vw - 48px);
    max-width: 100%;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
    padding-left: env(safe-area-inset-left, 0);
    border-radius: 0 20px 20px 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .ds-sidebar.open {
    transform: translateX(0);
  }

  .ds-sidebar-close {
    display: flex;
  }

  .ds-chat-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ds-chat-item-actions {
    opacity: 1;
    gap: 6px;
    padding: 0 6px;
  }

  .ds-chat-rename,
  .ds-chat-delete {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    font-size: 1.35rem;
    border-radius: 10px;
  }

  .ds-main {
    padding-left: 0;
    min-width: 0;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    flex-basis: 0;
    position: relative;
  }

  .ds-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 16px 20px 160px 56px;
    padding-left: max(56px, env(safe-area-inset-left, 56px));
    padding-right: max(20px, env(safe-area-inset-right, 12px));
    padding-bottom: max(160px, calc(140px + env(safe-area-inset-bottom, 0)));
  }

  .ds-typing-inner {
    padding: 0 12px 0 56px;
    padding-left: max(56px, env(safe-area-inset-left, 56px));
  }

  .ds-input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 12px 12px max(12px, env(safe-area-inset-bottom, 12px));
    padding-left: max(12px, env(safe-area-inset-left, 12px));
    padding-right: max(12px, env(safe-area-inset-right, 12px));
    background: transparent;
    border-top: none;
    pointer-events: none;
  }

  .ds-input-area::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: max(80px, calc(60px + env(safe-area-inset-bottom, 0)));
    background: var(--bg-page, #fafafa);
    pointer-events: none;
    z-index: 0;
  }

  .ds-input-area .ds-input-wrap {
    pointer-events: auto;
    position: relative;
    z-index: 1;
  }

  .ds-input-disclaimer {
    display: block;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted, #888);
    text-align: center;
  }

  .ds-input-wrap {
    max-width: 100%;
    min-width: 0;
    overflow: visible;
    box-sizing: border-box;
    position: relative;
  }

  .ds-mobile-plus-menu {
    display: none;
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    min-width: 220px;
    z-index: 10;
    border: 1px solid var(--border, #e8e8e8);
  }
  .ds-mobile-plus-menu.open {
    display: flex;
  }

  .ds-plus-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--text, #1a1a1a);
    text-align: left;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
  }
  .ds-plus-menu-item:hover:not(.disabled) {
    background: var(--border-light, #f5f5f5);
  }
  .ds-plus-menu-item.disabled {
    color: var(--text-muted, #888);
    cursor: default;
    opacity: 0.8;
  }
  .ds-plus-menu-item.disabled .ds-plus-menu-icon {
    opacity: 0.7;
  }
  .ds-plus-menu-icon {
    flex-shrink: 0;
    opacity: 0.9;
  }
  .ds-plus-menu-item.active {
    color: #0066ff;
    font-weight: 600;
    background: rgba(0, 102, 255, 0.08);
  }
  .ds-plus-menu-item.active .ds-plus-menu-icon {
    color: #0066ff;
  }
  .ds-plus-menu-badge {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 600;
    color: #0066ff;
    background: rgba(0, 102, 255, 0.15);
    padding: 2px 8px;
    border-radius: 6px;
  }
  .ds-plus-menu-item:not(.active) .ds-plus-menu-badge {
    display: none;
  }

  .ds-mobile-search-toggle {
    display: inline-flex;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid var(--border, #e0e0e0);
    background: #fff;
    color: var(--text, #333);
    font-size: 1.5rem;
    font-weight: 300;
  }
  .ds-mobile-search-toggle.active {
    background: rgba(0, 102, 255, 0.08);
    border-color: rgba(0, 102, 255, 0.3);
    color: #0066ff;
  }

  .ds-input-footer {
    justify-content: flex-start;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    min-height: 0;
  }

  .ds-mobile-active-badges:not([hidden]) {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    line-height: 1;
    font-size: 0.7rem;
    padding: 0;
    margin: 0;
  }

  .ds-mobile-active-badges[hidden] {
    display: none !important;
  }

  .ds-input-cost {
    margin-left: auto;
    text-align: right;
    line-height: 1.15;
  }

  .ds-input-options {
    display: none;
  }

  .ds-input-row {
    min-width: 0;
    overflow: visible;
    align-items: center;
    gap: 10px;
    padding-right: 4px;
    box-sizing: border-box;
  }

  .ds-input {
    max-height: 100px;
  }

  .ds-send {
    background: #0066ff;
    color: #fff;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
  }
  .ds-send .ds-send-icon {
    display: none;
  }
  .ds-send::after {
    content: '↑';
    font-size: 1.35rem;
    line-height: 1;
    color: #fff;
  }
  .ds-send:hover:not(:disabled) {
    background: #0052cc;
  }

  .ds-msg {
    max-width: 100%;
    overflow: visible;
    align-items: flex-start;
  }

  .ds-msg-user .ds-msg-avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
  }

  .ds-msg-user .ds-msg-avatar-pro-wrap {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 2px;
    box-sizing: border-box;
  }

  .ds-msg-user .ds-msg-avatar-pro-wrap .ds-msg-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    box-sizing: border-box;
  }

  .ds-msg-assistant .ds-msg-content {
    padding: 12px 0;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
  }

  .ds-scroll-to-bottom {
    display: none !important;
  }
}
