:root{--bg:#0b1220;--card:#121a2b;--muted:#94a3b8;--text:#e2e8f0;--primary:#4f46e5;--border:#1f2a44;--green:#10b981;--sidebar-width:280px;--sidebar-collapsed-width:60px}
*{box-sizing:border-box}

/* 页面尺寸限制 */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body{
  background:var(--bg);
  color:var(--text);
  font:14px/1.6 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto;
  padding-bottom:72px;
  max-width: 1920px;
  max-height: 1080px;
  margin: 0 auto;
  position: relative;
}

/* 主容器限制 */
.main-container {
  width: 100%;
  height: 100vh;
  max-width: 1920px;
  max-height: 1080px;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
}

.topbar{display:flex;align-items:center;gap:16px;padding:12px 20px;height:48px;box-sizing:border-box;border-bottom:1px solid var(--border);background:#0d1526;position:sticky;top:0;z-index: 100;}
.home-topbar{background:linear-gradient(135deg,#0d1526 0%,#1a2338 100%);border-bottom:1px solid rgba(79,70,229,0.2);position:relative;overflow:hidden}
.home-topbar::before{content:'';position:absolute;top:0;left:-100%;width:100%;height:100%;background:linear-gradient(90deg,transparent,rgba(79,70,229,0.1),transparent);animation:shimmer 3s infinite}
@keyframes shimmer{0%{left:-100%}100%{left:100%}}
.welcome-text-nav{color:var(--text);font-size:14px;font-weight:500}
.current-time{color:var(--muted);font-size:12px;font-family:monospace}
.nav-stats{display:flex;align-items:center;gap:6px;color:var(--muted);font-size:12px}

.stat-dot{color:var(--primary);font-size:8px}
.logo{font-weight:700;color:#fff;text-decoration:none;display:flex;align-items:center;gap:8px;transition:color 0.2s ease;}
.logo:hover{color:var(--primary);}
.actions{margin-left:auto;display:flex;align-items:center;gap:12px}
.search{background:#0b1324;border:1px solid var(--border);color:var(--text);padding:8px 10px;border-radius:8px}
.btn{display:inline-block;padding:8px 12px;border:1px solid var(--border);border-radius:8px;color:var(--text);text-decoration:none;background:#0f1830;cursor:pointer}
.btn.primary{background:var(--primary);border-color:transparent}
.btn.ghost{background:transparent}
.btn.xs{padding:4px 8px;font-size:12px}
.link{color:#93c5fd;text-decoration:none;margin-right:8px}
.container{padding:20px;max-width:1100px;margin:0 auto}
.card-grid{display:grid;grid-template-columns:1fr;gap:16px}
.card{background:var(--card);border:1px solid var(--border);border-radius:12px;padding:16px}
.btn-row{display:flex;gap:10px;margin-top:8px}
.list{margin-top:16px}
.list-head{display:flex;align-items:center;justify-content:space-between}
.list-row{display:grid;grid-template-columns:2fr 1fr 1fr 1fr 1fr;gap:8px;padding:10px;border-bottom:1px solid var(--border)}
.list-row.head{color:var(--muted)}
.footer{padding:16px;color:var(--muted);text-align:center;border-top:1px solid var(--border);margin-top:24px}
.steps{display:flex;gap:8px}
.step{color:var(--muted);text-decoration:none;padding:6px 8px;border-radius:6px}
.step.active{background:#19233b;color:#fff}
.with-sidebar{display:grid;grid-template-columns:1fr 320px;gap:16px;padding:20px}
.content{background:transparent}
.sidebar{background:var(--card);border:1px solid var(--border);border-radius:12px;padding:16px;max-height:calc(100vh - 120px);overflow-y:auto}

/* 侧边栏滚动条样式 */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
  transition: background 0.2s ease;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Firefox 滚动条样式 */
.sidebar {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg);
}
.grid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}
.field-card{background:var(--card);border:1px solid var(--border);border-radius:12px;padding:12px}
.field-card label{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:6px 0}
input,select{background:#0b1324;border:1px solid var(--border);color:var(--text);padding:8px;border-radius:8px;min-width:120px}
.meta{color:var(--muted);font-size:12px}
.hint{color:#fbbf24;font-size:12px}
.sources{margin-top:12px}
.cards{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}
.rec-card{background:var(--card);border:1px solid var(--border);border-radius:12px;padding:12px}
.rec-head{font-weight:700;margin-bottom:4px}
.rec-tags{color:var(--muted);font-size:12px;margin-top:6px}
.tip-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;padding:20px;max-height:calc(100vh - 200px);overflow-y:auto}

/* TIP滚动条样式 */
.tip-grid::-webkit-scrollbar {
  width: 8px;
}

.tip-grid::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 4px;
}

.tip-grid::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
  transition: background 0.2s ease;
}

.tip-grid::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Firefox 滚动条样式 */
.tip-grid {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg);
}

.tip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.tip-header h4 {
  margin: 0;
  color: var(--primary);
  font-size: 16px;
}

.tip-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tip-section {
  background: rgba(79,70,229,0.05);
  border-radius: 8px;
  padding: 12px;
  border-left: 3px solid var(--primary);
}

.tip-section h5 {
  margin: 0 0 8px 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.tip-section ul {
  margin: 0;
  padding-left: 16px;
}

.tip-section li {
  margin-bottom: 4px;
  font-size: 13px;
  line-height: 1.4;
}
.tip-col{background:var(--card);border:1px solid var(--border);border-radius:12px;padding:12px}
.timeline{list-style:decimal;padding-left:18px}
.table{width:100%;border-collapse:collapse}
.table th,.table td{border:1px solid var(--border);padding:8px;text-align:center}
.pair{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.fabe{display:grid;grid-template-columns:1fr;gap:8px;max-height:calc(100vh - 120px);overflow-y:auto}

/* FABE滚动条样式 */
.fabe::-webkit-scrollbar {
  width: 8px;
}

.fabe::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 4px;
}

.fabe::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
  transition: background 0.2s ease;
}

.fabe::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Firefox 滚动条样式 */
.fabe {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg);
}
.section{background:var(--card);border:1px solid var(--border);border-radius:12px;padding:12px;margin-bottom:12px}

/* S4页面内容区域滚动 */
.page.with-sidebar .content {
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.page.with-sidebar .content::-webkit-scrollbar {
  width: 8px;
}

.page.with-sidebar .content::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 4px;
}

.page.with-sidebar .content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
  transition: background 0.2s ease;
}

.page.with-sidebar .content::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

.page.with-sidebar .content {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg);
}
.objections{margin:0;padding-left:18px}
.spacer{flex:1}
@media(max-width:960px){.with-sidebar{grid-template-columns:1fr}.grid{grid-template-columns:1fr}.cards{grid-template-columns:1fr}.tip-grid{grid-template-columns:1fr}}

/* 固定底部操作条 */
.bottombar{position:fixed;left:0;right:0;bottom:0;display:flex;align-items:center;gap:12px;padding:10px 20px;border-top:1px solid var(--border);background:#0d1526;z-index:10}

/* 移动端底部按钮优化 */
@media(max-width: 768px) {
  .bottombar {
    padding: 8px 16px;
    gap: 8px;
  }
  
  .bottombar .btn {
    padding: 8px 16px;
    font-size: 14px;
    min-height: 40px;
  }
}

@media(max-width: 480px) {
  .bottombar {
    padding: 6px 12px;
    gap: 6px;
  }
  
  .bottombar .btn {
    padding: 6px 12px;
    font-size: 13px;
    min-height: 36px;
  }
}
.rec-card{cursor:grab}

/* 模态对话框（首页手动输入） */
.backdrop{position:fixed;inset:0;background:rgba(2,6,23,.6);backdrop-filter:saturate(120%) blur(2px);display:none;align-items:center;justify-content:center;z-index:20}
.backdrop.show{display:flex}
.modal{width:min(720px,92vw);background:var(--card);border:1px solid var(--border);border-radius:12px;box-shadow:0 10px 24px rgba(0,0,0,.35);overflow:hidden}
.modal-head{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid var(--border)}
.modal-body{padding:16px;display:grid;grid-template-columns:1fr;gap:12px}
.modal-foot{display:flex;gap:8px;justify-content:flex-end;padding:12px 16px;border-top:1px solid var(--border)}
.file-list{margin:0;padding-left:18px;color:var(--muted);max-height:120px;overflow:auto}
.inline{display:flex;gap:8px;align-items:center}

/* 顶部收缩按钮 */
.sidebar-toggle {
  width: 24px;
  height: 24px;
  background: var(--primary);
  border: 2px solid var(--card);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: white;
  font-size: 12px;
  margin-left: 8px;
}

.sidebar-toggle:hover {
  background: #6366f1;
  transform: scale(1.1);
}

.sidebar-toggle::before {
  content: '◀';
  transition: transform 0.3s ease;
}

.sidebar-collapsed .sidebar-toggle::before {
  transform: rotate(180deg);
}

/* 收缩状态下的按钮样式 */
.home-sidebar.collapsed .sidebar-toggle,
.chat-sidebar.collapsed .sidebar-toggle {
  margin-left: 0;
  border-color: var(--border);
  background: var(--card);
  color: var(--text);
}

.home-sidebar.collapsed .sidebar-toggle:hover,
.chat-sidebar.collapsed .sidebar-toggle:hover {
  background: var(--primary);
  color: white;
}

/* 首页布局 */
.home-layout{display:grid;grid-template-columns:var(--sidebar-width) 1fr;gap:0;height:100vh;transition: grid-template-columns 0.3s ease;}
.home-sidebar{background:var(--card);border-right:1px solid var(--border);display:flex;flex-direction:column;height:100vh;transition: width 0.3s ease;overflow: hidden;}

/* 侧边栏头部 */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  height: 48px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg,#0d1526 0%,#1a2338 100%);
  border-bottom: 1px solid rgba(79,70,229,0.2);
  position: relative;
  overflow: hidden;
}

.sidebar-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,transparent,rgba(79,70,229,0.1),transparent);
  animation: shimmer 3s infinite;
}

.sidebar-header .logo {
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
}

/* 主内容区域 */
.main-content {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.main-content .topbar {
  border-bottom: 1px solid var(--border);
  background: #0d1526;
  position: sticky;
  top: 0;
  z-index: 100;
}

.home-content{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  height: 100%;
  padding: 20px;
  gap: 20px;
  overflow: hidden;
}

.welcome-text{
  margin-bottom: 0;
  max-width: 600px;
  flex-shrink: 0;
}

.welcome-text h1{
  font-size: clamp(24px, 4vw, 36px);
  margin: 0 0 8px 0;
  color: #fff;
  font-weight: 700;
  line-height: 1.2;
}

.welcome-text h2{
  font-size: clamp(18px, 3vw, 24px);
  margin: 0 0 12px 0;
  color: var(--primary);
  font-weight: 600;
  line-height: 1.3;
}

.welcome-text p{
  font-size: clamp(14px, 2vw, 16px);
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
  opacity: 0.9;
}

/* 功能卡片 */
.feature-cards{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(12px, 2vw, 20px);
  margin-bottom: 0;
  max-width: 800px;
  width: 100%;
  flex-shrink: 0;
}

.feature-card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: clamp(16px, 3vw, 24px);
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #6366f1);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.feature-card:hover{
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(79,70,229,0.15);
}

.feature-card:hover::before {
  transform: scaleX(1);
}

.feature-icon{
  font-size: clamp(24px, 4vw, 36px);
  margin-bottom: clamp(8px, 2vw, 12px);
  display: block;
}

.feature-title{
  font-size: clamp(14px, 2vw, 16px);
  font-weight: 600;
  color: #fff;
  margin-bottom: clamp(6px, 1vw, 8px);
  line-height: 1.3;
}

.feature-desc{
  font-size: clamp(12px, 1.5vw, 14px);
  color: var(--muted);
  line-height: 1.4;
  opacity: 0.8;
}

.home-input{
  width: 100%;
  max-width: 600px;
  flex-shrink: 0;
}

.input-container{
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: clamp(10px, 2vw, 14px);
  margin: 0 auto;
  transition: all 0.3s ease;
  position: relative;
}

.input-container:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.attach-btn{
  position: relative;
  cursor: pointer;
  padding: clamp(6px, 1.5vw, 8px);
  border-radius: 6px;
  transition: all 0.2s ease;
  font-size: clamp(12px, 2vw, 14px);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(28px, 4vw, 32px);
  height: clamp(28px, 4vw, 32px);
}

.attach-btn svg {
  width: 16px;
  height: 16px;
  color: currentColor;
  transition: color 0.2s ease;
}

.attach-btn:hover{
  background: rgba(79,70,229,0.1);
  color: var(--primary);
}

.attach-btn:hover svg {
  color: var(--primary);
}

.attach-btn input{
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.voice-btn{
  cursor: pointer;
  padding: clamp(6px, 1.5vw, 8px);
  border-radius: 6px;
  transition: all 0.2s ease;
  font-size: clamp(12px, 2vw, 14px);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(28px, 4vw, 32px);
  height: clamp(28px, 4vw, 32px);
}

.voice-btn svg {
  width: 16px;
  height: 16px;
  color: currentColor;
  transition: color 0.2s ease;
}

.voice-btn:hover{
  background: rgba(79,70,229,0.1);
  color: var(--primary);
}

.voice-btn:hover svg {
  color: var(--primary);
}

#home-input{
  flex: 1;
  min-height: clamp(28px, 4vw, 32px);
  max-height: 80px;
  resize: vertical;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: clamp(13px, 2vw, 14px);
  outline: none;
  line-height: 1.4;
  padding: clamp(4px, 1vw, 6px) 0;
}

#home-input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.send-btn{
  background: var(--primary);
  color: #fff;
  border: none;
  padding: clamp(6px, 1.5vw, 8px) clamp(12px, 2vw, 16px);
  border-radius: 8px;
  cursor: pointer;
  font-size: clamp(12px, 1.5vw, 13px);
  font-weight: 600;
  transition: all 0.2s ease;
  min-width: clamp(50px, 8vw, 60px);
  height: clamp(28px, 4vw, 32px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.send-btn:hover{
  background: #6366f1;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(79,70,229,0.3);
}

.send-btn:active {
  transform: translateY(0);
}

.input-hint{
  display: none;
}

.input-hint::before {
  display: none;
}

/* 侧边栏收缩状态 */
.home-layout.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-width) 1fr;
}

.home-sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.home-sidebar.collapsed .sidebar-header .logo,
.home-sidebar.collapsed .new-chat,
.home-sidebar.collapsed .customer-list {
  display: none;
}

.home-sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 12px 8px;
  border-bottom: none;
  background: transparent;
}

.home-sidebar.collapsed .sidebar-header::before {
  display: none;
}

.welcome-text{margin-bottom:40px}
.welcome-text h1{font-size:36px;margin:0 0 16px 0;color:#fff;font-weight:700}
.welcome-text h2{font-size:24px;margin:0 0 20px 0;color:var(--primary);font-weight:600}
.welcome-text p{font-size:18px;color:var(--muted);margin:0;line-height:1.6}

/* 功能卡片 */
.feature-cards{display:grid;grid-template-columns:repeat(3,1fr);gap:20px;margin-bottom:40px;max-width:600px;margin-left:auto;margin-right:auto}
.feature-card{background:var(--card);border:1px solid var(--border);border-radius:12px;padding:20px;text-align:center;transition:all 0.3s ease}
.feature-card:hover{transform:translateY(-4px);border-color:var(--primary);box-shadow:0 8px 24px rgba(79,70,229,0.2)}
.feature-icon{font-size:32px;margin-bottom:12px}
.feature-title{font-size:16px;font-weight:600;color:#fff;margin-bottom:8px}
.feature-desc{font-size:14px;color:var(--muted);line-height:1.5}

.home-input{width:100%}
.input-container{display:flex;align-items:flex-end;gap:8px;background:var(--card);border:1px solid var(--border);border-radius:12px;padding:12px;max-width:600px;margin:0 auto}
.attach-btn{position:relative;cursor:pointer;padding:8px;border-radius:6px;transition:background 0.2s}
.attach-btn:hover{background:#0f1830}
.attach-btn input{position:absolute;inset:0;opacity:0;cursor:pointer}
.voice-btn{cursor:pointer;padding:8px;border-radius:6px;transition:all 0.2s;font-size:16px}
.voice-btn:hover{background:#0f1830}
#home-input{flex:1;min-height:24px;max-height:120px;resize:vertical;background:transparent;border:none;color:var(--text);font-size:16px;outline:none}
.send-btn{background:var(--primary);color:#fff;border:none;padding:8px 16px;border-radius:6px;cursor:pointer;font-size:14px;transition:opacity 0.2s}
.send-btn:hover{opacity:0.9}
.input-hint{display:none}

@media(max-width:768px){
  .home-content {
    padding: 16px;
    gap: 16px;
  }
  
  .welcome-text h1{
    font-size: clamp(20px, 6vw, 28px);
    margin-bottom: 6px;
  }
  
  .welcome-text h2{
    font-size: clamp(16px, 4vw, 20px);
    margin-bottom: 8px;
  }
  
  .welcome-text p{
    font-size: clamp(12px, 3vw, 14px);
  }
  
  .feature-cards{
    display: none;
  }
  
  .input-container {
    padding: clamp(8px, 3vw, 12px);
    gap: 6px;
  }
  
  .attach-btn,
  .voice-btn {
    padding: clamp(4px, 2vw, 6px);
    min-width: clamp(24px, 6vw, 28px);
    height: clamp(24px, 6vw, 28px);
    font-size: clamp(10px, 3vw, 12px);
  }
  
  .send-btn {
    padding: clamp(4px, 2vw, 6px) clamp(8px, 3vw, 12px);
    min-width: clamp(40px, 10vw, 50px);
    height: clamp(24px, 6vw, 28px);
    font-size: clamp(10px, 2.5vw, 12px);
  }
  
  #home-input {
    font-size: clamp(11px, 3vw, 13px);
    max-height: 60px;
  }
  
  .input-hint {
    font-size: clamp(9px, 2.5vw, 11px);
    margin-top: clamp(6px, 2vw, 8px);
  }
  
  /* 聊天界面输入框响应式 */
  .chat-input {
    padding: 16px;
    max-width: 100%;
  }
  
  .chat-input .input-container {
    padding: clamp(8px, 3vw, 12px);
    gap: 6px;
    width: 100%;
  }
  
  .chat-input .attach-btn,
  .chat-input .voice-btn {
    padding: clamp(4px, 2vw, 6px);
    min-width: clamp(24px, 6vw, 28px);
    height: clamp(24px, 6vw, 28px);
    font-size: clamp(10px, 3vw, 12px);
  }
  
  .chat-input .send-btn {
    padding: clamp(4px, 2vw, 6px) clamp(8px, 3vw, 12px);
    min-width: clamp(40px, 10vw, 50px);
    height: clamp(24px, 6vw, 28px);
    font-size: clamp(10px, 2.5vw, 12px);
  }
  
  .chat-input #chat-input {
    font-size: clamp(11px, 3vw, 13px);
    max-height: 60px;
  }
  
  .home-layout{grid-template-columns:1fr;gap:12px;padding:12px}
  .home-sidebar{order:2;margin-top:20px}
  .home-content{order:1}
  .home-topbar .actions{flex-wrap:wrap;gap:8px}
  .nav-stats{font-size:11px}
  .current-time{display:none}
}

@media(max-width:480px){
  .home-content {
    padding: 12px;
    gap: 12px;
  }
  
  .welcome-text h1{
    font-size: clamp(18px, 7vw, 24px);
    margin-bottom: 4px;
  }
  
  .welcome-text h2{
    font-size: clamp(14px, 5vw, 18px);
    margin-bottom: 6px;
  }
  
  .welcome-text p{
    font-size: clamp(11px, 4vw, 13px);
  }
  
  .feature-cards{
    display: none;
  }
  
  .input-container {
    padding: clamp(6px, 4vw, 10px);
    gap: 4px;
  }
  
  .attach-btn,
  .voice-btn {
    padding: clamp(3px, 2vw, 5px);
    min-width: clamp(20px, 7vw, 24px);
    height: clamp(20px, 7vw, 24px);
    font-size: clamp(9px, 4vw, 11px);
  }
  
  .send-btn {
    padding: clamp(3px, 2vw, 5px) clamp(6px, 4vw, 10px);
    min-width: clamp(35px, 12vw, 45px);
    height: clamp(20px, 7vw, 24px);
    font-size: clamp(9px, 3vw, 11px);
  }
  
  #home-input {
    font-size: clamp(10px, 4vw, 12px);
    max-height: 50px;
  }
  
  .input-hint {
    font-size: clamp(8px, 3vw, 10px);
    margin-top: clamp(4px, 2vw, 6px);
  }
  
  /* 聊天界面输入框响应式 */
  .chat-input {
    padding: 12px;
    max-width: 100%;
  }
  
  .chat-input .input-container {
    padding: clamp(6px, 4vw, 10px);
    gap: 4px;
    width: 100%;
  }
  
  .chat-input .attach-btn,
  .chat-input .voice-btn {
    padding: clamp(3px, 2vw, 5px);
    min-width: clamp(20px, 7vw, 24px);
    height: clamp(20px, 7vw, 24px);
    font-size: clamp(9px, 4vw, 11px);
  }
  
  .chat-input .send-btn {
    padding: clamp(3px, 2vw, 5px) clamp(6px, 4vw, 10px);
    min-width: clamp(35px, 12vw, 45px);
    height: clamp(20px, 7vw, 24px);
    font-size: clamp(9px, 3vw, 11px);
  }
  
  .chat-input #chat-input {
    font-size: clamp(10px, 4vw, 12px);
    max-height: 50px;
  }
}

/* 聊天布局 - PC端默认状态 */
.chat-layout{
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 0;
  height: 100vh;
  transition: grid-template-columns 0.3s ease;
}

.chat-sidebar{
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  transition: width 0.3s ease;
  overflow: hidden;
}

/* 聊天侧边栏收缩状态 */
.chat-layout.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-width) 1fr;
}

.chat-sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.chat-sidebar.collapsed .sidebar-header .logo,
.chat-sidebar.collapsed .new-chat,
.chat-sidebar.collapsed .customer-list {
  display: none;
}

.chat-sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 12px 8px;
  border-bottom: none;
  background: transparent;
}

.chat-sidebar.collapsed .sidebar-header::before {
  display: none;
}

.new-chat{display:flex;align-items:center;gap:8px;padding:8px 12px;margin:8px;background:#0f1830;border:1px solid var(--border);border-radius:8px;cursor:pointer;transition:all 0.2s}
.new-chat:hover{background:#19233b}
.new-chat .icon{font-size:16px}
.customer-list{flex:1;overflow:auto;padding:8px}
.customer-item{display:flex;flex-direction:column;gap:4px;padding:10px;border:1px solid var(--border);border-radius:8px;margin-bottom:8px;cursor:pointer;transition:all 0.2s}
.customer-item:hover{background:#0f1830}
.customer-item.active{background:#19233b;border-color:#4f46e5}
.customer-name{font-weight:600;font-size:14px}
.customer-meta{color:var(--muted);font-size:11px}
.plan-list{display:flex;flex-direction:column;gap:2px;margin-top:6px}
.plan-item{display:flex;align-items:center;justify-content:space-between;padding:4px 6px;background:#0f1830;border-radius:4px;font-size:11px;cursor:pointer;transition:all 0.2s}
.plan-item:hover{background:#1a2238}
.plan-item.active{background:#1a2238;color:#4f46e5}
.plan-item.add{background:transparent;border:1px dashed var(--border);color:var(--muted);justify-content:flex-start;gap:6px}
.plan-item.add:hover{background:#0f1830;color:#fff;border-color:#4f46e5}
.plan-item .add-icon{font-weight:700;color:#4f46e5}
.plan-title{flex:1}
.plan-status{font-size:10px;padding:2px 4px;border-radius:2px}
.plan-status.draft{background:#fbbf24;color:#000}
.plan-status.final{background:#10b981;color:#fff}
.chat-main{
  display:flex;
  flex-direction:column;
  height:100vh;
  overflow: hidden;
  flex:1;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:12px;
}
.chat-head{display:flex;align-items:center;gap:8px;padding:12px 16px;border-bottom:1px solid var(--border)}
.chat-head .customer-info{display:flex;align-items:center;gap:8px}
.chat-head .customer-info .avatar{width:32px;height:32px;border-radius:50%;background:#4f46e5;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:600}
.chat-messages{
  flex:1;
  overflow-y:auto;
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:12px;
  max-height: calc(100vh - 200px);
}

/* 自定义滚动条样式 */
.chat-messages::-webkit-scrollbar {
  width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
  transition: background 0.2s ease;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Firefox 滚动条样式 */
.chat-messages {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg);
}
.chat-input{display:flex;align-items:flex-end;gap:8px;padding:16px;border-top:1px solid var(--border);background:var(--card);}
.chat-input textarea{flex:1;min-height:40px;max-height:120px;resize:vertical;background:#0b1324;border:1px solid var(--border);color:var(--text);padding:8px;border-radius:8px;outline:none;}
.plan-preview{padding:16px;overflow:auto;flex:1;display:flex;flex-direction:column;gap:16px}
.preview-section{background:#0f1830;border:1px solid var(--border);border-radius:8px;padding:12px}
.preview-section h4{margin:0 0 8px 0;color:#4f46e5;font-size:14px}
.preview-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}
.preview-item{display:flex;justify-content:space-between;padding:4px 0}
.preview-item .label{color:var(--muted);font-size:12px}
.preview-item .value{font-weight:500}
.preview-cards{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}
.preview-card{background:var(--card);border:1px solid var(--border);border-radius:6px;padding:8px}
.preview-card .card-title{font-size:12px;color:var(--muted);margin-bottom:6px}
.preview-card .card-content{display:flex;flex-direction:column;gap:4px}
.motive-item,.breakthrough-item{font-size:12px;padding:2px 0}
.preview-tip{display:flex;flex-direction:column;gap:6px}
.tip-item{font-size:12px;line-height:1.4}
.preview-fabe{display:flex;flex-direction:column;gap:6px}
.fabe-item{font-size:12px;line-height:1.4}

/* 消息样式 */
.msg{display:flex;margin-bottom:12px;}
.msg.user{justify-content:flex-end;}
.msg.ai{justify-content:flex-start;}
.bubble{max-width:70%;padding:12px 16px;border-radius:12px;line-height:1.5;word-wrap:break-word;}
.msg.user .bubble{background:var(--primary);color:#fff;}
.msg.ai .bubble{background:var(--card);border:1px solid var(--border);color:var(--text);}

/* 聊天内联预览卡（Claude风格） */
.chat-preview{display:flex;align-items:flex-start;gap:12px;background:#0f1830;border:1px solid var(--border);border-radius:10px;padding:12px;margin-top:8px}
.chat-preview .icon{flex:0 0 auto;width:28px;height:28px;border-radius:6px;display:flex;align-items:center;justify-content:center;background:#1a2338;color:#93c5fd;font-size:14px}
.chat-preview .content{flex:1;min-width:0}
.chat-preview .title{margin:0 0 4px 0;font-weight:700;color:#fff;font-size:14px}
.chat-preview .subtitle{margin:0 0 8px 0;color:var(--muted);font-size:12px;line-height:1.4}
.chat-preview .actions{display:flex;gap:8px;flex-wrap:wrap}
.chat-preview .actions .btn{padding:6px 10px;border-radius:8px;font-size:12px}
.chat-preview .actions .btn.primary{background:var(--primary);border-color:transparent}
.chat-preview .actions .btn.ghost{background:transparent}

@media(max-width:960px){
  .chat-preview{padding:10px;border-radius:8px}
  .chat-preview .icon{width:24px;height:24px;font-size:12px}
  .chat-preview .title{font-size:13px}
  .chat-preview .subtitle{font-size:12px}
}

/* 手机端响应式设计 */
@media(max-width:960px){
  .chat-layout {
    grid-template-columns: 1fr;
  }
  
  .chat-sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    width: 280px;
    height: 100vh;
    z-index: 1000;
    transition: left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
  }
  
  .chat-sidebar.mobile-visible {
    left: 0;
  }
  
  .mobile-sidebar-toggle {
    display: none;
    position: fixed;
    top: 60px;
    left: 16px;
    z-index: 1001;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
    font-size: 20px;
    font-weight: bold;
  }
  
  /* 在移动端显示切换按钮 */
  .mobile-sidebar-toggle.mobile-visible {
    display: block;
  }
  
  .mobile-sidebar-toggle:hover {
    background: #6366f1;
    transform: scale(1.1);
  }
  
  .mobile-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
  }
  
  .mobile-sidebar-overlay.visible {
    display: block;
  }
  
  .chat-main {
    margin-left: 0;
    width: 100%;
  }
  
  .topbar {
    padding: 8px 16px;
  }
  
  .actions {
    gap: 8px;
  }
  
  .welcome-text-nav,
  .nav-stats {
    display: none;
  }
  
  .search {
    flex: 1;
    max-width: 200px;
  }
  
  /* 手机端输入框适配 */
  .chat-input {
    padding: 12px;
    max-width: 100%;
  }
  
  .chat-input .input-container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 12px;
  }
  
  .chat-input #chat-input {
    width: 100%;
    font-size: 16px; /* 防止iOS缩放 */
  }
  
  .chat-messages {
    padding: 12px;
  }
  
  .bubble {
    max-width: 85%;
  }
}

/* PC端保持原有布局 */
@media(min-width:961px){
  .chat-sidebar {
    position: static !important;
    left: auto !important;
    top: auto !important;
    width: auto !important;
    height: auto !important;
    z-index: auto !important;
    transition: width 0.3s ease !important;
    box-shadow: none !important;
  }
  
  /* 确保PC端侧边栏收缩功能正常 */
  .chat-layout.sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed-width) 1fr;
  }
  
  .chat-sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
  }
  
  .mobile-sidebar-toggle {
    display: none !important;
  }
  
  .mobile-sidebar-overlay {
    display: none !important;
  }
  
  .chat-main {
    margin-left: 0;
    width: auto;
  }
}

@media(max-width:768px){
  .chat-input .input-container {
    width: 100%;
    max-width: none;
    margin: 0 12px;
    padding: 10px;
  }
  
  .chat-input #chat-input {
    width: 100%;
    font-size: 16px;
  }
  
  .chat-messages {
    padding: 10px;
  }
  
  .bubble {
    max-width: 90%;
  }
  
  .mobile-sidebar-toggle {
    top: 50px;
    left: 12px;
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
  
  .topbar {
    padding: 6px 12px;
    height: 44px;
  }
  
  .actions {
    gap: 6px;
  }
  
  .search {
    max-width: 150px;
    font-size: 14px;
  }
  
  .user {
    font-size: 14px;
  }
}

/* 超小屏幕适配 */
@media(max-width:480px){
  .chat-input {
    padding: 8px;
  }
  
  .chat-input .input-container {
    margin: 0 8px;
    padding: 8px;
    gap: 6px;
  }
  
  .chat-input .attach-btn,
  .chat-input .voice-btn {
    min-width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  .chat-input .send-btn {
    min-width: 44px;
    height: 32px;
    font-size: 12px;
    padding: 6px 8px;
  }
  
  .chat-messages {
    padding: 8px;
  }
  
  .bubble {
    max-width: 95%;
    padding: 10px 12px;
    font-size: 14px;
  }
  
  .mobile-sidebar-toggle {
    top: 45px;
    left: 8px;
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
  
  .topbar {
    padding: 4px 8px;
    height: 40px;
  }
  
  .actions {
    gap: 4px;
  }
  
  .search {
    max-width: 120px;
    font-size: 13px;
    padding: 6px 8px;
  }
  
  .user {
    font-size: 13px;
    padding: 6px 8px;
  }
  
  .chat-head {
    padding: 8px 12px;
  }
  
  .chat-head .btn {
    font-size: 12px;
    padding: 6px 10px;
  }
}

/* 触摸友好的样式 */
@media (hover: none) and (pointer: coarse) {
  .mobile-sidebar-toggle {
    min-height: 44px;
    min-width: 44px;
  }
  
  .chat-input .attach-btn,
  .chat-input .voice-btn,
  .chat-input .send-btn {
    min-height: 44px;
    min-width: 44px;
  }
  
  .chat-head .btn {
    min-height: 36px;
    min-width: 60px;
  }
  
  .search {
    min-height: 36px;
  }
}

/* 横屏手机适配 */
@media(max-width:960px) and (orientation: landscape) {
  .mobile-sidebar-toggle {
    top: 8px;
    left: 8px;
    width: 36px;
    height: 36px;
    font-size: 14px;
  }
  
  .chat-input {
    padding: 8px;
  }
  
  .chat-input .input-container {
    padding: 8px;
  }
  
  .chat-messages {
    max-height: calc(100vh - 120px);
  }
}

/* 高分辨率手机适配 */
@media(max-width:960px) and (min-resolution: 2dppx) {
  .mobile-sidebar-toggle {
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  }
  
  .chat-input .input-container {
    border-width: 1px;
  }
  
  .bubble {
    border-width: 1px;
  }
}

.attach.btn.xs svg {
  width: 14px;
  height: 14px;
  color: currentColor;
  margin-right: 4px;
  transition: color 0.2s ease;
}

.attach.btn.xs:hover svg {
  color: var(--primary);
}

/* 聊天界面输入框样式 */
.chat-input {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.chat-input .input-container {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: clamp(10px, 2vw, 14px);
  margin: 0 auto;
  transition: all 0.3s ease;
  position: relative;
  width: 100%;
  max-width: 800px;
}

.chat-input .input-container:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.chat-input .attach-btn {
  position: relative;
  cursor: pointer;
  padding: clamp(6px, 1.5vw, 8px);
  border-radius: 6px;
  transition: all 0.2s ease;
  font-size: clamp(12px, 2vw, 14px);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(28px, 4vw, 32px);
  height: clamp(28px, 4vw, 32px);
}

.chat-input .attach-btn svg {
  width: 16px;
  height: 16px;
  color: currentColor;
  transition: color 0.2s ease;
}

.chat-input .attach-btn:hover {
  background: rgba(79,70,229,0.1);
  color: var(--primary);
}

.chat-input .attach-btn:hover svg {
  color: var(--primary);
}

.chat-input .attach-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.chat-input .voice-btn {
  cursor: pointer;
  padding: clamp(6px, 1.5vw, 8px);
  border-radius: 6px;
  transition: all 0.2s ease;
  font-size: clamp(12px, 2vw, 14px);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(28px, 4vw, 32px);
  height: clamp(28px, 4vw, 32px);
}

.chat-input .voice-btn svg {
  width: 16px;
  height: 16px;
  color: currentColor;
  transition: color 0.2s ease;
}

.chat-input .voice-btn:hover {
  background: rgba(79,70,229,0.1);
  color: var(--primary);
}

.chat-input .voice-btn:hover svg {
  color: var(--primary);
}

.chat-input #chat-input {
  width: 100%;
  min-height: 36px;
  max-height: 100px;
  resize: vertical;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  outline: none;
  line-height: 0.8;
  padding: 8px 0;
  border-radius: 6px;
}

.chat-input #chat-input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.chat-input .send-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: clamp(6px, 1.5vw, 8px) clamp(12px, 2vw, 16px);
  border-radius: 8px;
  cursor: pointer;
  font-size: clamp(12px, 1.5vw, 13px);
  font-weight: 600;
  transition: all 0.2s ease;
  min-width: clamp(50px, 8vw, 60px);
  height: clamp(28px, 4vw, 32px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-input .send-btn:hover {
  background: #6366f1;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(79,70,229,0.3);
}

.chat-input .send-btn:active {
  transform: translateY(0);
}



/* iPhone 等移动端适配修复（解除 100vh/overflow 限制，防止布局被截断） */
@media (max-width: 960px) {
  html, body {
    height: auto;
    overflow: auto;
  }
  .main-container {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .main-content,
  .home-sidebar,
  .chat-sidebar,
  .chat-main {
    height: auto;
  }
  /* 聊天消息区域允许根据内容自然生长，由外层滚动 */
  .chat-messages {
    max-height: none;
  }
  /* 首页两列在 <=960 下也改为单列，避免拥挤（兜底） */
  .home-layout {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }
}

/* iOS Safari 表单聚焦放大问题：确保字体 >=16px */
@media (max-width: 480px) {
  #home-input,
  .chat-input #chat-input,
  .search,
  input,
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* 手机端首页侧边栏抽屉样式 */
@media(max-width:960px){
  .home-layout { grid-template-columns: 1fr; }
  .home-sidebar { position: fixed; left: -100%; top: 0; width: 280px; height: 100vh; z-index: 1000; transition: left 0.3s ease; box-shadow: 2px 0 10px rgba(0,0,0,0.3); }
  .home-sidebar.mobile-visible { left: 0; }
  #home-layout > .mobile-sidebar-toggle.mobile-visible { display: block !important; position: fixed; top: 60px; left: 16px; z-index: 1001; background: var(--primary); color: #fff; border: none; border-radius: 50%; width: 48px; height: 48px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.3); transition: all 0.2s ease; font-size: 20px; font-weight: bold; }
  #home-layout > .mobile-sidebar-toggle.mobile-visible:hover { background: #6366f1; transform: scale(1.1); }
  #home-layout > .mobile-sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 999; }
  #home-layout > .mobile-sidebar-overlay.visible { display: block; }
}

/* 统一移动端切换按钮样式为与PC一致 */
.mobile-sidebar-toggle{
  display:none;
  position:fixed;
  z-index:1001;
  background: var(--primary);
  color: white;
  border: 2px solid var(--card);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: all 0.2s ease;
  font-size: 0; /* 隐藏原有字符，如 ☰ */
}
.mobile-sidebar-toggle::before{
  content: '◀';
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  height:100%;
  color:#fff;
  font-size:12px;
}
.mobile-sidebar-toggle:hover{ background:#6366f1; transform: scale(1.1); }

/* 打开状态箭头旋转 */
.mobile-sidebar-toggle.open::before{ transform: rotate(180deg); transition: transform 0.3s ease; }

/* 移动端展示与定位（统一位置） */
@media(max-width:960px){
  .mobile-sidebar-toggle.mobile-visible{ display:block; }
  .mobile-sidebar-toggle{ top: 56px; left: 16px; }
}

@media(max-width:768px){
  .mobile-sidebar-toggle{ top: 48px; left: 12px; }
}

@media(max-width:480px){
  .mobile-sidebar-toggle{ top: 44px; left: 8px; }
}

/* 将移动端按钮放置在顶栏内部左侧，垂直居中 */
@media(max-width:960px){
  #home-topbar .mobile-sidebar-toggle,
  #chat-topbar .mobile-sidebar-toggle{
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
  }
  #home-topbar .mobile-sidebar-toggle.mobile-visible,
  #chat-topbar .mobile-sidebar-toggle.mobile-visible{ display:block; }
  /* 顶栏已有高度：默认48px，按钮24px，保持视觉居中 */
}

/* 移动端隐藏侧边栏品牌文案，仅保留箭头按钮 */
@media(max-width:960px){
  .home-sidebar .sidebar-header .logo,
  .chat-sidebar .sidebar-header .logo{ display:none; }
}

/* 保留侧边栏头部的箭头按钮（sidebar-toggle）在移动端可见 */
@media(max-width:960px){
  .home-sidebar .sidebar-header .sidebar-toggle,
  .chat-sidebar .sidebar-header .sidebar-toggle{ display:flex; }
}

/* 移动端：侧边栏头部箭头固定在右侧，间距与PC一致 */
@media(max-width:960px){
  .home-sidebar .sidebar-header,
  .chat-sidebar .sidebar-header{ position: relative; }
  .home-sidebar .sidebar-header .sidebar-toggle,
  .chat-sidebar .sidebar-header .sidebar-toggle{
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
  }
  /* 打开抽屉时隐藏顶栏内的移动端按钮，避免双重入口 */
  .mobile-sidebar-toggle.hidden{ display: none !important; }
}

/* 移动端首页布局修复：侧边栏关闭时仍保持首页原有居中布局 */
@media(max-width:960px){
  .home-layout{ grid-template-columns: 1fr; }
  .home-content{ order: 1; }
  .home-sidebar{ order: 2; }
  /* 仅在 mobile-visible 时抽屉入场，默认保持在视口外 */
  .home-sidebar{ left: -100%; }
  .home-sidebar.mobile-visible{ left: 0; }
}

/* 移动端首页：侧边栏收起时完全不占位且不可点，展开时可交互 */
@media(max-width:960px){
  .home-sidebar{ pointer-events: none; }
  .home-sidebar.mobile-visible{ pointer-events: auto; }
}

/* 移动端悬浮式侧边栏：使用 transform 控制进出场，确保无残留边框 */
@media(max-width:960px){
  .home-sidebar,
  .chat-sidebar{
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 280px !important;
    height: 100vh !important;
    background: var(--card) !important;
    border: none !important;
    box-shadow: none !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s ease !important;
    z-index: 1000 !important;
    pointer-events: none;
  }
  .home-sidebar.mobile-visible,
  .chat-sidebar.mobile-visible{
    transform: translateX(0) !important;
    pointer-events: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3) !important;
    border: 1px solid var(--border) !important;
  }
}

/* 移动端：侧边栏顶栏显示品牌文案，与PC一致 */
@media(max-width:960px){
  .home-sidebar .sidebar-header .logo,
  .chat-sidebar .sidebar-header .logo{ display:flex !important; align-items:center; }
}

/* 移动端首页：自适应高度与宽度，避免出现滚动条 */
@media(max-width:960px){
  #home-layout{ height: 100dvh; overflow: hidden; }
  #home-layout .main-content{ height: 100%; overflow: hidden; }
  #home-topbar{ height: 48px; }
  #home-layout .home-content{
    height: calc(100dvh - 48px);
    min-height: 0; /* 允许子项在flex内收缩，防止挤出滚动 */
    overflow: hidden;
    padding: 12px; /* 紧凑边距，防止溢出 */
    gap: 12px;
    justify-content: center;
  }
  #home-layout .welcome-text{ max-width: 560px; margin: 0 auto; }
  #home-layout .feature-cards{ display: none; }
  #home-layout .home-input{ max-width: 600px; margin: 0 auto; }
  #home-layout .input-container{ max-width: 600px; width: 100%; }
}

@media(max-width:960px){
  #home-layout #home-input{ max-height: 72px; }
  #home-layout .send-btn{ flex-shrink: 0; }
  #home-layout .attach-btn, #home-layout .voice-btn{ flex-shrink: 0; }
}

/* 移动端首页高度进一步适配：svh/dvh 兼容并去除多余底部空间 */
@media(max-width:960px){
  body{ padding-bottom: 0; }
  /* 视口高度兼容：优先 svh，其次 dvh，最后 vh */
  #home-layout{
    height: 100svh;
    min-height: 100svh;
    max-height: 100svh;
    /* iOS 安全区（不增加总高度，仅内边距，避免被遮挡） */
    padding-bottom: env(safe-area-inset-bottom, 0);
    overflow: hidden;
  }
  /* 顶栏高度保持 48px（与现有PC对齐），内容区域精确填充剩余高度 */
  #home-topbar{ height: 48px; }
  #home-layout .main-content{ height: 100%; overflow: hidden; }
  #home-layout .home-content{
    height: calc(100svh - 48px);
    min-height: 0;
    overflow: hidden;
    padding: 12px;
    gap: 10px;
    justify-content: center;
  }
  /* 文案与输入区域限制，避免撑高 */
  #home-layout .welcome-text{ max-width: 560px; margin: 0 auto; }
  #home-layout .welcome-text h1{ margin: 0 0 6px 0; }
  #home-layout .welcome-text h2{ margin: 0 0 8px 0; }
  #home-layout .feature-cards{ display: none; }
  #home-layout .home-input{ max-width: 600px; margin: 0 auto; }
  #home-layout .input-container{ max-width: 600px; width: 100%; }
  #home-layout #home-input{ max-height: 64px; }
  #home-layout .send-btn{ flex-shrink: 0; }
  #home-layout .attach-btn, #home-layout .voice-btn{ flex-shrink: 0; }
}

/* 额外兜底：某些设备不支持 svh，用 dvh/vh 退化 */
@supports not (height: 100svh) {
  @media(max-width:960px){
    #home-layout{
      height: 100dvh;
      min-height: 100dvh;
      max-height: 100dvh;
    }
    #home-layout .home-content{ height: calc(100dvh - 48px); }
  }
}
@supports not (height: 100dvh) {
  @media(max-width:960px){
    #home-layout{
      height: 100vh;
      min-height: 100vh;
      max-height: 100vh;
    }
    #home-layout .home-content{ height: calc(100vh - 48px); }
  }
}

/* 移动端聊天页：与PC一致，仅消息区滚动，页面不滚动 */
@media(max-width:960px){
  body{ padding-bottom: 0; }
  #chat-layout{ height: 100svh; overflow: hidden; }
  #chat-topbar{ height: 48px; }
  #chat-layout .main-content{ height: 100%; overflow: hidden; }
  .chat-main{ height: calc(100svh - 48px); display: flex; flex-direction: column; overflow: hidden; }
  .chat-head{ flex: 0 0 auto; }
  .chat-messages{ flex: 1 1 auto; min-height: 0; overflow-y: auto; max-height: none !important; -webkit-overflow-scrolling: touch; }
  .chat-input{ flex: 0 0 auto; }
}

@supports not (height: 100svh) {
  @media(max-width:960px){
    #chat-layout{ height: 100dvh; }
    .chat-main{ height: calc(100dvh - 48px); }
  }
}
@supports not (height: 100dvh) {
  @media(max-width:960px){
    #chat-layout{ height: 100vh; }
    .chat-main{ height: calc(100vh - 48px); }
  }
}

/* S1-S4：移动端顶栏隐藏搜索框 */
@media(max-width:960px){
  .s-topbar .search{ display: none !important; }
}

/* 顶栏用户菜单（提升到最外层，避免被遮挡） */
.user{ position: relative; cursor: pointer; }
.user-menu{ position: fixed; right: 0; top: 0; margin-top: 0; background: var(--card); border: 1px solid var(--border); border-radius: 8px; min-width: 160px; box-shadow: 0 12px 28px rgba(0,0,0,0.45); display: none; z-index: 5000; }
.user-menu.open{ display: block; }
.user-menu .item{ padding: 10px 12px; color: var(--text); font-size: 13px; white-space: nowrap; }
.user-menu .item:hover{ background: #19233b; }
.user-menu .divider{ height: 1px; background: var(--border); margin: 4px 0; }

@media(max-width:960px){
  .user-menu{ min-width: 140px; }
}

/* 设置悬浮窗样式优化 */
.settings-modal .modal{backdrop-filter:saturate(120%) blur(2px)}
.settings-modal .modal-head{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid var(--border);background:linear-gradient(135deg,#0d1526 0%,#1a2338 100%)}
.settings-modal .modal-head h3{margin:0;color:#fff;font-size:16px;font-weight:700}
/* 设置悬浮窗：强制单列布局，所有功能一行一个 */
.settings-modal .modal-body{grid-template-columns:1fr !important}
/* 每个功能块独立一行（含注销按钮、开关、链接） */
.settings-row, .settings-links{grid-column:1 / -1}
/* 开关样式 */
.switch{position:relative;display:inline-block;width:44px;height:24px}
.switch input{display:none}
.switch .slider{position:absolute;cursor:pointer;inset:0;background:#0b1324;border:1px solid var(--border);border-radius:999px;transition:.2s}
.switch .slider:before{content:"";position:absolute;height:18px;width:18px;left:3px;top:50%;transform:translateY(-50%);background:#94a3b8;border-radius:50%;transition:.2s}
.switch input:checked + .slider{background:rgba(79,70,229,0.35);border-color:var(--primary)}
.switch input:checked + .slider:before{left:22px;background:#fff}
/* 隐藏底部操作区，修改即生效 */
.settings-modal .modal-foot{display:none}
.settings-row label{color:#cbd5e1;font-weight:600;font-size:12px;margin-bottom:4px}
.settings-row input:not([type="checkbox"]){width:100%}
/* 数据优化开关行的左右布局优化 */
.settings-row .meta{margin-top:4px}
/* 注销按钮居左或居中皆可，这里保持居左但提升可点击性 */
.settings-row .btn.ghost{width:100%;text-align:center}
/* 协议链接条目卡片化对齐 */
.settings-links{display:flex;gap:12px;align-items:center;color:var(--muted);font-size:12px;padding:0;border:none;background:transparent;justify-content:flex-start}
.settings-links a{color:#93c5fd;text-decoration:none}
.settings-links a:hover{text-decoration:underline}
.settings-row input[type="text"],
.settings-row input:not([type="checkbox"]){background:#0b1324;border:1px solid var(--border);color:var(--text);padding:10px 12px;border-radius:8px;outline:none;transition:border-color .2s,box-shadow .2s}
.settings-row input:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(79,70,229,0.1)}
.settings-row input::placeholder{color:var(--muted)}
.settings-row input[type="checkbox"]{accent-color:var(--primary);width:16px;height:16px}
.settings-links{display:flex;gap:12px;align-items:center;color:var(--muted);font-size:12px}
.settings-links a{color:#93c5fd;text-decoration:none}
.settings-links a:hover{text-decoration:underline}
.settings-modal .modal-foot{display:flex;gap:8px;justify-content:flex-end;padding:12px 16px;border-top:1px solid var(--border);background:#0d1526}
@media(min-width:961px){
  .settings-modal .modal{width:min(420px,92vw)}
  .settings-modal .modal-body{grid-template-columns:1fr 1fr}
  /* 让长行独占一行 */
  .settings-links{grid-column:1 / -1}
  .settings-row:nth-last-child(2){grid-column:1 / -1}
}
@media(max-width:960px){
  .settings-modal .modal-body{grid-template-columns:1fr}
  .settings-actions .btn{min-width:96px}
}

/* 设置项：左右排布，右侧为可编辑/展示区域 */
.settings-item{display:flex;align-items:center;justify-content:space-between;gap:12px}
.settings-item .value{display:flex;align-items:center;min-height:32px;color:#e2e8f0}
.settings-item input[type="text"], .settings-item input:not([type="checkbox"]){max-width:240px;text-align:right}
.settings-item .clickable{cursor:pointer}
