/* ==========================================================================
   尼禄的聊天室 — QQNT 风格 UI
   三栏布局:左侧窄导航 + 中间会话列表 + 右侧内容区
   浅色/深色双主题,跟随系统,可手动切换
   ========================================================================== */

/* ---------- 主题变量 ---------- */
:root {
  --accent: #0099ff;            /* QQNT 主题蓝 */
  --accent-hover: #33adff;
  --accent-light: rgba(0, 153, 255, 0.12);

  --bg: #f5f6f7;                /* 页面底 */
  --panel: #ffffff;             /* 卡片/面板 */
  --panel-2: #fafafa;           /* 次级面板 */
  --hover: #f0f1f2;             /* 悬浮 */
  --active: #e8f4ff;            /* 选中态 */

  --login-bg: url("login-bg.jpg");  /* 登录/申请界面背景图(可动态替换) */

  --border: #e8e8ea;
  --border-strong: #dcdcde;

  --text: #1c1c1e;
  --text-muted: #8a8a8e;
  --text-faint: #b0b0b4;

  --user-bubble: #0099ff;       /* 自己发的气泡 */
  --user-text: #ffffff;
  --ai-bubble: #ffffff;         /* 对方气泡 */
  --ai-text: #1c1c1e;

  --danger: #ff5f5f;
  --ok: #22c55e;
  --warn: #f5a623;

  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.14);
  --radius: 10px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --rail-w: 68px;               /* 左栏宽 */
  --list-w: 300px;              /* 中栏宽 */

  --bg-dim: 1;                  /* 背景图亮度系数(深色主题自动压暗) */
}

/* 深色主题 */
:root[data-theme="dark"] {
  --accent: #2da8ff;
  --accent-hover: #55bbff;
  --accent-light: rgba(45, 168, 255, 0.18);

  --bg: #171717;
  --panel: #1e1e1e;
  --panel-2: #242424;
  --hover: #2a2a2a;
  --active: #1f3a4d;

  --border: #2e2e2e;
  --border-strong: #3a3a3a;

  --text: #e8e8ea;
  --text-muted: #9a9a9e;
  --text-faint: #6a6a6e;

  --user-bubble: #2da8ff;
  --user-text: #ffffff;
  --ai-bubble: #2a2a2a;
  --ai-text: #e8e8ea;

  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.6);

  --bg-dim: 0.4;               /* 深色主题下背景图压暗,实现「全暗」 */
}

/* 默认跟随系统;通过 data-theme 覆盖 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --accent: #2da8ff;
    --accent-hover: #55bbff;
    --accent-light: rgba(45, 168, 255, 0.18);
    --bg: #171717;
    --panel: #1e1e1e;
    --panel-2: #242424;
    --hover: #2a2a2a;
    --active: #1f3a4d;
    --border: #2e2e2e;
    --border-strong: #3a3a3a;
    --text: #e8e8ea;
    --text-muted: #9a9a9e;
    --text-faint: #6a6a6e;
    --user-bubble: #2da8ff;
    --user-text: #ffffff;
    --ai-bubble: #2a2a2a;
    --ai-text: #e8e8ea;
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.6);
    --bg-dim: 0.4;             /* 系统深色下背景图压暗 */
  }
}

/* ---------- 基础 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  height: 100dvh; /* 移动端动态视口高度,避免地址栏收起/展开导致底部输入框被裁 */
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ==========================================================================
   主界面三栏布局
   ========================================================================== */
.app {
  display: flex;
  height: 100vh;
  height: 100dvh; /* 移动端动态视口高度 */
  width: 100%;
  background: var(--bg);
}

/* ---------- 左栏:窄导航 ---------- */
.nav-rail {
  width: var(--rail-w);
  flex-shrink: 0;
  background: var(--panel-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 4px;
}

.nav-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--active);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  margin-bottom: 16px;
  transition: transform 0.15s;
}
.nav-avatar:hover { transform: scale(1.08); }

.nav-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-btn {
  width: 48px;
  height: 52px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  transition: all 0.15s;
}

.nav-btn .nav-icon { font-size: 22px; line-height: 1; }
.nav-btn .nav-icon svg { display: block; }
.nav-btn .nav-label { font-size: 10px; }

.nav-btn:hover { background: var(--hover); color: var(--text); }
.nav-btn.active { background: var(--active); color: var(--accent); }

/* 添加好友:圆形加号按钮 */
.nav-add-friend {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px auto;
  transition: all 0.15s;
  box-shadow: var(--shadow);
}
.nav-add-friend:hover { background: var(--accent-hover); transform: scale(1.06); }

.nav-foot {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-foot .nav-btn { height: 44px; }
.nav-foot .nav-btn .nav-icon { font-size: 18px; }

/* ---------- 中栏:会话列表 ---------- */
.list-pane {
  width: var(--list-w);
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

/* 中栏雾化背景层:原图铺满 + 按 --list-blur 雾化,内容浮在 z-index:1 之上 */
.list-pane::before {
  content: '';
  position: absolute;
  inset: -12px;
  background-image: var(--list-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(var(--list-blur, 10px)) brightness(var(--bg-dim, 1));
  transform: scale(1.05);
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.list-pane.has-list-bg::before { opacity: 1; }

.list-head,
.list-body { position: relative; z-index: 1; }

.list-head {
  padding: 12px 12px 12px;
  border-bottom: 1px solid var(--border);
}

.list-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--hover);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
}

.search-icon { font-size: 13px; opacity: 0.6; }

.search-input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}
.search-input::placeholder { color: var(--text-faint); }

.list-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
}

.list-section { margin-bottom: 8px; }

.list-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 6px;
}

.list-section-title {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.3px;
}

.list-add-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.list-add-btn:hover { background: var(--hover); color: var(--accent); }

/* ---------- 角色/好友列表项 ---------- */
.role-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.role-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.role-item:hover { background: var(--hover); }
.role-item.active { background: var(--active); }
.role-item.active .name { color: var(--accent); font-weight: 600; }

.role-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 头像圆:悬停时轻微放大(角色/好友通用) */
.role-item .avatar {
  transition: transform 0.15s;
}
.role-item:hover .avatar { transform: scale(1.08); }

/* 无角色/无好友时的引导项 */
.role-empty-hint {
  cursor: pointer;
  opacity: 1;
}
.role-empty-hint:hover { opacity: 1; }
.role-empty-hint .avatar.empty-plus {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--active);
  color: var(--accent);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  box-shadow: var(--shadow);
}
.role-empty-hint:hover .avatar.empty-plus { transform: scale(1.06); }
.role-empty-hint .name { color: var(--text-muted); }

.role-item .avatar {
  font-size: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.role-item .avatar img {
  width: 40px !important;
  height: 40px !important;
  object-fit: cover;
  display: block;
}
.role-item .avatar .char-avatar {
  width: 40px !important;
  height: 40px !important;
  font-size: 20px !important;
}

.role-item .name {
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.role-preview {
  font-size: 13px;
  color: var(--text-muted);
  padding-left: 48px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 好友快捷入口(中栏) */
.menu-friend-item {
  position: relative;
  gap: 2px;
}
.menu-friend-item .avatar { font-size: 28px; }
.menu-friend-item .avatar .char-avatar {
  width: 40px !important;
  height: 40px !important;
  font-size: 20px !important;
}
.menu-friend-item .name { font-size: 16px; }
.menu-friend-item .role-preview { padding-left: 48px; }
.f-menu-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
  margin-left: auto;
}
.f-menu-dot.on { background: var(--ok); }
.f-menu-unread {
  color: #fff;
  background: var(--danger);
  font-size: 10px;
  font-weight: 600;
  border-radius: 8px;
  padding: 0 5px;
  margin-left: 4px;
}
.menu-friend-empty { color: var(--text-faint); font-size: 13px; padding: 8px 10px; }

/* ==========================================================================
   右栏:内容区
   ========================================================================== */
.content-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.view { display: none; height: 100%; width: 100%; }
.view.active { display: flex; flex-direction: column; }

/* ---------- 聊天视图 ---------- */
.chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* 对话栏雾化背景层:原图铺满 + 按 --chat-blur 雾化,做在不滚动的 .chat 容器上,消息区透出 */
.chat::before {
  content: '';
  position: absolute;
  inset: -12px;
  background-image: var(--chat-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(var(--chat-blur, 0px)) brightness(var(--bg-dim, 1));
  transform: scale(1.05);
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.chat.has-chat-bg::before { opacity: 1; }
.chat-head,
.chat .messages,
.chat .input-area { position: relative; z-index: 1; }

.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-head-title {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.chat-name {
  font-size: 17px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-sub { font-size: 12px; color: var(--text-muted); }

.avatar-small { font-size: 40px; flex-shrink: 0; line-height: 1; display: flex; align-items: center; }
.avatar-small img, .avatar-small .char-avatar { width: 40px !important; height: 40px !important; font-size: 20px !important; }

/* 消息区 */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: transparent;
}

/* 无角色时的空态引导 */
.chat-empty-guide {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
}
.chat-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--hover);
  color: var(--text-faint);
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.msg {
  display: flex;
  max-width: 72%;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg.user { align-self: flex-end; }
.msg.ai { align-self: flex-start; }

.bubble {
  padding: 11px 15px;
  border-radius: var(--radius-lg);
  font-size: 15px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: var(--shadow);
}

.msg.user .bubble {
  background: var(--user-bubble);
  color: var(--user-text);
  border-bottom-right-radius: 5px;
}

.msg.ai .bubble {
  background: var(--ai-bubble);
  color: var(--ai-text);
  border-bottom-left-radius: 5px;
}

.msg img {
  max-width: 220px;
  max-height: 220px;
  border-radius: var(--radius);
  margin-bottom: 6px;
  display: block;
}

.voice-btn {
  margin-top: 8px;
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.voice-btn:hover { background: var(--accent-light); }

/* 输入区 */
.input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#input {
  flex: 1;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 15px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.4;
  color: var(--text);
  transition: border-color 0.15s;
}
#input:focus { border-color: var(--accent); }
#input::placeholder { color: var(--text-faint); }

.send-btn {
  background: var(--accent);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  box-shadow: var(--shadow);
}
.send-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* 加载动画 */
.typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}
.typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: blink 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}

/* ---------- 图标按钮 ---------- */
.icon-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: background 0.15s;
  color: var(--text);
}
.icon-btn:hover { background: var(--hover); }
.icon-btn.active { background: var(--accent-light); color: var(--accent); }
.icon-btn.recording { background: var(--danger); color: #fff; animation: voice-pulse 1s ease-in-out infinite; }
@keyframes voice-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* 图片按钮内联图标(蓝天绿地太阳),垂直居中 */
.img-icon { display: block; }

/* 语音消息气泡(好友聊天/角色聊天的录音消息) */
.voice-msg { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.voice-msg .voice-play { flex-shrink: 0; }
.voice-msg .voice-bar {
  width: 120px; height: 20px;
  display: flex; align-items: center; gap: 2px;
}
.voice-msg .voice-bar i {
  flex: 1; min-width: 2px; background: currentColor; opacity: 0.5;
  border-radius: 1px;
}
.voice-msg .voice-dur { font-size: 12px; opacity: 0.7; }

/* ==========================================================================
   好友聊天视图
   ========================================================================== */
.friends {
  display: flex;
  height: 100%;
  width: 100%;
}

.f-main {
  display: flex;
  height: 100%;
  width: 100%;
}

.f-side {
  width: 260px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.f-side-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.f-status {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 10px;
  background: var(--hover);
  color: var(--text-muted);
}
.f-status.on { background: var(--accent-light); color: var(--accent); }

.f-add {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.f-add input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  outline: none;
}
.f-add input:focus { border-color: var(--accent); }

.f-add-btn {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.f-add-btn:hover { background: var(--accent-hover); }

/* 好友申请通知 */
.f-pending {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
/* 弹窗内的好友申请列表:去掉边框和灰底 */
.f-add-panel .f-pending {
  padding: 0;
  border-bottom: none;
  background: none;
}
.f-pending-title {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.f-pending-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
}
.f-pending-name { font-size: 14px; }
.f-pending-actions { display: flex; gap: 6px; }
.f-accept, .f-reject {
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.f-accept { background: var(--accent); color: #fff; }
.f-reject { background: var(--hover); color: var(--text); }

/* 好友列表 */
.f-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.f-hint {
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
  padding: 30px 10px;
}

/* 添加好友 / 好友申请 弹窗 */
.f-add-panel {
  width: 360px;
  max-width: 92vw;
  max-height: 80vh;
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.f-add-panel-body {
  padding: 18px 20px 22px;
  overflow-y: auto;
}
.f-add-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.f-add-row {
  display: flex;
  gap: 8px;
}
.f-add-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  outline: none;
}
.f-add-row input:focus { border-color: var(--accent); }
.f-add-status {
  font-size: 13px;
  color: var(--accent);
  min-height: 18px;
  margin-top: 10px;
}
.f-add-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}
.f-pending-title {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.f-add-empty {
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
  padding: 20px 0;
}

/* 中栏「好友申请」按钮红点 */
.list-add-btn.has-badge {
  position: relative;
}
.list-add-btn.has-badge::after {
  content: "";
  position: absolute;
  top: 1px;
  right: 1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 1.5px solid var(--panel);
}

.f-peer {
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.f-peer:hover { background: var(--hover); }
.f-peer.on { background: var(--active); }

.f-peer-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.f-peer-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}
.f-peer-dot.on { background: var(--ok); }

.f-peer-name {
  font-size: 14px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.f-unread {
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  border-radius: 8px;
  padding: 0 5px;
  min-width: 16px;
  text-align: center;
}

.f-peer-preview {
  font-size: 12px;
  color: var(--text-muted);
  padding-left: 14px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 好友聊天区 */
.f-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

/* 好友聊天雾化背景层(同聊天栏) */
.f-chat::before {
  content: '';
  position: absolute;
  inset: -12px;
  background-image: var(--chat-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(var(--chat-blur, 0px)) brightness(var(--bg-dim, 1));
  transform: scale(1.05);
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.f-chat.has-chat-bg::before { opacity: 1; }
.f-chat .chat-head,
.f-chat .f-messages,
.f-chat .f-input-row { position: relative; z-index: 1; }

.f-del-btn {
  border: 1px solid var(--danger);
  background: none;
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.f-del-btn:hover { background: rgba(255, 95, 95, 0.1); }

.f-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: transparent;
}

.f-msg { display: flex; flex-direction: column; max-width: 72%; }
.f-msg.me { align-self: flex-end; align-items: flex-end; }
.f-msg.peer { align-self: flex-start; align-items: flex-start; }
.f-msg.ai { align-self: flex-start; align-items: flex-start; }

.f-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  box-shadow: var(--shadow);
}
.f-msg.me .f-bubble { background: var(--user-bubble); color: var(--user-text); border-bottom-right-radius: 5px; }
.f-msg.peer .f-bubble { background: var(--ai-bubble); color: var(--ai-text); border-bottom-left-radius: 5px; }
.f-msg.ai .f-bubble { background: var(--accent-light); color: var(--accent-text, #2b4a6f); border-bottom-left-radius: 5px; border-left: 3px solid var(--accent); }

/* 群消息发送者名（非本人时显示） */
.g-sender { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; padding-left: 2px; }

/* 群列表里的成员数角标 */
.f-menu-count { font-size: 11px; color: var(--text-muted); margin-left: 6px; }

.f-bubble img {
  max-width: 220px;
  max-height: 220px;
  border-radius: var(--radius);
  margin-bottom: 6px;
  display: block;
}

.f-meta { font-size: 11px; color: var(--text-faint); margin-top: 2px; }

.f-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.f-input-row input {
  flex: 1;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  outline: none;
}
.f-input-row input:focus { border-color: var(--accent); }

/* ==========================================================================
   控制台视图
   ========================================================================== */
.console {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: var(--panel);
}

/* 角色控制面板弹窗 */
.role-panel {
  width: 640px;
  max-width: 94vw;
  height: 88vh;          /* 固定高度,不随内容变化 */
  max-height: 88vh;
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.role-panel-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.role-panel-body .console-tabs {
  border-top: 1px solid var(--border);
}
.role-panel-body .console-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* 人设放大编辑按钮 */
.persona-edit-head {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}

/* 人设大弹窗(单独一层,专门编辑长人设) */
.persona-big-panel {
  width: 860px;
  max-width: 96vw;
  height: 90vh;
  max-height: 90vh;
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.persona-big-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  padding: 16px;
}
.persona-big-body textarea {
  flex: 1;
  width: 100%;
  height: 100%;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 14px;
  font-family: "Consolas", "Menlo", "Microsoft YaHei", monospace;
  color: var(--text);
  line-height: 1.7;
  resize: none;
  outline: none;
}
.persona-big-body textarea:focus { border-color: var(--accent); }

/* 管理角色:角色列表页 */
.console-role-list {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.console-role-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.console-role-list-head h2 { font-size: 18px; margin: 0; }
.console-role-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.console-role-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  transition: all 0.15s;
}
.console-role-card:hover { border-color: var(--accent); background: var(--hover); }
.console-role-card .avatar { font-size: 30px; display: flex; align-items: center; }
.console-role-card .avatar img { width: 40px !important; height: 40px !important; object-fit: cover; border-radius: 50%; }
.console-role-card .avatar .char-avatar { width: 40px !important; height: 40px !important; font-size: 20px !important; }
.console-role-card .name { flex: 1; font-size: 16px; font-weight: 600; }

/* 管理角色界面的好友分区 */
.console-friend-empty {
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
  padding: 20px 0;
}
.console-friend-status {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.console-friend-status.on { color: var(--ok); }

/* 控制面板(某角色的 10 个 tab) */
.console-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}
.console-back {
  border: none;
  background: none;
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--accent);
  white-space: nowrap;
  font-family: inherit;
  border-bottom: 2px solid transparent;
}
.console-back:hover { color: var(--accent-hover); }

.console-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 12px 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.console-tabs button {
  border: none;
  background: none;
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.15s;
  font-family: inherit;
}
.console-tabs button:hover { color: var(--text); }
.console-tabs button.on {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.console-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.ctab { display: none; }
.ctab.on { display: block; }

/* 控制台内部通用控件(兼容原有类名) */
.ctab h2, .ctab h3 { margin-bottom: 14px; font-size: 16px; }
.ctab label { display: block; font-size: 13px; color: var(--text-muted); margin: 12px 0 4px; }
.ctab input[type="text"], .ctab input[type="password"], .ctab input[type="number"], .ctab textarea, .ctab select {
  width: 100%;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  outline: none;
}
.ctab input:focus, .ctab textarea:focus, .ctab select:focus { border-color: var(--accent); }
.ctab textarea { min-height: 120px; resize: vertical; line-height: 1.5; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  background: var(--hover);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.btn-ghost:hover { background: var(--border); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}
.data-table th { color: var(--text-muted); font-weight: 600; }

/* ==========================================================================
   遮罩/弹窗
   ========================================================================== */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3200; /* 需高于登录/申请界面(3000),否则登录界面换背景弹窗会被盖住 */
}

/* 设置面板 */
.settings-panel {
  width: 480px;
  max-width: 92vw;
  max-height: 86vh;
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.settings-divider { height: 1px; background: var(--border); margin: 16px 0; }
.preset-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.preset-theme-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.preset-theme-name { flex: 1; font-size: 13px; color: var(--text-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.settings-label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin: 12px 0 4px;
}

.settings-status { font-size: 13px; color: var(--text-muted); min-height: 18px; margin-top: 8px; }
.settings-status.err { color: var(--danger); }
.settings-status.ok { color: var(--ok); }

/* ============ 创建群聊弹窗 ============ */
.gc-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
  margin-top: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}
.gc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  transition: background 0.12s;
  user-select: none;
}
.gc-item:hover { background: var(--hover, rgba(0,0,0,0.04)); }
.gc-item.checked { background: var(--accent-light); }
.gc-avatar { flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.gc-name { flex: 1; font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gc-uid { font-size: 11px; color: var(--text-muted); }
.gc-tag {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.2;
}
.gc-check { flex-shrink: 0; }
.gc-check input { width: 16px; height: 16px; cursor: pointer; }
.gc-empty { font-size: 13px; color: var(--text-muted); padding: 12px 8px; text-align: center; }
.gc-hint { font-size: 11px; color: var(--text-faint); margin-left: 6px; font-weight: normal; }
.gc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}
.gc-count { font-size: 12px; color: var(--text-muted); }
.gc-footer .btn-primary { flex-shrink: 0; }

/* ============ 群资料弹窗 ============ */
.gp-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.gp-edit { margin-top: 4px; }
.gp-edit .role-input { margin-bottom: 4px; }
.gp-edit textarea.role-input { resize: vertical; min-height: 48px; }
.gp-edit .btn-primary { width: 100%; margin-top: 8px; }
.gp-danger-zone { margin-top: 4px; }
.gp-danger-zone .btn-danger { width: 100%; }
.gp-danger-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; text-align: center; }

/* ============ 群聊 @ 候选面板 ============ */
.group-at-panel {
  position: fixed;
  z-index: 9999;
  min-width: 200px;
  max-width: 260px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,0.15));
  padding: 4px;
}
.group-at-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.group-at-item:hover, .group-at-item.on { background: var(--accent-light); }
.group-at-ico { flex-shrink: 0; font-size: 16px; }
.group-at-name { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-at-tag {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 1px 4px;
  line-height: 1.2;
}

/* ============ 群未读角标 ============ */
.g-unread {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
  background: var(--danger, #e74c3c);
  color: #fff;
  font-size: 11px;
  padding: 0 5px;
  margin-left: 6px;
}
.g-unread.at { background: var(--accent, #4f8ef7); }

.settings-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.role-input {
  width: 100%;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  margin-bottom: 4px;
}
.role-input:focus { border-color: var(--accent); }

/* 模型预设槽位卡片 */
.slot-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--panel);
}
.slot-card.configured { border-color: var(--accent); }
.slot-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.slot-title { font-weight: 600; font-size: 14px; }
.slot-sub { font-size: 12px; color: var(--text-muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-actions { display: flex; gap: 6px; }
.slot-body { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.slot-row { display: flex; gap: 8px; font-size: 12px; }
.slot-k { color: var(--text-muted); flex: 0 0 52px; }
.slot-v { color: var(--text); word-break: break-all; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.dot-ok { background: var(--ok); }
.dot-warn { background: #f6c445; }
.dot-off { background: var(--border-strong); }

.slot-form-panel { width: 520px; }

/* 虚线按钮(添加模型提供商) */
.btn-dashed {
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  padding: 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  transition: border-color .15s, color .15s;
}
.btn-dashed:hover { border-color: var(--accent); color: var(--accent); }

/* 模型选择下拉(自定义:分组 + 搜索 + 对勾) */
.model-picker { position: relative; }
.model-picker-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
}
.mp-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-arrow { color: var(--text-muted); font-size: 12px; }
.model-picker-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  z-index: 4000;
  max-height: 320px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.model-picker-search {
  margin: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--bg, var(--panel));
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.model-picker-search:focus { border-color: var(--accent); }
.model-picker-list { overflow-y: auto; padding: 0 6px 6px; }
.mp-group {
  padding: 6px 10px 2px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.mp-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.mp-item:hover { background: var(--hover, rgba(128,128,128,.08)); }
.mp-item.selected { color: var(--accent); font-weight: 600; }
.mp-check { width: 16px; flex: 0 0 16px; text-align: center; color: var(--accent); }
.mp-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-empty { padding: 20px 10px; text-align: center; color: var(--text-muted); font-size: 13px; }


.manage-role-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

/* 提示弹窗 */
.toast-box {
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px 32px;
  text-align: center;
  max-width: 320px;
}
.toast-icon { font-size: 40px; margin-bottom: 14px; }
.toast-text { font-size: 15px; margin-bottom: 18px; line-height: 1.5; }

/* ==========================================================================
   来信通知弹窗
   ========================================================================== */
.f-notify {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  max-width: 90%;
  animation: notifyInRight 0.25s ease;
}
@keyframes notifyInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

.f-notify-avatar { font-size: 26px; flex-shrink: 0; }
.f-notify-body { min-width: 0; }
.f-notify-title { font-size: 14px; font-weight: 600; }
.f-notify-preview {
  font-size: 12.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}

/* ==========================================================================
   登录/申请界面
   ========================================================================== */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  background-size: cover;
  background-position: center;
}

/* 雾化背景层:原图铺满 + 10% 雾化(blur),做在登录/申请弹窗后的大背景上 */
.login-bg {
  position: absolute;
  inset: 0;
  background-image: var(--login-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(10px) brightness(0.9);
  transform: scale(1.05);
  z-index: 0;
}

.login-box {
  position: relative;
  z-index: 1;
  width: 340px;
  max-width: 92vw;
  max-height: 90vh;
  overflow: auto;
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  /* 框内用原图做底层背景(不雾化) */
  background-image: var(--login-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* 框内内容压一层半透明遮罩,保证文字在图上清晰可读(暗色主题用深色遮罩) */
.login-box::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.78);
  z-index: 0;
  pointer-events: none;
}
[data-theme="dark"] .login-box::before {
  background: rgba(24, 24, 28, 0.82);
}
.login-box > * {
  position: relative;
  z-index: 1;
}

/* 登录/申请界面入场动画:淡入 + 上浮 */
.login-screen {
  animation: login-fade-in 0.3s ease both;
}
@keyframes login-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.login-box {
  animation: login-box-up 0.32s ease both;
}
@keyframes login-box-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
  color: #1c1c1e;
}
[data-theme="dark"] .login-title { color: #f0f0f2; }

.login-sub {
  font-size: 13px;
  color: #5a5a5e;
  text-align: center;
  margin-bottom: 22px;
}
[data-theme="dark"] .login-sub { color: #b0b0b4; }

.login-label {
  font-size: 13px;
  color: #5a5a5e;
  margin: 10px 0 4px;
}
[data-theme="dark"] .login-label { color: #b0b0b4; }

.login-input {
  border: 1px solid #c3dcf5;
  background: #eaf4fd;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
  color: #1c1c1e;
  outline: none;
}
.login-input::placeholder {
  color: #8aa3b8;
}
.login-input:focus {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--accent-light);
}

.login-msg {
  font-size: 13px;
  color: var(--danger);
  min-height: 18px;
  margin-top: 10px;
  text-align: center;
}

/* 记住密码 */
.login-remember {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  font-size: 13px;
  color: #5a5a5e;
  cursor: pointer;
  user-select: none;
  width: fit-content;
}
[data-theme="dark"] .login-remember { color: #b0b0b4; }
.login-remember-box {
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.login-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 14px;
  transition: background 0.15s;
  font-family: inherit;
}
.login-btn:hover { background: var(--accent-hover); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.login-btn-ghost {
  background: var(--accent);
  color: #fff;
  margin-top: 10px;
  font-weight: 600;
}
.login-btn-ghost:hover {
  background: var(--accent-hover);
  color: #fff;
}

/* ============ 账号安全(密保)表单 ============ */
.sec-field {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}
.sec-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.sec-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sec-input::placeholder {
  color: var(--text-faint);
}
.sec-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}
.sec-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0 14px;
}
.sec-actions {
  margin-top: 16px;
}
.sec-actions .btn-primary {
  width: 100%;
}
/* 数据同步 */
.sync-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft, rgba(255, 255, 255, 0.4));
}
.sync-state {
  font-size: 13px;
  color: var(--text-dim, #666);
  flex: 1;
  min-width: 0;
}
#sync-status {
  margin-top: 8px;
  font-size: 13px;
  min-height: 18px;
}
#sec-status {
  margin-top: 10px;
  font-size: 13px;
  min-height: 18px;
}

/* ============ 存储位置(数据目录) ============ */
.data-dir-path {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  word-break: break-all;
  line-height: 1.5;
  min-height: 40px;
}
#data-dir-status {
  margin-top: 10px;
  font-size: 13px;
  min-height: 18px;
  word-break: break-all;
}

/* 忘记密码链接 */
.login-forgot {
  display: block;
  text-align: center;
  margin-top: 14px;
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  opacity: 0.85;
}
.login-forgot:hover {
  opacity: 1;
  text-decoration: underline;
}

/* 找回密码弹窗 */
.forgot-panel {
  width: 360px;
  max-width: 92vw;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.forgot-body {
  padding: 16px 20px 20px;
}
.forgot-body .btn-primary {
  width: 100%;
  margin-top: 4px;
}
.forgot-body .f-add-status {
  min-height: 18px;
  margin: 2px 0 8px;
}

/* 账户与安全弹窗(修改密码 / 设置密保) */
.accsec-panel {
  width: 380px;
  max-width: 92vw;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.accsec-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 16px 0;
  border-bottom: 1px solid var(--border);
}
.accsec-tab {
  flex: 1;
  padding: 9px 0;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.accsec-tab:hover {
  color: var(--text);
}
.accsec-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.accsec-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
}
.accsec-body .f-add-status {
  min-height: 18px;
  margin: 2px 0 8px;
}
.accsec-submit {
  width: 100%;
  margin-top: 4px;
}

/* 登录/申请界面右下角「变更背景」按钮 */
.login-bg-btn {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #000;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.login-bg-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
.login-bg-btn:active {
  transform: scale(0.96);
}

/* 变更登录背景弹窗 */
.login-bg-picker-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
.login-bg-picker-actions .btn-primary,
.login-bg-picker-actions .btn-ghost {
  width: 100%;
}

/* ==========================================================================
   首字头像(无头像时取名字首字 + 淡色背景)
   ========================================================================== */
.char-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-family: "SimHei", "黑体", "Microsoft YaHei", sans-serif;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  user-select: none;
}
.char-avatar-lg {
  width: 72px;
  height: 72px;
  font-size: 32px;
  border-radius: 50%;
}

/* ==========================================================================
   头像编辑(人设页)
   ========================================================================== */
.avatar-preview-wrap {
  position: relative;
  display: inline-block;
  margin-top: 6px;
}
.avatar-preview {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-edit-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border: 2px solid var(--panel);
}

.avatar-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  max-height: 140px;
  overflow-y: auto;
  padding: 4px;
}
.avatar-option {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.avatar-option:hover { background: var(--hover); }
.avatar-option.on {
  border-color: var(--accent);
  background: var(--accent-light);
}

.avatar-shape-picker {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.shape-option {
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.shape-option:hover { border-color: var(--accent); }
.shape-option.on {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

/* 头像选项菜单(点击头像弹出) */
.avatar-menu {
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  min-width: 140px;
  z-index: 2100;
  overflow: hidden;
}
.avatar-menu-item {
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.avatar-menu-item:hover { background: var(--hover); }

/* 历史头像弹窗 */
.avatar-history-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2100;
}
.avatar-history-panel {
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 420px;
  max-width: 92vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.avatar-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.avatar-history-close {
  border: none;
  background: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
}
.avatar-history-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.avatar-history-item {
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
}
.avatar-history-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-history-item:hover { border-color: var(--accent); }
.avatar-history-item.current { border-color: var(--accent); }
.avatar-history-item.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.avatar-history-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

/* 头像裁剪器 */
.avatar-crop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3300; /* 需高于个人中心 .overlay(3200),否则个人中心里改头像时裁剪弹窗会被盖住 */
}
.avatar-crop-panel {
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 460px;
  max-width: 94vw;
  overflow: hidden;
}
.avatar-crop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.avatar-crop-close {
  border: none;
  background: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
}
.avatar-crop-stage {
  position: relative;
  width: 100%;
  height: 340px;
  overflow: hidden;
  background: #222;
}
.avatar-crop-stage img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.avatar-crop-box {
  position: absolute;
  border: 2px dashed #fff;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.5);
  cursor: move;
}
.avatar-crop-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* 卡片 */
.card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.hint {
  font-size: 12.5px;
  color: var(--text-muted);
}
.hint.ok { color: var(--ok); }
.hint.err { color: var(--danger); }

/* ==========================================================================
   控制台各 tab 组件样式
   ========================================================================== */
.feature-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

/* 语音开关按钮状态:开启绿色/关闭灰色/未安装禁用 */
.voice-toggle-btn { transition: background 0.15s, color 0.15s, opacity 0.15s; }
.voice-toggle-btn.on {
  background: var(--ok, #2ecc71);
  color: #fff;
  border-color: var(--ok, #2ecc71);
}
.voice-toggle-btn.off {
  background: var(--hover);
  color: var(--text-muted);
}
.voice-toggle-btn.disabled {
  background: var(--hover);
  color: var(--text-faint);
  opacity: 0.6;
  cursor: not-allowed;
}

/* 语音状态提示文字 */
.voice-status { margin: 6px 0 0; font-size: 12px; }
.voice-status.err { color: var(--danger); }
.voice-status.warn { color: #e67e22; }
.voice-status.ok { color: var(--ok, #2ecc71); }

/* 新用户分步引导向导 */
.onboarding-panel { width: 460px; max-width: 94vw; }
.ob-steps {
  display: flex;
  gap: 4px;
  padding: 10px 16px 0;
  flex-wrap: wrap;
}
.ob-step {
  font-size: 12px;
  color: var(--text-faint);
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--hover);
  white-space: nowrap;
}
.ob-step.on {
  background: var(--accent);
  color: #fff;
}
.ob-step.done {
  background: var(--active);
  color: var(--accent);
}
.ob-footer {
  display: flex;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}
.ob-footer .btn-primary { flex: 1; }
.ob-footer .btn-ghost { flex: 0 0 auto; }

/* 轻量欢迎页(功能介绍) */
.welcome-grid { display: flex; flex-direction: column; gap: 10px; }
.welcome-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 12px; border-radius: 10px; background: var(--hover);
}
.welcome-ico {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.welcome-ico svg { display: block; }
.welcome-item b { display: block; font-size: 14px; margin-bottom: 2px; }
.welcome-item p { margin: 0; font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* 语音包配置区(下拉选择 + 目录输入) */
.voice-config { margin-top: 12px; }
.voice-config .settings-label {
  font-size: 13px;
  color: var(--text-muted);
  margin: 8px 0 4px;
  display: block;
}
.voice-config-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.voice-select {
  flex: 1;
  background: var(--panel);
  color: var(--text);
}
.voice-config .role-input {
  width: 100%;
  box-sizing: border-box;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}
.btn-danger:hover { opacity: 0.85; }

/* 统计卡片网格 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.stat {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat b {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}
.stat span {
  font-size: 12px;
  color: var(--text-muted);
}

/* 账本区间 */
.ledger-intervals {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.interval {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}
.interval-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

/* 表格容器 */
.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 460px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 600px;
}
.table-wrap th, .table-wrap td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}
.table-wrap th {
  color: var(--text-muted);
  font-weight: 600;
  background: var(--panel-2);
  position: sticky;
  top: 0;
  z-index: 1;
}
.table-wrap td.preview {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
}

/* 记录日志 */
.records-log {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  max-height: 420px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.7;
  word-break: break-word;
}

/* 聊天记录 / 原始记录:参照 QQ 查找聊天记录(按日期分组) */
.rec-group { margin-bottom: 4px; }
.rec-day {
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  padding: 8px 0 6px;
  position: sticky;
  bottom: 0; /* 往上翻历史时,日期标题贴在底部 */
  background: var(--panel-2);
  z-index: 1;
}
.rec-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
}
.rec-item + .rec-item { border-top: 1px solid var(--border); }
.rec-avatar {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  font-family: 'SimHei', '黑体', 'Microsoft YaHei', sans-serif;
}
.rec-avatar.user { background: var(--accent); }
.rec-avatar.ai { background: #8a8a8e; }
.rec-main { flex: 1; min-width: 0; }
.rec-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 2px;
}
.rec-name { font-size: 13px; font-weight: 600; }
.rec-name.user { color: var(--accent); }
.rec-name.ai { color: var(--text-muted); }
.rec-time {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
}
.rec-text {
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
  color: var(--text);
}
.rec-clickable {
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}
.rec-clickable:hover { background: var(--hover); }

/* 原始记录:按日期列表 */
.rec-day-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}
.rec-day-item:last-child { border-bottom: none; }
.rec-day-item:hover { background: var(--hover); }
.rec-day-item-label {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.rec-day-item-count {
  font-size: 12px;
  color: var(--text-faint);
}
.rec-day-item-arrow {
  font-size: 18px;
  color: var(--text-faint);
}

/* 某一天聊天记录弹窗 */
.rec-day-panel { width: 560px; max-width: 94vw; }
.rec-day-body {
  padding: 8px 16px 16px;
  max-height: 70vh;
  overflow-y: auto;
}

/* 聊天记录编辑弹窗 */
.rec-edit-panel { width: 460px; max-width: 92vw; }
.rec-edit-body { padding: 16px 18px; }
.rec-edit-origin-label {
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.rec-edit-origin {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  color: var(--text);
}
.rec-edit-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.rec-edit-actions .btn-danger,
.rec-edit-actions .btn-ghost,
.rec-edit-actions .btn-primary { flex: 1; }
.rec-edit-modify-zone { margin-top: 14px; }
.rec-edit-textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.6;
  color: var(--text);
  background: var(--panel);
  outline: none;
}
.rec-edit-textarea:focus { border-color: var(--accent); }


/* 兼容旧布局:深度记录 / 问询记录等 tab 仍在用的紧凑行 */
.raw-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.raw-line:last-child { border-bottom: none; }
.raw-role {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  padding: 0 6px;
  border-radius: 4px;
  line-height: 1.6;
}
.raw-role.user { background: var(--accent-light); color: var(--accent); }
.raw-role.ai { background: var(--hover); color: var(--text-muted); }
.raw-text { font-size: 13px; line-height: 1.6; flex: 1; word-break: break-word; }
.raw-time {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
}

/* 策略选择列表 */
.strategy-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.strategy-item {
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.strategy-item:hover { border-color: var(--accent); }
.strategy-item.on {
  border-color: var(--accent);
  background: var(--accent-light);
}
.strategy-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.strategy-name { font-size: 14px; font-weight: 600; }
.strategy-lock {
  font-size: 11px;
  background: var(--accent);
  color: #fff;
  padding: 1px 8px;
  border-radius: 8px;
}
.strategy-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

/* 管理角色列表 */
.manage-role-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.manage-role-item:hover { border-color: var(--accent); }
.manage-role-item .avatar { font-size: 24px; }

/* ==========================================================================
   个人中心
   ========================================================================== */
.profile-panel {
  width: 520px;
  max-width: 94vw;
  max-height: 88vh;
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.profile-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.profile-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 40px;
  position: relative;
  transition: opacity 0.15s;
}
.profile-avatar:hover { opacity: 0.85; }

.profile-id {
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 8px;
  transition: background 0.15s;
}
.profile-id:hover { background: var(--hover); }

.profile-sign {
  width: 100%;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  text-align: center;
}
.profile-sign:focus { border-color: var(--accent); }

.profile-actions { margin-top: 4px; }

.profile-section { margin-top: 4px; }
.profile-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.bg-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.bg-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 500;
}
.bg-item-head span { flex: 1; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.bg-preview-box {
  height: 110px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px dashed var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.bg-preview-label {
  font-size: 12px;
  color: var(--text-faint);
  background: rgba(0,0,0,0.35);
  padding: 2px 10px;
  border-radius: 8px;
  color: #fff;
}

.bg-slider-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
}

input[type="range"] {
  width: 100%;
  margin-top: 4px;
  accent-color: var(--accent);
}

.bg-restore {
  text-align: center;
  margin-top: 14px;
}

/* 好友个人中心备注 */
.fp-note-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.fp-note-row label {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}
.fp-note-row input {
  flex: 1;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  outline: none;
}
.fp-note-row input:focus { border-color: var(--accent); }

.fp-color-label {
  display: block;
  width: 100%;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.fp-color-row {
  display: flex;
  gap: 5px;
  margin-top: 10px;
  flex-wrap: wrap;
  justify-content: center;
  max-height: 180px;
  overflow-y: auto;
  padding: 4px;
}
.fp-color {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: #fff;
  font-family: monospace;
  overflow: hidden;
  text-shadow: 0 0 2px rgba(0,0,0,0.6);
}
.fp-color:hover { transform: scale(1.15); }
.fp-color.on {
  border-color: var(--text);
  box-shadow: 0 0 0 3px var(--accent-light);
  transform: scale(1.2);
  font-size: 7px;
}
.fp-color-hex.on { color: #fff; }

.fp-signature {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  max-width: 80%;
  word-break: break-word;
}

.large-avatar-box {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.large-avatar-close { background: rgba(0,0,0,0.4); border-radius: 50%; }

.fp-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}

/* 三段删除确认框 */
.confirm-box {
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 26px 30px;
  width: 360px;
  max-width: 90vw;
  text-align: center;
}
.confirm-text {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 22px;
}
.confirm-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.confirm-btns .btn-danger,
.confirm-btns .btn-ghost {
  padding: 9px 24px;
  font-size: 14px;
}

/* 搜索新好友结果 */
.search-friend-result {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  background: var(--panel-2);
}
.search-friend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
}
.search-friend-item .name {
  flex: 1;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sf-add {
  border: none;
  background: var(--ok);
  color: #fff;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}
.sf-cancel {
  border: none;
  background: var(--danger);
  color: #fff;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}

/* ==========================================================================
   响应式:移动端
   ========================================================================== */
@media (max-width: 720px) {
  :root {
    --rail-w: 56px;
    --list-w: 0px;
  }
  /* 移动端隐藏中栏,只显示导航+内容 */
  .list-pane { display: none; }

  .msg { max-width: 85%; }
  .f-msg { max-width: 85%; }

  /* 来信通知移到顶部 */
  .f-notify {
    right: auto;
    left: 50%;
    bottom: auto;
    top: 16px;
    transform: translateX(-50%);
    animation: notifyInTop 0.25s ease;
  }
  @keyframes notifyInTop {
    from { opacity: 0; transform: translate(-50%, -20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
  }
}

/* 今日日程：等宽时间线，保留换行 */
.life-schedule {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(128, 128, 128, 0.10);
  border: 1px solid var(--border, rgba(128, 128, 128, 0.16));
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.85;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  max-height: 420px;
  overflow-y: auto;
}
