﻿/* ================================================================
   EvoMind Design System v3 — 极简全屏对话
   ================================================================ */

:root {
    --bg-deep: oklch(10% 0.005 250);
    --bg-card: oklch(14% 0.006 250);
    --bg-card-hover: oklch(17% 0.006 250);
    --bg-elevated: oklch(18% 0.006 250);
    --bg-surface: oklch(22% 0.006 250);
    --bg-input: oklch(15% 0.004 250);

    --bg-blue: oklch(24% 0.04 250 / 0.35);
    --bg-green: oklch(24% 0.04 160 / 0.35);
    --bg-orange: oklch(24% 0.04 70 / 0.35);
    --bg-red: oklch(24% 0.04 15 / 0.35);

    --border-subtle: oklch(100% 0 0 / 0.05);
    --border-def: oklch(100% 0 0 / 0.08);
    --border-hov: oklch(100% 0 0 / 0.14);
    --border-focus: oklch(70% 0.15 250);

    --txt-pri: oklch(96% 0.003 250);
    --txt-sec: oklch(78% 0.003 250);
    --txt-ter: oklch(58% 0.003 250);
    --txt-qua: oklch(42% 0.003 250);

    --accent: #0A84FF;
    --accent-dim: oklch(55% 0.1 250 / 0.15);
    --green: #34C759;
    --orange: #FF9F0A;
    --red: #FF453A;
    --purple: #BF5AF2;

    --space-1: 4px; --space-2: 8px; --space-3: 12px;
    --space-4: 16px; --space-5: 20px; --space-6: 24px;
    --space-8: 32px; --space-10: 40px; --space-12: 48px;

    --radius-xs: 6px; --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px;

    --font-ui: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-fast: 150ms;

    --chat-max-width: 760px;
    --panel-width: 520px;
}

/* 浅色主题 */
:root.light {
    --bg-deep: oklch(97% 0.003 250);
    --bg-card: oklch(100% 0 0);
    --bg-card-hover: oklch(95% 0.003 250);
    --bg-elevated: oklch(100% 0 0);
    --bg-surface: oklch(93% 0.005 250);
    --bg-input: oklch(96% 0.002 250);

    --bg-blue: oklch(90% 0.04 250 / 0.5);
    --bg-green: oklch(90% 0.04 160 / 0.5);
    --bg-orange: oklch(90% 0.04 70 / 0.5);
    --bg-red: oklch(90% 0.04 15 / 0.5);

    --border-subtle: oklch(0% 0 0 / 0.06);
    --border-def: oklch(0% 0 0 / 0.10);
    --border-hov: oklch(0% 0 0 / 0.16);
    --border-focus: oklch(50% 0.15 250);

    --txt-pri: oklch(15% 0.003 250);
    --txt-sec: oklch(35% 0.003 250);
    --txt-ter: oklch(50% 0.003 250);
    --txt-qua: oklch(62% 0.003 250);

    --accent-dim: oklch(55% 0.1 250 / 0.10);
}

/* 浅色主题下嵌入卡片的微调 */
:root.light .stat-card { background: oklch(0% 0 0 / 0.03); border-color: oklch(0% 0 0 / 0.06); }
:root.light .stat-card:hover { background: oklch(0% 0 0 / 0.06); border-color: oklch(0% 0 0 / 0.10); }
:root.light .section-header:hover { background: oklch(0% 0 0 / 0.03); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    height: 100%; font-family: var(--font-ui);
    line-height: 1.6; color: var(--txt-pri); background: var(--bg-deep);
    -webkit-font-smoothing: antialiased; overflow: hidden;
}
a { color: var(--accent); text-decoration: none; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hov); border-radius: 3px; }

/* ================================================================
   App 主布局 — 全屏对话
   ================================================================ */
.app-main {
    display: flex; flex-direction: column;
    height: 100vh; height: 100dvh; width: 100%;
}
.chat-full {
    flex: 1; display: flex; flex-direction: column;
    min-height: 0; position: relative;
}

/* 欢迎语由 .chat-messages 内部的 .chat-welcome 负责 */

/* ================================================================
   登录页
   ================================================================ */
.auth-page {
    display: flex; align-items: center; justify-content: center;
    height: 100vh; height: 100dvh; width: 100%;
}

.auth-container {
    display: flex; flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 420px; width: 100%;
    padding: var(--space-6);
}

.auth-header {
    text-align: center;
    margin-bottom: var(--space-6);
}

.auth-logo {
    font-size: 32px; font-weight: 700;
    color: var(--txt-pri);
    margin-bottom: var(--space-2);
}

.auth-subtitle {
    font-size: 14px; color: var(--txt-ter);
}

.auth-title {
    font-size: 20px; font-weight: 600;
    color: var(--txt-pri);
    margin-bottom: var(--space-4);
    text-align: center;
}

.glass-panel {
    background: var(--bg-card); border: 1px solid var(--border-def);
    border-radius: var(--radius-lg); padding: var(--space-6);
    width: 100%;
}

.glass-input {
    background: var(--bg-input); border: 1px solid var(--border-def);
    border-radius: var(--radius-sm); color: var(--txt-pri);
    font-size: 14px; padding: 10px 14px; width: 100%;
    outline: none; transition: border-color var(--duration-fast);
}
.glass-input:focus { border-color: var(--border-focus); }

.auth-switch {
    text-align: center; font-size: 13px; color: var(--txt-ter);
    margin-top: var(--space-4);
}
.auth-switch a { color: var(--accent); cursor: pointer; }
.auth-switch a:hover { text-decoration: underline; }

/* ================================================================
   聊天消息
   ================================================================ */
.chat-messages {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    padding: var(--space-5) 0 var(--space-6) 0;
    scroll-behavior: smooth;
    display: flex; flex-direction: column;
}
.chat-welcome {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center; padding: var(--space-6);
    transition: opacity 0.3s var(--ease-out);
}
.chat-welcome.hidden { display: none; }
.chat-welcome h2 {
    font-size: 28px; font-weight: 700;
    margin-bottom: var(--space-2); color: var(--txt-pri);
}
.chat-welcome p {
    font-size: 15px; color: var(--txt-ter);
    max-width: 360px;
}

.chat-message {
    max-width: var(--chat-max-width); width: 100%;
    margin: 0 auto;
    padding: var(--space-3) var(--space-5);
    font-size: 14px; line-height: 1.7;
    animation: messageIn 0.2s var(--ease-out);
    position: relative;
}
.chat-message.user { display: flex; flex-direction: column; align-items: flex-end; }
.chat-message.assistant { display: block; }
.chat-message.system { text-align: center; font-size: 12px; color: var(--txt-ter); padding: 2px 12px; }

.msg-content { max-width: 85%; }
/* 思考动画 */
.thinking-dots { display: inline-flex; gap: 3px; align-items: center; }
.thinking-dots span {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--txt-ter);
    animation: thinkBounce 1.4s ease-in-out infinite both;
}
.thinking-dots span:nth-child(1) { animation-delay: 0s; }
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinkBounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* Markdown 样式 */
.msg-content h2 { font-size: 16px; font-weight: 700; margin: 12px 0 6px; }
.msg-content h3 { font-size: 15px; font-weight: 600; margin: 10px 0 4px; }
.msg-content h4 { font-size: 14px; font-weight: 600; margin: 8px 0 4px; }
.msg-content ul { padding-left: 16px; margin: 4px 0; }
.msg-content li { margin: 2px 0; line-height: 1.5; }
.msg-content strong { font-weight: 700; color: var(--txt-pri); }
.msg-content em { font-style: italic; }
.msg-content code {
    background: var(--bg-surface); padding: 1px 5px;
    border-radius: 4px; font-size: 12px; font-family: monospace;
}
.msg-content pre {
    background: var(--code-bg, var(--bg-deep));
    color: var(--code-color, inherit);
    padding: 28px 12px 12px 12px; border-radius: 8px;
    overflow-x: auto; margin: 8px 0; font-size: 12px;
    position: relative;
}
.msg-content pre code { background: none; padding: 0; }
.code-lang-label {
    position: absolute; top: 4px; left: 12px;
    font-size: 10px; color: var(--txt-qua);
    text-transform: uppercase; letter-spacing: 0.04em;
    font-weight: 600;
}
.code-copy-btn {
    position: absolute; top: 4px; right: 8px;
    background: oklch(100% 0 0 / 0.08); border: 1px solid var(--border-subtle);
    color: var(--txt-ter); font-size: 10px; padding: 1px 7px;
    border-radius: 4px; cursor: pointer; transition: all 0.12s;
}
.code-copy-btn:hover { background: oklch(100% 0 0 / 0.14); color: var(--txt-pri); }

.msg-content p { margin: 0 0 8px 0; line-height: 1.7; }
.msg-content p:last-child { margin-bottom: 0; }

.msg-time {
    font-size: 10px; color: var(--txt-qua);
    margin-top: 2px; opacity: 0.4;
}
.chat-message.user .msg-time { text-align: right; padding-right: 2px; }
.chat-message.assistant .msg-time { text-align: left; padding-left: 2px; }

.chat-message.user .msg-content {
    background: var(--accent-dim); border: 1px solid oklch(65% 0.15 250 / 0.2);
    border-radius: 16px;
    padding: var(--space-3) var(--space-4);
    color: var(--txt-pri);
}
.chat-message.user { position: relative; }
.chat-message.user .msg-actions { right: 12px; bottom: 24px; }

.chat-message.assistant .msg-content {
    padding: 0;
    max-width: 100%;
}

/* Agent 状态指示 — 独立一行 */
.agent-status-bar {
    display: flex; align-items: center; gap: var(--space-2);
    margin-bottom: var(--space-2);
}

/* Agent 协作状态卡片 — 三列并排 + 动画 */
.agent-status-card {
    margin: 8px auto 4px; max-width: var(--chat-max-width);
    padding: 12px 16px;
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 12px;
    animation: cardSlideIn 0.3s var(--ease-out);
}
.agent-status-card.collapsed .agent-progress-bar,
.agent-status-card.collapsed .agent-timeline { display: none; }
.agent-status-card.collapsed .agent-card-arrow { transform: rotate(-90deg); }

.agent-card-header {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; user-select: none;
    padding-bottom: 8px;
}
.agent-card-arrow {
    font-size: 9px; color: var(--txt-ter);
    transition: transform 0.2s var(--ease-out);
    display: inline-block;
}
.agent-card-title {
    flex: 1; font-size: 11px; color: var(--txt-ter);
    text-transform: uppercase; letter-spacing: 0.5px; font-weight: 500;
}
.agent-progress-text {
    font-size: 10px; color: var(--txt-qua); font-weight: 500;
}

.agent-progress-bar {
    height: 2px; background: var(--bg-input); border-radius: 1px;
    overflow: hidden; margin-bottom: 10px;
}
.agent-progress-fill {
    height: 100%; background: #34C759;
    border-radius: 1px; transition: width 0.4s var(--ease-out);
}

.agent-timeline {
    display: flex; flex-direction: column; gap: 0;
}
.agent-step {
    display: flex; gap: 10px; padding: 6px 0;
    position: relative;
}
.agent-step:not(:last-child)::after {
    content: ''; position: absolute;
    left: 7px; top: 22px; bottom: -6px;
    width: 1px; background: var(--border-subtle);
}
.agent-step.done:not(:last-child)::after { background: #34C759; }

.agent-step-left { flex-shrink: 0; padding-top: 2px; }
.agent-step-dot {
    width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid var(--border-subtle);
    background: transparent; display: inline-block;
    transition: all 0.3s var(--ease-out);
}
.agent-step.waiting .agent-step-dot { opacity: 0.4; }
.agent-step.running .agent-step-dot {
    border-color: #007AFF !important; background: #007AFF !important;
    animation: dotPulse 1.2s ease-in-out infinite;
}
.agent-step.done .agent-step-dot {
    border-color: #34C759 !important; background: #34C759 !important;
}
.agent-step.error .agent-step-dot {
    border-color: #FF3B30 !important; background: #FF3B30 !important;
}

.agent-step-right { flex: 1; min-width: 0; }
.agent-step-header {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 500; color: var(--txt-pri);
}
.agent-step-icon { flex-shrink: 0; }
.agent-step-name { flex: 1; }
.agent-step-body-wrap {
    max-height: 200px; overflow-y: auto; overflow-x: hidden;
    margin-top: 4px; position: relative;
}
.agent-step-body {
    font-size: 11px; color: var(--txt-ter);
    line-height: 1.5; white-space: pre-wrap; word-break: break-all;
}
.agent-copy-btn {
    display: block; margin: 4px 0 0 auto; padding: 2px 8px;
    font-size: 10px; background: var(--bg-input);
    border: 1px solid var(--border-subtle); border-radius: 4px;
    color: var(--txt-sec); cursor: pointer;
}
.agent-copy-btn:hover { background: var(--bg-surface); }

.agent-step-badge {
    font-size: 10px; padding: 1px 6px; border-radius: 8px;
    font-weight: 500; flex-shrink: 0;
}
.badge-waiting { background: var(--bg-surface); color: var(--txt-qua); }
.badge-running { background: rgba(0,122,255,0.1); color: #007AFF; }
.badge-done { background: rgba(52,199,89,0.1); color: #34C759; }
.badge-failed { background: rgba(255,59,48,0.1); color: #FF3B30; }

.collab-summary-box {
    border: 1px solid var(--border-subtle);
    border-radius: 8px; overflow: hidden;
    margin-bottom: 8px;
}
.collab-summary-header {
    font-size: 10px; color: var(--txt-ter);
    text-transform: uppercase; letter-spacing: 0.5px;
    padding: 6px 12px; background: var(--bg-input);
    font-weight: 500;
}
.collab-summary-body {
    padding: 10px 12px; font-size: 13px; line-height: 1.6;
    color: var(--txt-pri);
}

/* ── 工具调用卡片（ReAct 模式）── */
.tool-calls-card {
    margin: 8px auto 4px; max-width: var(--chat-max-width);
    padding: 8px 12px;
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    animation: cardSlideIn 0.3s var(--ease-out);
}
.tool-call-item {
    padding: 6px 0;
    border-bottom: 1px solid var(--border-subtle);
}
.tool-call-item:last-child { border-bottom: none; }
.tool-call-header {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--txt-sec);
}
.tool-call-icon {
    flex-shrink: 0; color: var(--txt-ter);
    transition: color 0.3s var(--ease-out);
}
.tool-call-icon.spin {
    animation: dotSpin 1s linear infinite;
    color: #007AFF;
}
.tool-call-name {
    font-weight: 500; color: var(--txt-pri);
    flex-shrink: 0; font-size: 12px;
}
.tool-call-arg {
    flex: 1; min-width: 0;
    font-size: 11px; color: var(--txt-qua);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-family: var(--font-mono, monospace);
}
.tool-call-badge {
    font-size: 10px; padding: 1px 6px; border-radius: 8px;
    font-weight: 500; flex-shrink: 0;
}
.tool-call-body {
    margin-top: 4px; padding: 6px 8px;
    background: var(--bg-input); border-radius: 4px;
    font-size: 11px; color: var(--txt-ter);
    max-height: 150px; overflow-y: auto;
    line-height: 1.5;
}

/* 流式代码块 — 输入中状态 */
pre.streaming-code {
    border-left: 2px solid #007AFF;
    opacity: 0.9;
}
pre.streaming-code .code-lang-label {
    color: #007AFF;
}

/* 工具调用卡片 — 中文标签 */
.tool-call-name {
    font-weight: 500;
    color: var(--txt-pri);
    font-size: 12px;
    min-width: 80px;
}
.badge-running { background: rgba(0,122,255,0.12); color: #007AFF; }
.badge-done { background: rgba(52,199,89,0.12); color: #34C759; }
.badge-failed { background: rgba(255,59,48,0.12); color: #FF3B30; }

/* 代码 diff 视图 */
.diff-line {
    font-family: var(--font-mono, "SF Mono", monospace);
    font-size: 10px;
    line-height: 1.6;
    padding: 0 4px;
    white-space: pre-wrap;
    word-break: break-all;
}
.diff-add { background: rgba(52,199,89,0.08); color: #34C759; }
.diff-del { background: rgba(255,59,48,0.08); color: #FF3B30; }
.diff-hunk { color: #007AFF; font-weight: 500; }
.diff-ctx { color: var(--txt-qua); }

/* Artifact 预览卡片 */
.artifact-card {
    margin: 8px 0; border: 1px solid var(--border-subtle);
    border-radius: 8px; overflow: hidden;
    background: var(--bg-card);
}
.artifact-header {
    padding: 8px 12px; background: var(--bg-input);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 12px; font-weight: 500; color: var(--txt-sec);
}
.artifact-preview {
    padding: 0; background: #fff;
}
.artifact-iframe {
    width: 100%; min-height: 300px; border: none;
    display: block;
}
.artifact-code {
    padding: 0; overflow-x: auto;
}
.artifact-code pre {
    margin: 0; border: none; border-radius: 0;
}

/* Artifact 操作按钮 */
.artifact-actions {
    display: flex; gap: 2px; margin-right: 8px;
}
.artifact-action-btn {
    width: 26px; height: 26px; padding: 0;
    border: none; background: transparent;
    color: var(--txt-ter); cursor: pointer;
    border-radius: 4px; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s var(--ease-out);
}
.artifact-action-btn:hover {
    background: var(--bg-input); color: var(--txt-pri);
}

/* 全屏预览 */
.artifact-fullscreen-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999; background: rgba(0,0,0,0.85);
    display: flex; flex-direction: column;
}
.artifact-fullscreen-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; color: #fff; font-size: 13px;
    background: rgba(255,255,255,0.05);
}
.artifact-fullscreen-iframe {
    flex: 1; width: 100%; border: none; background: #fff;
}

/* diff Accept/Reject 按钮 */
.diff-action-bar {
    display: flex; align-items: center; gap: 8px;
    margin-top: 6px; padding-top: 6px;
    border-top: 1px solid var(--border-subtle);
}
.btn-accept {
    background: rgba(52,199,89,0.12) !important;
    color: #34C759 !important;
    border: 1px solid rgba(52,199,89,0.3) !important;
}
.btn-accept:hover {
    background: rgba(52,199,89,0.2) !important;
}
.btn-reject {
    background: rgba(255,59,48,0.08) !important;
    color: #FF3B30 !important;
    border: 1px solid rgba(255,59,48,0.2) !important;
}
.btn-reject:hover {
    background: rgba(255,59,48,0.15) !important;
}

/* ═══ 号仓面板 v5 ═══ */

/* 概览卡片 */
.wh-ov { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
.wh-ov-card {
    padding: 12px 10px; border-radius: 10px; background: var(--bg-card);
    border: 1px solid var(--border-subtle); text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.wh-ov-card:hover { border-color: var(--border-hov); }
.wh-ov-icon { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; margin: 0 auto 8px; }
.wh-ov-ic1 { background: oklch(60% 0.12 250 / 0.12); color: oklch(70% 0.12 250); }
.wh-ov-ic2 { background: rgba(52,199,89,0.12); color: #34C759; }
.wh-ov-ic3 { background: rgba(255,59,48,0.12); color: #FF3B30; }
.wh-ov-ic4 { background: rgba(10,132,255,0.12); color: #0A84FF; }
.wh-ov-ic5 { background: rgba(255,159,10,0.12); color: #FF9F0A; }
.wh-ov-num { font-size: 20px; font-weight: 700; color: var(--txt-pri); line-height: 1.2; }
.wh-ov-green { color: #34C759; }
.wh-ov-red { color: #FF3B30; }
.wh-ov-blue { color: #0A84FF; }
.wh-ov-orange { color: #FF9F0A; }
.wh-ov-label { font-size: 11px; color: var(--txt-ter); margin-top: 2px; }

/* 按钮栏 */
.wh-bar { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.wh-bar-btns { display: flex; gap: 6px; }
.wh-bar-right { display: flex; align-items: center; gap: 14px; }
.wh-bar-rot { display: flex; align-items: center; gap: 8px; }
.wh-bar-rot span { font-size: 11px; color: var(--txt-ter); white-space: nowrap; }
.wh-bar-rot select { padding: 5px 10px; font-size: 11px; background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: 6px; color: var(--txt-pri); cursor: pointer; }
.wh-bar-rot em { font-size: 10px; color: var(--txt-qua); font-style: normal; }

/* 自动签到 */
.wh-bar-auto-signin { display: flex; align-items: center; gap: 6px; }
.wh-bar-auto-signin > span { font-size: 11px; color: var(--txt-ter); white-space: nowrap; }
.wh-time-input {
    padding: 5px 8px; font-size: 11px; background: var(--bg-input);
    border: 1px solid var(--border-subtle); border-radius: 6px; color: var(--txt-pri);
    width: 72px; text-align: center; cursor: pointer;
}
.wh-time-sep { font-size: 10px; color: var(--txt-qua); }
.wh-auto-toggle { display: inline-block; width: 32px; height: 20px; position: relative; cursor: pointer; flex-shrink: 0; }
.wh-auto-toggle input { display: none; }
.wh-auto-toggle b { position: absolute; top:0; left:0; right:0; bottom:0; background: var(--border-subtle); border-radius: 10px; transition: 0.2s; }
.wh-auto-toggle b:before { content:""; position:absolute; width:16px; height:16px; left:2px; top:2px; background:#fff; border-radius:50%; transition:0.2s; }
.wh-auto-toggle input:checked + b { background: #34C759; box-shadow: 0 0 8px rgba(52,199,89,0.3); }
.wh-auto-toggle input:checked + b:before { transform: translateX(12px); }

/* 按钮 */
.wh-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 7px 16px; font-size: 12px; font-weight: 500; border-radius: 7px; cursor: pointer;
    border: 1px solid var(--border-subtle); background: var(--bg-input);
    color: var(--txt-sec); transition: all 0.15s; white-space: nowrap;
    line-height: 1;
}
.wh-btn:hover { background: var(--bg-card); border-color: var(--border-hov); color: var(--txt-pri); }
.wh-btn svg { flex-shrink: 0; }
.wh-btn-pri { background: var(--accent); color: #fff; border-color: var(--accent); }
.wh-btn-pri:hover { opacity: 0.88; color: #fff; }
.wh-btn-sm { padding: 6px 10px; font-size: 11px; border-radius: 6px; min-width: 32px; }
.wh-btn-act { color: var(--txt-sec); }
.wh-btn-act:hover { color: var(--txt-pri); }
.wh-btn-del { color: #FF3B30 !important; border-color: rgba(255,59,48,0.15) !important; background: transparent !important; }
.wh-btn-del:hover { background: rgba(255,59,48,0.08) !important; }

/* 按钮颜色统一：全部用 bg-input 灰底，hover 变亮 */
.wh-bar-btns .wh-btn { background: var(--bg-input); color: var(--txt-sec); border-color: var(--border-subtle); }
.wh-bar-btns .wh-btn:hover { background: var(--bg-card); color: var(--txt-pri); border-color: var(--border-hov); }
.wh-bar-btns .wh-btn-pri { background: var(--accent); color: #fff; border-color: var(--accent); }
.wh-bar-btns .wh-btn-pri:hover { opacity: 0.88; }

/* OAuth 卡片 */
.wh-oauth { margin-bottom: 14px; }
.wh-oauth.hidden { display: none; }
.wh-oauth-inner { padding: 12px 14px; background: var(--bg-card); border-radius: 10px; border: 1px solid var(--border-subtle); }
.wh-oauth-title { font-size: 12px; font-weight: 600; color: var(--txt-pri); margin-bottom: 8px; }
.wh-oauth-row { display: flex; gap: 6px; margin-bottom: 4px; }
.wh-oauth-hint { font-size: 11px; color: var(--txt-qua); }
.wh-input { flex: 1; padding: 6px 10px; font-size: 11px; font-family: monospace; background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: 5px; color: var(--txt-pri); }

/* 导入面板 */
.wh-import-tabs { display: flex; gap: 2px; margin-bottom: 10px; background: var(--bg-input); border-radius: 6px; padding: 2px; }
.wh-import-tab { flex: 1; padding: 5px 8px; font-size: 11px; border: none; background: transparent; color: var(--txt-ter); border-radius: 4px; cursor: pointer; transition: all 0.15s; text-align: center; }
.wh-import-tab:hover { color: var(--txt-sec); }
.wh-import-tab.active { background: var(--bg-card); color: var(--txt-pri); font-weight: 500; }
.wh-import-body.hidden { display: none; }
.wh-import-body { margin-bottom: 0; }
.wh-textarea { width: 100%; resize: vertical; font-size: 11px; font-family: monospace; padding: 8px 10px; margin-bottom: 6px; box-sizing: border-box; }
.wh-import-row { display: flex; align-items: center; gap: 8px; }
.wh-import-hint { font-size: 10px; color: var(--txt-qua); flex: 1; }
.wh-import-result { margin-top: 8px; padding: 8px 10px; background: var(--bg-input); border-radius: 6px; }
.wh-import-loading { font-size: 12px; color: var(--txt-ter); }
.wh-import-token-item { display: flex; flex-direction: column; gap: 2px; padding: 4px 0; border-bottom: 1px solid var(--border-subtle); }
.wh-import-token-item code { font-size: 11px; color: var(--txt-sec); word-break: break-all; }
.wh-import-manual { padding: 4px 0; }

/* 文件拖拽区 */
.wh-import-file-zone {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    padding: 24px 16px; border: 2px dashed var(--border-subtle); border-radius: 8px;
    cursor: pointer; transition: all 0.2s; color: var(--txt-ter);
}
.wh-import-file-zone:hover { border-color: var(--border-hov); background: var(--bg-input); color: var(--txt-sec); }
.wh-import-file-zone svg { opacity: 0.5; }
.wh-import-file-zone span { font-size: 12px; }
.wh-import-file-zone em { font-size: 10px; color: var(--txt-qua); font-style: normal; }

/* 列表 */
.wh-sec { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--txt-sec); margin-bottom: 10px; }
.wh-sec-center { justify-content: center; }
.wh-sec-n { color: var(--txt-ter); font-weight: 400; font-size: 11px; }
.wh-items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.wh-item {
    display: flex; align-items: center; gap: 14px; padding: 14px 16px;
    background: var(--bg-card); border-radius: 10px; border: 1px solid var(--border-subtle);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.wh-item:hover { border-color: var(--border-hov); }

/* 圆环 */
.wh-item-ring { flex-shrink: 0; }
.wh-item-ring svg { display: block; }

/* 中间信息 */
.wh-item-info { flex: 1; min-width: 0; }
.wh-item-top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.wh-item-n { font-size: 14px; font-weight: 600; color: var(--txt-pri); }
.wh-item-plan { font-size: 10px; color: var(--txt-ter); background: var(--bg-input); padding: 2px 7px; border-radius: 4px; }
.wh-item-mid { display: flex; align-items: baseline; gap: 3px; margin-bottom: 5px; }
.wh-item-v { font-size: 18px; font-weight: 700; color: var(--txt-pri); }
.wh-item-vsep { font-size: 14px; color: var(--txt-qua); margin: 0 2px; }
.wh-item-vt { font-size: 13px; color: var(--txt-ter); }
.wh-item-unit { font-size: 10px; color: var(--txt-qua); margin-left: 4px; }
.wh-item-bot { display: flex; align-items: center; gap: 8px; }

/* Token 过期徽章 */
.wh-tk-badge { font-size: 10px; padding: 1px 7px; border-radius: 4px; background: oklch(40% 0.02 250 / 0.3); color: var(--txt-ter); white-space: nowrap; }
.wh-tk-badge.wh-tk-warn { background: rgba(255,159,10,0.12); color: #FF9F0A; }
.wh-tk-badge.wh-tk-exp { background: rgba(255,59,48,0.12); color: #FF3B30; }

/* 右侧操作 */
.wh-item-r { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.wh-item-r .wh-btn-sm { padding: 7px 10px; }

/* 标签 */
.wh-item-tags { display: flex; gap: 3px; }
.wh-i { display: inline-block; padding: 1px 6px; font-size: 10px; font-weight: 600; border-radius: 4px; line-height: 17px; font-style: normal; white-space: nowrap; }
.wh-i-g { background: rgba(52,199,89,0.1); color: #34C759; }
.wh-i-s { background: rgba(142,142,147,0.1); color: #8E8E93; }
.wh-i-r { background: rgba(255,59,48,0.1); color: #FF3B30; }
.wh-i-b { background: rgba(0,122,255,0.1); color: #007AFF; }
.wh-i-o { background: rgba(255,159,10,0.1); color: #FF9F0A; }
.wh-i-x { background: rgba(142,142,147,0.1); color: #8E8E93; }
.wh-i-warn { background: rgba(255,159,10,0.12); color: #FF9F0A; }
.wh-empty { padding: 36px 16px; text-align: center; font-size: 13px; color: var(--txt-ter); }

/* 低余额预警 */
.wh-item-warn { border-color: rgba(255,159,10,0.3) !important; }
.wh-item-warn:hover { border-color: rgba(255,159,10,0.5) !important; }

/* 签到已签按钮 */
.wh-btn-done { opacity: 0.4; pointer-events: none; }
.wh-btn-done svg { stroke: #34C759; }

/* 筛选按钮 */
.wh-filter { display: flex; gap: 3px; }
.wh-filter-btn {
    padding: 3px 10px; font-size: 10px; border-radius: 4px; cursor: pointer;
    border: 1px solid var(--border-subtle); background: transparent; color: var(--txt-ter);
    transition: all 0.15s;
}
.wh-filter-btn:hover { color: var(--txt-sec); border-color: var(--border-hov); }
.wh-filter-btn.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

/* 操作日志 */
.wh-log {
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-radius: 10px; padding: 10px 14px; max-height: 180px; overflow-y: auto;
    margin-bottom: 16px;
}
.wh-log-collapsed { display: none; }
.wh-log-arrow { flex-shrink: 0; color: var(--txt-ter); transition: transform 0.2s; }
.wh-log-item { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.wh-log-time { font-size: 10px; color: var(--txt-qua); font-family: monospace; min-width: 36px; text-align: right; }
.wh-log-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--txt-ter); flex-shrink: 0; }
.wh-log-dot-g { width: 6px; height: 6px; border-radius: 50%; background: #34C759; flex-shrink: 0; }
.wh-log-dot-r { width: 6px; height: 6px; border-radius: 50%; background: #FF3B30; flex-shrink: 0; }
.wh-log-text { font-size: 11px; color: var(--txt-sec); }
.wh-log-empty { font-size: 11px; color: var(--txt-qua); text-align: center; padding: 8px 0; }

/* MITM */
.wh-mitm {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    background: var(--bg-card); border-radius: 10px; border: 1px solid var(--border-subtle);
}
.wh-mitm-l b { display: block; font-size: 13px; font-weight: 600; color: var(--txt-pri); margin-bottom: 2px; }
.wh-mitm-l span { font-size: 11px; color: var(--txt-qua); }
.wh-tg { display: inline-block; width: 38px; height: 22px; position: relative; cursor: pointer; flex-shrink: 0; }
.wh-tg input { display: none; }
.wh-tg b { position: absolute; top:0; left:0; right:0; bottom:0; background: var(--border-subtle); border-radius: 11px; transition: 0.2s; }
.wh-tg b:before { content:""; position:absolute; width:18px; height:18px; left:2px; top:2px; background:#fff; border-radius:50%; transition:0.2s; }
.wh-tg input:checked + b { background: #34C759; }
.wh-tg input:checked + b:before { transform: translateX(16px); }
.wh-tg-lg { width: 44px; height: 24px; }
.wh-tg-lg b { border-radius: 12px; }
.wh-tg-lg b:before { width: 20px; height: 20px; left: 2px; top: 2px; }
.wh-tg-lg input:checked + b:before { transform: translateX(20px); }

/* 代理池面板 */

.proxy-stats-bar { display: flex; justify-content: center; gap: 20px; padding: 12px 10px 14px; font-size: 11px; color: var(--txt-ter); border-bottom: 1px solid var(--border-subtle); }
.proxy-stats-bar .proxy-stat { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.proxy-stats-bar .proxy-stat b { font-weight: 600; color: var(--txt-pri); font-size: 13px; }

.proxy-log-table { width: 100%; }
.log-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.log-table th { padding: 8px 6px; font-size: 10px; color: var(--txt-qua); font-weight: 500; text-align: center; border-bottom: 1px solid var(--border-subtle); letter-spacing: 0.5px; }
.log-table th:nth-child(1), .log-table td:nth-child(1) { width: 54px; }
.log-table th:nth-child(2), .log-table td:nth-child(2) { width: 64px; }
.log-table th:nth-child(3), .log-table td:nth-child(3) { width: 44px; }
.log-table th:nth-child(4), .log-table td:nth-child(4) { width: 46px; }
.log-table th:nth-child(5), .log-table td:nth-child(5) { width: 40px; }
.log-table th:nth-child(6), .log-table td:nth-child(6) { width: 36px; }

.log-table td { padding: 7px 6px; font-size: 11px; font-family: monospace; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.02); }
.log-table .log-row:hover td { background: oklch(100% 0 0 / 0.04); }
.log-table .log-time { color: var(--txt-qua); }
.log-table .log-acct { color: var(--txt-sec); }
.log-table .log-credits { color: #FF9F0A; }
.log-table .log-latency { color: var(--txt-ter); }
.log-table .log-remain { color: var(--txt-ter); }
.log-table .log-ok { color: #34C759; font-weight: 600; }
.log-table .log-err { color: #FF3B30; font-weight: 600; }

proxy-log-empty { display: flex; flex-direction: column; align-items: center; padding: 24px 10px; color: var(--txt-qua); }
.proxy-log-empty p { font-size: 14px; color: var(--txt-ter); margin-bottom: 4px; }
.proxy-log-empty span { font-size: 10px; }

.proxy-ov { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 14px; }
.proxy-ov-card {
    padding: 14px 10px; border-radius: 10px; background: var(--bg-card);
    border: 1px solid var(--border-subtle); text-align: center;
    transition: border-color 0.2s;
}
.proxy-ov-card:hover { border-color: var(--border-hov); }
.proxy-ov-num { font-size: 18px; font-weight: 700; line-height: 1.2; }
.proxy-ov-label { font-size: 10px; color: var(--txt-ter); margin-top: 3px; }

.proxy-config-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 0; border-bottom: 1px solid var(--border-subtle);
}
.proxy-config-row > span:first-child { font-size: 12px; color: var(--txt-sec); min-width: 56px; }
.proxy-config-hint { font-size: 10px; color: var(--txt-qua); flex: 1; }

.proxy-section-title { display: flex; align-items: baseline; gap: 8px; margin-top: 12px; margin-bottom: 8px; }
.proxy-section-title > span:first-child { font-size: 11px; font-weight: 600; color: var(--txt-sec); }
.proxy-section-desc { font-size: 10px; color: var(--txt-qua); }
.proxy-path-list { display: flex; flex-direction: column; gap: 4px; }
.proxy-path-item {
    display: flex; align-items: center; gap: 8px; padding: 6px 10px;
    background: var(--bg-input); border-radius: 6px; border-left: 3px solid transparent;
}
.proxy-path-intercept { border-left-color: #007AFF; }
.proxy-path-passthrough { border-left-color: #34C759; }
.proxy-path-tag {
    font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 3px;
    text-transform: uppercase; flex-shrink: 0;
}
.proxy-path-intercept .proxy-path-tag { background: rgba(0,122,255,0.15); color: #007AFF; }
.proxy-path-passthrough .proxy-path-tag { background: rgba(52,199,89,0.15); color: #34C759; }
.proxy-path-item code { font-size: 11px; color: var(--txt-pri); font-family: monospace; }
.proxy-path-label { font-size: 10px; color: var(--txt-ter); margin-left: auto; }

/* 代理池面板 */
.proxy-status {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px;
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-radius: 10px; margin-bottom: 14px;
}
.proxy-status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.proxy-on { background: #34C759; box-shadow: 0 0 8px rgba(52,199,89,0.4); }
.proxy-off { background: var(--txt-qua); }
.proxy-status-info { flex: 1; }
.proxy-status-info b { display: block; font-size: 13px; color: var(--txt-pri); }
.proxy-status-info span { font-size: 11px; color: var(--txt-ter); }

.proxy-config-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0; border-bottom: 1px solid var(--border-subtle);
}
.proxy-config-row span { font-size: 12px; color: var(--txt-sec); }
.proxy-config-label { font-size: 11px; color: var(--txt-ter); margin-bottom: 6px; }
.proxy-path-list { display: flex; flex-wrap: wrap; gap: 4px; }
.proxy-path-item {
    padding: 3px 8px; font-size: 11px; font-family: monospace;
    background: var(--bg-input); border-radius: 4px; color: var(--txt-sec);
}

/* 号仓联动表格 */
.proxy-wh-table { max-height: 180px; overflow-y: auto; }
.proxy-wh-hd {
    display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border-subtle);
    font-size: 10px; color: var(--txt-qua); font-weight: 500;
}
.proxy-wh-hd span:nth-child(1) { width: 100px; }
.proxy-wh-hd span:nth-child(2) { flex: 1; }
.proxy-wh-hd span:nth-child(3) { width: 44px; text-align: center; }
.proxy-wh-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border-subtle); }
.proxy-wh-row:last-child { border-bottom: none; }
.proxy-wh-name { font-size: 11px; color: var(--txt-pri); width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proxy-wh-bal { font-size: 11px; color: var(--txt-sec); flex: 1; font-family: monospace; }
.proxy-wh-ok { font-size: 10px; color: #34C759; width: 44px; text-align: center; }
.proxy-wh-ex { font-size: 10px; color: #FF3B30; width: 44px; text-align: center; }

/* 使用说明 */
.proxy-help-block { margin-bottom: 14px; }
.proxy-help-block:last-child { margin-bottom: 0; }
.proxy-help-title { font-size: 12px; font-weight: 600; color: var(--txt-pri); margin-bottom: 6px; }
.proxy-help-code {
    display: block; padding: 8px 12px; background: var(--bg-input);
    border-radius: 6px; font-size: 12px; color: var(--accent); font-family: monospace;
    margin-bottom: 4px; word-break: break-all;
}
.proxy-help-desc { font-size: 11px; color: var(--txt-ter); line-height: 1.6; }
.proxy-help-flow {
    display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
    font-size: 11px; color: var(--txt-sec);
}
.proxy-help-flow > span {
    padding: 3px 8px; background: var(--bg-input); border-radius: 4px;
}
.proxy-flow-arrow { color: var(--txt-qua); padding: 0 2px !important; background: none !important; }
.proxy-help-tags { display: flex; gap: 6px; margin-top: 6px; }
.proxy-help-tags span {
    padding: 3px 10px; font-size: 10px; background: rgba(52,199,89,0.1); color: #34C759;
    border-radius: 4px;
}

/* 自定义模态框（替代浏览器 prompt/confirm） */
.wh-modal-overlay {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
    opacity: 0; transition: opacity 0.2s;
}
.wh-modal-overlay.active { opacity: 1; }
.wh-modal {
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-radius: 12px; width: 360px; max-width: 92vw;
    box-shadow: 0 16px 48px rgba(0,0,0,0.4);
    transform: translateY(8px) scale(0.97);
    transition: transform 0.2s var(--ease-out);
}
.wh-modal-overlay.active .wh-modal { transform: translateY(0) scale(1); }
.wh-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px 10px; font-size: 14px; font-weight: 600; color: var(--txt-pri);
}
.wh-modal-close {
    background: none; border: none; color: var(--txt-ter); cursor: pointer;
    padding: 4px; border-radius: 4px; display: flex; align-items: center;
}
.wh-modal-close:hover { color: var(--txt-pri); background: var(--bg-input); }
.wh-modal-body { padding: 0 16px 14px; }
.wh-modal-foot {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 0 16px 14px;
}
.wh-modal-foot .wh-btn { min-width: 72px; }

/* 打字指示器 — 参考 ChatGPT */
.typing-indicator {
    display: flex; align-items: center; gap: 4px;
    padding: 4px 0;
}
.typing-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--txt-ter);
    animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* 等待指示器 — 旋转环 + 分阶段文字 */
.waiting-indicator {
    display: flex; flex-direction: column; align-items: center;
    gap: 12px; padding: 32px 0 120px 0;
    min-height: 200px;
}
.waiting-ring {
    width: 28px; height: 28px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.waiting-text {
    font-size: 13px; color: var(--txt-ter);
    transition: color 0.3s;
}

/* 流式输出光标 */
.cursor-blink {
    display: inline-block; width: 2px; height: 1em;
    background: var(--txt-pri); margin-left: 1px;
    vertical-align: text-bottom;
    animation: cursorBlink 0.8s step-end infinite;
}

/* 响应耗时条 */
.elapsed-bar {
    display: flex; justify-content: center;
    padding: 6px 16px; margin: 4px auto;
    max-width: var(--chat-max-width);
    font-size: 11px; color: var(--txt-qua);
    transition: opacity 0.5s;
}

/* 健康检查警告条 */
.health-alert {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    padding: 10px 16px; margin: 8px auto;
    max-width: var(--chat-max-width);
    background: rgba(255,59,48,0.08); border: 1px solid rgba(255,59,48,0.2);
    border-radius: var(--radius-sm);
    font-size: 12px; color: #FF3B30;
    animation: cardSlideIn 0.3s var(--ease-out);
}

/* 错误消息卡片（chat 内） */
.error-message {
    display: flex; flex-direction: column; align-items: center;
    padding: 20px 16px; margin: 0 auto;
    max-width: var(--chat-max-width);
    font-size: 13px; color: var(--txt-sec);
}
.error-icon {
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,59,48,0.1); color: #FF3B30;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700; margin-bottom: 8px;
}
.error-text {
    text-align: center; line-height: 1.6;
}

/* 动画关键帧 */
@keyframes cardSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes dotPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.6; }
}
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}
@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
@keyframes dotSpin {
    0% { transform: rotate(0deg); border-top: 2px solid currentColor; border-right: 2px solid transparent; }
    100% { transform: rotate(360deg); border-top: 2px solid currentColor; border-right: 2px solid transparent; }
}

/* 消息 hover 操作按钮 — 放在消息内容右下角 */
.msg-actions {
    position: absolute; right: 8px; bottom: -4px;
    display: flex; gap: 2px;
    opacity: 0; transition: opacity 0.15s var(--ease-out);
    pointer-events: none;
}
.chat-message.assistant:hover .msg-actions { opacity: 1; pointer-events: auto; }
.chat-message.user:hover .msg-actions { opacity: 1; pointer-events: auto; }
.msg-action-btn {
    width: 28px; height: 28px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-elevated); border: 1px solid var(--border-subtle);
    cursor: pointer; font-size: 12px; color: var(--txt-ter);
    transition: all var(--duration-fast);
}
.msg-action-btn:hover { background: var(--bg-surface); color: var(--txt-pri); border-color: var(--border-hov); }
.msg-action-btn svg { width: 14px; height: 14px; fill: currentColor; }

/* Token 用量条 */
.token-usage-bar {
    display: flex; justify-content: center; gap: 16px;
    padding: 8px 16px; margin: 4px auto;
    max-width: var(--chat-max-width);
    font-size: 11px; color: var(--txt-qua);
    transition: opacity 0.5s;
}
.token-usage-bar span { white-space: nowrap; }

/* 思考过程折叠 */
.thinking-block {
    margin: var(--space-2) 0; border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm); overflow: hidden;
}
.thinking-toggle {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-2) var(--space-3); font-size: 12px; color: var(--txt-ter);
    cursor: pointer; background: var(--bg-card); transition: background var(--duration-fast);
}
.thinking-toggle:hover { background: var(--bg-card-hover); }
.thinking-toggle .arrow { transition: transform 0.15s; font-size: 10px; }
.thinking-toggle.open .arrow { transform: rotate(90deg); }
.thinking-body { display: none; padding: var(--space-3); font-size: 12px; color: var(--txt-ter); background: var(--bg-input); }
.thinking-body.open { display: block; }

/* Agent 状态指示 — 独立一行 */
.agent-status-bar {
    display: flex; align-items: center; gap: var(--space-2);
    padding: 0; margin-bottom: var(--space-2);
}
.agent-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 10px; font-size: 11px; font-weight: 500;
    border-radius: 10px;
    background: var(--bg-surface); color: var(--txt-ter);
}
.agent-chip.running { background: var(--bg-blue); color: var(--accent); }
.agent-chip.done { background: var(--bg-green); color: var(--green); }
.agent-chip .agent-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.agent-chip.running .agent-dot { animation: pulse-dot 1s ease-in-out infinite; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* 发送按钮 — 小圆形图标，跟头像呼应 */
.send-btn-group { display: flex; align-items: center; }

.btn-send {
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-dim); border: 1px solid oklch(65% 0.15 250 / 0.2);
    cursor: pointer; color: var(--accent);
    transition: all 0.15s var(--ease-out);
    flex-shrink: 0;
}
.btn-send svg { width: 24px; height: 24px; }
.btn-send:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-send:active { transform: scale(0.95); }

/* 停止按钮 */
.btn-send.stop {
    background: var(--bg-red); border-color: var(--red); color: var(--red);
}
.btn-send.stop:hover { background: var(--red); color: #fff; }

/* ================================================================
   输入区 — 头像 + 输入框一排
   ================================================================ */
.chat-input-area {
    padding: var(--space-4) var(--space-6) var(--space-6);
    display: flex; justify-content: center;
}

.chat-input-row {
    display: flex; align-items: center; gap: var(--space-3);
    max-width: var(--chat-max-width); width: 100%;
}

.chat-input-wrapper {
    flex: 1;
    display: flex; align-items: center; gap: var(--space-3);
    background: var(--bg-card); border: 1px solid var(--border-def);
    border-radius: var(--radius-md); padding: 0 var(--space-3);
    min-height: 44px;
    transition: border-color var(--duration-fast);
}
.chat-input-wrapper:focus-within { border-color: var(--border-focus); }
.chat-input {
    flex: 1; border: none; background: transparent; font-family: var(--font-ui); font-size: 14px;
    color: var(--txt-pri); outline: none; resize: none;
    padding: 10px 0;
    max-height: 120px; line-height: 1.5;
}
.chat-input::placeholder { color: var(--txt-qua); }

/* ================================================================
   输入框左侧悬浮头像 — 纯图片，无容器
   ================================================================ */
.floating-avatar {
    position: relative;
    flex-shrink: 0;
}

.user-avatar-img {
    display: block;
    width: 44px; height: 44px;
    object-fit: cover;
    cursor: pointer;
    clip-path: circle(50%);
    animation: petBreathe 4s ease-in-out infinite;
    transition: transform 0.2s var(--ease-out);
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}
.user-avatar-img:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* ================================================================
   左侧抽屉菜单 + 二级级联面板
   ================================================================ */
.side-drawer { position: fixed; inset: 0; z-index: 90; pointer-events: none; }
.side-drawer:not(.hidden) { pointer-events: auto; }
.side-drawer.hidden .drawer-backdrop { opacity: 0; }
.side-drawer.hidden #drawer-layer1 { transform: translateX(-100%); }

/* drawer-backdrop 只覆盖 drawer 右侧区域，不挡 pip-panel */
.drawer-backdrop {
    position: absolute;
    left: 280px; top: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.35);
    transition: opacity 0.25s var(--ease-out);
    z-index: 0;
}

/* 隐藏滚动条 */
.drawer-panel::-webkit-scrollbar { width: 0; }
.drawer-panel { scrollbar-width: none; -ms-overflow-style: none; }
.side-drawer.hidden #drawer-layer2 { transform: translateX(-100%); opacity: 0; }

.drawer-panel {
    position: absolute; left: 0; top: 0; bottom: 0;
    background: var(--bg-deep); border-right: 1px solid var(--border-subtle);
    display: flex; flex-direction: column;
    transition: transform 0.3s var(--ease-out);
}

#drawer-layer1 { box-shadow: 4px 0 32px rgba(0,0,0,0.5); }
#drawer-layer2 { box-shadow: -4px 0 32px rgba(0,0,0,0.5); border-right: none; border-left: 1px solid var(--border-subtle); }

#drawer-layer1 { width: 280px; z-index: 2; overflow-y: auto; overflow-x: hidden; }
#drawer-layer2 { width: 480px; z-index: 1; }

.drawer-layer2 {
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s;
    transform-origin: left center;
}
.drawer-layer2.hidden { transform: translateX(-100%); opacity: 0; }
.drawer-layer2:not(.hidden) { opacity: 1; transform: translateX(0); }

.drawer-user {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-5) var(--space-5) var(--space-4);
}
.drawer-avatar {
    width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
}
.drawer-user-info { display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.drawer-name { font-size: 14px; font-weight: 600; color: var(--txt-pri); }
.drawer-email { font-size: 11px; color: var(--txt-qua); }

.drawer-section-label {
    padding: var(--space-3) var(--space-5) var(--space-1);
    font-size: 11px; font-weight: 600; color: var(--txt-qua);
    letter-spacing: 0.04em;
}
.drawer-divider { height: 1px; background: var(--border-def); margin: var(--space-2) var(--space-4); }

.drawer-item {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-2) var(--space-4); margin: 0 var(--space-2);
    font-size: 13px; color: var(--txt-sec); cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.12s var(--ease-out);
}
.drawer-item:hover { background: var(--bg-card); color: var(--txt-pri); }
.drawer-item-icon { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; opacity: 0.6; }
.drawer-item:hover .drawer-item-icon { opacity: 1; }
.drawer-shortcut {
    margin-left: auto; font-size: 11px; color: var(--txt-qua);
    background: var(--bg-surface); padding: 1px 6px; border-radius: 4px;
}
.drawer-sub {
    margin-left: auto; font-size: 11px; color: var(--txt-qua);
}
.drawer-version {
    margin-left: auto; font-size: 11px; color: var(--txt-qua);
}
.drawer-item-danger { color: var(--txt-ter); }
.drawer-item-danger:hover { background: var(--bg-red); color: var(--red); }

.drawer-spacer { display: none; }

/* 对话历史列表（侧边栏内嵌） */
.chat-history-list {
    padding: var(--space-1) 0;
}
.drawer-search { padding: var(--space-2) var(--space-3); }
.drawer-search-input {
    width: 100%; height: 32px; border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card); color: var(--txt-sec);
    font-size: 12px; padding: 0 var(--space-3);
    outline: none; transition: border 0.15s;
}
.drawer-search-input:focus { border-color: var(--border-hov); }
.drawer-search-input::placeholder { color: var(--txt-qua); }

.history-group-label {
    font-size: 11px; font-weight: 600; color: var(--txt-qua);
    padding: var(--space-2) var(--space-4) var(--space-1);
    letter-spacing: 0.03em;
}
.history-item {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-1) var(--space-3); margin: 0 var(--space-2);
    font-size: 13px; color: var(--txt-sec); cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.12s var(--ease-out);
    position: relative;
}
.history-item:hover { background: var(--bg-card); color: var(--txt-pri); }
.history-item.active { background: var(--bg-surface); color: var(--txt-pri); }
.history-item-title {
    flex: 1; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; line-height: 1.4;
}
.history-item-time {
    font-size: 10px; color: var(--txt-qua);
    flex-shrink: 0; margin-right: var(--space-1);
}
.history-item:hover .history-item-time { display: none; }
.history-item-del {
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: none; cursor: pointer;
    color: var(--txt-qua); font-size: 16px; flex-shrink: 0;
    transition: all 0.12s; opacity: 0;
}
.history-item:hover .history-item-del { opacity: 1; }
.history-item-del:hover { background: var(--bg-red); color: var(--red); opacity: 1; }

/* ================================================================
   画中画悬浮面板 — 基于右侧聊天区
   ================================================================ */
.pip-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    padding: clamp(0px, 8vw, 64px);
    animation: fadeIn 0.2s var(--ease-out);
}
.pip-panel {
    width: 100%; height: 100%;
    background: var(--bg-elevated);
    border: 1px solid oklch(100% 0 0 / 0.08);
    border-radius: 16px;
    box-shadow: 0 32px 64px rgba(0,0,0,0.5);
    display: flex; flex-direction: column; overflow: hidden;
    animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.pip-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    flex-shrink: 0; border-bottom: 1px solid oklch(100% 0 0 / 0.04);
}
.pip-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; color: var(--txt-pri); }
.pip-close {
    width: 28px; height: 28px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: none; cursor: pointer;
    color: var(--txt-ter); font-size: 16px;
    transition: all 0.15s var(--ease-out);
}
.pip-close:hover { background: oklch(100% 0 0 / 0.08); color: var(--txt-pri); }
.pip-body { flex: 1; overflow-y: auto; padding: var(--space-5) var(--space-6) var(--space-6); }

/* 浅色 pip */
:root.light .pip-close:hover { background: oklch(0% 0 0 / 0.06); }

/* 保留旧 modal 类（向后兼容） */
/* modal visibility controlled by JS inline style */

/* 安装引导折叠 body */
.install-body {
    display: none;
    padding: 0 var(--space-5) var(--space-4);
    padding-left: calc(var(--space-5) + 22px + var(--space-3));
}
.install-body.open { display: block; }
.section-arrow {
    display: inline-block; transition: transform 0.2s var(--ease-out);
    font-size: 14px; color: var(--txt-ter);
}
.settings-row.open .section-arrow { transform: rotate(90deg); }

/* 折叠分区 */
.modal-section { display: none; }
.section-header { display: none; }

/* 面板内 sub-section（非折叠） */
.sub-section { width: 100%; margin-bottom: var(--space-4); }
.sub-section:last-child { margin-bottom: 0; }
.sub-section-title {
    font-size: 12px; font-weight: 600; color: var(--txt-ter);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-bottom: var(--space-3); padding: 0 var(--space-1);
}
.sub-section-body { }
.section-header-left { display: flex; align-items: center; gap: var(--space-3); }
.section-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-surface); font-size: 18px; flex-shrink: 0;
}
.section-label { font-size: 14px; font-weight: 500; color: var(--txt-pri); }
.section-arrow {
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; color: var(--txt-ter);
    transition: transform 0.2s var(--ease-out);
    flex-shrink: 0;
}
.section-header.open .section-arrow { transform: rotate(90deg); }
.section-body {
    display: none;
    padding: 0 var(--space-4) var(--space-4);
    padding-left: calc(var(--space-4) + 36px + var(--space-3));
}
.section-body.open { display: block; }

/* 面板内组件 */
.panel-hint { font-size: 12px; color: var(--txt-qua); margin-top: var(--space-2); }
.panel-row { display: flex; align-items: center; gap: var(--space-3); }
.panel-row-col { display: flex; flex-direction: column; gap: var(--space-3); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ================================================================
   右侧面板 (保留兼容旧代码)
   ================================================================ */
.right-panel { display: none !important; }
.panel-section { border-bottom: 1px solid var(--border-subtle); padding: var(--space-4) var(--space-6); }
.panel-section:last-child { border-bottom: none; }
.panel-section-title {
    font-size: 12px; font-weight: 600; color: var(--txt-sec);
    margin-bottom: var(--space-3);
}
.panel-header { display: none; }
.panel-body { padding: 0; }

/* ================================================================
   组件
   ================================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
    height: 34px; padding: 0 var(--space-4); font-family: var(--font-ui); font-size: 13px;
    font-weight: 500; border: 1px solid var(--border-def); border-radius: var(--radius-sm);
    background: var(--bg-surface); color: var(--txt-pri); cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out); white-space: nowrap; user-select: none;
}
.btn:hover { background: var(--bg-elevated); border-color: var(--border-hov); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #0070E0; }
.btn-danger { background: var(--bg-red); border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { height: 28px; padding: 0 var(--space-3); font-size: 12px; }
.btn-lg { height: 42px; padding: 0 var(--space-6); font-size: 15px; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-surface); }

.input {
    height: 36px; padding: 0 var(--space-3); font-family: var(--font-ui); font-size: 13px;
    color: var(--txt-pri); background: var(--bg-input); border: 1px solid var(--border-def);
    border-radius: var(--radius-sm); outline: none; transition: border-color var(--duration-fast);
}
.input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 2px var(--accent-dim); }
.input::placeholder { color: var(--txt-qua); }
.textarea {
    min-height: 80px; padding: var(--space-3); font-family: var(--font-mono); font-size: 13px;
    color: var(--txt-pri); background: var(--bg-input); border: 1px solid var(--border-def);
    border-radius: var(--radius-sm); outline: none; resize: vertical; width: 100%;
}
.textarea:focus { border-color: var(--border-focus); }

/* ================================================================
   Settings Panel — 凌霄 Agent 风格（settings-group + settings-row）
   ================================================================ */
.settings-group {
    width: 100%;
    background: oklch(100% 0 0 / 0.04);
    border: 1px solid oklch(100% 0 0 / 0.06);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 14px;
}
.settings-section-title {
    font-size: 11px; font-weight: 500; color: var(--txt-ter);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-bottom: 6px; padding-left: 2px;
    width: 100%;
}
.settings-row {
    display: flex; align-items: center;
    padding: 14px var(--space-5);
    border-bottom: 1px solid oklch(100% 0 0 / 0.03);
    gap: var(--space-4);
    transition: background 0.12s;
}
/* 只有纯展示行才有 hover 效果，带控件的行不做 pointer 变化 */
.settings-row.has-action {
    cursor: pointer;
}
.settings-row.has-action:hover { background: oklch(100% 0 0 / 0.02); }
.settings-row:last-child { border-bottom: none; }
.settings-row.active-row {
    background: oklch(100% 0 0 / 0.04);
}
.settings-row.active-row .settings-row-label { color: var(--accent); }
.settings-row-left {
    display: flex; align-items: center; gap: var(--space-3);
    min-width: 0; flex-shrink: 1;
}
.settings-row-symbol {
    width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
}
.settings-row-label {
    font-size: 13px; color: var(--txt-pri); font-weight: 500;
}
.settings-row-desc {
    font-size: 11px; color: var(--txt-ter); margin-top: 1px;
}
.settings-row-right {
    flex: 1; display: flex; justify-content: flex-end; min-width: 0;
}
/* iOS 风格 Toggle */
.settings-toggle {
    position: relative; width: 49px; height: 29px; flex-shrink: 0; cursor: pointer;
}
.settings-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.settings-toggle-track {
    position: absolute; inset: 0; border-radius: 14.5px;
    background: oklch(100% 0 0 / 0.18);
    transition: background 0.3s cubic-bezier(0.4,0,0.2,1);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}
.settings-toggle input:checked + .settings-toggle-track { background: #34C759; }
.settings-toggle-thumb {
    position: absolute; top: 1px; left: 1px;
    width: 27px; height: 27px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.settings-toggle input:checked ~ .settings-toggle-thumb { transform: translateX(20px); }

/* 浅色主题 settings-group */
:root.light .settings-group { background: oklch(0% 0 0 / 0.02); border-color: oklch(0% 0 0 / 0.05); }
:root.light .settings-row { border-bottom-color: oklch(0% 0 0 / 0.04); }
:root.light .settings-row:hover { background: oklch(0% 0 0 / 0.015); }
:root.light .settings-toggle-track { background: oklch(0% 0 0 / 0.18); }

/* 进度条（用量概览用） */
.settings-progress {
    height: 6px; border-radius: 3px;
    background: oklch(100% 0 0 / 0.08);
    overflow: hidden; margin-top: var(--space-2);
}
.settings-progress-fill {
    height: 100%; border-radius: 3px;
    transition: width 0.6s var(--ease-out);
}
/* 配额数字 */
.settings-quota-nums {
    display: flex; gap: var(--space-4); margin-top: var(--space-2);
}
.settings-quota-item { display: flex; flex-direction: column; align-items: center; }
.settings-quota-num { font-size: 16px; font-weight: 600; color: var(--txt-pri); }
.settings-quota-label { font-size: 10px; color: var(--txt-ter); text-transform: uppercase; letter-spacing: 0.04em; }

/* settings-row 内嵌输入框 */
.settings-row-input { flex: 1; }
.settings-inline-form { display: flex; gap: var(--space-2); width: 100%; }
.settings-inline-form-col { display: flex; flex-direction: column; gap: var(--space-2); width: 100%; }

/* 下拉选择框 — 凌霄 Agent 风格 */
.settings-select {
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    background: oklch(100% 0 0 / 0.08);
    border: 1px solid oklch(100% 0 0 / 0.06);
    border-radius: 8px; padding: 8px 36px 8px 14px;
    font-family: var(--font-ui); font-size: 13px;
    color: var(--txt-pri); outline: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7'%3E%3Cpath d='M1 1l4.5 5L10 1' stroke='rgba(255,255,255,0.4)' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
    transition: border-color 0.2s, background-color 0.2s;
    min-width: 140px;
}
.settings-select:hover { border-color: oklch(100% 0 0 / 0.12); }
.settings-select:focus {
    border-color: var(--accent);
    background-color: oklch(100% 0 0 / 0.12);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7'%3E%3Cpath d='M1 1l4.5 5L10 1' stroke='%23007AFF' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}
.settings-select option { background: #1c1c1e; color: var(--txt-pri); }
:root.light .settings-select option { background: #fff; color: #111; }
:root.light .settings-select {
    background-color: oklch(0% 0 0 / 0.04);
    border-color: oklch(0% 0 0 / 0.08);
}

/* 横向面板双列布局 */
.settings-col2 {
    display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4);
    width: 100%;
}
.settings-col2 .settings-group { margin-bottom: 0; }

/* 横向面板全宽 section（表单、表格等） */
.settings-full { width: 100%; }

/* 保留旧 account-card 用于向后兼容 */
.account-card {
    width: 100%; max-width: 420px;
    background: oklch(100% 0 0 / 0.04);
    border: 1px solid oklch(100% 0 0 / 0.06);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    transition: border-color 0.15s var(--ease-out);
}
.account-card:hover { border-color: oklch(100% 0 0 / 0.10); }
.ac-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.ac-card-title { font-size: 13px; font-weight: 600; color: var(--txt-sec); letter-spacing: -0.01em; }
.ac-card-badge { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: var(--radius-xs); }
.ac-card-badge.badge-danger { background: var(--bg-red); color: var(--red); }
.ac-card-badge.badge-warning { background: var(--bg-orange); color: var(--orange); }
.ac-card-badge.badge-info { background: var(--bg-blue); color: var(--accent); }
.ac-card-body { }
.ac-progress-track { height: 6px; border-radius: 3px; background: oklch(100% 0 0 / 0.08); overflow: hidden; margin-bottom: var(--space-4); }
.ac-progress-fill { height: 100%; border-radius: 3px; transition: width 0.6s var(--ease-out); }
.ac-quota-row { display: flex; gap: var(--space-4); }
.ac-quota-item { flex: 1; display: flex; flex-direction: column; align-items: center; padding: var(--space-2) 0; }
.ac-quota-num { font-size: 18px; font-weight: 600; color: var(--txt-pri); letter-spacing: -0.02em; }
.ac-quota-label { font-size: 11px; color: var(--txt-ter); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }
.ac-key-display { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.ac-key-code { font-family: var(--font-mono); font-size: 12px; color: var(--txt-sec); background: oklch(100% 0 0 / 0.05); padding: 6px 10px; border-radius: 6px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-key-empty { display: flex; align-items: center; justify-content: space-between; }
.ac-inline-form { display: flex; gap: var(--space-2); }
.ac-inline-form-col { display: flex; flex-direction: column; gap: var(--space-2); }
:root.light .account-card { background: oklch(0% 0 0 / 0.02); border-color: oklch(0% 0 0 / 0.05); }
:root.light .account-card:hover { border-color: oklch(0% 0 0 / 0.09); }
:root.light .ac-progress-track { background: oklch(0% 0 0 / 0.08); }
:root.light .ac-key-code { background: oklch(0% 0 0 / 0.04); }

/* 保留旧 stat-card 用于号仓等（向后兼容） */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); width: 100%; }
.stat-card { background: oklch(100% 0 0 / 0.06); border: 1px solid oklch(100% 0 0 / 0.08); border-radius: var(--radius-sm); padding: var(--space-5); text-align: center; transition: all 0.15s var(--ease-out); }
.stat-card:hover { background: oklch(100% 0 0 / 0.10); border-color: oklch(100% 0 0 / 0.12); transform: translateY(-1px); }
.stat-label { font-size: 11px; color: var(--txt-ter); margin-bottom: var(--space-2); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 24px; font-weight: 600; color: var(--txt-pri); }

.table-container { border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); overflow-x: auto; margin-bottom: var(--space-4); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: center; padding: var(--space-3) var(--space-4); background: var(--bg-surface); color: var(--txt-ter); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-subtle); color: var(--txt-sec); text-align: center; }
tr:hover td { background: var(--bg-card-hover); }

.badge { display: inline-flex; align-items: center; padding: 2px 10px; font-size: 11px; font-weight: 500; border-radius: var(--radius-xs); }
.badge-success { background: var(--bg-green); color: var(--green); }
.badge-warning { background: var(--bg-orange); color: var(--orange); }
.badge-danger { background: var(--bg-red); color: var(--red); }
.badge-info { background: var(--bg-blue); color: var(--accent); }

.command-menu {
    position: fixed; bottom: 100px;
    left: 50%; transform: translateX(-50%);
    width: var(--chat-max-width); max-width: calc(100vw - 80px);
    background: var(--bg-elevated); border: 1px solid var(--border-def);
    border-radius: var(--radius-md); box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    max-height: 260px; overflow-y: auto; z-index: 100;
}
.command-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); cursor: pointer; }
.command-item:hover, .command-item.active { background: var(--bg-surface); }
.command-item .cmd-label { font-size: 13px; }
.command-item .cmd-desc { font-size: 12px; color: var(--txt-ter); margin-left: auto; }

.toast-container { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); pointer-events: none; }
.toast { padding: var(--space-2) var(--space-5); background: var(--bg-elevated); border: 1px solid var(--border-def); border-radius: 20px; font-size: 13px; color: var(--txt-sec); box-shadow: 0 4px 20px rgba(0,0,0,0.4); backdrop-filter: blur(12px); transition: opacity 0.3s, transform 0.3s; pointer-events: none; }
.toast-success { border-color: var(--green); color: var(--green); }
.toast-error { border-color: var(--red); color: var(--red); }

@keyframes messageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes popoverIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
/* 电子宠物呼吸动画 — 轻微缩放 + 边框辉光 */
@keyframes petBreathe {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 oklch(65% 0.15 250 / 0); }
    50% { transform: scale(1.06); box-shadow: 0 0 12px 2px oklch(65% 0.15 250 / 0.2); }
}

.hidden { display: none !important; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.w-full { width: 100%; }
.text-sm { font-size: 12px; }
.text-mono { font-family: var(--font-mono); }
.text-sec { color: var(--txt-sec); }
.text-ter { color: var(--txt-ter); }
.text-center { text-align: center; }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
/* 外观面板 — Radio 列表 */
.appearance-group { margin-bottom: var(--space-5); width: 100%; max-width: 400px; }
.appearance-group:last-child { margin-bottom: 0; }
.appearance-group-title {
    font-size: 12px; font-weight: 600; color: var(--txt-ter);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-bottom: var(--space-3); text-align: center;
}
.radio-list { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.radio-item {
    display: flex; align-items: center; justify-content: center; gap: var(--space-4);
    padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
    cursor: pointer; transition: all 0.15s var(--ease-out);
    border: 1px solid transparent;
    width: 100%; max-width: 400px; text-align: center;
}
.radio-item:hover { background: var(--bg-card); border-color: var(--border-subtle); }
.radio-item.active { background: var(--bg-card); border-color: var(--accent); }
.radio-dot {
    width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
    border: 2px solid var(--border-hov); transition: all 0.2s var(--ease-out);
    display: flex; align-items: center; justify-content: center;
}
.radio-item.active .radio-dot {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: 0 0 0 4px oklch(55% 0.15 250 / 0.15);
}
.radio-item.active .radio-dot::after {
    content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff;
}
.radio-text { display: flex; flex-direction: column; gap: 1px; align-items: center; text-align: center; }
.radio-label { font-size: 14px; color: var(--txt-pri); font-weight: 500; }
.radio-desc { font-size: 12px; color: var(--txt-ter); }

/* 三档预设 — 横向排列 */
.radio-row {
    display: flex; gap: var(--space-2);
    padding: 0 var(--space-1);
}
.radio-row .radio-item {
    flex: 1; flex-direction: column; align-items: center; gap: var(--space-2);
    padding: var(--space-4) var(--space-2); text-align: center;
}
.radio-row .radio-dot { margin: 0 auto 2px; }
.radio-row .radio-text { text-align: center; }
.radio-row .radio-label { font-size: 14px; }
.radio-row .radio-desc { font-size: 11px; }

/* ═══ User Management: Modal ═══ */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    width: 90%; max-width: 420px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    animation: modalIn 0.15s ease;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border-subtle);
}
.modal-title { font-size: 15px; font-weight: 600; color: var(--txt-pri); }
.modal-close { font-size: 20px; color: var(--txt-ter); cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--txt-pri); }
.modal-body { padding: 16px 20px; }
.modal-footer {
    display: flex; gap: 8px; justify-content: flex-end;
    padding: 12px 20px 16px;
    border-top: 1px solid var(--border-subtle);
}


/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
    /* 侧边抽屉 - 移动端全屏 */
    .side-drawer:not(.hidden) .drawer-backdrop {
        background: rgba(0,0,0,0.5);
        width: 100% !important;
    }
    .drawer-panel {
        width: 100% !important;
        max-width: 320px;
    }
    #drawer-layer1 {
        width: 85% !important;
        max-width: 300px;
    }
    #drawer-layer2 {
        width: 100% !important;
        max-width: none;
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        height: 100% !important;
        z-index: 95 !important;
    }
    .drawer-layer2 {
        width: 100% !important;
    }

    /* pip 面板（设置子面板）- 移动端全屏 */
    .pip-panel {
        width: 100% !important;
        height: 100% !important;
        right: 0 !important;
        bottom: 0 !important;
        top: 0 !important;
        left: 0 !important;
        border-radius: 0 !important;
        max-width: none !important;
    }
    .pip-overlay {
        width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    #pip-body {
        padding: 12px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* 主内容全宽 */
    .app-main { padding: 0 !important; }
    .chat-full { height: calc(100vh - 56px) !important; }

    /* 顶部栏 */
    .topbar {
        height: 56px;
        padding: 0 12px !important;
    }
    .topbar-title { font-size: 16px !important; }

    /* 聊天消息 */
    .chat-messages { padding: 12px !important; }
    .chat-bubble { max-width: 90% !important; font-size: 14px !important; }

    /* 输入框 */
    .chat-input-area { padding: 8px !important; }
    .chat-input { font-size: 16px !important; }

    /* 模态框 */
    .modal-content {
        width: 95% !important;
        margin: 10px auto !important;
    }

    /* 表格 */
    .log-table { font-size: 12px !important; }
    .log-table th, .log-table td { padding: 6px 8px !important; }

    /* 卡片 */
    .card { padding: 12px !important; margin-bottom: 12px !important; }

    /* 按钮 */
    .btn { padding: 8px 16px !important; font-size: 13px !important; }
    .btn-lg { padding: 10px 20px !important; font-size: 14px !important; }

    /* 设置面板内容 */
    .settings-group { margin-bottom: 12px !important; }
    .settings-row { padding: 10px 12px !important; }
    .settings-section-title { font-size: 15px !important; }

    /* 画中画悬浮按钮 */
    .pip-toggle {
        bottom: 80px !important;
        right: 12px !important;
    }
}

@media (max-width: 768px) {    .pip-overlay {
        padding: 0 !important;
    }
    .pip-panel {
        border-radius: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
    }
    .pip-header {
        padding: 12px 16px !important;
    }
    .pip-body {
        padding: 12px 16px !important;
    }
    .settings-group {
        margin-bottom: 8px !important;
    }
    .settings-row {
        padding: 12px 16px !important;
        flex-wrap: wrap;
    }
    .settings-row-left {
        flex: 1 1 100%;
        margin-bottom: 8px;
    }
    .settings-row-right {
        flex: 1 1 100%;
    }
}

@media (max-width: 480px) {
    .chat-bubble { max-width: 95% !important; }
    .topbar-title { display: none; }
    .drawer-item { padding: 10px 16px !important; font-size: 13px !important; }
    .guide-grid { grid-template-columns: 1fr !important; }
    .faq-q-text { font-size: 13px !important; }
    .download-hero h1 { font-size: 24px !important; }
    .download-hero p { font-size: 13px !important; }
    .download-btn { width: 100% !important; margin-bottom: 8px !important; }
}

/* 密码强度提示 */
.pw-hint { font-size: 12px; line-height: 1.8; min-height: 22px; }
.pw-hint .pw-ok { color: var(--green); margin-right: 8px; }
.pw-hint .pw-bad { color: var(--red); margin-right: 8px; opacity: 0.7; }
.pw-hint.pw-all-ok .pw-ok { font-weight: 600; }
