/* ===== 桌面布局：图标栏 + 会话列表 + 聊天区 ===== */
.shell { display: flex; height: 100dvh; overflow: hidden; }

/* ---- 左侧图标栏 ---- */
.rail {
  width: var(--rail-w); flex: 0 0 var(--rail-w); background: var(--bg-rail);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  align-items: center; padding: 10px 0 12px; gap: 6px; z-index: 3;
}
.rail-top { margin-bottom: 10px; }
.rail-mid { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.rail-bottom { margin-top: auto; }
.rail-btn {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  color: var(--txt-2); position: relative; transition: background .15s, color .15s;
}
.rail-btn svg { width: 23px; height: 23px; fill: currentColor; }
.rail-btn:hover { background: var(--bg-hover); color: var(--txt); }
.rail-btn.active { color: var(--accent); background: rgba(51, 144, 236, .13); }
.rail-btn.logo { color: var(--accent-2); }
.rail-badge {
  position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--bg-rail);
}
.avatar-btn { width: 42px; height: 42px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; }
.avatar-btn .avatar { width: 42px; height: 42px; font-size: 15px; }

/* ---- 列表栏 ---- */
.list-panel { width: var(--list-w); flex: 0 0 var(--list-w); background: var(--bg-list); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.list-head { padding: 10px 10px 8px; border-bottom: 1px solid var(--line); }
.list-title-row { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 8px; }
.list-title-row h2 { font-size: 19px; font-weight: 700; letter-spacing: .2px; }
.list-actions { display: flex; gap: 2px; }
.search-wrap { position: relative; }
.search-wrap .search-ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--txt-3); pointer-events: none; }
.search-wrap input {
  width: 100%; background: var(--bg-input); border-radius: 9px; padding: 9px 12px 9px 34px;
  font-size: 13.5px; transition: background .15s, box-shadow .15s;
}
.search-wrap input:focus { background: rgba(51, 144, 236, .1); box-shadow: inset 0 0 0 1px rgba(51, 144, 236, .4); }
.list-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px; scroll-behavior: smooth; }
.list-scroll.over { overflow-y: auto; }

/* ---- 聊天区 ---- */
.chat-panel {
  flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative;
  background-color: var(--bg-chat);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(51, 144, 236, .10), transparent 42%),
    radial-gradient(circle at 88% 92%, rgba(79, 195, 247, .08), transparent 45%),
    radial-gradient(circle at 60% 40%, rgba(120, 90, 200, .05), transparent 50%);
}
.chat-head {
  height: 58px; flex: 0 0 58px; display: flex; align-items: center; gap: 11px; padding: 0 12px 0 10px;
  background: var(--bg-head); border-bottom: 1px solid var(--line); z-index: 2;
}
.chat-head-avatar .avatar { width: 38px; height: 38px; font-size: 14px; }
.chat-head-info { flex: 1; min-width: 0; cursor: pointer; }
.chat-head-name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head-sub { font-size: 12px; color: var(--txt-2); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head-sub.online { color: var(--online); }
.chat-head-sub.typing { color: var(--accent-2); }
.chat-head-actions { display: flex; gap: 2px; }
.back-btn { display: none; }

.msg-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; scroll-behavior: auto; }
.msg-inner { padding: 12px 0 10px; display: flex; flex-direction: column; justify-content: flex-end; min-height: 100%; }
.msg-list { display: flex; flex-direction: column; }
.load-more { text-align: center; padding: 8px; }
.load-more button { font-size: 12.5px; color: var(--accent-2); padding: 6px 14px; border-radius: 20px; background: rgba(51, 144, 236, .1); }
.scroll-down {
  position: absolute; right: 18px; bottom: 16px; width: 42px; height: 42px; border-radius: 50%;
  background: var(--bg-elevated); color: var(--txt); display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35); border: 1px solid var(--line);
}
.scroll-down svg { width: 22px; height: 22px; }
.scroll-down-badge {
  position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}

/* ---- 输入区 ---- */
.composer {
  position: relative; padding: 8px 12px calc(10px + var(--safe-b)); background: var(--bg-head);
  border-top: 1px solid var(--line);
}
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea {
  flex: 1; background: var(--bg-input); border-radius: 12px; padding: 10px 14px; font-size: 14.5px;
  resize: none; max-height: 140px; min-height: 42px; line-height: 1.4; transition: box-shadow .15s;
}
.composer textarea:focus { box-shadow: inset 0 0 0 1px rgba(51, 144, 236, .45); }
.send-btn {
  width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; flex: 0 0 auto; transition: transform .1s, background .15s;
  box-shadow: 0 4px 14px rgba(51, 144, 236, .35);
}
.send-btn svg { width: 21px; height: 21px; }
.send-btn:hover { background: var(--accent-dark); }
.send-btn:active { transform: scale(.94); }
.send-btn.rec { background: var(--danger); }
.emoji-panel {
  position: absolute; bottom: calc(100% + 8px); right: 12px; width: min(380px, calc(100vw - 100px));
  height: 320px; background: var(--bg-elevated); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; z-index: 20;
  animation: pop .14s var(--ease);
}
.emoji-tabs { display: flex; padding: 6px 6px 0; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.emoji-tabs button { padding: 6px 8px; font-size: 17px; border-radius: 8px 8px 0 0; opacity: .55; }
.emoji-tabs button.active { opacity: 1; background: var(--hover-soft); }
.emoji-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; }
.emoji-grid button { font-size: 22px; height: 40px; border-radius: 8px; display: grid; place-items: center; transition: background .1s, transform .1s; }
.emoji-grid button:hover { background: var(--bg-hover); transform: scale(1.15); }
.emoji-stickers { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px; }
.emoji-stickers button { font-size: 44px; height: 82px; border-radius: 10px; display: grid; place-items: center; background: var(--hover-soft); }
.emoji-stickers button:hover { background: var(--bg-hover); }

/* 待发送附件预览 */
.attach-preview { display: flex; gap: 8px; padding: 4px 2px 8px; overflow-x: auto; }
.att-chip { position: relative; flex: 0 0 auto; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; background: var(--bg-input); display: grid; place-items: center; font-size: 11px; color: var(--txt-2); }
.att-chip img { width: 100%; height: 100%; object-fit: cover; }
.att-chip .rm { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0, 0, 0, .65); color: #fff; font-size: 12px; display: grid; place-items: center; }
.reply-bar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; margin-bottom: 6px; border-left: 3px solid var(--accent); background: rgba(51, 144, 236, .08); border-radius: 6px; font-size: 12.5px; color: var(--txt-2); }
.reply-bar .x { margin-left: auto; color: var(--txt-3); }

/* 设置页 / 资料页 */
.profile-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 0 16px; }
.profile-hero .name { font-size: 19px; font-weight: 700; }
.profile-hero .uname { font-size: 13px; color: var(--txt-2); }
.settings-tabs { display: flex; gap: 6px; padding: 0 4px 12px; }
.settings-tabs .btn { padding: 7px 14px; font-size: 13px; }
.settings-tabs .btn.active { background: var(--accent); color: #fff; }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 4px; border-bottom: 1px solid var(--line); gap: 10px; }
.switch-row .t { font-size: 14px; }
.switch-row .s { font-size: 12px; color: var(--txt-2); margin-top: 2px; }
.switch { width: 44px; height: 26px; border-radius: 14px; background: var(--bg-input); position: relative; flex: 0 0 auto; transition: background .18s; }
.switch::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: transform .18s; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }
.theme-dots { display: flex; gap: 10px; }
.theme-dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; outline: 1px solid var(--line-strong); }
.theme-dot.active { border-color: var(--accent); }

/* 拖拽上传高亮 */
.drop-hint {
  position: absolute; inset: 0; background: rgba(51, 144, 236, .12); border: 2px dashed var(--accent);
  display: grid; place-items: center; font-size: 15px; font-weight: 600; color: var(--accent-2);
  z-index: 40; border-radius: 8px; pointer-events: none;
}
