/* desktop.css – PC 平行视图（左栏 + 会话列表 + 聊天面板） */
.chat-pane,
.splitter,
.desktop-frame,
.frame-loading {
  display: none;
}

@media (min-width: 768px) {
  :root {
    --rail-w: 72px;
    --list-w: 380px;
    --panel-bg: #f5f7fb;
  }

  html,
  body {
    background: #e9eef5;
  }

  /* 整个应用铺满视口，不再做“居中手机壳” */
  .pg {
    position: fixed;
    inset: 0;
    width: auto;
    max-width: none;
    margin: 0;
    overflow: hidden;
    background: #fff;
    box-shadow: none;
  }

  .topbg {
    display: none;
  }

  /* 最左侧图标栏：承担原底部 TabBar 的功能 */
  .tabbar {
    top: 0;
    left: 0;
    right: auto;
    bottom: auto;
    width: var(--rail-w);
    height: 100vh;
    margin: 0;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-right: 1px solid #e5e7eb;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    transform: none;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    z-index: 30;
  }

  .tabbar::before,
  .tabbar::after {
    display: none !important;
  }

  .tabbar.classic {
    display: flex;
    left: 0;
    right: auto;
    bottom: auto;
    width: var(--rail-w);
    height: 100vh;
    padding: 16px 0;
    background: #fff;
    border: 0;
    border-right: 1px solid #e5e7eb;
    transform: none;
  }

  .tab {
    width: 100%;
    padding: 10px 0;
    flex-direction: column;
    gap: 3px;
    border-radius: 0;
  }

  .tab svg {
    width: 24px;
    height: 24px;
  }

  .tab:hover svg {
    transform: none;
  }

  .tab-lb {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: #4b5563;
  }

  .tab.on .tab-lb {
    color: #3b6df6;
  }

  .tabdot {
    top: 12px;
    right: calc(50% - 16px);
  }

  /* 会话列表顶部信息 */
  .user {
    top: 16px;
    left: calc(var(--rail-w) + 16px);
    z-index: 20;
  }

  .sbox {
    top: 72px;
    left: calc(var(--rail-w) + 16px);
    right: auto;
    width: calc(var(--list-w) - 76px);
    height: 38px;
    z-index: 20;
  }

  .add {
    top: 16px;
    right: calc(100vw - var(--rail-w) - var(--list-w) + 16px);
    z-index: 25;
  }

  .card {
    top: 60px;
    right: calc(100vw - var(--rail-w) - var(--list-w) + 16px);
  }

  /* 会话列表 */
  .recent {
    top: 116px;
    left: var(--rail-w);
    right: auto;
    bottom: 0;
    width: var(--list-w);
    padding: 0 0 16px;
    overflow-y: auto;
    border-right: 1px solid #e5e7eb;
    background: #fff;
    transform: none;
    z-index: 15;
  }

  .rhead {
    padding: 12px 16px 8px;
  }

  .rcslide {
    padding: 12px 16px;
  }

  .rcitem.active .rcslide {
    background: #e9edf3;
  }

  .rcitem.pin .rcslide {
    background: #f6faff;
  }

  .rcitem.active.pin .rcslide {
    background: #e3edff;
  }

  /* 右侧聊天面板 */
  .chat-pane {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: calc(var(--rail-w) + var(--list-w));
    display: flex;
    flex-direction: column;
    background: var(--panel-bg);
    z-index: 10;
  }

  .chat-head {
    height: 72px;
    flex: 0 0 72px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
  }

  .chat-back {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    cursor: pointer;
  }

  .chat-back:hover {
    background: #f1f5f9;
  }

  .chat-avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    background: #e2e8f0;
  }

  .chat-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
  }

  .chat-meta {
    flex: 1;
    min-width: 0;
  }

  .chat-name {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-status {
    margin-top: 2px;
    font-size: 12px;
    color: #6b7280;
  }

  .chat-add {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #6b7280;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
  }

  .chat-add:hover {
    background: #f1f5f9;
  }

  .chat-body {
    flex: 1;
    min-height: 0;
    display: flex;
  }

  .chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #9aa4b2;
    font-size: 14px;
  }

  .chat-empty[hidden] {
    display: none;
  }

  .chat-empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e8edf5;
    color: #7c8aa0;
  }

  .chat-empty-icon svg {
    width: 34px;
    height: 34px;
  }

  .chat-thread {
    flex: 1;
    width: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px 24px 18px;
  }

  .chat-thread[hidden] {
    display: none;
  }

  .chat-messages {
    flex: 1;
    width: 100%;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 4px;
  }

  .chat-day {
    margin: 4px 0 8px;
    text-align: center;
    font-size: 12px;
    color: #9aa4b2;
  }

  .bubble {
    max-width: min(72%, 560px);
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
    word-break: break-word;
  }

  .bubble-left {
    align-self: flex-start;
    margin-right: auto;
    border: 1px solid #e5e7eb;
    border-top-left-radius: 4px;
    background: #fff;
    color: #1f2937;
  }

  .bubble-right {
    align-self: flex-end;
    margin-left: auto;
    border-top-right-radius: 4px;
    background: #3b6df6;
    color: #fff;
  }

  .chat-compose {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    padding: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
  }

  .chat-compose input {
    flex: 1;
    min-width: 0;
    padding: 0 8px;
    border: 0;
    outline: none;
    background: transparent;
    color: #1f2937;
    font-family: inherit;
    font-size: 14px;
  }

  .chat-compose button {
    height: 36px;
    padding: 0 18px;
    border: 0;
    border-radius: 10px;
    background: #3b6df6;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
  }

  /* 联系人与动态：在应用内用 iframe 打开远程页面，不跳出桌面壳 */
  .desktop-frame {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: var(--rail-w);
    display: none;
    width: calc(100vw - var(--rail-w));
    height: 100vh;
    border: 0;
    background: #fff;
    z-index: 20;
  }

  .desktop-frame.on {
    display: block;
  }

  body.frame-mode .frame-loading {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: var(--rail-w);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f7fb;
    color: #9aa4b2;
    font-size: 14px;
    z-index: 21;
  }

  body.frame-mode .recent,
  body.frame-mode .user,
  body.frame-mode .sbox,
  body.frame-mode .add,
  body.frame-mode .card,
  body.frame-mode .chat-pane,
  body.frame-mode .splitter {
    display: none !important;
  }

  /* 可拖动分割线 */
  .splitter {
    position: fixed;
    top: 0;
    bottom: 0;
    left: calc(var(--rail-w) + var(--list-w) - 3px);
    display: block;
    width: 6px;
    background: transparent;
    cursor: col-resize;
    touch-action: none;
    z-index: 40;
  }

  .splitter::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 3px;
    width: 1px;
    background: #e5e7eb;
    transition: width 0.15s, background 0.15s;
  }

  .splitter::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 1px;
    width: 4px;
    height: 36px;
    border-radius: 2px;
    background: #d7dee8;
    transform: translateY(-50%);
    transition: background 0.15s;
  }

  .splitter:hover::before,
  body.resizing .splitter::before {
    background: #3b6df6;
  }

  .splitter:hover::after,
  body.resizing .splitter::after {
    width: 2px;
    background: #3b6df6;
  }

  body.resizing {
    cursor: col-resize;
    user-select: none;
  }

  /* 侧边栏覆盖层保持原交互 */
  .sidebar {
    width: 320px;
  }

  /* 暗色模式 */
  html.nm-dark .pg,
  html.nm-dark .recent {
    background: #1a1c20 !important;
  }

  html.nm-dark .tabbar,
  html.nm-dark .tabbar.classic {
    background: #131519 !important;
    border-right-color: #2b2e35 !important;
  }

  html.nm-dark .chat-head {
    background: #1a1c20 !important;
    border-bottom-color: #2b2e35 !important;
  }

  html.nm-dark .chat-name {
    color: #e5e8ee;
  }

  html.nm-dark .chat-status {
    color: #949cab;
  }

  html.nm-dark .chat-pane {
    background: #131519 !important;
  }

  html.nm-dark .bubble-left {
    background: #23262c;
    border-color: #2b2e35;
    color: #e5e8ee;
  }

  html.nm-dark .chat-compose {
    background: #1a1c20;
    border-color: #2b2e35;
  }

  html.nm-dark .chat-compose input {
    color: #e5e8ee;
  }

  html.nm-dark .rcitem.active .rcslide {
    background: #23262c !important;
  }

  html.nm-dark .rcitem.active.pin .rcslide {
    background: #1f2837 !important;
  }
}
