/* ══════════════════════════════════════════════════════════════
   Split Layout — PC 端分屏布局
   三种状态：
     1. 首页门户（默认）— landingPage 全宽
     2. 全宽对话（html.in-chat）— chatApp 居中全宽
     3. 分屏对话（html.in-chat.content-open）— 左聊天 + 右内容面板
   移动端 (max-width:768px) 不启用分屏
   ══════════════════════════════════════════════════════════════ */

/* ── 状态1：首页门户（默认） ── */
#splitDivider,
#contentPanel {
  display: none;
}

#closeLandingBtn,
#expandLandingBtn {
  display: none !important;
}

.split-panel-float-btn {
  position: fixed;
  top: 66px;
  right: 12px;
  z-index: 60;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border, #E5E7EB);
  border-radius: 9px;
  background: #fff;
  color: var(--text2, #666);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background .16s, border-color .16s, transform .16s;
}

.split-panel-float-btn:hover {
  background: #fff;
  border-color: #D1D5DB;
  color: #374151;
  transform: translateY(-1px);
}

.split-panel-float-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* PC 端用 display:none 隐藏 chatApp；移动端保留原始 opacity 机制 */
@media (min-width: 769px) {
  #chatApp {
    display: none;
  }
}

/* ── 状态2a：全宽对话（非分屏） ── */
html.in-chat:not(.split-mode) #landingPage {
  display: none;
}

html.in-chat:not(.split-mode) #chatApp {
  display: flex;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
}

html.in-chat #splitDivider,
html.in-chat #contentPanel {
  display: none;
}

/* ── 状态2b：分屏对话（PC，默认 chat 左 + landing 右） ── */
@media (min-width: 769px) {
  /* nav 拉通全宽（被 JS 提取到 body 顶层） */
  html.split-mode.in-chat #mainNav {
    position: fixed !important;
    top: 0; left: 0;
    width: 100vw !important;
    z-index: 100;
  }
  /* nav logo 在分屏模式下保持完整图片 */
  html.split-mode.in-chat #mainNav .logo img {
    height: 24px;
  }
  /* hero 隐藏（左侧已有聊天） */
  html.split-mode.in-chat #landingPage .hero {
    display: none !important;
  }
  /* chat topbar 精简：隐藏标题，保留按钮 */
  html.split-mode.in-chat .chat-topbar {
    border-bottom: none !important;
    background: var(--bg, #fff) !important;
    position: sticky;
    top: 0;
    left: auto; right: 0;
    width: 100%;
    z-index: 10;
    padding: 4px 8px !important;
    min-height: 0 !important;
    height: auto !important;
    display: flex !important;
    justify-content: flex-end;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
  }
  html.split-mode.in-chat .chat-topbar .chat-title {
    display: none !important;
  }
  html.split-mode.in-chat .chat-topbar .menu-btn {
    display: flex !important;
  }
  /* 默认：chat 左，landing 右 */
  html.split-mode.in-chat #chatApp {
    display: flex !important;
    position: fixed;
    left: 0; right: auto; top: 0;
    width: var(--split-left, 50%);
    max-width: none;
    margin: 0;
    padding-top: 56px;
    z-index: 2;
    height: 100vh; height: 100dvh;
    opacity: 1 !important;
    pointer-events: all !important;
  }
  html.split-mode.in-chat #landingPage {
    display: block !important;
    position: fixed;
    right: 0; left: auto; top: 0;
    width: calc(100vw - var(--split-left, 50%) - 6px);
    height: 100vh; height: 100dvh;
    padding-top: 56px;
    overflow-y: auto;
    z-index: 1;
    opacity: 1 !important;
    transform: none !important;
    pointer-events: all !important;
  }
  /* 换位：landing 左，chat 右 */
  html.split-mode.in-chat.layout-swapped #chatApp {
    left: auto; right: 0;
    width: calc(100vw - var(--split-left, 50%) - 6px);
  }
  html.split-mode.in-chat.layout-swapped #landingPage {
    left: 0; right: auto;
    width: var(--split-left, 50%);
  }
  /* sidebar 弹出时提升 chatApp z-index，让 overlay(9980) 盖过 divider */
  html.split-mode.in-chat #chatApp:has(.sb-overlay.active) {
    z-index: 100 !important;
  }
  /* divider 在状态2b可见可拖 */
  html.split-mode.in-chat:not(.content-open) #splitDivider {
    display: block !important;
    position: fixed;
    left: var(--split-left, 50%);
    top: 56px;
    width: 6px;
    height: calc(100vh - 56px);
    z-index: 50;
    cursor: col-resize;
    background: var(--border, #e5e7eb);
  }
  html.split-mode.in-chat:not(.content-open) #splitDivider:hover,
  html.split-mode.in-chat:not(.content-open) #splitDivider.dragging {
    background: var(--accent, #4D144A);
  }
  /* divider 上的折叠按钮 */
  .split-collapse-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 50%;
    width: 24px; height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    color: var(--text2, #666);
    opacity: 0;
    transition: opacity .2s;
    z-index: 51;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
  }
  #splitDivider:hover .split-collapse-btn {
    opacity: 1;
  }
  /* ── 收起landing：纯聊天全宽 ── */
  html.split-mode.in-chat.landing-collapsed #landingPage {
    display: none !important;
  }
  html.split-mode.in-chat.landing-collapsed #splitDivider {
    display: none !important;
  }
  html.split-mode.in-chat:not(.content-open):not(.landing-collapsed) #closeLandingBtn {
    display: flex !important;
  }
  /* 换位时关闭按钮在左侧 */
  html.split-mode.in-chat.layout-swapped #closeLandingBtn {
    right: auto;
    left: 12px;
  }
  html.split-mode.in-chat.landing-collapsed #chatApp {
    width: 100% !important;
    max-width: 900px;
    margin: 0 auto;
    left: 0; right: 0;
  }
  /* 收起时显示展开按钮 */
  html.split-mode.in-chat.landing-collapsed #expandLandingBtn {
    display: flex !important;
  }
  html.split-mode.in-chat.layout-swapped.landing-collapsed #expandLandingBtn {
    right: auto;
    left: 12px;
  }
}

/* ── 状态3：分屏对话 ── */
@media (min-width: 769px) {
  html.in-chat.content-open,
  html.in-chat.content-open body {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
  }

  html.in-chat.content-open #splitRoot {
    display: flex;
    flex-direction: row;
    position: fixed;
    top: 56px;
    left: 0;
    width: 100vw;
    height: calc(100vh - 56px);
    height: calc(100dvh - 56px);
    overflow: hidden;
    z-index: 1;
  }

  /* 换位：flex 反转 */
  html.in-chat.content-open.layout-swapped #splitRoot {
    flex-direction: row-reverse;
  }

  html.in-chat.content-open #landingPage {
    display: none;
  }

  html.in-chat.content-open #chatApp {
    display: flex;
    flex: 0 0 auto;
    /* width 由 JS 控制，默认 50% */
    width: 50%;
    max-width: none;
    margin: 0;
    height: 100%;
    min-width: 0;
    overflow: hidden;
    padding-top: 0;
    /* 覆盖原始 position:fixed，让 chatApp 参与 splitRoot flex 布局 */
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    z-index: auto;
  }

  html.in-chat.content-open #splitDivider {
    display: block;
  }

  html.in-chat.content-open #contentPanel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    height: 100%;
    overflow: hidden;
  }

  html.in-chat.content-open.content-maximized #chatApp,
  html.in-chat.content-open.content-maximized #splitDivider {
    display: none !important;
  }

  html.in-chat.content-open.content-maximized #contentPanel {
    flex: 1 1 100%;
    width: 100%;
  }

  /* ── 内容面板滑入/滑出动画 ── */
  html.in-chat.content-open #contentPanel {
    animation: cp-slide-in 300ms ease-out;
  }

  html.in-chat.content-closing #contentPanel {
    animation: cp-slide-out 200ms ease-in forwards;
  }

  @keyframes cp-slide-in {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
  }

  @keyframes cp-slide-out {
    from { transform: translateX(0); }
    to   { transform: translateX(100%); }
  }
}

/* ── 分割线 #splitDivider ── */
#splitDivider {
  flex: 0 0 6px;
  width: 6px;
  background: #E5E7EB;
  cursor: col-resize;
  position: relative;
  user-select: none;
  transition: background 0.15s;
  z-index: 30;
}

#splitDivider:hover,
#splitDivider.dragging {
  background: #D8D0E8;
}

/* 扩大可拖拽区域 */
#splitDivider::before {
  content: '';
  position: absolute;
  left: -3px;
  right: -3px;
  top: 0;
  bottom: 0;
}

/* grip 手柄：3个小圆点竖排 */
#splitDivider .grip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

#splitDivider .grip::before,
#splitDivider .grip::after,
#splitDivider .grip span {
  content: '';
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
}

#splitDivider:hover .grip,
#splitDivider.dragging .grip {
  opacity: 1;
}

/* ── 拖拽状态 ── */
html.split-dragging,
html.split-dragging * {
  user-select: none !important;
  cursor: col-resize !important;
}

html.split-dragging iframe,
html.split-dragging embed {
  pointer-events: none;
}

/* ── 内容面板 #contentPanel ── */

/* 头部 */
.cp-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  height: 44px;
  min-height: 44px;
  padding: 0 10px 0 12px;
  background: #fff;
  border-bottom: 1px solid #E5E7EB;
  flex-shrink: 0;
  gap: 10px;
}

/* Tab 容器 */
.cp-tabs {
  display: flex;
  flex-direction: row;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

.cp-actions {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Tab + 单标签关闭 */
.cp-tab-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 220px;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  background: #fff;
  transition: background 0.15s, border-color 0.15s;
}

.cp-tab-wrap:hover,
.cp-tab-wrap.active {
  background: #F6F4FF;
  border-color: #D8D0FF;
}

.cp-tab-wrap.home .cp-tab {
  padding-right: 12px;
  font-weight: 600;
  color: #374151;
}

.cp-tab-wrap.active::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 2px;
  border-radius: 999px;
  background: #6D28D9;
}

/* 单个 Tab */
.cp-tab {
  max-width: 190px;
  padding: 10px 26px 10px 12px;
  font-size: 13px;
  font-family: inherit;
  background: none;
  border: none;
  cursor: pointer;
  color: #6B7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s;
}

.cp-tab:hover,
.cp-tab-wrap.active .cp-tab,
.cp-tab.active {
  color: #6D28D9;
}

.cp-tab-wrap.active .cp-tab,
.cp-tab.active {
  font-weight: 600;
}

.cp-tab-x {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #9CA3AF;
  cursor: pointer;
  font-size: 15px;
  line-height: 18px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cp-tab-x:hover {
  background: #ECE7FF;
  color: #6D28D9;
}

.cp-icon-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  color: #6B7280;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.cp-icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cp-icon-btn:hover,
.cp-icon-btn.active {
  background: #F3F4F6;
  border-color: #E5E7EB;
  color: #374151;
}

.cp-close:hover {
  color: #E53E3E;
}

/* 内容区 */
.cp-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  background: #FAFAFA;
}

.cp-tab-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}

.cp-tab-content.cp-home-content {
  padding: 0;
  background: var(--bg, #F7F5FB);
}

html.in-chat.content-open .cp-home-content #landingPage {
  display: block !important;
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  height: 100% !important;
  padding-top: 0 !important;
  overflow-y: auto !important;
  z-index: auto !important;
  opacity: 1 !important;
  transform: none !important;
  pointer-events: auto !important;
}

html.in-chat.content-open .cp-home-content #closeLandingBtn,
html.in-chat.content-open .cp-home-content #expandLandingBtn {
  display: none !important;
}

.cp-empty {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9CA3AF;
  font-size: 14px;
  background: #fff;
  border: 1px dashed #E5E7EB;
  border-radius: 8px;
}

/* ── Tab 内容：商品网格 ── */
.cp-products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  padding: 4px;
}

.cp-product-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cp-product-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.cp-product-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #F9FAFB;
  display: block;
}

/* 右上角 PK 按钮 */
.cp-product-card .cp-pk-btn {
  position: absolute; top: 6px; right: 6px;
  min-width: 30px; height: 24px; padding: 0 8px;
  border-radius: 12px; border: 1px solid #E5E7EB;
  background: rgba(255,255,255,.95); color: #6B7280;
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  cursor: pointer; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.cp-product-card .cp-pk-btn:hover { background: #B83340; color: #fff; border-color: #B83340; }
.cp-product-card .cp-pk-btn.active { background: #6b2068; color: #fff; border-color: #6b2068; }

/* hover 0.3s 浮现操作层 */
.cp-product-card .cp-hover-actions {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; gap: 6px; padding: 10px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.78));
  opacity: 0; transform: translateY(8px);
  transition: opacity .25s, transform .25s;
  pointer-events: none; z-index: 2;
}
.cp-product-card .cp-hover-actions.show {
  opacity: 1; transform: translateY(0); pointer-events: auto;
}
.cp-product-card .cp-hover-actions button {
  flex: 1; padding: 7px 8px; border-radius: 6px; border: none;
  background: rgba(255,255,255,.95); color: #1a1a1a;
  font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.cp-product-card .cp-hover-actions button.primary {
  background: linear-gradient(90deg, #6b2068, #b83340); color: #fff;
}
.cp-product-card .cp-hover-actions button:hover { filter: brightness(1.08); }

.cp-product-card .cp-product-name {
  font-size: 14px;
  color: #111827;
  padding: 10px 12px 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cp-product-card .cp-product-price {
  font-size: 16px;
  font-weight: 700;
  color: #E53E3E;
  padding: 6px 12px 0;
}

.cp-product-card .cp-product-desc {
  font-size: 12px;
  color: #6B7280;
  padding: 4px 12px 12px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cp-product-btn {
  display: inline-block;
  padding: 6px 16px;
  border: 1px solid #E53E3E;
  border-radius: 6px;
  background: none;
  color: #E53E3E;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.cp-product-btn:hover {
  background: #E53E3E;
  color: #fff;
}

/* ── Tab 内容：对比表（增强：含外观/价格/分类/简介/操作） ── */
.cp-cmp-label { color:#6B7280; font-size:12px; white-space:nowrap; padding:8px 10px; background:#FAFAFA; }
.cp-cmp-img-wrap { width:100px; height:100px; background:#F9FAFB; border-radius:8px; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.cp-cmp-img-wrap img { max-width:100%; max-height:100%; object-fit:contain; }
.cp-cmp-price { font-size:16px; font-weight:700; color:#E53E3E; }
.cp-cmp-desc { color:#4B5563; font-size:12.5px; line-height:1.6; }
.cp-cmp-buy { display:inline-block; padding:5px 12px; border-radius:6px; background:#fff; border:1px solid #B83340; color:#B83340; font-size:12px; text-decoration:none; }
.cp-cmp-buy:hover { background:#B83340; color:#fff; }
.cp-cmp-ask { padding:5px 12px; border-radius:6px; background:#6D28D9; border:none; color:#fff; font-size:12px; cursor:pointer; font-family:inherit; margin-left:6px; }
.cp-cmp-ask:hover { filter:brightness(1.08); }

/* ── Tab 内容：对比表 ── */
.cp-compare {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.cp-compare th {
  background: #F9FAFB;
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: #111827;
  border-bottom: 1px solid #E5E7EB;
}

.cp-compare td {
  padding: 12px;
  border-bottom: 1px solid #E5E7EB;
  color: #111827;
}

.cp-compare .diff-cell {
  background: #FEF3C7;
}

/* ── Tab 内容：门店列表 ── */
.cp-stores {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cp-stores li {
  padding: 12px 0;
  border-bottom: 1px solid #E5E7EB;
}

.cp-stores li:last-child {
  border-bottom: none;
}

.cp-store-name {
  font-weight: 600;
  color: #111827;
  font-size: 14px;
}

.cp-store-address,
.cp-store-phone {
  font-size: 13px;
  color: #6B7280;
  margin-top: 2px;
}

/* ── Tab 内容：商品详情页 ── */
.cpd-loading {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 200px; color: #9CA3AF; font-size: 14px;
}
.cpd-spinner {
  width: 20px; height: 20px; border: 2px solid #E5E7EB; border-top-color: #6D28D9;
  border-radius: 50%; animation: cpd-spin .6s linear infinite;
}
@keyframes cpd-spin { to { transform: rotate(360deg); } }

.cpd-page { padding: 0; }
.cpd-main {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 420px);
  gap: 20px;
  padding: 16px 20px 0;
  align-items: stretch;
}
.cpd-hero {
  background: linear-gradient(135deg, #F8F7FF 0%, #F0EEFF 100%);
  padding: 24px; text-align: center;
  border-radius: 12px;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cpd-img-wrap img {
  max-width: 100%; max-height: 300px; object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.08));
}
.cpd-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.cpd-info { padding: 0; }
.cpd-name {
  margin: 0 0 8px; font-size: 17px; font-weight: 600; color: #111827; line-height: 1.4;
}
.cpd-price-row {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; flex-wrap: wrap;
}
.cpd-price { font-size: 26px; font-weight: 700; color: #E53E3E; }
.cpd-orig-price { font-size: 14px; color: #9CA3AF; text-decoration: line-through; }
.cpd-stock { font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.cpd-stock.in { color: #059669; background: #ECFDF5; }
.cpd-stock.out { color: #DC2626; background: #FEF2F2; }

.cpd-highlights {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px;
}
.cpd-hl-tag {
  font-size: 12px; padding: 3px 10px; border-radius: 12px;
  background: #F3F0FF; color: #6D28D9; border: 1px solid #E9E5FF;
}
.cpd-desc {
  font-size: 13px; color: #6B7280; line-height: 1.6; margin: 0 0 12px;
}

.cpd-actions {
  display: flex; gap: 10px; padding: 14px 0 0;
}
.cpd-actions .cpd-buy {
  flex: 1; padding: 12px; background: linear-gradient(135deg, #E53E3E, #C53030);
  color: #fff; border: none; border-radius: 10px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: transform .1s;
}
.cpd-actions .cpd-buy:active { transform: scale(.97); }
.cpd-actions .cpd-ask {
  flex: 1; padding: 12px; background: linear-gradient(135deg, #4D144A, #6D28D9);
  color: #fff; border: none; border-radius: 10px; font-size: 15px; cursor: pointer;
  transition: transform .1s;
}
.cpd-actions .cpd-ask:active { transform: scale(.97); }

.cpd-actions-sub {
  display: flex; gap: 10px; padding: 10px 0 0;
}
.cpd-actions-sub .cpd-link,
.cpd-actions-sub .cpd-compare {
  flex: 1; padding: 9px; text-align: center; border-radius: 8px; font-size: 13px;
  border: 1px solid #E5E7EB; background: #fff; color: #374151; cursor: pointer;
  text-decoration: none; transition: background .15s;
}
.cpd-actions-sub .cpd-link:hover,
.cpd-actions-sub .cpd-compare:hover { background: #F9FAFB; }

.cpd-specs-section,
.cpd-wiki-section,
.cpd-tu { padding: 16px 20px 20px; border-top: 1px solid #F3F4F6; }
.cpd-section-title,
.cpd-specs-title {
  margin: 0 0 12px; font-size: 14px; font-weight: 600; color: #374151;
  padding-bottom: 8px; border-bottom: 2px solid #6D28D9;
  display: inline-block;
}
.cpd-tu-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cpd-tu-tag { padding: 4px 10px; border-radius: 999px; background: #EEF2FF; color: #4338CA; font-size: 12px; }
.cpd-wiki-body { font-size: 13px; color: #4B5563; line-height: 1.7; }
.cpd-wiki-block { padding: 12px 14px; margin-bottom: 12px; background: #FAFAFA; border-left: 3px solid #B83340; border-radius: 8px; }
.cpd-wiki-title { font-size: 13px; font-weight: 600; color: #111827; margin-bottom: 6px; }
.cpd-wiki-content { font-size: 12.5px; color: #6B7280; line-height: 1.7; white-space: pre-wrap; }
.cpd-specs {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.cpd-specs tr { border-bottom: 1px solid #F3F4F6; }
.cpd-specs tr:nth-child(even) { background: #FAFAFA; }
.cpd-spec-label {
  color: #6B7280; padding: 8px 12px; white-space: nowrap; width: 100px;
}
.cpd-spec-value { color: #111827; padding: 8px 12px; }

@media (max-width: 860px) {
  .cpd-main {
    grid-template-columns: 1fr;
  }
  .cpd-hero {
    min-height: 260px;
  }
}

/* ── Tab 内容：门店卡片 ── */
.cp-stores-page { padding: 18px 22px; }
.cp-perks { display:flex; gap:12px; align-items:center; flex-wrap:wrap; padding:10px 14px; margin-bottom:14px; background:#FEF3F2; border-left:3px solid #B83340; border-radius:6px; font-size:12.5px; color:#6B7280; }
.cp-perks strong { color:#B83340; font-size:13px; }
.cp-store-card { background:#fff; border:1px solid #E5E7EB; border-radius:12px; padding:16px 18px; margin-bottom:12px; transition:box-shadow .15s; }
.cp-store-card:hover { box-shadow:0 4px 14px rgba(0,0,0,.08); }
.cp-store-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px; }
.cp-store-name { font-size:15px; font-weight:700; color:#111827; display:flex; align-items:center; gap:8px; }
.cp-store-rating { font-size:12px; color:#F59E0B; font-weight:600; }
.cp-store-flag { padding:1px 8px; border-radius:4px; background:#FEE2E2; color:#B83340; font-size:10px; font-weight:600; }
.cp-store-distance { font-size:12px; color:#9CA3AF; }
.cp-store-meta { font-size:13px; color:#4B5563; line-height:1.9; }
.cp-store-meta a { color:#6D28D9; }
.cp-store-tags { font-size:12px; color:#6B7280; margin-top:8px; display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.cp-store-tags strong { font-size:12px; color:#374151; }
.cp-store-tag { padding:3px 9px; border-radius:999px; background:#EEF2FF; color:#4338CA; font-size:11px; }
.cp-store-slots { margin-top:12px; padding-top:10px; border-top:1px dashed #E5E7EB; }
.cp-store-slots h4 { font-size:13px; font-weight:600; color:#374151; margin:0 0 8px; }
.cp-store-slot { display:flex; align-items:center; gap:10px; padding:8px 10px; margin-bottom:6px; background:#FAFAFA; border-radius:8px; }
.cp-slot-time { flex:1; font-size:13px; color:#111827; font-weight:500; }
.cp-slot-remain { font-size:11px; color:#9CA3AF; }
.cp-slot-btn { padding:5px 12px; border-radius:6px; border:1px solid #B83340; background:#fff; color:#B83340; font-size:12px; cursor:pointer; font-family:inherit; transition:all .15s; }
.cp-slot-btn:hover { background:#B83340; color:#fff; }
[data-theme="dark"] .cp-store-card { background:rgba(255,255,255,.04); border-color:rgba(255,255,255,.08); }
[data-theme="dark"] .cp-store-name { color:#fafafa; }
[data-theme="dark"] .cp-store-meta { color:#a1a1aa; }
[data-theme="dark"] .cp-store-slot { background:rgba(255,255,255,.04); }
[data-theme="dark"] .cp-slot-time { color:#fafafa; }

/* ── Tab 内容：通用 info（markdown 渲染） ── */
.cp-info-page { padding: 20px 24px; font-size: 14px; color: #1f2937; line-height: 1.7; }
.cp-info-page h1, .cp-info-page h2, .cp-info-page h3, .cp-info-page h4 { color: #111827; margin: 18px 0 10px; font-weight: 700; }
.cp-info-page h1 { font-size: 22px; }
.cp-info-page h2 { font-size: 18px; }
.cp-info-page h3 { font-size: 16px; }
.cp-info-page h4 { font-size: 14px; color: #374151; }
.cp-info-page p  { margin: 0 0 10px; color: #4b5563; }
.cp-info-page ul, .cp-info-page ol { padding-left: 22px; margin: 0 0 12px; }
.cp-info-page li { margin: 4px 0; color: #4b5563; }
.cp-info-page table { border-collapse: collapse; width: 100%; font-size: 13px; margin: 10px 0 16px; }
.cp-info-page th, .cp-info-page td { border: 1px solid #e5e7eb; padding: 8px 12px; text-align: left; }
.cp-info-page th { background: #f9fafb; color: #374151; font-weight: 600; }
.cp-info-page strong { color: #111827; }
.cp-info-page code { background: #f3f4f6; padding: 1px 6px; border-radius: 4px; font-size: 12.5px; color: #b83340; }
.cp-info-page pre  { background: #1f2937; color: #f9fafb; padding: 12px 16px; border-radius: 8px; overflow-x: auto; font-size: 12px; }
.cp-info-page a    { color: #b83340; text-decoration: none; border-bottom: 1px dotted #b83340; }
.cp-info-page hr   { border: none; border-top: 1px solid #e5e7eb; margin: 18px 0; }
[data-theme="dark"] .cp-info-page { color: #d4d4d8; }
[data-theme="dark"] .cp-info-page h1, [data-theme="dark"] .cp-info-page h2,
[data-theme="dark"] .cp-info-page h3, [data-theme="dark"] .cp-info-page h4 { color: #fafafa; }
[data-theme="dark"] .cp-info-page p, [data-theme="dark"] .cp-info-page li { color: #a1a1aa; }
[data-theme="dark"] .cp-info-page th { background: rgba(255,255,255,.05); color: #d4d4d8; }
[data-theme="dark"] .cp-info-page th, [data-theme="dark"] .cp-info-page td { border-color: rgba(255,255,255,.1); }

/* ── Tab 内容：CTO 预设切换栏 ── */
.cp-cto-presetbar { display:flex; gap:6px; align-items:center; padding:10px 16px; border-bottom:1px solid #E5E7EB; background:#fafafa; flex-wrap:wrap; }
.cp-cto-preset { padding:6px 12px; border-radius:999px; border:1px solid #E5E7EB; background:#fff; color:#374151; font-size:12.5px; cursor:pointer; font-family:inherit; transition:all .15s; }
.cp-cto-preset:hover { border-color:#6b2068; color:#6b2068; }
.cp-cto-preset.active { background:linear-gradient(90deg,#6b2068,#b83340); color:#fff; border-color:transparent; }
.cp-cto-spacer { flex:1; }
.cp-cto-host { padding:0; min-height:600px; display:flex; flex-direction:column; background:#fff; }
[data-theme="dark"] .cp-cto-host { background:var(--card2); }
.cp-cto-host .ai-modal-close { display:none !important; }
.cp-cto-host .cto-head { padding:18px 22px; border-bottom:1px solid #E5E7EB; display:flex; align-items:center; gap:14px; flex-shrink:0; }
.cp-cto-host .cto-tabs { display:flex; padding:0 22px; border-bottom:1px solid #E5E7EB; flex-shrink:0; }
.cp-cto-host .cto-body { flex:1 1 auto; overflow:visible; padding:18px 22px; }
.cp-cto-host .cto-foot { flex-shrink:0; padding:14px 22px; border-top:1px solid #E5E7EB; display:flex; align-items:center; justify-content:space-between; gap:14px; background:rgba(0,0,0,.02); }
[data-theme="dark"] .cp-cto-presetbar { background:rgba(255,255,255,.04); border-color:rgba(255,255,255,.08); }
[data-theme="dark"] .cp-cto-preset { background:transparent; border-color:rgba(255,255,255,.12); color:#d4d4d8; }

/* ── Tab 内容：服务中心（customize / coupon / member / tradein） ── */
.cp-svc-page { padding: 0 0 24px; }
.cp-svc-hero { padding: 28px 28px; color: #fff; border-radius: 0 0 14px 14px; margin-bottom: 18px; }
.cp-svc-hero h2 { margin: 0 0 8px; font-size: 22px; font-weight: 700; }
.cp-svc-hero p { margin: 0; font-size: 13px; line-height: 1.7; opacity: .92; }
.cp-svc-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; padding: 0 24px; }
.cp-svc-btn {
  padding: 14px 18px; border-radius: 10px; border: 1px solid #E5E7EB; background: #fff;
  color: #374151; font-size: 14px; font-weight: 500; cursor: pointer;
  font-family: inherit; transition: all .15s; text-align: left;
  display: flex; align-items: center; gap: 8px;
}
.cp-svc-btn:hover { border-color: #6b2068; color: #6b2068; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(107,32,104,.12); }
.cp-svc-btn.primary { background: linear-gradient(90deg,#6b2068,#b83340); color: #fff; border-color: transparent; }
.cp-svc-btn.primary:hover { filter: brightness(1.08); color: #fff; }
.cp-svc-tips {
  margin: 18px 24px 0; padding: 12px 16px;
  background: #FEF3F2; border-left: 3px solid #B83340; border-radius: 6px;
  font-size: 12.5px; color: #6B7280; line-height: 1.7;
}
.cp-svc-tips strong { color: #B83340; margin-right: 6px; }

/* ── 输入框上方功能 chips（subnav-extra-input） ── */
.subnav-extra-input {
  display: flex; gap: 6px; padding: 0 0 10px; flex-wrap: wrap; align-items: center;
}
.subnav-extra-input .se-btn {
  padding: 5px 11px; border-radius: 999px; border: 1px solid #E5E7EB; background: #fff;
  color: #6B7280; font-size: 12.5px; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 4px; transition: all .15s;
  white-space: nowrap;
}
.subnav-extra-input .se-btn:hover { border-color: #6b2068; color: #6b2068; background: #FEF3F2; }
.subnav-extra-input .se-btn .ico { font-size: 13px; }
.subnav-extra-input .se-more { position: relative; display: inline-block; }
.subnav-extra-input .se-more.open .se-dropdown { display: block; }
.subnav-extra-input .se-dropdown {
  display: none; position: fixed; width: 180px; max-width: 220px;
  background: #fff; border: 1px solid #E5E7EB; border-radius: 10px;
  box-shadow: 0 -8px 24px rgba(0,0,0,.18); padding: 6px; z-index: 100000;
}
.subnav-extra-input .se-dropdown button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 12px; border: none; background: transparent; color: #374151;
  font-size: 13px; cursor: pointer; font-family: inherit; border-radius: 6px; text-align: left;
}
.subnav-extra-input .se-dropdown button:hover { background: #FEF3F2; color: #6b2068; }
[data-theme="dark"] .subnav-extra-input .se-btn { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.1); color: #9CA3AF; }
[data-theme="dark"] .subnav-extra-input .se-dropdown { background: #1f1f23; border-color: rgba(255,255,255,.1); }
[data-theme="dark"] .subnav-extra-input .se-dropdown button { color: #d4d4d8; }

/* ── Tab 内容：iframe 预览 ── */
.cp-preview {
  width: 100%;
  height: 100%;
  border: none;
}

/* ── Tab 内容：留资表单 ── */
.cp-form {
  max-width: 400px;
  margin: 0 auto;
}

.cp-form .cp-form-group {
  margin-bottom: 16px;
}

.cp-form label {
  display: block;
  font-size: 14px;
  color: #111827;
  margin-bottom: 6px;
  font-weight: 500;
}

.cp-form input,
.cp-form select,
.cp-form textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: #111827;
  background: #fff;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.cp-form input:focus,
.cp-form select:focus,
.cp-form textarea:focus {
  outline: none;
  border-color: #6D28D9;
}

.cp-form textarea {
  resize: vertical;
  min-height: 80px;
}

.cp-form .cp-form-submit {
  width: 100%;
  padding: 12px;
  background: #E53E3E;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.cp-form .cp-form-submit:hover {
  background: #C53030;
}

/* ── 顶部控制按钮 #splitControls ── */
#splitControls {
  display: none;
  align-items: center;
  gap: 4px;
}

html.in-chat #splitControls {
  display: inline-flex;
}

#splitControls button {
  background: transparent;
  border: 1px solid #E5E7EB;
  color: #6B7280;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
}

#splitControls button:hover {
  border-color: #6D28D9;
  color: #6D28D9;
}

#splitControls button svg {
  width: 13px;
  height: 13px;
}

/* ── 移动端：禁用所有分屏逻辑 ── */
@media (max-width: 768px) {
  #splitRoot {
    display: contents;
  }

  #splitDivider,
  #contentPanel,
  #splitControls {
    display: none !important;
  }

  /* 移动端全宽对话保持默认行为 */
  html.in-chat #chatApp {
    max-width: none;
  }
}
