/* ============================================================
   Boss — Boss的第二大脑 | Design System
   风格：简洁白底 + 金色点缀 + 扁平纯色
   ============================================================ */

:root {
    /* 白色基调 - 更柔和的米白 */
    --bg-primary: #fefefe;
    --bg-secondary: #f8f7f4;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #fffdf8;
    --bg-input: #f5f4f1;
    --bg-overlay: rgba(0, 0, 0, 0.4);

    /* 金色品牌色 - 更饱和 */
    --gold: #b8954e;
    --gold-light: #d4a84c;
    --gold-dark: #8b7030;
    --gold-glow: rgba(184, 149, 78, 0.12);
    --gold-border: rgba(184, 149, 78, 0.4);
    --gold-bg: #faf6ed;

    /* 文字 - 更深的对比度 */
    --text-primary: #0f0f0f;
    --text-secondary: #4a4a4a;
    --text-muted: #8a8a8a;
    --text-gold: #9a7b3a;

    /* 功能色 */
    --green: #059669;
    --red: #dc2626;
    --blue: #2563eb;
    --orange: #d97706;

    /* 来源标签色 */
    --tag-personal: #4f46e5;
    --tag-industry: #059669;
    --tag-public: #2563eb;

    /* 间距 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* 字号阶梯 (基于 16px 基准) */
    --fs-xs: 0.75rem;      /* 12px — 时间戳、辅助说明 */
    --fs-sm: 0.8125rem;    /* 13px — 标签、次要信息 */
    --fs-base: 0.9375rem;  /* 15px — 正文、消息体 */
    --fs-md: 1rem;         /* 16px — 输入框、按钮 */
    --fs-lg: 1.125rem;     /* 18px — 标题、导航品牌 */
    --fs-xl: 1.25rem;      /* 20px — 面板标题 */
    --fs-2xl: 1.5rem;      /* 24px — 欢迎语 */
    --fs-3xl: 2rem;        /* 32px — 大标题 */

    /* 间距体系 */
    --sp-xs: 4px;
    --sp-sm: 8px;
    --sp-md: 12px;
    --sp-lg: 16px;
    --sp-xl: 20px;
    --sp-2xl: 24px;
    --sp-3xl: 32px;

    /* 字体 — 系统原生字体栈，无需外部加载 */
    --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", "Segoe UI", Roboto, Arial, sans-serif;

    /* PWA 安全区域变量 */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --header-top-padding: calc(max(52px, var(--safe-top)));
}

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

html {
    height: 100dvh !important;
    margin: 0;
    padding: 0;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.6;
    width: 100%;
    height: 100dvh !important;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    position: relative;
}

/* 主 App 专用的禁止回弹布局类 */
.is-app-body {
    height: 100dvh !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    overscroll-behavior-y: none;
    display: flex;
    flex-direction: column;
}

/* ===== 通用按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font);
}

.btn-gold {
    background: var(--gold);
    color: #ffffff;
}
.btn-gold:hover {
    background: var(--gold-dark);
}
.btn-gold:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid #e0e0e0;
}
.btn-outline:hover {
    border-color: var(--gold-border);
    color: var(--text-gold);
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-family: var(--font);
}
.btn-ghost:hover {
    color: var(--text-gold);
}

/* 读数据卡片按钮样式 */
.btn-primary {
    background: var(--gold);
    color: #ffffff;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-primary:hover {
    background: var(--gold-dark);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 10px 20px;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-secondary:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.btn-full {
    width: 100%;
}

/* ===== 表单 ===== */
input, textarea, select {
    font-family: var(--font);
    background: var(--bg-input);
    border: 1px solid #e5e5e5;
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    width: 100%;
    transition: border-color 0.2s;
    outline: none;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--gold);
}
input::placeholder, textarea::placeholder {
    color: var(--text-muted);
}

/* ===== 来源标签 ===== */
.source-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
}
.source-tag.personal {
    background: rgba(99, 102, 241, 0.1);
    color: var(--tag-personal);
}
.source-tag.industry {
    background: rgba(16, 185, 129, 0.1);
    color: var(--tag-industry);
}
.source-tag.public {
    background: rgba(59, 130, 246, 0.1);
    color: var(--tag-public);
}
.source-tag.warning {
    background: rgba(234, 179, 8, 0.15);
    color: #ca8a04;
}

/* ===== 主容器 ===== */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    height: 100dvh;
}

/* ===== 聊天头部 (纯功能按钮) ===== */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    padding-top: var(--header-top-padding);
    background: var(--bg-primary);
    z-index: 100;
    border-bottom: 1px solid rgba(0,0,0,0.03);
    flex-shrink: 0;
}
.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: background 0.2s;
    cursor: pointer;
    border: none;
    background: transparent;
}
.header-btn:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text-primary);
}
.header-logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.header-logo img {
    height: 24px;
    width: auto;
}
.user-avatar-btn {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: var(--gold-glow);
    border: 1px solid var(--gold-border);
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
}
.user-avatar-btn svg {
    width: 20px;
    height: 20px;
}

@media (max-width: 768px) {
    .chat-header {
        padding: 8px 16px;
    }
}

/* ===== 侧边栏 (Sidebar) ===== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 400px;
    background: var(--bg-sidebar);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 20px rgba(0,0,0,0.05);
}
.sidebar.active {
    transform: translateX(0);
}

.sidebar-header {
    padding: 16px 20px;
    padding-top: var(--header-top-padding);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.sidebar-header .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.sidebar-header .brand img {
    height: 28px;
}
.sidebar-header .close-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}
.sidebar-header .close-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}
.sidebar-new-chat {
    margin: 0 16px 16px;
}
.btn-new-chat {
    width: 100%;
    padding: 14px 16px;
    background: var(--gold-bg);
    border: 1.5px solid var(--gold-border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-gold);
    transition: all 0.2s;
    font-family: var(--font);
    cursor: pointer;
}
.btn-new-chat:hover {
    background: var(--gold);
    border-color: var(--gold);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(184, 149, 78, 0.25);
}
.btn-new-chat svg {
    stroke-width: 2.5;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px;
}
.history-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 8px 12px 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.history-item {
    padding: 12px 12px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-base);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px; /* 最小触控热区 */
}
.history-item .hist-main {
    flex: 1;
    min-width: 0;
}
.history-item .hist-main .title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: var(--fs-base);
}
.history-item .hist-main .time {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-top: 2px;
}
.hist-more-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
    touch-action: manipulation;
}
.history-item:hover .hist-more-btn {
    opacity: 1;
}
.hist-more-btn:hover {
    background: rgba(0,0,0,0.06);
    color: var(--text-primary);
}

/* 历史记录操作菜单 */
.hist-action-menu {
    position: absolute;
    right: 8px;
    top: 100%;
    background: #fff;
    border: 1px solid #eee;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    z-index: 200;
    padding: 4px;
    min-width: 120px;
    animation: menu-slide-up 0.15s ease;
}
.hist-action-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
}
.hist-action-item:hover {
    background: rgba(0,0,0,0.04);
    color: var(--text-primary);
}
.hist-action-item.hist-action-danger {
    color: var(--red);
}
.hist-action-item.hist-action-danger:hover {
    background: rgba(220,38,38,0.06);
}

.history-item:hover {
    background: rgba(0,0,0,0.03);
    color: var(--text-primary);
}
.history-item.active {
    background: var(--gold-glow);
    color: var(--text-gold);
    font-weight: 500;
}

/* ===== 历史记录分组样式 ===== */
.history-group {
    margin-bottom: 8px;
}
.history-group-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 8px 12px 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.history-group-label.pinned-label {
    color: var(--gold);
}
.history-group-label.pinned-label svg {
    fill: var(--gold);
}
.history-group-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ===== 历史记录项增强样式 ===== */
.history-item {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-base);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
}
.history-item .hist-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.history-item .hist-icon svg {
    width: 100%;
    height: 100%;
}
.history-item .hist-main {
    flex: 1;
    min-width: 0;
}
.history-item .hist-main .title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: var(--fs-base);
    line-height: 1.4;
}
.history-item .hist-main .time {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-top: 2px;
}
.hist-more-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
    touch-action: manipulation;
}
.history-item:hover .hist-more-btn {
    opacity: 1;
}
.hist-more-btn:hover {
    background: rgba(0,0,0,0.06);
    color: var(--text-primary);
}

/* 移动端始终显示操作按钮 */
@media (max-width: 768px) {
    .hist-more-btn {
        opacity: 1;
        width: 40px;
        height: 40px;
    }
    .history-item {
        padding: 12px;
        min-height: 56px;
    }
    .history-item .hist-icon {
        width: 24px;
        height: 24px;
    }
}

/* ===== 个人中心浮层 (User Dropdown) ===== */
.user-menu {
    position: absolute;
    top: 60px;
    right: 16px;
    width: 340px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.05);
    z-index: 500;
    display: none;
    padding: 12px;
    animation: menu-slide-up 0.2s ease;
}
.user-menu.active {
    display: block;
}

/* Chat 推广条（菜单内） */
.menu-promo-chat {
    background: linear-gradient(135deg, var(--gold-bg) 0%, #fff9eb 100%);
    color: var(--gold-dark) !important;
    font-weight: 600;
    border-radius: 8px;
    margin: 4px 6px;
    position: relative;
}
.menu-promo-chat:hover {
    background: linear-gradient(135deg, #f5ecd5 0%, #fff3d6 100%);
}
.promo-badge {
    font-size: 10px;
    background: var(--gold);
    color: white;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: auto;
    font-weight: 600;
    letter-spacing: 0.5px;
}
@keyframes menu-slide-up {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}
.menu-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}
.menu-item.logout {
    color: var(--red);
    margin-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.06);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    padding-top: 14px;
}
.menu-item.logout:hover {
    background: rgba(220, 38, 38, 0.04);
}
.menu-divider {
    height: 1px;
    background: #f0f0f0;
    margin: 4px 0;
}

/* ===== 聊天主体 ===== */
.chat-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    align-items: center; /* 核心消息流居中显示 */
    scroll-behavior: smooth;
}
.chat-body-content {
    width: 95%;
    max-width: 820px;
    display: flex;
    flex-direction: column;
}

/* ===== 欢迎屏 (完全左对齐结构) ===== */
.welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 0 5%;
    max-width: 800px;
    margin: 40px auto 30px;
    width: 100%;
}
.welcome-avatar {
    width: auto;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 20px;
}
.welcome-brand {
    font-size: 34px;
    font-weight: 700;
    margin-bottom: 32px;
    background: linear-gradient(135deg, #CFAB51 0%, #E6C57A 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--gold); /* 降级 */
    letter-spacing: -0.5px;
}
/* ===== 文字提问列表 (左对齐无边框) ===== */
.quick-questions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 40px;
    width: 100%;
}
.quick-q-btn {
    display: inline-flex;
    align-items: center;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    font-family: var(--font);
    text-align: left;
}
.quick-q-btn .q-icon {
    margin-right: 12px;
    font-size: 18px;
    color: var(--text-muted);
}
.quick-q-btn:hover {
    color: var(--text-gold);
}

/* ===== 场景卡片 — 一行横向卡片 ===== */
.scene-scroll-wrapper {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    display: flex;
    justify-content: center;
    padding-bottom: 30px;
    position: relative;
}

.scroll-arrow {
    position: absolute;
    top: calc(50% - 15px);
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #eee;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.scroll-arrow:hover {
    color: var(--gold);
    border-color: var(--gold-border);
    box-shadow: 0 4px 16px rgba(201, 168, 76, 0.15);
}
.scroll-arrow-left {
    left: calc(50vw - 425px);
}
.scroll-arrow-right {
    right: calc(50vw - 425px);
}
@media (max-width: 850px) {
    .scroll-arrow-left { left: 10px; }
    .scroll-arrow-right { right: 10px; }
    .hide-on-mobile { display: none !important; }
}
.scene-grid {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 4px 5%;
    max-width: 800px;
    width: 100%;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
/* 隐藏网页底部的横向滚动条！ */
body { overflow-x: hidden; }
.scene-grid::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.scene-card {
    flex: 0 0 220px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 16px;
    padding-bottom: 32px;
    background: var(--bg-card);
    border: 1px solid #e8e8e8;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
}
.scene-card:hover {
    border-color: var(--gold-border);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(201, 168, 76, 0.08);
}

/* 信息建设卡片 — 虚线边框 + 金色微光提示"待补充" */
.scene-card.info-card {
    border-style: dashed;
    border-color: var(--gold-border);
    background: linear-gradient(135deg, #fffdf8 0%, #faf6ed 100%);
    position: relative;
}
.scene-card.info-card::after {
    content: '补充信息';
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 10px;
    color: var(--gold);
    background: var(--gold-glow);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 500;
}
.scene-card.info-card:hover {
    border-color: var(--gold);
    background: linear-gradient(135deg, #faf6ed 0%, #f5eedd 100%);
    box-shadow: 0 4px 20px rgba(184, 149, 78, 0.15);
}

/* 自我突破卡片 — 极简白底高对比 */
.scene-card.challenge-card {
    background: linear-gradient(135deg, #ffffff 0%, #fcf9f2 100%);
    border-color: var(--gold-border);
    color: var(--text-primary);
}
.scene-card.challenge-card .scene-title {
    color: var(--text-primary);
}
.scene-card.challenge-card .scene-desc {
    color: var(--text-secondary);
}
.scene-card.challenge-card:hover {
    border-color: #f59e0b;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.1);
    background: linear-gradient(135deg, #fff 0%, #fef3c7 100%);
}

/* 大衍推盘卡片 — 淡淡的浅紫背景 */
.scene-card.card-iching {
    background: #fdfcff;
    border: 1px solid #e8e3f0;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}
.scene-card.card-iching::before {
    display: none;
}
.scene-card.card-iching .scene-title {
    color: #5b4b73;
    font-weight: 600;
}
.scene-card.card-iching .scene-desc {
    color: var(--text-secondary);
}
.scene-card.card-iching .scene-icon {
    font-size: 1.4rem;
}
.scene-card.card-iching:hover {
    border-color: #d7cce6;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(118, 93, 160, 0.06);
    background: #f7f3fc;
}
/* Chat 推广卡片（场景卡末尾） */
.scene-card.chat-promo-card {
    background: linear-gradient(135deg, var(--gold-bg) 0%, #fef3c7 100%);
    border: 1.5px solid var(--gold);
    position: relative;
}
.scene-card.chat-promo-card .scene-title {
    color: var(--gold-dark);
    font-weight: 700;
}
.scene-card.chat-promo-card .scene-desc {
    color: var(--text-secondary);
}
.scene-card.chat-promo-card:hover {
    border-color: var(--gold-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(184, 149, 78, 0.2);
    background: linear-gradient(135deg, #fff9eb 0%, #fef3c7 100%);
}
/* 画像完善度指示器 (收纳在个人中心菜单中) */
.profile-status {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
}
.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.status-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.status-percent {
    font-size: 14px;
    font-weight: 700;
    color: var(--gold);
}
.status-bar-bg {
    width: 100%;
    height: 6px;
    background: #e8e6e0;
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 10px;
}
.status-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-light), var(--gold));
    border-radius: var(--radius-full);
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.status-tip {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0;
}
.is-complete .status-tip {
    color: var(--gold-dark);
    font-weight: 500;
}
.scene-icon {
    font-size: 20px;
    margin-bottom: 4px;
}
.scene-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.scene-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.scene-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
    white-space: normal; /* 允许折行 */
}

/* ===== 卡片管理入口 ===== */
.card-manager-entry {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}
.btn-card-manager {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-card-manager:hover {
    color: var(--gold-dark);
    border-color: var(--gold);
    background: var(--gold-glow);
}
.btn-card-manager svg {
    stroke: currentColor;
}

/* ===== 卡片管理弹窗 ===== */
.card-manager-modal {
    max-width: 480px;
    max-height: 80vh;
}
.card-stats-summary {
    display: flex;
    gap: 24px;
    padding: 16px;
    background: var(--gold-glow);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}
.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--gold-dark);
}
.stat-label {
    font-size: 12px;
    color: var(--text-muted);
}
.card-manager-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.card-manager-hint svg {
    flex-shrink: 0;
    stroke: var(--gold);
}
.card-list-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}
.card-manager-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.card-manager-item:hover {
    background: var(--gold-glow);
    border-color: var(--gold-border);
}
.card-manager-item.fixed {
    background: linear-gradient(135deg, var(--gold-glow) 0%, #fff9eb 100%);
    border-color: var(--gold);
}
.card-manager-order {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-primary);
    border-radius: var(--radius-full);
}
.card-manager-item.fixed .card-manager-order {
    background: var(--gold);
    color: white;
}
.card-manager-icon {
    font-size: 20px;
    width: 32px;
    text-align: center;
}
.card-manager-info {
    flex: 1;
    min-width: 0;
}
.card-manager-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.card-manager-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}
.card-manager-meta .use-count {
    color: var(--gold-dark);
}
.card-manager-action {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
}
.card-manager-item.fixed .card-manager-action {
    color: var(--gold);
}
.card-manager-action svg {
    width: 18px;
    height: 18px;
}
.card-manager-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--gold-border);
}

/* 移动端卡片管理适配 */
@media (max-width: 768px) {
    .card-manager-modal {
        max-width: 100%;
        max-height: 90vh;
        margin: 16px;
    }
    .card-manager-item {
        padding: 16px;
        min-height: 60px;
    }
    .card-manager-icon {
        font-size: 24px;
        width: 40px;
    }
    .card-manager-title {
        font-size: 15px;
    }
    .card-manager-meta {
        font-size: 13px;
    }
}

/* ===== 消息气泡容器 (支持头像) ===== */
/* ===== 消息气泡容器 (支持头像) ===== */
.msg-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 24px;
    width: 100%;
}
.msg-row.user-row {
    justify-content: flex-end;
}

.msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: #fff;
    border: 1px solid #f0f0f0;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.msg-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
}

.msg {
    max-width: 85%;
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    font-size: 15px;
    line-height: 1.7;
    word-wrap: break-word;
    animation: msgIn 0.25s ease-out;
}
@keyframes msgIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg.user {
    background: #FDFaf2;
    border: 1px solid rgba(184, 149, 78, 0.15);
    color: #333;
    border-bottom-right-radius: 4px;
    font-size: 14.5px;
}

.msg.ai {
    background: #fff;
    color: #353535;
    box-shadow: 0 4px 16px rgba(184, 149, 78, 0.04);
    border: 1px solid rgba(184, 149, 78, 0.2);
    border-top-left-radius: 4px;
}

/* ===== AI 消息内 Markdown 高级排版 (Premium Reporting Style) ===== */
.msg.ai {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
    line-height: 1.75;
    font-size: 15px;
    letter-spacing: 0.2px;
}
.msg.ai h1, .msg.ai h2, .msg.ai h3, .msg.ai h4 {
    color: #9A7730;
    font-weight: bold;
    margin-top: 26px;
    margin-bottom: 12px;
    line-height: 1.4;
    border: none;
}
.msg.ai h1 { font-size: 18px; color: #8F6D25; }
.msg.ai h2 { font-size: 17px; }
.msg.ai h3 { font-size: 16px; }
.msg.ai p { margin: 12px 0; }
.msg.ai a { color: var(--gold); text-decoration: none; border-bottom: 1px dashed var(--gold); transition: all 0.2s; }
.msg.ai a:hover { color: #9A7730; border-bottom-style: solid; }
.msg.ai blockquote {
    background: linear-gradient(135deg, rgba(250, 246, 237, 0.7), rgba(255, 253, 248, 0.4));
    border-left: 4px solid var(--gold);
    padding: 14px 18px;
    margin: 16px 0;
    color: var(--text-secondary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 14.5px;
}
.msg.ai table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14.5px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.02);
    border-radius: var(--radius-sm);
}
.msg.ai table th, .msg.ai table td {
    padding: 12px 16px;
    border: 1px solid rgba(184, 149, 78, 0.15);
    text-align: left;
    vertical-align: top;
}
.msg.ai table th {
    background: rgba(250, 246, 237, 0.8);
    color: #8c6a21;
    font-weight: 600;
    white-space: nowrap;
}
.msg.ai table tr:hover td {
    background: rgba(250, 246, 237, 0.2);
}
.msg.ai ul, .msg.ai ol { padding-left: 1.8em; margin: 14px 0; }
.msg.ai li { margin-bottom: 10px; }
.msg.ai li::marker { color: #C9A84C; font-weight: 500; }
.msg.ai strong { color: #111; font-weight: bold; }
.msg.ai code {
    background: rgba(69, 172, 126, 0.1);
    color: #2e8d64;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
}
.msg.ai pre {
    background: #f8f9fa;
    color: #333;
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid #eee;
}
.msg.ai pre code {
    background: none;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-weight: normal;
    white-space: pre;
}
.msg.ai hr {
    border: none;
    border-top: 1px dotted rgba(201, 168, 76, 0.4);
    margin: 20px 0;
}

/* ===== 思考动画 ===== */
.thinking {
    display: flex;
    gap: 6px;
    padding: 4px 0;
}
.thinking span {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--gold);
    opacity: 0.4;
    animation: blink 1.4s infinite both;
}
.thinking span:nth-child(2) { animation-delay: 0.2s; }
.thinking span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
    0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* ===== 深度思考展示块 (Thinking Block - Embedded in AI Response) ===== */
.thinking-block {
    margin: -16px -20px 16px -20px;
    background: linear-gradient(180deg, rgba(246, 244, 238, 0.6) 0%, rgba(255, 255, 255, 0) 100%);
    border-bottom: 1px solid rgba(0,0,0,0.04);
    padding: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
/* 当思考块后面有正文内容时，给一个间距 */
.thinking-block + .ai-content-body {
    margin-top: 12px;
}
/* 正文内容体（v3：与思考块共享同一个 .msg.ai 容器） */
.ai-content-body {
    line-height: inherit;
    font-size: inherit;
}
.thinking-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px 12px 20px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}
.thinking-header:hover {
    background: rgba(201, 168, 76, 0.06);
}
.thinking-icon {
    font-size: 16px;
    display: inline-block;
    animation: thinkPulse 2.5s ease-in-out infinite;
}
@keyframes thinkPulse {
    0% { filter: drop-shadow(0 0 2px rgba(201,168,76,0.2)); transform: scale(0.95); opacity: 0.7; }
    50% { filter: drop-shadow(0 0 6px rgba(201,168,76,0.8)); transform: scale(1.1); opacity: 1; }
    100% { filter: drop-shadow(0 0 2px rgba(201,168,76,0.2)); transform: scale(0.95); opacity: 0.7; }
}
.thinking-block.collapsed .thinking-icon {
    animation: none;
    opacity: 1;
    transform: none;
    filter: none;
}
.thinking-toggle {
    font-size: 13px;
    font-weight: 600;
    color: var(--gold);
    flex: 1;
    letter-spacing: 0.5px;
}
.thinking-arrow {
    font-size: 14px;
    color: var(--gold);
    opacity: 0.6;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.thinking-block.collapsed .thinking-arrow {
    transform: rotate(-90deg);
}
.thinking-content {
    max-height: 500px;
    overflow-y: auto;
    padding: 0 20px 14px 20px;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s, opacity 0.3s;
    opacity: 1;
}
.thinking-block.collapsed .thinking-content {
    max-height: 0;
    padding: 0 20px;
    opacity: 0;
    overflow: hidden;
}
.thinking-content-text {
    font-family: inherit !important;
    font-size: 13px !important;
    line-height: 1.7 !important;
    color: rgba(60, 60, 60, 0.8) !important;
    white-space: pre-wrap !important;
    word-break: break-word !important;
    margin: 0 !important;
    background: transparent !important;
    padding: 0 0 0 12px !important;
    border: none !important;
    border-left: 2px solid rgba(201, 168, 76, 0.3) !important;
    border-radius: 0 !important;
}
/* 思考内容滚动条 */
.thinking-content::-webkit-scrollbar { width: 4px; }
.thinking-content::-webkit-scrollbar-thumb { background: var(--gold-border); border-radius: 2px; }

/* ===== 新版输入气泡 (类似截图) ===== */
.chat-footer {
    padding: 12px 24px;
    padding-bottom: max(12px, var(--safe-bottom));
    background: var(--bg-primary);
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0; /* 防止由于键盘或溢出被挤没 */
    transition: opacity 0.25s ease;
}
/* 场景表单激活时，禁用底部输入区 */
.chat-footer.disabled {
    opacity: 0.35;
    pointer-events: none;
    user-select: none;
}
.chat-input-bubble {
    display: flex;
    flex-direction: column;
    max-width: 820px;
    margin: 0 auto;
    background: #f6f6f6;
    border-radius: 20px;
    padding: 8px 14px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}
.chat-input-bubble:focus-within {
    background: #fff;
    border-color: var(--gold-border);
    box-shadow: 0 4px 20px rgba(201, 168, 76, 0.08);
}
.chat-input-bubble textarea {
    width: 100%;
    background: transparent;
    border: none !important;
    padding: 4px 8px;
    margin-bottom: 8px;
    resize: none;
    min-height: 48px;
    max-height: 150px;
    font-size: 15px;
    line-height: 1.5;
    outline: none !important;
    box-shadow: none !important;
}

/* 操作行 */
.input-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.actions-left {
    display: flex;
    gap: 12px;
}
.action-btn {
    background: transparent;
    border: none;
    padding: 6px;
    border-radius: 8px;
    color: #999;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.action-btn:hover {
    background: rgba(0,0,0,0.05);
    color: var(--gold);
}

/* 圆形发送按钮 */
.send-btn-circle {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--gold);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
}
.send-btn-circle:hover {
    background: var(--gold-dark);
    transform: scale(1.05);
}
.send-btn-circle svg {
    margin-top: 1px; /* 视觉微调 */
}

/* ===== 决策重心菜单 (Focus Menu) ===== */
.focus-menu {
    position: absolute;
    bottom: calc(100% + 12px); /* 永远悬浮在输入区域上方 */
    left: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(201, 168, 76, 0.2);
    border-radius: 16px;
    padding: 8px;
    width: 240px;
    display: none;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.12);
    z-index: 999; /* 确保置顶 */
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 480px) {
    .focus-menu {
        width: 90%;
        left: 5%;
        bottom: calc(100% + 20px);
        border-radius: 20px;
        padding: 12px;
    }
    .focus-item {
        padding: 12px 16px;
    }
}

.focus-menu.active {
    display: flex;
    animation: menuUp 0.2s ease-out;
}
@keyframes menuUp {
    from { opacity: 0; transform: translateY(10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.focus-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}
.focus-item:hover {
    background: var(--gold-bg);
}
.focus-item.active {
    background: var(--gold-bg);
    color: var(--text-gold);
}
.focus-item .mode-icon {
    font-size: 18px;
}
.focus-item .mode-info {
    display: flex;
    flex-direction: column;
}
.focus-item .mode-name {
    font-size: 14px;
    font-weight: 600;
}
.focus-item .mode-desc {
    font-size: 11px;
    opacity: 0.7;
}

/* 激活态滑块图标 */
.action-btn.active {
    color: var(--gold);
    transform: scale(1.1);
}
.send-btn-circle:disabled {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
}

/* ===== 历史记录面板 ===== */
.history-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 90;
}
.history-overlay.open { display: block; }

.history-panel {
    position: fixed;
    top: 0; right: -360px;
    width: 340px; height: 100dvh;
    background: var(--bg-primary);
    border-left: 1px solid #f0f0f0;
    z-index: 100;
    overflow-y: auto;
    padding: 20px;
    transition: right 0.3s ease;
    box-shadow: -4px 0 16px rgba(0,0,0,0.08);
}
.history-panel.open { right: 0; }

.history-panel .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.history-panel .header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.history-panel .history-item {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border: 1px solid #f0f0f0;
    transition: all 0.2s;
}
.history-panel .history-item:hover {
    border-color: var(--gold-border);
    background: var(--gold-bg);
}
.history-panel .history-item .title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-panel .history-item .time {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #e0e0e0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #ccc; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .sidebar { width: 85%; max-width: 340px; }
    .sidebar-header { 
        padding: 16px 16px 12px; 
        padding-top: var(--header-top-padding);
    }
    .sidebar-header .brand { font-size: var(--fs-md); }
    .sidebar-header .brand img { height: 24px; }
    .sidebar-new-chat { margin: 0 12px 12px; }
    .btn-new-chat { padding: 12px 14px; font-size: var(--fs-base); }
    .sidebar-content { padding: 0 8px; }
    .history-section-label { font-size: var(--fs-xs); padding: 6px 10px 10px; }
    .history-item { padding: 12px 10px; font-size: var(--fs-base); }
    
    .chat-header { 
        padding: 12px 12px; 
        padding-top: var(--header-top-padding);
    }
    .chat-body { padding: 12px; }
    .chat-body-content {
        width: 100%;
        max-width: 100%;
    }
    .chat-footer { 
        position: relative !important;
        bottom: auto !important;
        padding: 10px 12px; 
        padding-bottom: max(16px, var(--safe-bottom));
        background: var(--bg-primary);
        flex-shrink: 0;
    }
    .chat-input-bubble {
        max-width: 100%;
    }
    .msg { max-width: 90%; font-size: var(--fs-base); padding: 14px 16px; }
    .msg-row { gap: 0; margin-bottom: 20px; padding: 0 4px; }
    .msg-avatar { display: none; }
    .msg.ai { border-radius: 12px 12px 12px 2px; }
    .msg.user { border-radius: 12px 12px 2px 12px; }
    
    /* 防止 iOS 输入框聚焦时自动放大页面 (Font-size 必须 >= 16px) */
    input, textarea, select, .form-input {
        font-size: 16px !important;
    }
    
    /* Mobile specific thinking block negative margins to match new msg padding */
    .thinking-block { margin: -14px -16px 14px -16px; }
    .thinking-header { padding: 14px 16px 10px 16px; }
    .thinking-content { padding: 0 16px 12px 16px; }
    .thinking-block.collapsed .thinking-content { padding: 0 16px; }
    .welcome { padding: 0 16px; max-width: 100%; }
    .welcome-brand { font-size: var(--fs-3xl); }
    .welcome-sub { font-size: var(--fs-base); margin-bottom: 24px; }
    .scene-grid { gap: 8px; }
    .scene-card { padding: 12px; }
    .scene-title { font-size: var(--fs-base); }
    .scene-desc { font-size: var(--fs-sm); }
    .history-panel { width: 280px; right: -300px; }
    .scene-scroll-wrapper { width: 100%; margin-left: 0; }
}

@media (max-width: 480px) {
    .scene-grid { gap: 8px; }
    .scene-card { padding: 10px 14px; }
    .scene-title { font-size: 14px; }
    .scene-desc { font-size: var(--fs-sm); }
}

/* ===== 行内表单卡片 (Inline UI) ===== */
.inline-form-msg {
    width: 100%;
    max-width: 100% !important;
}
.inline-intro {
    font-size: 15px;
    margin-bottom: 16px;
    color: var(--text-primary);
    line-height: 1.6;
}
.inline-form-card {
    background: var(--bg-secondary);
    border: 1px solid #eee;
    border-radius: var(--radius-md);
    padding: 20px;
}

/* 引导提示标签行 */
.guidance-hints-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
}
.guidance-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-right: 4px;
    white-space: nowrap;
}
.guidance-hint-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: var(--gold-bg);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-full);
    font-size: 13px;
    color: var(--text-gold);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font);
    white-space: nowrap;
    user-select: none;
}
.guidance-hint-tag:hover {
    background: var(--gold);
    color: #fff;
    border-color: var(--gold);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(184, 149, 78, 0.25);
}
.guidance-hint-tag.used {
    background: #f0f0f0;
    border-color: #ddd;
    color: var(--text-muted);
    opacity: 0.6;
    cursor: default;
    transform: none;
    box-shadow: none;
}

/* 主输入框 */
.inline-input-main {
    width: 100%;
    background: #fff;
    border: 1.5px solid #e0e0e0;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    transition: border-color 0.2s;
    outline: none;
    resize: none;
    min-height: 120px;
}
.inline-input-main:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(184, 149, 78, 0.08);
}
.inline-input-main::placeholder {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

/* 底部操作栏 */
.inline-bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}
.inline-attach-area {
    display: flex;
    align-items: center;
    gap: 8px;
}
.inline-attach-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: var(--radius-full);
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}
.inline-attach-btn:hover {
    border-color: var(--gold-border);
    color: var(--text-gold);
    background: var(--gold-bg);
}
.inline-attach-btn.has-file {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--gold-bg);
}
.inline-attach-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.attach-info {
    font-size: 13px;
    color: var(--text-gold);
    display: none;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 提交按钮（紧凑型） */
.inline-submit-btn {
    padding: 10px 24px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* 提交后状态 */
.inline-form-submitted {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.4s ease;
}
.inline-form-submitted .inline-form-card {
    position: relative;
}
.inline-form-submitted .inline-form-card::after {
    content: '✓ 已提交';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    color: var(--gold);
    font-weight: 600;
    background: rgba(255,255,255,0.85);
    padding: 6px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--gold-border);
}

/* 移动端适配 */
@media (max-width: 480px) {
    .guidance-hints-row {
        gap: 6px;
    }
    .guidance-hint-tag {
        padding: 6px 14px;
        font-size: 14px;
        margin-bottom: 2px;
    }
    .guidance-label {
        display: block;
        font-size: 15px;
        margin-bottom: 8px;
        font-weight: 600;
    }
    .inline-input-main {
        font-size: 16px; /* 防止 iOS 自动缩放 */
        padding: 14px;
        min-height: 120px;
    }
    .inline-bottom-bar {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    .inline-submit-btn {
        width: 100%;
        justify-content: center;
    }
    .attach-info {
        max-width: 120px;
    }
}

.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}
.inline-input {
    width: 100%;
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    transition: border-color 0.2s;
    outline: none;
    resize: none;
}
.inline-input:focus {
    border-color: var(--gold);
}
.inline-upload {
    border: 2px dashed #d9d9d9;
    background: #fafafa;
    border-radius: var(--radius-sm);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.inline-upload:hover {
    border-color: var(--gold);
    background: var(--gold-bg);
}
.upload-icon {
    font-size: 28px;
    margin-bottom: 8px;
    opacity: 0.8;
}
.upload-text {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}


/* shimmer 动画已在骨架屏样式区域统一定义 */

/* ===== 个人画像完善弹窗 ===== */
.profile-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 10000;
    display: flex;
    align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}
.profile-modal-content {
    position: relative;
    background: var(--bg-primary);
    width: 90%; max-width: 480px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex; flex-direction: column;
    animation: slideUp 0.3s ease;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.modal-header h3 {
    margin: 0; font-size: 18px; color: var(--text-primary); font-weight: 600;
}
.modal-close-btn {
    background: none; border: none; font-size: 24px; color: #999;
    cursor: pointer; line-height: 1; margin: -5px; padding: 5px;
}
.modal-close-btn:hover { color: var(--text-primary); }
.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block; margin-bottom: 6px; font-size: 14px;
    color: var(--text-secondary); font-weight: 500;
}
.form-group select, .form-group input, .form-group textarea {
    width: 100%; padding: 10px 12px;
    border: 1px solid rgba(0,0,0,0.1); border-radius: 8px;
    box-sizing: border-box; background: rgba(0,0,0,0.02);
    font-size: 14px; color: var(--text-primary);
    transition: border-color 0.2s, background 0.2s;
    font-family: inherit;
}
.form-group select:focus, .form-group input:focus, .form-group textarea:focus {
    outline: none; border-color: var(--gold); background: var(--bg-primary);
}

/* ===== 通用弹窗底部样式 ===== */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid rgba(0,0,0,0.06);
    background: var(--bg-primary);
}

/* ===== 导出操作按钮组 (Export Actions) ===== */
.export-actions {
    margin-top: 14px;
    display: flex;
    gap: 8px;
    border-top: 1px dashed rgba(201, 168, 76, 0.25);
    padding-top: 14px;
    flex-wrap: wrap;
}
.export-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #faf6ed 0%, #fff 100%);
    border: 1px solid rgba(201, 168, 76, 0.35);
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-gold);
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: var(--font);
    white-space: nowrap;
}
.export-btn:hover {
    background: var(--gold);
    color: #fff;
    border-color: var(--gold);
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(184, 149, 78, 0.3);
}
.export-btn:active {
    transform: translateY(0);
    box-shadow: none;
}
@media (max-width: 480px) {
    .export-actions {
        gap: 6px;
    }
    .export-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

.form-group textarea { resize: vertical; }

/* ===== 认知面板（让 Boss 更了解你） ===== */
.cognition-panel {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}
.cognition-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.cognition-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}
.cognition-update {
    font-size: 12px;
    color: var(--text-muted);
}
.cognition-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 32px;
}
.cognition-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    background: var(--bg-primary);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: var(--radius-full);
    font-size: 13px;
    color: var(--text-secondary);
    white-space: normal;
    word-break: break-all;
    line-height: 1.4;
    transition: all 0.2s;
}
.cognition-tag:hover {
    border-color: var(--gold-border);
    color: var(--text-gold);
}
.tag-forget-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 6px;
    margin-right: -4px;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
}
.cognition-tag:hover .tag-forget-btn {
    opacity: 1;
}
.tag-forget-btn:hover {
    background: rgba(0,0,0,0.06);
    color: var(--red);
}

/* 适配移动端触屏：删除按钮不再依赖 hover，常态可见，且扩大点击区域 */
@media (hover: none) and (pointer: coarse) {
    .tag-forget-btn {
        opacity: 0.6;
        width: 28px;
        height: 28px;
        margin-right: -8px;
        color: var(--text-muted);
    }
    .tag-forget-btn:active {
        background: rgba(0,0,0,0.06);
        color: var(--red);
    }

    /* 历史操作按钮移动端常驻显示 + 加大热区 */
    .hist-more-btn {
        opacity: 0.7;
        width: 44px;
        height: 44px;
        font-size: 20px;
    }

    /* 所有可交互元素的触控反馈 :active 态 */
    button:active, .btn:active, .scene-card:active,
    .history-item:active, .menu-item:active,
    .tips-card:active, .quick-q-btn:active,
    .cognition-action-card:active, .export-btn:active {
        transform: scale(0.97);
        opacity: 0.85;
        transition: transform 0.1s, opacity 0.1s;
    }

    /* 最小触控热区保障 */
    .header-btn {
        min-width: 44px;
        min-height: 44px;
    }
    .user-avatar-btn {
        min-width: 44px;
        min-height: 44px;
    }
    .menu-item {
        min-height: 44px;
    }
}
.cognition-tag-domain {
    background: var(--gold-glow);
    border-color: var(--gold-border);
    color: var(--text-gold);
}
.cognition-loading {
    font-size: 13px;
    color: var(--text-muted);
    padding: 8px 0;
}
.cognition-empty {
    font-size: 13px;
    color: var(--text-muted);
    padding: 8px 0;
    line-height: 1.5;
}

/* 行动卡片 */
.cognition-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.cognition-action-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-primary);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}
.cognition-action-card:hover {
    border-color: var(--gold-border);
    background: var(--gold-glow);
}
.cognition-action-card .action-icon {
    font-size: 20px;
    flex-shrink: 0;
}
.cognition-action-card .action-info {
    flex: 1;
    min-width: 0;
}
.cognition-action-card .action-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.cognition-action-card .action-desc {
    font-size: 12px;
    color: var(--text-muted);
}
.cognition-action-card svg {
    flex-shrink: 0;
    color: var(--text-muted);
}
.cognition-action-card .chevron-icon {
    transition: transform 0.25s ease;
}

/* 折叠表单 */
.profile-form-collapse {
    padding: 16px 0 8px;
    border-top: 1px solid rgba(0,0,0,0.05);
    margin-top: 4px;
    animation: slideDown 0.25s ease;
}
@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 600px; }
}

/* 隐私声明 */
.privacy-pledge {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
    background: rgba(0,0,0,0.02);
    border-radius: var(--radius-sm);
    margin-top: 16px;
    border: 1px solid rgba(0,0,0,0.04);
}
.pledge-icon {
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 1px;
}
.pledge-text {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* 重置按钮区域 */
.reset-section {
    text-align: center;
    padding-top: 12px;
}
.reset-section .btn-ghost {
    font-size: 12px;
    color: var(--text-muted);
    padding: 6px 12px;
}
.reset-section .btn-ghost:hover {
    color: var(--red);
}

/* ===== 场景卡片精度引导角标 ===== */
.scene-card.has-precision-hint {
    /* 不再需要 position relative 或强制 padding bottom */
}
.precision-hint {
    align-self: flex-end;
    margin-top: auto;
    font-size: 10px;
    color: var(--gold);
    background: var(--gold-glow);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    z-index: 1;
}
.precision-hint:hover {
    background: var(--gold);
    color: #fff;
    transform: scale(1.05);
}

/* ===== Wiki 更新 toast 通知 ===== */
.wiki-update-toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--gold-border);
    color: var(--text-gold);
    font-size: 13px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    box-shadow: 0 4px 20px rgba(184, 149, 78, 0.15);
    z-index: 9999;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-family: var(--font);
}
.wiki-update-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================================
   锦囊面板 (Tips Panel) — 全量场景卡片分类展示
   ============================================================ */

/* 侧边栏锦囊按钮 */
.sidebar-tips-btn {
    margin: 0 16px 12px;
}
.btn-tips {
    width: 100%;
    padding: 11px 12px;
    background: linear-gradient(135deg, #fffdf8 0%, #faf6ed 100%);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    color: var(--text-gold);
    transition: all 0.2s;
    cursor: pointer;
    font-family: var(--font);
    font-size: 14px;
}
.btn-tips:hover {
    background: linear-gradient(135deg, #faf6ed 0%, #f5eedd 100%);
    border-color: var(--gold);
    box-shadow: 0 2px 12px rgba(184, 149, 78, 0.12);
}
.btn-tips .tips-icon {
    font-size: 18px;
}
.btn-tips .tips-count {
    margin-left: auto;
    font-size: 12px;
    background: var(--gold-glow);
    color: var(--gold);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 600;
}

/* 首页「更多锦囊」入口卡 */
.scene-card.card-more-tips {
    background: linear-gradient(135deg, #fdfcff 0%, #f8f6f0 100%);
    border: 1.5px dashed var(--gold-border);
    position: relative;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.scene-card.card-more-tips .scene-icon {
    font-size: 24px;
}
.scene-card.card-more-tips .scene-title {
    color: var(--text-gold);
}
.scene-card.card-more-tips .scene-desc {
    color: var(--text-muted);
    font-size: 12px;
}
.scene-card.card-more-tips:hover {
    border-color: var(--gold);
    background: linear-gradient(135deg, #faf6ed 0%, #f5eedd 100%);
    box-shadow: 0 4px 20px rgba(184, 149, 78, 0.12);
    transform: translateY(-2px);
}

/* 锦囊面板覆盖层 */
.tips-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.tips-panel-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 锦囊面板主体 */
.tips-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 520px;
    background: var(--bg-primary);
    z-index: 2001;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.08);
}
.tips-panel.active {
    transform: translateX(0);
}

.tips-panel-header {
    padding: 16px 24px;
    padding-top: calc(16px + var(--safe-top));
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}
.tips-panel-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.tips-panel-title .tips-title-icon {
    font-size: 22px;
}
.tips-panel-close {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.tips-panel-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

/* 锦囊内容区域 */
.tips-panel-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 20px 40px;
}

/* 分类标题 */
.tips-category {
    margin-bottom: 24px;
}
.tips-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.tips-category-icon {
    font-size: 16px;
}
.tips-category-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}
.tips-category-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

/* 锦囊面板内的卡片网格 */
.tips-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.tips-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid #eee;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}
.tips-card:hover {
    border-color: var(--gold-border);
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(184, 149, 78, 0.08);
}
.tips-card:active {
    transform: scale(0.98);
}
.tips-card-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}
.tips-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.tips-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tips-card-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 大衍推盘在锦囊面板中的特殊样式 */
.tips-card.tips-card-iching {
    background: #fdfcff;
    border-color: #e8e3f0;
}
.tips-card.tips-card-iching:hover {
    border-color: #d7cce6;
    box-shadow: 0 3px 12px rgba(118, 93, 160, 0.06);
}

/* 移动端适配 */
@media (max-width: 520px) {
    .tips-panel {
        max-width: 100%;
    }
    .tips-card-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== App 提示条 (微信/PWA) ===== */
.app-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    top: 16px;
    z-index: 9999;
    padding: 12px 44px 12px 14px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    animation: banner-slide-in 0.3s ease;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes banner-slide-in {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.app-banner.wechat-banner {
    background: linear-gradient(135deg, #07c160 0%, #05a350 100%);
    color: #fff;
}

.app-banner.pwa-banner {
    background: var(--gold-bg);
    border: 1.5px solid var(--gold-border);
}

.banner-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.banner-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.wechat-banner .banner-icon {
    opacity: 0.9;
}

.pwa-banner .banner-icon {
    color: var(--gold);
}

.banner-text-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.banner-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.wechat-banner .banner-title {
    color: #fff;
}

.pwa-banner .banner-title {
    color: var(--text-gold);
}

.banner-guide {
    font-size: 12px;
    line-height: 1.4;
    opacity: 0.9;
}

.wechat-banner .banner-guide {
    color: rgba(255,255,255,0.85);
}

.pwa-banner .banner-guide {
    color: var(--text-muted);
}

.banner-close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.2);
    color: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.wechat-banner .banner-close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.wechat-banner .banner-close:hover {
    background: rgba(255,255,255,0.3);
}

.pwa-banner .banner-close {
    background: var(--bg-secondary);
    color: var(--text-muted);
}

.pwa-banner .banner-close:hover {
    background: rgba(0,0,0,0.08);
    color: var(--text-primary);
}

/* --- 移动端原生化体验封印 (iOS PWA) --- */
html, body {
    overscroll-behavior-y: none; /* 禁止 Safari 顶底部的橡皮筋回弹效果 */
    -webkit-tap-highlight-color: transparent; /* 取消所有 iOS 触摸高亮（灰色块） */
}

/* 全局除特定输入与内容区外，禁止长按选中文本选框 */
body {
    -webkit-user-select: none;
    user-select: none;
}

/* 释放核心交互区的文本选择能力 (让 Boss 还能复制 AI 的回答/输入密码) */
.chat-message-content, .message-content, .msg.ai, input, textarea {
    -webkit-user-select: auto;
    user-select: auto;
}

/* 所有可点击元素统一触控规范 */
button, a, [onclick], .history-item, .scene-card, .menu-item,
.cognition-action-card, .tips-card, .quick-q-btn, .export-btn,
.hist-more-btn, .hist-action-item, .guidance-hint-tag,
.banner-close, .modal-close-btn, .btn, .focus-item {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* ===== 骨架屏样式 ===== */
.skeleton-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0 5%;
    max-width: 800px;
    margin: 40px auto 30px;
    width: 100%;
}
.skeleton-bar {
    border-radius: var(--radius-sm);
    background: #f0eee9;
}
.skeleton-card {
    flex: 0 0 180px;
    height: 100px;
    border-radius: var(--radius-md);
    background: #f0eee9;
}
@keyframes shimmer {
    0% { background-position: -468px 0; }
    100% { background-position: 468px 0; }
}
.skeleton-shimmer {
    background: linear-gradient(to right, #f0eee9 0%, #f8f6f1 20%, #f0eee9 40%, #f0eee9 100%);
    background-repeat: no-repeat;
    background-size: 800px 104px;
    animation: shimmer 1.2s linear infinite;
}
@media (max-width: 768px) {
    .skeleton-welcome {
        padding: 0 16px;
        margin: 20px auto 20px;
    }
    .skeleton-card {
        flex: 0 0 140px;
        height: 80px;
    }
}

/* ===== 账户设置弹窗 (重构后左右结构) ===== */
.account-settings-modal {
    max-width: 680px;
    height: 85vh;
    max-height: 600px;
    overflow: hidden;
    padding: 0;
    text-align: left;
    display: flex;
    flex-direction: column;
}

.account-settings-content-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.account-settings-sidebar {
    width: 160px;
    background: #f9f9f9;
    border-right: 1px solid rgba(0,0,0,0.06);
    padding: 24px 0;
    display: flex;
    flex-direction: column;
}

.account-settings-tab {
    padding: 12px 24px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    background: transparent;
    border: none;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.account-settings-tab:hover {
    background: rgba(0,0,0,0.03);
}

.account-settings-tab.active {
    color: var(--gold-dark);
    font-weight: 600;
    background: var(--gold-glow);
    border-right: 3px solid var(--gold);
}

.account-settings-panels {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
}

.account-settings-panel {
    display: none;
}

.account-settings-panel.active {
    display: block;
}

.account-settings-panel-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.account-settings-panel-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.account-settings-panel-header p {
    margin: 4px 0 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

@media (max-width: 600px) {
    .account-settings-modal {
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }
    
    .account-settings-content-wrapper {
        flex-direction: column;
    }
    
    .account-settings-sidebar {
        width: 100%;
        flex-direction: row;
        padding: 12px 16px;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid rgba(0,0,0,0.06);
    }
    
    .account-settings-sidebar > div {
        display: none; /* Hide '账户设置' title on mobile where space is tight */
    }
    
    .account-settings-tab {
        padding: 8px 16px;
        white-space: nowrap;
        border-right: none;
        border-bottom: 2px solid transparent;
        border-radius: 4px 4px 0 0;
    }
    
    .account-settings-tab.active {
        background: transparent;
        border-right: none;
        border-bottom: 2px solid var(--gold);
    }
    
    .account-settings-panels {
        padding: 16px;
    }
}

.account-settings-modal .section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.account-settings-modal .section-title svg {
    color: var(--gold);
}

.account-settings-modal .section-title.danger {
    color: var(--red);
}

.account-settings-modal .section-title.danger svg {
    color: var(--red);
}

.account-settings-modal .form-group {
    margin-bottom: 14px;
}

.account-settings-modal .form-group:last-child {
    margin-bottom: 0;
}

.account-settings-modal .form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.account-settings-modal .form-group input {
    width: 100%;
    padding: 11px 14px;
    font-size: 14px;
    border: 1px solid #e5e5e5;
    border-radius: var(--radius-sm);
    background: #fff;
    transition: all 0.2s;
    font-family: var(--font);
}

.account-settings-modal .form-group input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(184, 149, 78, 0.08);
}

.account-settings-modal .form-group input::placeholder {
    color: #bbb;
}

.account-settings-modal .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
    border: none;
}

.account-settings-modal .btn-gold {
    background: var(--gold);
    color: #fff;
}

.account-settings-modal .btn-gold:hover {
    background: var(--gold-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(184, 149, 78, 0.25);
}

.account-settings-modal .btn-outline {
    background: transparent;
    border: 1px solid #e0e0e0;
    color: var(--text-secondary);
}

.account-settings-modal .btn-outline:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--gold-bg);
}

.account-settings-modal .btn-danger {
    background: transparent;
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: var(--red);
    font-size: 13px;
    padding: 8px 14px;
    width: auto;
}

.account-settings-modal .btn-danger:hover {
    background: rgba(220, 38, 38, 0.05);
    border-color: var(--red);
}

.account-settings-modal .danger-zone {
    background: rgba(220, 38, 38, 0.02);
    border: 1px solid rgba(220, 38, 38, 0.08);
    border-radius: var(--radius-md);
    padding: 16px;
}

.account-settings-modal .danger-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.account-settings-modal .danger-info {
    flex: 1;
}

.account-settings-modal .danger-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.account-settings-modal .danger-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.account-settings-modal .modal-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 24px;
    border-top: 1px solid rgba(0,0,0,0.06);
    font-size: 11px;
    color: var(--text-muted);
}

.account-settings-modal .modal-footer .divider {
    color: #ddd;
}

/* 移动端适配 */
@media (max-width: 520px) {
    .account-settings-modal {
        max-width: 100%;
        max-height: 100dvh;
        border-radius: 0;
    }
    .account-settings-modal .modal-header {
        padding: 16px 20px;
    }
    .account-settings-modal .modal-body {
        padding: 20px;
    }
    .account-settings-modal .danger-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .account-settings-modal .btn-danger {
        width: 100%;
    }
}

/* ===== 多文件上传队列样式 ===== */
.file-queue-container {
    display: none;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid rgba(0,0,0,0.05);
    max-height: 120px;
    overflow-y: auto;
}

.file-queue-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: var(--radius-sm);
    min-width: 140px;
    max-width: 200px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.file-remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: var(--red);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 2;
}

.file-queue-item:hover .file-remove-btn {
    opacity: 1;
}

.file-thumb {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 4px;
    flex-shrink: 0;
    overflow: hidden;
}

.file-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-name {
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 11px;
    color: var(--text-muted);
}

/* 移动端适配 */
@media (max-width: 520px) {
    .file-queue-container {
        padding: 8px 12px;
        max-height: 100px;
    }
    
    .file-queue-item {
        min-width: 120px;
        max-width: 160px;
        padding: 6px 8px;
    }
    
    .file-thumb {
        width: 32px;
        height: 32px;
    }
    
    .file-remove-btn {
        opacity: 1;
        width: 16px;
        height: 16px;
        font-size: 10px;
    }
}

/* ===== 输入框上方文件预览 (ChatGPT/Gemini 风格) ===== */
.input-file-preview {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 16px 4px;
    margin: 0 auto 8px;
    max-width: 820px;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    z-index: 10;
}

.input-file-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 64px;
    flex-shrink: 0;
}

.input-file-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-file-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.input-file-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
}

.input-file-icon.pdf-icon {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}

.input-file-icon.excel-icon {
    background: linear-gradient(135deg, #217346 0%, #1e6a3f 100%);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}

.input-file-icon.csv-icon {
    background: linear-gradient(135deg, #4a90a4 0%, #3d7a8c 100%);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}

.input-file-remove {
    position: absolute;
    top: -4px;
    right: 0;
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 2;
}

.input-file-item:hover .input-file-remove {
    opacity: 1;
}

.input-file-name {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
    max-width: 60px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

/* 移动端适配 */
@media (max-width: 520px) {
    .input-file-preview {
        padding: 6px 12px 2px;
        margin: 0 12px;
    }
    
    .input-file-item {
        width: 56px;
    }
    
    .input-file-thumb {
        width: 48px;
        height: 48px;
    }
    
    .input-file-remove {
        opacity: 1;
        width: 16px;
        height: 16px;
    }
    
    .input-file-name {
        font-size: 9px;
        max-width: 52px;
    }
}

/* ===== 主动锦囊信号卡片 ===== */
.jinnang-signal-card {
    width: 100%;
    padding: 16px 18px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin-bottom: 12px;
    border: 1px solid transparent;
    animation: jinnang-breathe 3s ease-in-out infinite;
}

@keyframes jinnang-breathe {
    0%, 100% { box-shadow: 0 2px 12px rgba(0,0,0,0.04); }
    50% { box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
}

.jinnang-signal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 14px 14px 0 0;
}

.jinnang-signal-card:hover {
    transform: translateY(-1px);
}

/* 红色信号 */
.jinnang-red {
    background: linear-gradient(135deg, rgba(239,68,68,0.04) 0%, rgba(239,68,68,0.02) 100%);
    border-color: rgba(239,68,68,0.15);
}
.jinnang-red::before { background: linear-gradient(90deg, #ef4444, #f87171); }
.jinnang-red:hover { border-color: rgba(239,68,68,0.3); }
.jinnang-red .jinnang-signal-badge { color: #dc2626; background: rgba(239,68,68,0.08); }

/* 黄色信号 */
.jinnang-yellow {
    background: linear-gradient(135deg, rgba(245,158,11,0.04) 0%, rgba(245,158,11,0.02) 100%);
    border-color: rgba(245,158,11,0.15);
}
.jinnang-yellow::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.jinnang-yellow:hover { border-color: rgba(245,158,11,0.3); }
.jinnang-yellow .jinnang-signal-badge { color: #d97706; background: rgba(245,158,11,0.08); }

/* 绿色信号 */
.jinnang-green {
    background: linear-gradient(135deg, rgba(34,197,94,0.04) 0%, rgba(34,197,94,0.02) 100%);
    border-color: rgba(34,197,94,0.15);
}
.jinnang-green::before { background: linear-gradient(90deg, #22c55e, #4ade80); }
.jinnang-green:hover { border-color: rgba(34,197,94,0.3); }
.jinnang-green .jinnang-signal-badge { color: #16a34a; background: rgba(34,197,94,0.08); }

.jinnang-signal-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    margin-bottom: 8px;
}

.jinnang-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.4;
}

.jinnang-summary {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}

.jinnang-anchor {
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 0;
    margin-bottom: 10px;
    opacity: 0.8;
}

.jinnang-actions {
    display: flex;
    gap: 8px;
}

.jinnang-btn {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}

.jinnang-btn-primary {
    background: var(--gold);
    color: white;
}
.jinnang-btn-primary:hover {
    background: var(--gold-dark);
    transform: translateY(-1px);
}

.jinnang-btn-secondary {
    background: var(--bg-light);
    color: var(--text-secondary);
    border: 1px solid rgba(0,0,0,0.06);
}
.jinnang-btn-secondary:hover {
    background: var(--bg-hover);
}

.jinnang-btn-muted {
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    padding: 6px 12px;
}
.jinnang-btn-muted:hover {
    background: rgba(0,0,0,0.03);
    color: var(--red);
}

/* ===== 锦囊详情浮层 ===== */
.jinnang-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: jinnang-fade-in 0.25s ease;
}

@keyframes jinnang-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.jinnang-detail-panel {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 480px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    animation: jinnang-slide-up 0.3s ease;
}

@keyframes jinnang-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.jinnang-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.jinnang-detail-close {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--bg-light);
    border-radius: 8px;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.jinnang-detail-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.jinnang-detail-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
    line-height: 1.4;
}

.jinnang-detail-summary {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 16px;
    line-height: 1.6;
}

.jinnang-detail-content {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.7;
    padding: 16px;
    background: var(--bg-light);
    border-radius: 10px;
    margin-bottom: 16px;
    white-space: pre-wrap;
}

.jinnang-detail-anchor {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 12px;
    background: rgba(212,168,83,0.05);
    border-radius: 8px;
    margin-bottom: 16px;
    border-left: 3px solid var(--gold);
}

.jinnang-detail-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* 移动端适配 */
@media (max-width: 520px) {
    .jinnang-signal-card {
        padding: 14px 14px;
        margin-bottom: 10px;
    }
    .jinnang-title { font-size: 14px; }
    .jinnang-summary { font-size: 12px; }
    .jinnang-detail-panel {
        max-width: 100%;
        border-radius: 12px;
        padding: 18px;
    }
    .jinnang-detail-title { font-size: 16px; }
}

/* ===== 侧边栏新用户引导项 ===== */
.history-item.guide-item {
    border-left: 2px solid var(--gold);
    opacity: 0.85;
    transition: all 0.2s;
}
.history-item.guide-item:hover {
    opacity: 1;
    background: rgba(212,168,83,0.04);
}

/* ===== 读数据卡片样式 ===== */
.read-data-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px;
}

.rdu-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.rdu-header {
    text-align: center;
    margin-bottom: 24px;
}

.rdu-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: var(--gold-bg);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
}

.rdu-title {
    font-size: var(--fs-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.rdu-desc {
    font-size: var(--fs-sm);
    color: var(--text-muted);
}

.rdu-dropzone {
    border: 2px dashed rgba(0,0,0,0.12);
    border-radius: var(--radius-md);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-secondary);
}

.rdu-dropzone:hover {
    border-color: var(--gold);
    background: var(--gold-bg);
}

.rdu-dropzone.dragover {
    border-color: var(--gold);
    background: rgba(184, 149, 78, 0.08);
}

.rdu-upload-icon {
    color: var(--text-muted);
    margin-bottom: 12px;
}

.rdu-dropzone:hover .rdu-upload-icon {
    color: var(--gold);
}

.rdu-dropzone-text {
    font-size: var(--fs-base);
    color: var(--text-primary);
    margin-bottom: 8px;
}

.rdu-hint {
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.rdu-examples {
    margin-top: 20px;
    text-align: center;
}

.rdu-examples-label {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-right: 8px;
}

.rdu-tag {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    font-size: var(--fs-xs);
    color: var(--text-secondary);
    margin: 0 4px 4px 0;
}

/* 数据预览卡片 */
.rdu-data-preview {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid rgba(0,0,0,0.06);
}

.rdu-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.rdu-file-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rdu-file-icon {
    color: var(--gold);
}

.rdu-file-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: var(--fs-base);
}

.rdu-file-meta {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-top: 2px;
}

.rdu-status {
    font-size: var(--fs-xs);
    color: var(--green);
    background: rgba(5, 150, 105, 0.08);
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.rdu-schema-title {
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.rdu-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -20px;
    padding: 0 20px;
}

.rdu-preview-table {
    width: 100%;
    font-size: var(--fs-sm);
    border-collapse: collapse;
}

.rdu-preview-table th,
.rdu-preview-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    white-space: nowrap;
}

.rdu-preview-table th {
    background: var(--bg-secondary);
    font-weight: 500;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
}

.rdu-preview-table td {
    color: var(--text-primary);
}

/* 操作按钮 */
.rdu-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.rdu-actions button {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 对齐建议 */
.rdu-alignment-suggestion {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin: 16px 0;
    border: 1px solid var(--gold-border);
}

.rdu-alignment-suggestion h4 {
    font-size: var(--fs-base);
    color: var(--text-primary);
    margin-bottom: 8px;
}

.rdu-field-mappings {
    margin: 16px 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 12px;
}

.rdu-mapping-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.rdu-mapping-row:last-child {
    border-bottom: none;
}

.rdu-mapping-row.auto {
    color: var(--green);
}

.rdu-mapping-row.suggest {
    color: var(--orange);
}

.rdu-source-field,
.rdu-target-field {
    font-family: monospace;
    font-size: var(--fs-sm);
    padding: 4px 8px;
    background: var(--bg-card);
    border-radius: 4px;
}

.rdu-arrow {
    color: var(--text-muted);
}

.rdu-confidence {
    margin-left: auto;
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.rdu-alignment-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* 查询界面 */
.rdu-query-interface {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin: 16px 0;
    border: 1px solid rgba(0,0,0,0.06);
}

.rdu-query-input-area {
    margin-bottom: 16px;
}

.rdu-query-input-area label {
    display: block;
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.rdu-query-input-area textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: var(--radius-md);
    font-size: var(--fs-base);
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

.rdu-query-input-area textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-glow);
}

.rdu-suggestions {
    margin-bottom: 16px;
}

.rdu-suggestion-label {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
}

.rdu-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rdu-chips button {
    padding: 6px 14px;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.rdu-chips button:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--gold-bg);
}

/* 查询结果 */
.rdu-result-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin: 16px 0;
    border: 1px solid rgba(0,0,0,0.06);
}

.rdu-result-header {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.rdu-query-text {
    font-size: var(--fs-base);
    color: var(--text-primary);
    margin-bottom: 8px;
    font-style: italic;
}

.rdu-query-text::before {
    content: '"';
}

.rdu-query-text::after {
    content: '"';
}

.rdu-result-meta {
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.rdu-result-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -20px;
    padding: 0 20px;
}

.rdu-result-table {
    width: 100%;
    font-size: var(--fs-sm);
    border-collapse: collapse;
}

.rdu-result-table th,
.rdu-result-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    white-space: nowrap;
}

.rdu-result-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
}

.rdu-result-table td {
    color: var(--text-primary);
}

.rdu-more-hint {
    text-align: center;
    padding: 12px;
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.rdu-result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(0,0,0,0.04);
}

/* 状态提示 */
.rdu-loading,
.rdu-error,
.rdu-success,
.rdu-no-results {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    border-radius: var(--radius-md);
    margin: 16px 0;
    font-size: var(--fs-sm);
}

.rdu-loading {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.rdu-error {
    background: rgba(220, 38, 38, 0.06);
    color: var(--red);
}

.rdu-success {
    background: rgba(5, 150, 105, 0.06);
    color: var(--green);
}

.rdu-no-results {
    background: var(--bg-secondary);
    color: var(--text-muted);
    flex-direction: column;
    gap: 4px;
}

/* 响应式 */
@media (max-width: 640px) {
    .read-data-container {
        padding: 12px;
    }
    
    .rdu-card,
    .rdu-data-preview,
    .rdu-query-interface,
    .rdu-result-card {
        padding: 16px;
    }
    
    .rdu-actions {
        flex-direction: column;
    }
    
    .rdu-actions button {
        width: 100%;
        justify-content: center;
    }
}

/* 查询输入区 */
.rdu-query-section {
    margin-top: 20px;
    padding-top: 20px;
}

.rdu-query-divider {
    height: 1px;
    background: rgba(0,0,0,0.06);
    margin-bottom: 20px;
}

.rdu-query-box {
    display: flex;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: var(--radius-md);
    padding: 4px;
}

.rdu-query-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 12px;
    font-size: var(--fs-base);
    color: var(--text-primary);
    outline: none;
}

.rdu-query-input:disabled {
    color: var(--text-muted);
}

.rdu-query-input::placeholder {
    color: var(--text-muted);
}

.rdu-query-btn {
    background: var(--gold);
    border: none;
    color: white;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rdu-query-btn:hover:not(:disabled) {
    background: var(--gold-dark);
}

.rdu-query-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.rdu-query-hint {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-top: 8px;
    padding-left: 4px;
}

/* 已有数据提示 */
.rdu-existing-data {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 16px;
}

.rdu-existing-title {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-bottom: 8px;
}

.rdu-existing-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--fs-sm);
    color: var(--text-primary);
    padding: 4px 0;
}

.rdu-existing-item svg {
    color: var(--gold);
    flex-shrink: 0;
}

.rdu-existing-count {
    color: var(--text-muted);
    font-size: var(--fs-xs);
    margin-left: auto;
}

/* 底部输入框数据状态提示 */
.rdu-input-hint {
    padding: 8px 16px;
    background: var(--gold-bg);
    border-bottom: 1px solid var(--gold-border);
}

.rdu-data-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--fs-sm);
    color: var(--text-secondary);
}

.rdu-data-status svg {
    color: var(--gold);
    flex-shrink: 0;
}

.rdu-row-count {
    color: var(--text-muted);
    font-size: var(--fs-xs);
}
