/* ============================================
   DeepSeek 风格 AI 聊天界面
   ============================================ */

/* ===== CSS 变量 ===== */
:root {
  --ds-primary: #4f6ef7;
  --ds-primary-hover: #3b5de7;
  --ds-primary-light: #eef1ff;
  --ds-bg: #ffffff;
  --ds-bg-secondary: #f7f8fa;
  --ds-sidebar-bg: #f7f8fa;
  --ds-sidebar-hover: #eef0f4;
  --ds-sidebar-active: #e6e9ef;
  --ds-text: #1a1a2e;
  --ds-text-secondary: #6b7280;
  --ds-text-muted: #9ca3af;
  --ds-border: #e5e7eb;
  --ds-border-light: #f0f1f3;
  --ds-shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --ds-shadow: 0 2px 8px rgba(0,0,0,0.06);
  --ds-shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
  --ds-radius: 12px;
  --ds-radius-sm: 8px;
  --ds-radius-lg: 16px;
  --ds-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --ds-user-bg: #4f6ef7;
  --ds-user-text: #ffffff;
  --ds-assistant-bg: #ffffff;
  --ds-code-bg: #f8f9fa;
}

/* ===== 暗色模式 ===== */
[data-theme="dark"] {
  --ds-primary: #6b8aff;
  --ds-primary-hover: #5a7af0;
  --ds-primary-light: #1e2240;
  --ds-bg: #1a1a2e;
  --ds-bg-secondary: #16162a;
  --ds-sidebar-bg: #12121f;
  --ds-sidebar-hover: #1e1e35;
  --ds-sidebar-active: #2a2a45;
  --ds-text: #e5e7eb;
  --ds-text-secondary: #9ca3af;
  --ds-text-muted: #6b7280;
  --ds-border: #2d2d4a;
  --ds-border-light: #22223a;
  --ds-shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --ds-shadow: 0 2px 8px rgba(0,0,0,0.3);
  --ds-shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
  --ds-user-bg: #4f6ef7;
  --ds-user-text: #ffffff;
  --ds-assistant-bg: #1e1e35;
  --ds-code-bg: #12121f;
}

/* ============================================
   聊天首页
   ============================================ */

.ds-chat-home {
  display: flex;
  height: calc(100vh - 68px - 80px);
  max-width: 100%;
  margin: 0;
  padding: 0;
  background: var(--ds-bg);
  overflow: hidden;
}

/* ===== 侧边栏（首页 & 会话页共用） ===== */
.ds-sidebar,
.ds-session-sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--ds-sidebar-bg);
  border-right: 1px solid var(--ds-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ds-sidebar {
  height: 100%;
}

.ds-session-sidebar {
  height: 100vh;
}

.ds-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--ds-border);
}

.ds-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.ds-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--ds-primary);
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}

.ds-logo-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--ds-text);
}

.ds-new-chat-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--ds-primary);
  color: #fff;
  border: none;
  border-radius: var(--ds-radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--ds-transition);
}

.ds-new-chat-btn:hover {
  background: var(--ds-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 110, 247, 0.3);
}

.ds-new-chat-btn:active {
  transform: translateY(0);
}

.ds-sidebar-search {
  position: relative;
  padding: 12px 16px;
}

.ds-search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ds-text-muted);
  pointer-events: none;
}

.ds-search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-sm);
  font-size: 13px;
  background: var(--ds-bg);
  color: var(--ds-text);
  outline: none;
  transition: var(--ds-transition);
  box-sizing: border-box;
}

.ds-search-input:focus {
  border-color: var(--ds-primary);
  box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.1);
}

.ds-search-input::placeholder {
  color: var(--ds-text-muted);
}

.ds-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
}

.ds-sidebar-list::-webkit-scrollbar {
  width: 4px;
}

.ds-sidebar-list::-webkit-scrollbar-thumb {
  background: var(--ds-border);
  border-radius: 2px;
}

.ds-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--ds-radius-sm);
  text-decoration: none;
  color: var(--ds-text);
  transition: var(--ds-transition);
  margin-bottom: 2px;
  cursor: pointer;
}

.ds-history-item:hover {
  background: var(--ds-sidebar-hover);
  text-decoration: none;
  color: var(--ds-text);
}

.ds-history-item.active {
  background: var(--ds-sidebar-active);
}

.ds-history-item-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ds-bg);
  border-radius: 8px;
  color: var(--ds-text-muted);
}

.ds-history-item-info {
  flex: 1;
  min-width: 0;
}

.ds-history-item-title {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ds-text);
}

.ds-history-item-meta {
  font-size: 11px;
  color: var(--ds-text-muted);
  margin-top: 2px;
}

.ds-history-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ds-text-muted);
}

.ds-history-empty svg {
  margin-bottom: 12px;
}

.ds-history-empty p {
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--ds-text-secondary);
}

.ds-history-empty span {
  font-size: 12px;
}

.ds-sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--ds-border);
  display: flex;
  gap: 4px;
}

.ds-sidebar-footer-link {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--ds-radius-sm);
  color: var(--ds-text-secondary);
  font-size: 13px;
  text-decoration: none;
  transition: var(--ds-transition);
}

.ds-sidebar-footer-link:hover {
  background: var(--ds-sidebar-hover);
  color: var(--ds-primary);
  text-decoration: none;
}

/* ===== 主内容区（首页） ===== */
.ds-main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  padding: 0;
}

.ds-home-content {
  max-width: 680px;
  width: 100%;
  padding: 48px 40px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ds-home-header {
  text-align: center;
  margin-bottom: 36px;
}

.ds-home-logo {
  margin-bottom: 20px;
}

.ds-home-logo svg {
  color: var(--ds-primary);
  width: 48px;
  height: 48px;
}

.ds-home-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--ds-text);
  margin: 0 0 6px 0;
  border: none;
  padding: 0;
}

.ds-home-subtitle {
  font-size: 14px;
  color: var(--ds-text-muted);
  margin: 0;
}

/* ===== DeepSeek 风格：居中大输入框 ===== */
.ds-home-input-section {
  width: 100%;
  max-width: 600px;
  margin-bottom: 32px;
}

.ds-home-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--ds-bg);
  border: 1px solid var(--ds-border);
  border-radius: 16px;
  padding: 10px 10px 10px 18px;
  transition: var(--ds-transition);
  box-shadow: var(--ds-shadow);
}

.ds-home-input-wrapper:focus-within {
  border-color: var(--ds-primary);
  box-shadow: 0 0 0 4px rgba(79, 110, 247, 0.1), var(--ds-shadow);
}

.ds-home-textarea {
  flex: 1;
  border: none;
  background: none;
  padding: 6px 0;
  font-size: 15px;
  line-height: 1.6;
  resize: none;
  outline: none;
  max-height: 120px;
  font-family: inherit;
  color: var(--ds-text);
}

.ds-home-textarea::placeholder {
  color: var(--ds-text-muted);
}

.ds-home-send-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 10px;
  background: var(--ds-primary);
  color: #fff;
  cursor: pointer;
  transition: var(--ds-transition);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
}

.ds-home-send-btn:not(:disabled) {
  opacity: 1;
}

.ds-home-send-btn:not(:disabled):hover {
  background: var(--ds-primary-hover);
  transform: scale(1.05);
}

.ds-home-send-btn:not(:disabled):active {
  transform: scale(0.95);
}

.ds-home-send-btn:disabled {
  background: var(--ds-border);
  cursor: not-allowed;
}

.ds-home-input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 6px 0;
  font-size: 12px;
  color: var(--ds-text-muted);
}

.ds-home-model-select {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ds-home-model-select svg {
  flex-shrink: 0;
  color: var(--ds-text-muted);
}

.ds-home-model-select select {
  border: none;
  background: none;
  font-size: 12px;
  color: var(--ds-text-muted);
  outline: none;
  cursor: pointer;
  font-family: inherit;
  padding: 2px 4px;
  border-radius: 4px;
  transition: var(--ds-transition);
}

.ds-home-model-select select:hover {
  background: var(--ds-bg-secondary);
  color: var(--ds-text-secondary);
}

.ds-home-quota-text {
  color: var(--ds-text-muted);
}

/* ===== 快捷功能卡片 ===== */
.ds-home-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 600px;
  margin-bottom: 28px;
}

.ds-quick-action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 8px;
  background: var(--ds-bg);
  border: 1px solid var(--ds-border-light);
  border-radius: var(--ds-radius);
  cursor: pointer;
  transition: var(--ds-transition);
  color: var(--ds-text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.ds-quick-action-card:hover {
  border-color: var(--ds-primary);
  background: var(--ds-primary-light);
  color: var(--ds-primary);
  transform: translateY(-2px);
  box-shadow: var(--ds-shadow);
}

.ds-quick-action-card:active {
  transform: translateY(0);
}

.ds-quick-action-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ds-quick-action-icon--write {
  background: rgba(16, 163, 127, 0.1);
  color: #10a37f;
}

.ds-quick-action-icon--code {
  background: rgba(79, 110, 247, 0.1);
  color: #4f6ef7;
}

.ds-quick-action-icon--learn {
  background: rgba(217, 119, 6, 0.1);
  color: #d97706;
}

.ds-quick-action-icon--translate {
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
}

/* ===== 推荐话题（首页） ===== */
.ds-home-suggestions {
  width: 100%;
  max-width: 600px;
}

.ds-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ds-text-muted);
  margin: 0 0 10px 0;
  padding: 0;
  border: none;
  text-align: center;
}

.ds-home-suggestion-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.ds-home-suggestion-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--ds-bg);
  border: 1px solid var(--ds-border-light);
  border-radius: var(--ds-radius-sm);
  cursor: pointer;
  transition: var(--ds-transition);
  color: var(--ds-text-secondary);
  font-size: 13px;
}

.ds-home-suggestion-item:hover {
  background: var(--ds-bg-secondary);
  border-color: var(--ds-border);
  color: var(--ds-text);
}

.ds-home-suggestion-item svg {
  flex-shrink: 0;
  color: var(--ds-text-muted);
}

.ds-home-suggestion-item:hover svg {
  color: var(--ds-primary);
}

/* ============================================
   聊天会话页面
   ============================================ */

/* 侧边栏模型选择器 */
.ds-sidebar-model-select {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin: 0 8px 4px;
  background: var(--ds-hover-bg);
  border-radius: 8px;
  border: 1px solid var(--ds-border);
}

.ds-sidebar-model-select svg {
  width: 14px;
  height: 14px;
  color: var(--ds-text-secondary);
  flex-shrink: 0;
}

.ds-sidebar-model-select select {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--ds-text);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  padding: 2px 0;
  -webkit-appearance: none;
  appearance: none;
}

.ds-sidebar-model-select select option,
.ds-sidebar-model-select select optgroup {
  background: var(--ds-card-bg);
  color: var(--ds-text);
}

.ds-session-body {
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--ds-bg);
}

.ds-session-body main {
  max-width: 100%;
  padding: 0;
  margin: 0;
}

.ds-session-body header,
.ds-session-body footer {
  display: none;
}

.ds-session-container {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* ===== 聊天区域 ===== */
.ds-chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--ds-bg);
}

/* ===== 聊天头部 ===== */
.ds-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--ds-border);
  flex-shrink: 0;
  background: var(--ds-bg);
  z-index: 10;
}

.ds-chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.ds-mobile-sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--ds-text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: var(--ds-transition);
}

.ds-mobile-sidebar-toggle:hover {
  background: var(--ds-bg-secondary);
  color: var(--ds-text);
}

.ds-chat-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ds-chat-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--ds-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
  border: none;
  padding: 0;
}

.ds-chat-rename-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: var(--ds-text-muted);
  opacity: 0;
  transition: var(--ds-transition);
  display: flex;
  align-items: center;
}

.ds-chat-title-group:hover .ds-chat-rename-btn {
  opacity: 1;
}

.ds-chat-rename-btn:hover {
  color: var(--ds-primary);
  background: var(--ds-primary-light);
}

.ds-chat-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ds-model-select {
  padding: 6px 12px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-sm);
  font-size: 13px;
  background: var(--ds-bg);
  color: var(--ds-text);
  cursor: pointer;
  outline: none;
  transition: var(--ds-transition);
}

.ds-model-select:focus {
  border-color: var(--ds-primary);
  box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.1);
}

.ds-chat-header-btn {
  background: none;
  border: none;
  color: var(--ds-text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--ds-radius-sm);
  transition: var(--ds-transition);
  display: flex;
  align-items: center;
}

.ds-chat-header-btn:hover {
  background: var(--ds-bg-secondary);
  color: var(--ds-text);
}

/* ===== 消息列表 ===== */
.ds-message-list {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  scroll-behavior: smooth;
}

.ds-message-list::-webkit-scrollbar {
  width: 6px;
}

.ds-message-list::-webkit-scrollbar-track {
  background: transparent;
}

.ds-message-list::-webkit-scrollbar-thumb {
  background: var(--ds-border);
  border-radius: 3px;
}

.ds-message-list::-webkit-scrollbar-thumb:hover {
  background: var(--ds-text-muted);
}

/* ===== 欢迎信息 ===== */
.ds-welcome {
  text-align: center;
  padding: 80px 20px;
  color: var(--ds-text-muted);
}

.ds-welcome-icon {
  margin-bottom: 16px;
}

.ds-welcome-icon svg {
  color: var(--ds-primary);
  opacity: 0.6;
}

.ds-welcome h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--ds-text);
  margin: 0 0 8px 0;
  border: none;
  padding: 0;
}

.ds-welcome p {
  font-size: 14px;
  color: var(--ds-text-muted);
  margin: 0;
}

/* ===== 消息气泡 ===== */
.ds-message {
  display: flex;
  gap: 12px;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  animation: dsFadeIn 0.3s ease;
}

.ds-message.user {
  flex-direction: row-reverse;
}

.ds-message-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ds-bg-secondary);
  color: var(--ds-text-secondary);
}

.ds-message.user .ds-message-avatar {
  background: var(--ds-primary);
  color: #fff;
}

.ds-message-content {
  flex: 1;
  min-width: 0;
  max-width: calc(100% - 44px);
}

.ds-message.user .ds-message-content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.ds-message-text {
  font-size: 15px;
  line-height: 1.7;
  color: var(--ds-text);
  white-space: pre-wrap;
  word-break: break-word;
}

.ds-message.user .ds-message-text {
  background: var(--ds-user-bg);
  color: var(--ds-user-text);
  padding: 12px 16px;
  border-radius: 18px;
  border-bottom-right-radius: 4px;
  max-width: 85%;
}

.ds-message.assistant .ds-message-text {
  padding: 0;
  background: none;
}

/* ===== 消息操作按钮 ===== */
.ds-message-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
  margin-top: 8px;
}

.ds-message.user .ds-message-actions {
  justify-content: flex-end;
}

.ds-message:hover .ds-message-actions {
  opacity: 1;
}

.ds-message-actions button {
  background: none;
  border: 1px solid var(--ds-border);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  color: var(--ds-text-muted);
  transition: var(--ds-transition);
  display: flex;
  align-items: center;
}

.ds-message-actions button:hover {
  background: var(--ds-bg-secondary);
  color: var(--ds-text);
  border-color: var(--ds-text-muted);
}

.ds-message-meta {
  font-size: 11px;
  color: var(--ds-text-muted);
  margin-top: 4px;
}

.ds-message.user .ds-message-meta {
  text-align: right;
}

/* ===== 流式输出光标 ===== */
.ds-typing-cursor {
  display: inline-block;
  animation: dsCursorBlink 0.8s infinite;
  color: var(--ds-primary);
  font-weight: bold;
  font-size: 16px;
  line-height: 1;
  margin-left: 2px;
}

/* ===== 动画 ===== */
@keyframes dsSpinner {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.ds-spinner {
  animation: dsSpinner 1s linear infinite;
}

@keyframes dsCursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes dsFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== 输入区域 ===== */
.ds-input-area {
  flex-shrink: 0;
  padding: 16px 24px 20px;
  background: var(--ds-bg);
  border-top: 1px solid var(--ds-border);
}

.ds-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 800px;
  margin: 0 auto;
  background: var(--ds-bg-secondary);
  border: 1px solid var(--ds-border);
  border-radius: 16px;
  padding: 8px 8px 8px 16px;
  transition: var(--ds-transition);
}

.ds-input-wrapper:focus-within {
  border-color: var(--ds-primary);
  box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.1);
}

.ds-chat-input {
  flex: 1;
  border: none;
  background: none;
  padding: 8px 0;
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  outline: none;
  max-height: 200px;
  font-family: inherit;
  color: var(--ds-text);
}

.ds-chat-input::placeholder {
  color: var(--ds-text-muted);
}

.ds-send-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: var(--ds-primary);
  color: #fff;
  cursor: pointer;
  transition: var(--ds-transition);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ds-send-btn:hover {
  background: var(--ds-primary-hover);
  transform: scale(1.05);
}

.ds-send-btn:active {
  transform: scale(0.95);
}

.ds-send-btn:disabled {
  background: var(--ds-text-muted);
  cursor: not-allowed;
  transform: none;
}

.ds-input-footer {
  display: flex;
  justify-content: space-between;
  padding: 8px 4px 0;
  font-size: 12px;
  color: var(--ds-text-muted);
  max-width: 800px;
  margin: 0 auto;
}

/* ===== 侧边栏遮罩（移动端） ===== */
.ds-sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  z-index: 99;
}

/* ===== Markdown 内容样式 ===== */
.ds-message .markdown-body {
  line-height: 1.7;
  word-wrap: break-word;
  font-size: 15px;
}

.ds-message .markdown-body p {
  margin: 0 0 8px 0;
}

.ds-message .markdown-body p:last-child {
  margin-bottom: 0;
}

.ds-message .markdown-body h1,
.ds-message .markdown-body h2,
.ds-message .markdown-body h3,
.ds-message .markdown-body h4,
.ds-message .markdown-body h5,
.ds-message .markdown-body h6 {
  margin: 16px 0 8px 0;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ds-text);
}

.ds-message .markdown-body h1 { font-size: 1.4em; border-bottom: 1px solid var(--ds-border); padding-bottom: 6px; }
.ds-message .markdown-body h2 { font-size: 1.25em; border-bottom: 1px solid var(--ds-border); padding-bottom: 4px; }
.ds-message .markdown-body h3 { font-size: 1.1em; }
.ds-message .markdown-body h4 { font-size: 1em; }

.ds-message .markdown-body pre {
  background: var(--ds-code-bg);
  border-radius: var(--ds-radius-sm);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 10px 0;
  position: relative;
  border: 1px solid var(--ds-border);
}

.ds-message .markdown-body code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
}

.ds-message .markdown-body p code,
.ds-message .markdown-body li code {
  background: var(--ds-code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--ds-primary);
}

.ds-message .markdown-body pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 13px;
  line-height: 1.5;
}

.ds-message .markdown-body blockquote {
  border-left: 3px solid var(--ds-primary);
  padding: 4px 12px;
  margin: 10px 0;
  color: var(--ds-text-secondary);
  background: var(--ds-primary-light);
  border-radius: 0 4px 4px 0;
}

.ds-message .markdown-body ul,
.ds-message .markdown-body ol {
  padding-left: 22px;
  margin: 8px 0;
}

.ds-message .markdown-body li {
  margin: 4px 0;
}

.ds-message .markdown-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 10px 0;
  font-size: 14px;
}

.ds-message .markdown-body th,
.ds-message .markdown-body td {
  border: 1px solid var(--ds-border);
  padding: 8px 12px;
  text-align: left;
}

.ds-message .markdown-body th {
  background: var(--ds-bg-secondary);
  font-weight: 600;
}

.ds-message .markdown-body tr:nth-child(even) {
  background: var(--ds-bg-secondary);
}

.ds-message .markdown-body img {
  max-width: 100%;
  border-radius: 6px;
  margin: 8px 0;
}

.ds-message .markdown-body hr {
  border: none;
  border-top: 1px solid var(--ds-border);
  margin: 16px 0;
}

.ds-message .markdown-body a {
  color: var(--ds-primary);
  text-decoration: underline;
}

/* ===== 复制代码按钮 ===== */
.ds-message .copy-code-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--ds-bg);
  border: 1px solid var(--ds-border);
  border-radius: 5px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
  z-index: 2;
  color: var(--ds-text-secondary);
}

.ds-message .copy-code-btn:hover {
  background: var(--ds-bg-secondary);
  color: var(--ds-text);
}

.ds-message .markdown-body pre:hover .copy-code-btn {
  opacity: 1;
}

/* ===== Toast 提示 ===== */
.ds-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: var(--ds-radius-sm);
  font-size: 14px;
  z-index: 10000;
  animation: dsToastIn 0.3s ease;
  box-shadow: var(--ds-shadow-lg);
}

.ds-toast--success {
  background: #10b981;
  color: #fff;
}

.ds-toast--error {
  background: #ef4444;
  color: #fff;
}

.ds-toast--hiding {
  animation: dsToastOut 0.25s ease both;
}

@keyframes dsToastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes dsToastOut {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px) scale(0.95);
  }
}

/* ===== 消息编辑 ===== */
.ds-message-edit-container {
  padding: 8px 0;
}

.ds-message-edit-textarea {
  width: 100%;
  min-height: 60px;
  padding: 10px 12px;
  border: 1px solid var(--ds-primary);
  border-radius: var(--ds-radius-sm);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  background: var(--ds-bg);
  color: var(--ds-text);
  box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.1);
  box-sizing: border-box;
}

.ds-message-edit-buttons {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.ds-message-edit-buttons .btn {
  padding: 6px 16px;
  font-size: 13px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: var(--ds-transition);
}

.ds-message-edit-buttons .btn-primary {
  background: var(--ds-primary);
  color: #fff;
}

.ds-message-edit-buttons .btn-primary:hover {
  background: var(--ds-primary-hover);
}

.ds-message-edit-buttons .btn-secondary {
  background: var(--ds-bg-secondary);
  color: var(--ds-text-secondary);
  border: 1px solid var(--ds-border);
}

.ds-message-edit-buttons .btn-secondary:hover {
  background: var(--ds-border);
}

/* ============================================
   移动端适配
   ============================================ */

@media (max-width: 768px) {
  /* 首页 */
  .ds-chat-home {
    height: auto;
    min-height: calc(100vh - 68px);
  }

  .ds-sidebar {
    display: none;
  }

  .ds-main {
    margin-left: 0;
    width: 100%;
  }

  .ds-home-content {
    padding: 32px 20px;
  }

  .ds-home-header {
    margin-bottom: 28px;
  }

  .ds-home-title {
    font-size: 22px;
  }

  .ds-home-subtitle {
    font-size: 13px;
  }

  .ds-home-input-section {
    max-width: 100%;
  }

  .ds-home-input-wrapper {
    padding: 8px 8px 8px 14px;
    border-radius: 12px;
  }

  .ds-home-textarea {
    font-size: 14px;
  }

  .ds-home-quick-actions {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .ds-quick-action-card {
    padding: 14px 4px;
    font-size: 12px;
  }

  .ds-quick-action-icon {
    width: 38px;
    height: 38px;
  }

  .ds-quick-action-icon svg {
    width: 18px;
    height: 18px;
  }

  .ds-home-suggestion-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  /* 会话页面 */
  .ds-session-sidebar {
    position: fixed;
    left: -300px;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 1001;
    transition: left 0.3s ease;
    box-shadow: 2px 0 12px rgba(0,0,0,0.1);
  }

  .ds-session-sidebar.open {
    left: 0;
  }

  .ds-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 1000;
  }

  .ds-sidebar-overlay.open {
    display: block;
  }

  .ds-mobile-sidebar-toggle {
    display: flex !important;
  }

  .ds-chat-area {
    margin-left: 0;
    width: 100%;
  }

  .ds-chat-header {
    padding: 8px 12px;
  }

  .ds-chat-title {
    font-size: 14px;
    max-width: 150px;
  }

  .ds-chat-header-right .ds-chat-header-btn {
    width: 32px;
    height: 32px;
  }

  .ds-model-select {
    max-width: 120px;
    font-size: 12px;
    padding: 4px 8px;
  }

  .ds-message-list {
    padding: 12px;
  }

  .ds-message {
    gap: 8px;
    max-width: 100%;
  }

  .ds-message-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
  }

  .ds-message-avatar svg {
    width: 14px;
    height: 14px;
  }

  .ds-message-content {
    font-size: 14px;
  }

  .ds-message-actions {
    opacity: 1;
  }

  .ds-input-area {
    padding: 8px 12px;
  }

  .ds-input-wrapper {
    padding: 6px 12px;
  }

  .ds-chat-input {
    font-size: 14px;
    max-height: 100px;
  }

  .ds-send-btn {
    width: 32px;
    height: 32px;
  }

  .ds-send-btn svg {
    width: 16px;
    height: 16px;
  }

  .ds-input-footer {
    font-size: 11px;
    padding: 4px 4px 0;
  }

  .ds-welcome {
    padding: 40px 20px;
  }

  .ds-welcome-icon svg {
    width: 36px;
    height: 36px;
  }

  .ds-welcome h2 {
    font-size: 18px;
  }

  .ds-welcome p {
    font-size: 13px;
  }

  /* Toast 适配 */
  .ds-toast {
    top: 12px;
    right: 12px;
    min-width: 160px;
    font-size: 13px;
    padding: 8px 16px;
  }
}

@media (max-width: 480px) {
  .ds-home-content {
    padding: 20px 16px;
  }

  .ds-home-header {
    margin-bottom: 24px;
  }

  .ds-home-title {
    font-size: 18px;
  }

  .ds-home-logo svg {
    width: 36px;
    height: 36px;
  }

  .ds-home-input-section {
    margin-bottom: 24px;
  }

  .ds-home-input-wrapper {
    padding: 6px 6px 6px 12px;
    border-radius: 10px;
  }

  .ds-home-textarea {
    font-size: 13px;
    padding: 4px 0;
  }

  .ds-home-send-btn {
    width: 34px;
    height: 34px;
  }

  .ds-home-send-btn svg {
    width: 16px;
    height: 16px;
  }

  .ds-home-quick-actions {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 24px;
  }

  .ds-quick-action-card {
    padding: 12px 8px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
  }

  .ds-quick-action-icon {
    width: 34px;
    height: 34px;
  }

  .ds-quick-action-icon svg {
    width: 16px;
    height: 16px;
  }

  .ds-home-suggestion-list {
    grid-template-columns: 1fr;
  }

  .ds-chat-header {
    padding: 6px 8px;
  }

  .ds-chat-title {
    font-size: 13px;
    max-width: 120px;
  }

  .ds-message-list {
    padding: 8px;
  }

  .ds-message {
    gap: 6px;
  }

  .ds-message-avatar {
    width: 24px;
    height: 24px;
    min-width: 24px;
  }

  .ds-input-area {
    padding: 6px 8px;
  }

  .ds-input-wrapper {
    padding: 4px 10px;
    border-radius: 20px;
  }

  .ds-chat-input {
    font-size: 13px;
  }

  .ds-session-sidebar {
    width: 260px;
  }
}

/* ============================================
   AI 设置页面 (chat-profile) - DeepSeek 风格
   ============================================ */

/* 页面主体 - 覆盖 body 样式 */
body.ds-profile-body {
  background: var(--ds-bg);
  color: var(--ds-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans SC', sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

/* 主容器 */
.ds-profile-container {
  display: flex;
  width: 100%;
  max-width: 1200px;
  min-height: 100vh;
  position: relative;
}

/* ========== 侧边栏 ========== */
.ds-profile-sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--ds-sidebar-bg);
  border-right: 1px solid var(--ds-border);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.ds-profile-sidebar-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--ds-border);
}

.ds-profile-sidebar-header h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: var(--ds-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ds-profile-sidebar-header h2 svg {
  width: 22px;
  height: 22px;
  color: var(--ds-accent);
}

.ds-profile-nav {
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 2px;
  flex: 1;
}

.ds-profile-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--ds-text-secondary);
  font-size: 14px;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s ease;
  text-align: left;
  width: 100%;
  font-family: inherit;
}

.ds-profile-nav-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--ds-text-secondary);
  transition: color 0.15s ease;
}

.ds-profile-nav-btn:hover {
  background: var(--ds-hover-bg);
  color: var(--ds-text);
}

.ds-profile-nav-btn:hover svg {
  color: var(--ds-text);
}

.ds-profile-nav-btn.active {
  background: var(--ds-active-bg);
  color: var(--ds-text);
}

.ds-profile-nav-btn.active svg {
  color: var(--ds-accent);
}

.ds-profile-nav-btn .nav-badge {
  margin-left: auto;
  background: var(--ds-accent);
  color: #fff;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 500;
}

.ds-profile-sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--ds-border);
}

.ds-profile-back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--ds-text-secondary);
  font-size: 13px;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s ease;
  width: 100%;
  font-family: inherit;
}

.ds-profile-back-btn svg {
  width: 16px;
  height: 16px;
}

.ds-profile-back-btn:hover {
  background: var(--ds-hover-bg);
  color: var(--ds-text);
}

/* ========== 主内容区 ========== */
.ds-profile-main {
  flex: 1;
  padding: 32px 40px;
  overflow-y: auto;
  min-height: 100vh;
}

.ds-profile-tab-content {
  display: none;
  animation: dsFadeIn 0.2s ease;
}

.ds-profile-tab-content.active {
  display: block;
}

.ds-profile-tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.ds-profile-tab-header h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: var(--ds-text);
}

.ds-profile-tab-header p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ds-text-secondary);
}

/* ========== 按钮 ========== */
.ds-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--ds-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  white-space: nowrap;
}

.ds-btn-primary svg {
  width: 16px;
  height: 16px;
}

.ds-btn-primary:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.ds-btn-primary:active {
  transform: translateY(0);
}

.ds-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--ds-hover-bg);
  color: var(--ds-text);
  border: 1px solid var(--ds-border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.ds-btn-secondary:hover {
  background: var(--ds-active-bg);
}

.ds-btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: transparent;
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.ds-btn-danger svg {
  width: 15px;
  height: 15px;
}

.ds-btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
}

.ds-btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* ========== 模型卡片列表 ========== */
.ds-model-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ds-model-card {
  background: var(--ds-card-bg);
  border: 1px solid var(--ds-border);
  border-radius: 12px;
  padding: 16px 20px;
  transition: all 0.15s ease;
}

.ds-model-card:hover {
  border-color: var(--ds-accent);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.ds-model-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.ds-model-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ds-text);
}

.ds-model-card-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--ds-active-bg);
  color: var(--ds-text-secondary);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.ds-model-card-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
}

.ds-model-card-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.ds-model-card-status.enabled {
  color: #22c55e;
}

.ds-model-card-status.enabled::before {
  background: #22c55e;
}

.ds-model-card-status.disabled {
  color: var(--ds-text-secondary);
}

.ds-model-card-status.disabled::before {
  background: var(--ds-text-secondary);
}

.ds-model-card-body {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-bottom: 12px;
}

.ds-model-card-field {
  font-size: 13px;
  color: var(--ds-text-secondary);
}

.ds-model-card-field label {
  color: var(--ds-text-secondary);
  margin-right: 4px;
}

.ds-model-card-field code {
  font-size: 12px;
  background: var(--ds-active-bg);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--ds-text);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.ds-model-card-actions {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--ds-border);
}

/* ========== 角色卡片列表 ========== */
.ds-role-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ds-role-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--ds-card-bg);
  border: 1px solid var(--ds-border);
  border-radius: 12px;
  padding: 14px 18px;
  transition: all 0.15s ease;
}

.ds-role-card:hover {
  border-color: var(--ds-accent);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.ds-role-card-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--ds-active-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.ds-role-card-info {
  flex: 1;
  min-width: 0;
}

.ds-role-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ds-text);
  margin-bottom: 2px;
}

.ds-role-card-desc {
  font-size: 13px;
  color: var(--ds-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ds-role-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ========== 配额信息 ========== */
.ds-quota-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ds-quota-card {
  background: var(--ds-card-bg);
  border: 1px solid var(--ds-border);
  border-radius: 12px;
  padding: 20px 24px;
}

.ds-quota-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ds-quota-card-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--ds-text);
}

.ds-quota-card-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--ds-text);
}

.ds-quota-bar {
  height: 8px;
  background: var(--ds-active-bg);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.ds-quota-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ds-accent), #6366f1);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.ds-quota-bar-fill.total {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.ds-quota-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.ds-quota-info-row:not(:last-child) {
  border-bottom: 1px solid var(--ds-border);
}

.ds-quota-info-label {
  font-size: 13px;
  color: var(--ds-text-secondary);
}

.ds-quota-info-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--ds-text);
}

/* ========== 空状态 ========== */
.ds-profile-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.ds-profile-empty svg {
  width: 48px;
  height: 48px;
  color: var(--ds-text-secondary);
  opacity: 0.4;
  margin-bottom: 16px;
}

.ds-profile-empty p {
  font-size: 14px;
  color: var(--ds-text-secondary);
  margin: 4px 0;
}

.ds-profile-empty .ds-empty-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--ds-text);
}

/* ========== 模态框 ========== */
.ds-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: dsFadeIn 0.15s ease;
  backdrop-filter: blur(4px);
}

.ds-modal {
  background: var(--ds-card-bg);
  border: 1px solid var(--ds-border);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  animation: dsModalIn 0.2s ease;
}

@keyframes dsModalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.ds-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--ds-border);
}

.ds-modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--ds-text);
}

.ds-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--ds-text-secondary);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s ease;
  font-size: 18px;
}

.ds-modal-close:hover {
  background: var(--ds-hover-bg);
  color: var(--ds-text);
}

.ds-modal-body {
  padding: 24px;
}

.ds-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--ds-border);
}

/* ========== 表单 ========== */
.ds-form-group {
  margin-bottom: 18px;
}

.ds-form-group:last-child {
  margin-bottom: 0;
}

.ds-form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ds-text);
  margin-bottom: 6px;
}

.ds-form-label .required {
  color: #ef4444;
  margin-left: 2px;
}

.ds-form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--ds-border);
  border-radius: 8px;
  background: var(--ds-bg);
  color: var(--ds-text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.ds-form-input:focus {
  outline: none;
  border-color: var(--ds-accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.ds-form-input::placeholder {
  color: var(--ds-text-secondary);
  opacity: 0.6;
}

textarea.ds-form-input {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

select.ds-form-input {
  cursor: pointer;
  appearance: auto;
}

.ds-form-row {
  display: flex;
  gap: 16px;
}

.ds-form-row .ds-form-group {
  flex: 1;
}

/* ========== Toast 通知 ========== */
.ds-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ds-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--ds-card-bg);
  border: 1px solid var(--ds-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  font-size: 13px;
  color: var(--ds-text);
  animation: dsToastSlideIn 0.2s ease;
  min-width: 280px;
}

.ds-toast svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.ds-toast--success svg { color: #22c55e; }
.ds-toast--error svg { color: #ef4444; }
.ds-toast--info svg { color: var(--ds-accent); }

@keyframes dsToastSlideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ========== 移动端适配 ========== */
@media (max-width: 768px) {
  .ds-profile-sidebar {
    display: none;
  }

  .ds-profile-main {
    padding: 20px 16px;
  }

  .ds-profile-tab-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .ds-model-card {
    padding: 14px 16px;
  }

  .ds-model-card-body {
    flex-direction: column;
    gap: 4px;
  }

  .ds-role-card {
    flex-wrap: wrap;
  }

  .ds-role-card-actions {
    width: 100%;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid var(--ds-border);
  }

  .ds-modal {
    max-width: 100%;
    margin: 12px;
    max-height: 85vh;
  }

  .ds-form-row {
    flex-direction: column;
    gap: 0;
  }

  .ds-quota-card {
    padding: 16px;
  }
}
