/* ═══════════════════════════════════════════
   🐙 八爪鱼 — 微信/WhatsApp 白色主题
   ═══════════════════════════════════════════ */

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

:root {
    --header-bg: #ededed;
    --header-text: #191919;
    --chat-bg: #f0f0f0;
    --input-bg: #f7f7f7;
    --user-bubble: #95ec69;
    --user-text: #000;
    --bot-bubble: #fff;
    --bot-text: #1d1d1d;
    --text: #1d1d1d;
    --text-secondary: #888;
    --accent: #07c160;
    --accent-dim: rgba(7, 193, 96, 0.1);
    --border: rgba(0, 0, 0, 0.06);
    --shadow: rgba(0, 0, 0, 0.04);
}

/* 🌙 暗色模式 */
body.dark {
    --header-bg: #1a1a2e;
    --header-text: #e0e0e0;
    --chat-bg: #16213e;
    --input-bg: #1a1a2e;
    --user-bubble: #0f3460;
    --user-text: #e0e0e0;
    --bot-bubble: #1a1a2e;
    --bot-text: #d0d0d0;
    --text: #e0e0e0;
    --text-secondary: #888;
    --accent: #00d68f;
    --accent-dim: rgba(0, 214, 143, 0.15);
    --border: rgba(255, 255, 255, 0.08);
    --shadow: rgba(0, 0, 0, 0.2);
}

body.dark .header-avatar {
    background: transparent;
}

body.dark .header-name {
    color: #fff;
}

body.dark .header-status {
    color: #00d68f;
}

body.dark #input {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

html,
body {
    height: 100%;
    height: 100dvh; /* iOS 15.4+: 键盘弹出时自动缩小 */
    font-family: -apple-system, 'SF Pro', 'PingFang SC', sans-serif;
    background: var(--chat-bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    height: 100dvh; /* iOS 15.4+: 跟随 dvh 自适应键盘 */
    max-width: 500px;
    margin: 0 auto;
    background: var(--chat-bg);
}

/* ═══ 顶栏 — 右上角浮标 ═══ */
#header {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    left: max(12px, calc((100vw - 500px) / 2 + 12px));
    display: flex;
    align-items: center;
    padding: 5px 12px 5px 6px;
    background: var(--header-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08), 0 0 0 0.5px rgba(0, 0, 0, 0.05);
    z-index: 100;
    gap: 4px;
    transition: opacity 0.3s;
}

#header:hover {
    opacity: 0.7;
}

/* 🎛️ Header 操作按钮（统一 SVG 风格） */
.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.header-icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
}

.header-icon-btn:hover {
    color: var(--accent);
    background: var(--accent-dim);
}

.header-icon-btn:active {
    transform: scale(0.88);
}

.header-icon-btn.active {
    color: var(--accent);
    background: var(--accent-dim);
}

.header-btn-badge {
    position: absolute;
    top: 1px;
    right: 1px;
    min-width: 14px;
    height: 14px;
    background: #f06595;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    border-radius: 7px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 14px;
}

/* 🆕 新菜面板 */
.new-dishes-panel {
    position: fixed;
    top: max(46px, calc(env(safe-area-inset-top) + 36px));
    left: max(12px, calc((100vw - 500px) / 2 + 12px));
    right: max(12px, calc((100vw - 500px) / 2 + 12px));
    max-height: 60vh;
    overflow-y: auto;
    background: var(--bot-bubble);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 0 0 0.5px rgba(0, 0, 0, 0.05);
    z-index: 99;
    padding: 12px 14px;
    animation: panelSlideDown 0.25s ease;
    -webkit-overflow-scrolling: touch;
}

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

.new-dishes-panel .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.new-dishes-panel .panel-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
}

.new-dishes-panel .panel-close {
    font-size: 18px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 6px;
}

.new-dishes-panel .panel-close:active {
    background: var(--border);
}

.new-dishes-panel .date-group {
    margin-bottom: 12px;
}

.new-dishes-panel .date-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}

.new-dishes-panel .nd-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.new-dishes-panel .nd-item:last-child {
    border-bottom: none;
}

.new-dishes-panel .nd-cat {
    font-size: 14px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    padding-top: 1px;
}

.new-dishes-panel .nd-info {
    flex: 1;
    min-width: 0;
}

.new-dishes-panel .nd-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.new-dishes-panel .nd-cuisine {
    font-size: 10px;
    color: #e67700;
    background: rgba(230, 119, 0, 0.1);
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
    white-space: nowrap;
}

.new-dishes-panel .nd-detail {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 3px;
    line-height: 1.5;
}

.new-dishes-panel .nd-toggle {
    font-size: 11px;
    color: var(--accent);
    cursor: pointer;
    margin-top: 2px;
    display: inline-block;
}

.new-dishes-panel .nd-toggle:active {
    opacity: 0.6;
}

.new-dishes-panel .nd-loading {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

/* ════════ 预排菜卡片 ════════ */
.pre-menu-card {
    padding: 4px 0;
}
.pmc-header {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 2px;
}
.pmc-sub {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.pmc-date {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent, #51cf66);
    margin: 8px 0 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.pmc-count {
    font-size: 10px;
    background: rgba(81, 207, 102, 0.15);
    color: var(--accent, #51cf66);
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 500;
}
.pmc-dish {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 3px 0;
    border-bottom: 1px solid rgba(128,128,128,0.1);
}
.pmc-dish:last-child { border-bottom: none; }
.pmc-num {
    font-size: 12px;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent, #51cf66);
    font-weight: 700;
    margin-top: 2px;
}
.pmc-info { flex: 1; min-width: 0; }
.pmc-name { font-size: 13px; font-weight: 600; }
.pmc-cuisine {
    font-size: 10px;
    color: #e67700;
    background: rgba(230, 119, 0, 0.1);
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
    white-space: nowrap;
}
.pmc-cat {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
    white-space: nowrap;
}
.cat-meat { background: rgba(81,207,102,0.15); color: #51cf66; }
.cat-seafood { background: rgba(34,139,230,0.15); color: #228be6; }
.cat-soup { background: rgba(255,146,43,0.15); color: #ff922b; }
.cat-veggie { background: rgba(64,192,87,0.15); color: #40c057; }
.pmc-reason {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.3;
    margin-top: 1px;
}
.pmc-more-btn {
    font-size: 12px;
    color: var(--accent, #51cf66);
    text-align: center;
    padding: 8px 0 4px;
    cursor: pointer;
    opacity: 0.9;
}
.pmc-more-btn:hover { opacity: 1; text-decoration: underline; }
.pmc-tip {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 8px;
    text-align: center;
    opacity: 0.8;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--header-text);
}

.header-status {
    font-size: 10px;
    color: var(--accent);
}

/* ═══ 消息区 ═══ */
#messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow-y: auto;
    padding: 52px 12px 12px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    background: var(--chat-bg);
}

#messages.chat-flow-bottom::before {
    content: "";
    display: block;
    flex: 1 1 0;
    min-height: 0;
}

#messages > .msg,
#messages > .summary-btn-container,
#messages > .suggestions-container {
    flex-shrink: 0;
}

/* ═══ 消息气泡 ═══ */
.msg {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    margin-bottom: 16px;
    animation: msgIn 0.2s ease;
}

.msg.user {
    align-items: flex-end;
}

.msg.bot {
    align-items: flex-start;
}
.msg.bot .bubble::before {
    display: none;
}
.msg.bot .bubble {
    margin-left: 0;
}


.bubble {
    max-width: 92%;  /* AI 回复默认扩宽，表格不再挤压 */
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 15px;
    line-height: 1.5;
    word-break: break-word;
    position: relative;
    box-shadow: 0 1px 1px var(--shadow);
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

.msg.user .bubble {
    max-width: 78%;  /* 用户气泡保持紧凑，不撑满全宽 */
    background: var(--user-bubble);
    color: var(--user-text);
    border-top-right-radius: 2px;
}

.msg.bot .bubble {
    background: var(--bot-bubble);
    color: var(--bot-text);
    border-top-left-radius: 2px;
}

.bubble strong {
    font-weight: 600;
}

.msg-time {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
    padding: 0 4px;
    opacity: 0.5;
}

.msg-actions {
    text-align: right;
    margin-top: 2px;
}

.copy-msg-btn {
    font-size: 14px;
    cursor: pointer;
    opacity: 0.5;
    padding: 2px 4px;
}

.copy-msg-btn:active {
    opacity: 1;
}

@keyframes msgIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══ 菜谱卡片 ═══ */
.recipe-card {
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--accent-dim);
    border-radius: 6px;
    border-left: 3px solid var(--accent);
}

.recipe-card h4 {
    font-size: 14px;
    color: var(--accent);
    margin-bottom: 8px;
}

.dish-item {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.dish-item:last-child {
    border-bottom: none;
}

.dish-num {
    font-size: 16px;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
    padding-top: 1px;
}

.dish-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.dish-info h5 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.dish-toggle {
    font-size: 12px;
    color: var(--accent);
    cursor: pointer;
    margin-top: 4px;
    display: inline-block;
}

.dish-toggle:active {
    opacity: 0.6;
}

.copy-menu-btn {
    display: block;
    text-align: center;
    margin-top: 10px;
    padding: 8px;
    font-size: 13px;
    color: var(--accent);
    background: var(--accent-dim);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-menu-btn:active {
    transform: scale(0.97);
    opacity: 0.7;
}

.dish-detail {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dashed var(--border);
}

.dish-cat {
    font-size: 11px;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 1px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.dish-reason {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 3px;
}

.dish-ingredients {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.dish-method {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
    line-height: 1.5;
}

.shopping-list {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

/* 下午茶推荐 */
.snack-section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}

.snack-section h5 {
    font-size: 13px;
    color: #d97706;
    margin-bottom: 4px;
}

.shopping-list h5 {
    font-size: 13px;
    color: var(--accent);
    margin-bottom: 4px;
}

.shopping-list ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.shopping-list li {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    background: var(--accent-dim);
    padding: 3px 8px;
    border-radius: 4px;
    color: var(--text-secondary);
}

.shop-name {
    white-space: nowrap;
}

.hema-badge {
    font-size: 10px;
    white-space: nowrap;
}

.hema-badge.in-stock {
    color: #16a34a;
}

.hema-badge.out-stock {
    color: #dc2626;
}

.hema-badge.unchecked {
    color: #9ca3af;
}

.hema-badge.loading {
    color: #9ca3af;
}

.hema-img {
    cursor: pointer;
    text-decoration: none;
}

/* 截图弹窗 */
.screenshot-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.screenshot-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* ═══ 打字指示器 ═══ */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 14px 16px !important;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.3;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ═══ 欢迎页 ═══ */
.welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;   /* 从顶部开始排列 */
    padding: 20px 16px 12px;       /* 大幅压缩，留出按钮空间 */
    text-align: center;
    /* 撑满消息区但不超出 */
    min-height: 100%;
    box-sizing: border-box;
}

.welcome-avatar {
    font-size: 64px;
    margin-bottom: 12px;
    animation: welcomePulse 2s infinite;
}

@keyframes welcomePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.welcome-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 6px;
}

.welcome-disclaimer {
    max-width: 320px;
    margin: 0 0 14px;
    color: rgba(255, 255, 255, 0.46);
    font-size: 11px;
    line-height: 1.45;
}

.pending-message-notice {
    align-self: flex-end;
    max-width: min(78%, 360px);
    margin: 4px 16px 8px auto;
    padding: 7px 10px;
    border: 1px solid rgba(20, 184, 166, 0.28);
    border-radius: 12px;
    background: rgba(20, 184, 166, 0.12);
    color: rgba(255, 255, 255, 0.78);
    font-size: 12px;
    line-height: 1.45;
    text-align: left;
}

/* 题目区：内容可滚动，不占满整屏 */
.quick-btns {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 360px;
    padding: 0 4px 8px;
}

.quick-btns button {
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bot-bubble);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.quick-btns button:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
}

.quick-btns button:active {
    transform: scale(0.97);
}

/* 换一批按钮：样式突出，宽度适中 */
.quick-btns button[data-refresh="1"] {
    width: 100%;
    max-width: 180px;
    margin-top: 4px;
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.7);
    font-size: 12px;
}

.quick-btns button[data-refresh="1"]:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.9);
}

/* ═══ 输入栏 ═══ */
#input-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 12px;
    background: var(--input-bg);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
}

#input {
    flex: 1;
    border: none;
    outline: none;
    background: var(--bot-bubble);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    line-height: 1.4;
    box-shadow: 0 0 0 1px var(--border);
}

#input::placeholder {
    color: #bbb;
}

#send-btn {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: none;
    background: var(--accent);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

#send-btn:hover {
    opacity: 0.9;
}

#send-btn:active {
    transform: scale(0.93);
}

#send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ═══ 🎤 语音按钮 / 📷 图片按钮 ═══ */
#mic-btn,
#cam-btn {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

#mic-btn:hover {
    color: var(--accent);
    background: var(--accent-dim);
}

#mic-btn:active {
    transform: scale(0.93);
}

#mic-btn.recording {
    color: #fff;
    background: #e74c3c;
    animation: mic-pulse 1.2s ease-in-out infinite;
}

#mic-btn.no-support {
    display: none;
}

@keyframes mic-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.5);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(231, 76, 60, 0);
    }
}

/* ═══ 下拉刷新 & 加载更多 ═══ */
.pull-indicator {
    text-align: center;
    padding: 12px;
    color: var(--text-secondary);
    font-size: 13px;
    transition: opacity 0.2s;
}

.load-more {
    text-align: center;
    padding: 8px 0 4px;
}

.load-more button {
    background: none;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 6px 16px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}

.load-more button:active {
    background: var(--border);
}

/* ═══ 历史面板 ═══ */
.history-panel {
    position: fixed;
    top: max(46px, calc(env(safe-area-inset-top) + 36px));
    left: max(12px, calc((100vw - 500px) / 2 + 12px));
    right: max(12px, calc((100vw - 500px) / 2 + 12px));
    max-height: 60vh;
    overflow-y: auto;
    background: var(--bot-bubble);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 0 0 0.5px rgba(0, 0, 0, 0.05);
    z-index: 99;
    padding: 12px 14px;
    animation: panelSlideDown 0.25s ease;
    -webkit-overflow-scrolling: touch;
}

.history-panel .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.history-panel .panel-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
}

.history-panel .panel-close {
    font-size: 18px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 6px;
}

.history-panel .panel-close:active {
    background: var(--border);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-loading,
.history-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.history-item:hover {
    background: var(--accent-dim);
}

.history-item:active {
    background: var(--border);
}

.history-item.active {
    background: var(--accent-dim);
    border-left: 3px solid var(--accent);
}

.history-item-main {
    flex: 1;
    min-width: 0;
}

.history-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-preview {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.history-item-meta {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    font-size: 10px;
    color: var(--text-secondary);
    opacity: 0.7;
}

.history-item-del {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.4;
    transition: all 0.2s;
    flex-shrink: 0;
}

.history-item-del:hover {
    opacity: 1;
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

/* fx-active 特效模式适配 */
body.fx-active .history-panel {
    background: rgba(0, 0, 20, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.fx-active .history-item-title {
    color: rgba(255, 255, 255, 0.92);
}

body.fx-active .history-item-preview {
    color: rgba(255, 255, 255, 0.5);
}

body.fx-active .history-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

body.fx-active .history-item.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ═══ 响应式 ═══ */
@media (min-width: 501px) {
    body {
        background: #e5e5e5;
    }

    #app {
        border-left: 1px solid #ddd;
        border-right: 1px solid #ddd;
    }
}

/* ═══ 统一消息间距 ═══ */
/* SSE 流式回复（thinking-chain 创建的 .message.assistant）*/
.message.assistant {
    margin-bottom: 16px;
}
/* 追问建议容器 */
.suggestions-container {
    margin-bottom: 16px;
}

/* 图表在深海/极光皮肤下需要独立的可读承载面，避免图例和标题沉到背景里。 */
body.fx-active .chart-container,
body.fx-active .chart-container-child {
    background: rgba(4, 14, 45, 0.26);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.fx-active .chart-container-inline {
    margin: 16px -2px 20px !important;
}

body.fx-active .chart-container-multi {
    background: transparent;
    border: 0;
    box-shadow: none;
}

body.fx-active .long-answer-section-header,
body.fx-active .long-answer-toggle {
    color: rgba(255, 255, 255, 0.82) !important;
}
