/* ============================================
 * /agent/css/style.css
 * AI 投递助手 · 主样式
 * 2026-07-30 P0
 * 主题：纯白底 + 蓝紫渐变（plan.md 5.1 节）
 * ============================================ */

.agent-page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 16px 60px;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #1e293b;
}

/* ---- 顶部 hero ---- */
.agent-header {
    position: relative;
    border-radius: 20px;
    padding: 48px 32px 56px;
    margin-bottom: 24px;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    box-shadow: 0 8px 32px rgba(99,102,241,0.25);
}
.agent-header__bg {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 20% 30%, rgba(255,255,255,0.18) 0%, transparent 40%),
                      radial-gradient(circle at 80% 70%, rgba(255,255,255,0.12) 0%, transparent 50%);
    pointer-events: none;
}
.agent-header__inner { position: relative; text-align: center; }
.agent-header__icon { font-size: 56px; display: block; margin-bottom: 8px; }
.agent-header__title {
    font-size: 40px;
    font-weight: 800;
    margin: 0 0 8px;
    letter-spacing: -1px;
    text-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.agent-header__title--mid { font-size: 28px; }
.agent-header__tagline { font-size: 18px; margin: 0 0 12px; opacity: 0.95; }
.agent-header__sub { font-size: 14px; margin: 0; opacity: 0.85; }
.agent-header__login-tip {
    margin-top: 16px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.18);
    border-radius: 8px;
    display: inline-block;
    font-size: 13px;
}
.agent-header__login-tip a { color: #fef3c7; font-weight: 600; }
.agent-header__back {
    position: absolute;
    top: 16px; left: 16px;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-size: 14px;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(255,255,255,0.15);
}
.agent-header__back:hover { background: rgba(255,255,255,0.25); }
.agent-header--compact { padding: 36px 24px 36px; text-align: left; }
.agent-header--compact .agent-header__inner { text-align: left; }
.agent-header--compact .agent-header__title { font-size: 28px; padding-right: 90px; }
/* compact 模式下 back 链接不绝对定位，作为流式元素单独占一行，避免与 title 重叠 */
.agent-header--compact .agent-header__back {
    position: static;
    display: inline-block;
    margin-bottom: 14px;
}
/* 移动端不加 padding，让 back / lang 按钮和 title 自然换行 */
@media (max-width: 480px) {
    .agent-header--compact { padding: 24px 16px 24px; }
    .agent-header--compact .agent-header__title { padding-right: 0; font-size: 22px; }
}

/* ---- 统计卡片 ---- */
.agent-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.agent-stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.agent-stat-card--primary { border-color: #a5b4fc; background: linear-gradient(180deg, #eef2ff 0%, #fff 100%); }
.agent-stat-card--success { border-color: #86efac; background: linear-gradient(180deg, #f0fdf4 0%, #fff 100%); }
.agent-stat-card__num {
    font-size: 32px;
    font-weight: 800;
    color: #4f46e5;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.agent-stat-card--success .agent-stat-card__num { color: #16a34a; }
.agent-stat-card__label {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}

/* ---- 入口模块卡片 ---- */
.agent-modules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.agent-module {
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    text-decoration: none;
    color: inherit;
    display: flex;
    gap: 18px;
    align-items: flex-start;
    transition: all 0.2s;
}
.agent-module:hover {
    border-color: #a5b4fc;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99,102,241,0.12);
}
.agent-module--main { border-color: #c7d2fe; background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%); }
.agent-module__icon {
    font-size: 40px;
    flex-shrink: 0;
    line-height: 1;
}
.agent-module__title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.agent-module__desc { font-size: 13px; color: #64748b; line-height: 1.5; margin-bottom: 8px; }
.agent-module__cta {
    font-size: 13px;
    color: #4f46e5;
    font-weight: 600;
}

/* ---- 小贴士 ---- */
.agent-tips {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 16px 20px;
    margin-top: 24px;
}
.agent-tips h3 { margin: 0 0 8px; font-size: 15px; color: #92400e; }
.agent-tips ul { margin: 0; padding-left: 20px; font-size: 13px; color: #78350f; line-height: 1.8; }
.agent-tips code {
    background: rgba(146, 64, 14, 0.1);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 12px;
}

/* ---- 表单 ---- */
.agent-form {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    margin-top: 8px;
}
.agent-form__row { margin-bottom: 20px; }
.agent-form__row--inline { display: flex; flex-wrap: wrap; gap: 24px; }
.agent-form__group { flex: 1; min-width: 280px; }
.agent-form__label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}
.agent-form__required { color: #ef4444; margin-left: 2px; }
.agent-form__textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    min-height: 100px;
    resize: vertical;
    box-sizing: border-box;
}
.agent-form__textarea--lg { min-height: 150px; }
.agent-form__textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.agent-form__radios { display: flex; flex-wrap: wrap; gap: 8px; }
.agent-radio {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    user-select: none;
    transition: all 0.15s;
}
.agent-radio input { display: none; }
.agent-radio:has(input:checked) {
    background: #4f46e5;
    color: #fff;
    border-color: #4f46e5;
}
.agent-form__actions { display: flex; gap: 12px; margin-top: 8px; }

.agent-btn {
    padding: 10px 22px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #1e293b;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.agent-btn:hover { background: #f1f5f9; }
.agent-btn--primary { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; border: none; }
.agent-btn--primary:hover { opacity: 0.92; }
.agent-btn--success { background: #16a34a; color: #fff; border-color: #16a34a; }
.agent-btn--success:hover { background: #15803d; }
.agent-btn:disabled { opacity: 0.5; cursor: wait; }

/* ---- 结果区 ---- */
.agent-result { margin-top: 32px; padding-top: 24px; border-top: 2px dashed #e2e8f0; }
.agent-result h3 { font-size: 17px; font-weight: 700; margin: 0 0 12px; }
.agent-result__match {
    background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
    border: 1px solid #c7d2fe;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}
.agent-match__score { font-size: 40px; font-weight: 800; color: #4f46e5; }
.agent-match__bar {
    height: 10px;
    background: rgba(99,102,241,0.12);
    border-radius: 5px;
    overflow: hidden;
    margin: 8px 0 12px;
}
.agent-match__bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    width: 0%;
    transition: width 0.5s;
}
.agent-match__points { font-size: 13px; color: #475569; line-height: 1.7; }
.agent-match__points li { margin: 2px 0; }
.agent-match__advice {
    margin-top: 10px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.7);
    border-left: 3px solid #8b5cf6;
    border-radius: 4px;
    font-size: 14px;
    color: #4c1d95;
}

.agent-versions { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 768px) { .agent-versions { grid-template-columns: repeat(3, 1fr); } }
.agent-version {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    background: #fff;
    transition: all 0.15s;
}
.agent-version:hover { border-color: #a5b4fc; box-shadow: 0 4px 12px rgba(99,102,241,0.08); }
.agent-version__head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.agent-version__tag {
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    color: #fff;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.agent-version__sub { font-size: 11px; color: #94a3b8; }
.agent-version__body {
    min-height: 80px;
    font-size: 14px;
    line-height: 1.7;
    color: #334155;
    margin-bottom: 10px;
    white-space: pre-wrap;
}
.agent-btn--copy { font-size: 12px; padding: 4px 12px; }

/* ---- 反馈区 ---- */
.agent-feedback {
    margin-top: 24px;
    padding: 18px;
    background: #fefce8;
    border: 1px solid #fde047;
    border-radius: 12px;
}
.agent-feedback h3 { color: #854d0e; }
.agent-feedback__hint { font-size: 13px; color: #713f12; margin: 4px 0 12px; }
.agent-feedback__row {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: center;
}
.agent-feedback__version, .agent-feedback__result { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.agent-feedback__status { margin-top: 8px; font-size: 13px; }

/* ---- 错误提示 ---- */
.agent-error {
    margin-top: 12px;
    padding: 10px 14px;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: 13px;
}

/* ============================================
 * 树洞模块
 * ============================================ */
.agent-header--warm {
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 50%, #ec4899 100%);
}
.agent-treehole {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px 0;
}
.agent-mode-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.agent-mode-card {
    position: relative;
    display: block;
    padding: 16px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    background: #fff;
}
.agent-mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.agent-mode-card:hover { border-color: #cbd5e1; }
.agent-mode-card:has(input:checked) {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fff7ed 0%, #fff 100%);
    box-shadow: 0 4px 12px rgba(245,158,11,0.15);
}
.agent-mode-card__icon { font-size: 32px; margin-bottom: 4px; }
.agent-mode-card__title { font-size: 15px; font-weight: 700; color: #1e293b; }
.agent-mode-card__desc { font-size: 12px; color: #64748b; margin-top: 2px; }

.agent-chat {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 18px;
    min-height: 360px;
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 12px;
}
.agent-chat__welcome {
    text-align: center;
    color: #94a3b8;
    padding: 40px 20px;
}
.agent-chat__welcome-icon { font-size: 48px; margin-bottom: 8px; }
.agent-chat__welcome p { margin: 4px 0; font-size: 14px; line-height: 1.6; }
.agent-chat__welcome-tip { font-size: 12px; color: #cbd5e1; margin-top: 12px !important; }

.agent-msg {
    display: flex;
    gap: 10px;
    margin: 12px 0;
    align-items: flex-start;
    animation: agent-msg-in 0.25s ease-out;
}
@keyframes agent-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.agent-msg--user { flex-direction: row-reverse; }
.agent-msg__avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #4f46e5;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}
.agent-msg__avatar--bot { background: linear-gradient(135deg, #f59e0b, #ec4899); font-size: 18px; }
.agent-msg__bubble {
    max-width: 72%;
    padding: 10px 14px;
    border-radius: 14px;
    background: #f1f5f9;
    color: #1e293b;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
}
.agent-msg--user .agent-msg__bubble {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.agent-msg--bot .agent-msg__bubble {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}
.agent-msg__meta {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}
.agent-msg--user .agent-msg__meta { text-align: right; color: #c7d2fe; }
.agent-msg--typing .agent-msg__content { display: flex; gap: 4px; padding: 4px 0; }
.agent-dot {
    display: inline-block;
    width: 6px; height: 6px;
    background: #cbd5e1;
    border-radius: 50%;
    animation: agent-dot 1.2s infinite;
}
.agent-dot:nth-child(2) { animation-delay: 0.15s; }
.agent-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes agent-dot {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

.agent-input-bar {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 10px 10px 10px 16px;
    transition: border-color 0.15s;
    min-height: 56px;
}
.agent-input-bar:focus-within {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245,158,11,0.08);
}
.agent-input-bar__field {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.6;
    color: #1e293b;
    background: transparent;
    min-height: 44px;     /* 2 行最低高度（约 36-44px） */
    max-height: 220px;    /* 自动撑高上限 5-6 行 */
    padding: 6px 0;
    overflow-y: auto;
}
.agent-input-bar__field::placeholder { color: #94a3b8; }

.agent-chat__footer {
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
    margin: 12px 0 0;
    line-height: 1.5;
}

/* ============================================
 * 2026-07-31 英文版样式覆盖
 * 用 .agent-page[data-lang="en"] 限定只对英文生效
 * 风格：更克制、专业、深色基调（vs 中文蓝紫渐变）
 * ============================================ */
.agent-page[data-lang="en"] {
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #0f172a;
}
.agent-page[data-lang="en"] .agent-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    box-shadow: 0 8px 32px rgba(15,23,42,0.25);
}
.agent-page[data-lang="en"] .agent-header__title {
    font-weight: 700;
    letter-spacing: -0.5px;
}
.agent-page[data-lang="en"] .agent-stat-card--primary {
    border-color: #cbd5e1;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}
.agent-page[data-lang="en"] .agent-stat-card--success {
    border-color: #a7f3d0;
    background: linear-gradient(180deg, #ecfdf5 0%, #fff 100%);
}
.agent-page[data-lang="en"] .agent-stat-card__num { color: #0f172a; }
.agent-page[data-lang="en"] .agent-stat-card--success .agent-stat-card__num { color: #047857; }
.agent-page[data-lang="en"] .agent-module--main {
    border-color: #cbd5e1;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}
.agent-page[data-lang="en"] .agent-module:hover {
    border-color: #0f172a;
    box-shadow: 0 8px 24px rgba(15,23,42,0.12);
}
.agent-page[data-lang="en"] .agent-module__cta { color: #0f172a; }
.agent-page[data-lang="en"] .agent-tips {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.agent-page[data-lang="en"] .agent-tips h3 { color: #0f172a; }
.agent-page[data-lang="en"] .agent-tips ul { color: #334155; }
.agent-page[data-lang="en"] .agent-tips code { background: rgba(15,23,42,0.08); }
.agent-page[data-lang="en"] .agent-form__required { color: #b91c1c; }
.agent-page[data-lang="en"] .agent-btn--primary {
    background: #0f172a;
    color: #fff;
    box-shadow: 0 1px 2px rgba(15,23,42,0.2);
}
.agent-page[data-lang="en"] .agent-btn--primary:hover {
    background: #1e293b;
    box-shadow: 0 4px 12px rgba(15,23,42,0.3);
}
.agent-page[data-lang="en"] .agent-btn--success {
    background: #047857;
    color: #fff;
}
.agent-page[data-lang="en"] .agent-btn--success:hover { background: #065f46; }
.agent-page[data-lang="en"] .agent-version {
    border-color: #cbd5e1;
}
.agent-page[data-lang="en"] .agent-version__tag {
    background: #0f172a;
}
.agent-page[data-lang="en"] .agent-msg--user .agent-msg__bubble {
    background: #0f172a;
    color: #fff;
}
.agent-page[data-lang="en"] .agent-msg__avatar { background: #0f172a; }
.agent-page[data-lang="en"] .agent-msg__avatar--bot { background: #047857; }
.agent-page[data-lang="en"] .agent-input-bar:focus-within {
    border-color: #0f172a;
    box-shadow: 0 0 0 3px rgba(15,23,42,0.08);
}
.agent-page[data-lang="en"] .agent-chat__welcome-tip { color: #94a3b8; }

/* ---- 语言切换按钮 ---- */
.agent-header__lang {
    position: absolute;
    top: 16px;
    right: 16px;
    color: rgba(255,255,255,0.95);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    transition: all 0.2s;
    letter-spacing: 0.3px;
}
.agent-header__lang:hover {
    background: rgba(255,255,255,0.28);
    color: #fff;
}

/* 英文 hero 让 lang 按钮更明显（深色底上要更亮） */
.agent-page[data-lang="en"] .agent-header__lang {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.4);
}
.agent-page[data-lang="en"] .agent-header__lang:hover {
    background: #fff;
    color: #0f172a;
}

/* ---- 移动端微调 ---- */
@media (max-width: 640px) {
    .agent-header__lang { font-size: 12px; padding: 4px 10px; }
    .agent-header__back { font-size: 12px; padding: 3px 8px; }
    .agent-page[data-lang="en"] .agent-header__title { font-size: 32px; }
}

/* ============================================
 * 2026-07-31 P3 微信风格 · 多 Agent 联系人列表
 * 设计：左栏 280px（联系人）+ 右栏 flex:1（聊天）
 * 移动端：左栏抽屉 + 右栏全屏切换
 * ============================================ */
.agent-im { max-width: 1200px; margin: 0 auto; padding: 0 12px 24px; }
.agent-header--im { padding: 18px 24px 14px; }
.agent-header--im .agent-header__title--im {
    font-size: 22px;
    text-align: center;
    padding: 0;
}
.agent-header--im .agent-header__lang { top: 12px; }
.agent-header--im .agent-header__back { top: 12px; }

.agent-im__layout {
    display: flex;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 6px 24px rgba(15,23,42,0.06);
    overflow: hidden;
    min-height: 600px;
    border: 1px solid #e2e8f0;
}

/* ---- 左侧联系人 ---- */
.agent-im__sidebar {
    width: 280px;
    flex-shrink: 0;
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}
.agent-im__sidebar-head {
    padding: 16px 18px 12px;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}
.agent-im__sidebar-title {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
}
.agent-im__sidebar-hint {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
    letter-spacing: 0.3px;
}
.agent-im__contact-list {
    list-style: none;
    margin: 0;
    padding: 6px 0;
    overflow-y: auto;
    flex: 1;
}
.agent-im__contact {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.12s;
    position: relative;
}
.agent-im__contact:hover { background: #eef2f7; }
.agent-im__contact--active {
    background: #e0f2fe;
}
.agent-im__contact--active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: #0284c7;
}
.agent-im__contact-avatar {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.agent-im__contact--health .agent-im__contact-avatar {
    background: #ecfdf5;
    border-color: #a7f3d0;
}
.agent-im__contact--active .agent-im__contact-avatar {
    background: #fff;
    border-color: #0284c7;
}
.agent-im__contact-body {
    flex: 1;
    min-width: 0;
}
.agent-im__contact-name {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
}
.agent-im__contact-desc {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.agent-im__contact-tag {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: #f59e0b;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.agent-im__contact--health .agent-im__contact-tag {
    background: #10b981;
}
.agent-im__contact--more {
    opacity: 0.6;
    cursor: default;
}
.agent-im__contact--more:hover { background: transparent; }

/* ---- 右侧聊天主区 ---- */
.agent-im__main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #fff;
    position: relative;
}
.agent-im__chat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}
.agent-im__back {
    display: none;
    background: none;
    border: none;
    color: #64748b;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.agent-im__chat-head-avatar {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.agent-im__chat-head-info {
    flex: 1;
    min-width: 0;
}
.agent-im__chat-head-name {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
}
.agent-im__chat-head-desc {
    font-size: 11px;
    color: #64748b;
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.agent-im__clear {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 18px;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.12s;
}
.agent-im__clear:hover { background: #f1f5f9; color: #ef4444; }

.agent-im__chat {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: #f8fafc;
    background-image: linear-gradient(135deg, #f1f5f9 0%, #f8fafc 100%);
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.agent-im__placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
}
.agent-im__placeholder-icon { font-size: 64px; opacity: 0.4; margin-bottom: 12px; }
.agent-im__placeholder-text { font-size: 14px; }

/* ---- 消息气泡（兼容旧 .agent-msg 系列 + 适配新主题）---- */
.agent-msg {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    align-items: flex-end;
    max-width: 80%;
}
.agent-msg--user {
    margin-left: auto;
    flex-direction: row-reverse;
}
.agent-msg--bot { margin-right: auto; }
.agent-msg__avatar {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: #f59e0b;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}
.agent-msg__avatar--bot { background: #10b981; }
.agent-msg__bubble {
    background: #fff;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.6;
    color: #1e293b;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    max-width: 100%;
    word-break: break-word;
}
.agent-msg--user .agent-msg__bubble {
    background: #f59e0b;
    color: #fff;
}
.agent-msg__meta {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
    padding: 0 4px;
}
.agent-msg--user .agent-msg__meta { text-align: right; }
.agent-msg--typing .agent-msg__bubble { padding: 12px 16px; }
.agent-dot {
    display: inline-block;
    width: 6px; height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    margin: 0 2px;
    animation: agent-dot-pulse 1.2s infinite ease-in-out;
}
.agent-dot:nth-child(2) { animation-delay: 0.2s; }
.agent-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes agent-dot-pulse {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.9); }
    30% { opacity: 1; transform: scale(1.1); }
}

/* ---- 底部输入栏 ---- */
.agent-im__input-bar {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    align-items: flex-end;
}
.agent-im__input-field {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 8px 14px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: #1e293b;
    resize: none;
    outline: none;
    min-height: 36px;
    max-height: 120px;
    background: #f8fafc;
    transition: all 0.15s;
}
.agent-im__input-field:focus {
    background: #fff;
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2,132,199,0.08);
}
.agent-im__send-btn {
    background: #0284c7;
    color: #fff;
    border: none;
    border-radius: 18px;
    padding: 0 18px;
    height: 36px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}
.agent-im__send-btn:hover { background: #0369a1; }
.agent-im__send-btn:disabled { background: #cbd5e1; cursor: not-allowed; }

.agent-error {
    color: #dc2626;
    font-size: 13px;
    padding: 8px 16px;
    margin: 0;
    background: #fef2f2;
    border-top: 1px solid #fecaca;
}
.agent-chat__footer {
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
    margin: 12px 0 0;
    line-height: 1.5;
}

/* ---- 移动端：联系人默认隐藏（点击 back 按钮返回），聊天区始终可见 ---- */
@media (max-width: 768px) {
    .agent-im { padding: 0 4px 16px; }
    .agent-im__layout { min-height: 500px; }
    .agent-im__sidebar { display: none; }
    .agent-im__layout--sidebar { display: flex; }
    .agent-im__layout--sidebar .agent-im__main { display: none; }
    .agent-im__back { display: inline-block; }
    .agent-im__contact-tag { width: 18px; height: 18px; font-size: 9px; }
}

/* ---- 英文模式 ---- */
.agent-page[data-lang="en"] .agent-msg--user .agent-msg__bubble {
    background: #0f172a;
}
.agent-page[data-lang="en"] .agent-im__contact--active {
    background: #e0e7ff;
}
.agent-page[data-lang="en"] .agent-im__contact--active::before { background: #4f46e5; }
.agent-page[data-lang="en"] .agent-im__send-btn { background: #4f46e5; }
.agent-page[data-lang="en"] .agent-im__send-btn:hover { background: #4338ca; }
.agent-page[data-lang="en"] .agent-im__input-field:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

/* ============================================
 * 2026-07-31 暗黑模式（dark theme）
 * 通过 [data-theme="dark"] 在 html 根元素切换
 * 默认 light（不写 data-theme），用户选择写入 localStorage
 * 这里只覆盖关键元素：body/卡片/文字/边框/气泡/侧栏/输入
 * ============================================ */

/* ---- 主题切换按钮 ---- */
.agent-theme-toggle {
    position: absolute;
    top: 12px;
    right: 90px;          /* 不和 lang / back 链接重叠 */
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 999px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #fff;
    padding: 0;
    line-height: 1;
}
.agent-theme-toggle:hover { background: rgba(255,255,255,0.3); }
.agent-theme-toggle__icon { font-size: 14px; line-height: 1; }
.agent-theme-toggle__icon--moon { display: none; }
[data-theme="dark"] .agent-theme-toggle__icon--sun { display: none; }
[data-theme="dark"] .agent-theme-toggle__icon--moon { display: inline; }

/* 移动端不显示切换按钮（用户可在 OS 设置切换） */
@media (max-width: 768px) {
    .agent-theme-toggle { right: 80px; width: 28px; height: 28px; }
    .agent-theme-toggle__icon { font-size: 12px; }
}

/* ---- 暗黑模式：基础 ---- */
[data-theme="dark"] body,
[data-theme="dark"] html { background: #0f172a; }

[data-theme="dark"] .agent-page { color: #e2e8f0; }

[data-theme="dark"] .agent-header--im .agent-header__title--im { color: #f1f5f9; }
[data-theme="dark"] .agent-header__back {
    color: #cbd5e1;
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
}
[data-theme="dark"] .agent-header__back:hover { background: rgba(255,255,255,0.18); color: #fff; }
[data-theme="dark"] .agent-theme-toggle {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
}

/* ---- 暗黑模式：IM 布局 ---- */
[data-theme="dark"] .agent-im__layout {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 6px 24px rgba(0,0,0,0.4);
}
[data-theme="dark"] .agent-im__sidebar {
    background: #0f172a;
    border-right-color: #334155;
}
[data-theme="dark"] .agent-im__sidebar-head {
    background: #1e293b;
    border-bottom-color: #334155;
}
[data-theme="dark"] .agent-im__sidebar-title { color: #f1f5f9; }
[data-theme="dark"] .agent-im__sidebar-hint { color: #64748b; }
[data-theme="dark"] .agent-im__contact:hover { background: #1e293b; }
[data-theme="dark"] .agent-im__contact--active { background: #1e3a5f; }
[data-theme="dark"] .agent-im__contact--active::before { background: #38bdf8; }
[data-theme="dark"] .agent-im__contact-avatar {
    background: #1e293b;
    border-color: #334155;
}
[data-theme="dark"] .agent-im__contact--active .agent-im__contact-avatar {
    background: #0c4a6e;
    border-color: #38bdf8;
}
[data-theme="dark"] .agent-im__contact--health .agent-im__contact-avatar {
    background: #064e3b;
    border-color: #10b981;
}
[data-theme="dark"] .agent-im__contact-name { color: #f1f5f9; }
[data-theme="dark"] .agent-im__contact-desc { color: #94a3b8; }
[data-theme="dark"] .agent-im__contact--more { color: #64748b; }

/* ---- 暗黑模式：聊天主区 ---- */
[data-theme="dark"] .agent-im__main { background: #1e293b; }
[data-theme="dark"] .agent-im__chat-head {
    background: #0f172a;
    border-bottom-color: #334155;
}
[data-theme="dark"] .agent-im__chat-head-avatar {
    background: #0c4a6e;
    border-color: #38bdf8;
}
[data-theme="dark"] .agent-im__chat-head-name { color: #f1f5f9; }
[data-theme="dark"] .agent-im__chat-head-desc { color: #94a3b8; }
[data-theme="dark"] .agent-im__back { color: #cbd5e1; }
[data-theme="dark"] .agent-im__clear { color: #64748b; }
[data-theme="dark"] .agent-im__clear:hover { background: #334155; color: #f87171; }

[data-theme="dark"] .agent-im__chat {
    background: #0f172a;
    background-image: linear-gradient(135deg, #020617 0%, #0f172a 100%);
}
[data-theme="dark"] .agent-im__placeholder { color: #475569; }

[data-theme="dark"] .agent-msg__bubble {
    background: #334155;
    color: #f1f5f9;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
[data-theme="dark"] .agent-msg--user .agent-msg__bubble {
    background: #f59e0b;
    color: #0f172a;
}
[data-theme="dark"] .agent-msg__avatar { background: #f59e0b; color: #0f172a; }
[data-theme="dark"] .agent-msg__avatar--bot { background: #10b981; color: #022c22; }
[data-theme="dark"] .agent-msg__meta { color: #64748b; }
[data-theme="dark"] .agent-dot { background: #64748b; }

[data-theme="dark"] .agent-im__input-bar {
    background: #1e293b;
    border-top-color: #334155;
}
[data-theme="dark"] .agent-im__input-field {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}
[data-theme="dark"] .agent-im__input-field:focus {
    background: #0f172a;
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56,189,248,0.15);
}
[data-theme="dark"] .agent-im__input-field::placeholder { color: #64748b; }
[data-theme="dark"] .agent-im__send-btn { background: #38bdf8; color: #0f172a; }
[data-theme="dark"] .agent-im__send-btn:hover { background: #0ea5e9; }
[data-theme="dark"] .agent-im__send-btn:disabled { background: #334155; color: #64748b; }

[data-theme="dark"] .agent-error {
    background: #450a0a;
    color: #fca5a5;
    border-top-color: #7f1d1d;
}
[data-theme="dark"] .agent-chat__footer { color: #64748b; }

/* ---- 英文 + 暗色组合 ---- */
[data-theme="dark"] .agent-page[data-lang="en"] .agent-msg--user .agent-msg__bubble {
    background: #38bdf8;
    color: #0f172a;
}
[data-theme="dark"] .agent-page[data-lang="en"] .agent-msg__avatar { background: #4f46e5; color: #fff; }
[data-theme="dark"] .agent-page[data-lang="en"] .agent-msg__avatar--bot { background: #10b981; color: #022c22; }
[data-theme="dark"] .agent-page[data-lang="en"] .agent-im__contact--active { background: #312e81; }
[data-theme="dark"] .agent-page[data-lang="en"] .agent-im__send-btn { background: #4f46e5; color: #fff; }
[data-theme="dark"] .agent-page[data-lang="en"] .agent-im__send-btn:hover { background: #6366f1; }
[data-theme="dark"] .agent-page[data-lang="en"] .agent-im__input-field:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}

/* ---- 平滑过渡（用户切换主题时不刺眼） ---- */
.agent-page,
.agent-im__layout,
.agent-im__sidebar,
.agent-im__sidebar-head,
.agent-im__main,
.agent-im__chat-head,
.agent-im__chat,
.agent-msg__bubble,
.agent-im__input-bar,
.agent-im__input-field,
.agent-im__contact,
.agent-im__contact-avatar {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

