/* ==============================
   XinghuosClaw AI - 前端样式
   莫兰迪橙色 + 淡蓝色调，毛玻璃，年轻化
   ============================== */

:root {
    --xhclaw-orange: #E8A87C;
    --xhclaw-orange-deep: #D4845A;
    --xhclaw-orange-light: #F5D5BC;
    --xhclaw-blue: #A8C8D8;
    --xhclaw-blue-light: #D4E6EF;
    --xhclaw-blue-deep: #7BA8BD;
    --xhclaw-bg: rgba(255, 255, 255, 0.25);
    --xhclaw-card: rgba(255, 255, 255, 0.45);
    --xhclaw-card-hover: rgba(255, 255, 255, 0.6);
    --xhclaw-text: #3D3D3D;
    --xhclaw-text-light: #6B6B6B;
    --xhclaw-text-muted: #9B9B9B;
    --xhclaw-border: rgba(232, 168, 124, 0.3);
    --xhclaw-shadow: 0 8px 32px rgba(212, 132, 90, 0.12);
    --xhclaw-shadow-lg: 0 16px 48px rgba(212, 132, 90, 0.18);
    --xhclaw-radius: 16px;
    --xhclaw-radius-sm: 10px;
    --xhclaw-radius-xs: 6px;
    --xhclaw-gradient: linear-gradient(135deg, var(--xhclaw-orange-light), var(--xhclaw-blue-light));
    --xhclaw-gradient-btn: linear-gradient(135deg, var(--xhclaw-orange), var(--xhclaw-orange-deep));
    --xhclaw-blur: blur(16px);
}

.xhclaw-app {
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    color: var(--xhclaw-text);
    overflow: visible;
    width: 100%;
}

/* Banner */
.xhclaw-banner {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: var(--xhclaw-radius) var(--xhclaw-radius) 0 0;
}
.xhclaw-banner-img {
    width: 100%;
    height: 80px;
    object-fit: cover;
}
.xhclaw-banner-text {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 16px;
    background: linear-gradient(transparent, rgba(0,0,0,0.4));
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

/* Header */
.xhclaw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: transparent;
    border-bottom: 1px solid var(--xhclaw-border);
}
.xhclaw-header-left, .xhclaw-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.xhclaw-site-info {
    display: flex;
    align-items: center;
    gap: 6px;
}
.xhclaw-site-select {
    padding: 6px 28px 6px 10px;
    border: 1px solid var(--xhclaw-border);
    border-radius: var(--xhclaw-radius-xs);
    background: rgba(255,255,255,0.6);
    font-size: 13px;
    color: var(--xhclaw-text);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B6B6B' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}
.xhclaw-btn-icon {
    width: 28px;
    height: 28px;
    border: 1px dashed var(--xhclaw-border);
    border-radius: var(--xhclaw-radius-xs);
    background: rgba(255,255,255,0.4);
    color: var(--xhclaw-orange-deep);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.xhclaw-btn-icon:hover {
    background: var(--xhclaw-orange-light);
    border-color: var(--xhclaw-orange);
}

/* 智能体切换 - 内联标签按钮 */
.xhclaw-agent-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(0,0,0,0.05);
    border-radius: 18px;
    padding: 2px;
    flex-shrink: 1;
    min-width: 0;
    overflow: visible;
    position: relative;
}
.xhclaw-agent-tab {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
    font-size: 12px;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    border: none;
    background: none;
    outline: none;
    -webkit-appearance: none;
    color: #888;
    border: none;
    background: transparent;
    white-space: nowrap;
    line-height: 1;
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    z-index: 1;
}
.xhclaw-agent-tab:hover {
    color: #555;
    background: rgba(255,255,255,0.6);
}
.xhclaw-agent-tab.active {
    color: #fff;
    background: linear-gradient(135deg, #E8A87C, #D4796A);
    box-shadow: 0 2px 8px rgba(232, 168, 124, 0.35);
    font-weight: 600;
}
.xhclaw-agent-tab-icon {
    font-size: 13px;
    line-height: 1;
}
.xhclaw-agent-tab-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 空间不足时折叠为单按钮+弹窗 */
.xhclaw-agent-tabs.collapsed .xhclaw-agent-tab {
    display: none;
}
.xhclaw-agent-tab-collapsed-btn {
    display: none;
    align-items: center;
    gap: 4px;
    border: none;
    background: linear-gradient(135deg, #E8A87C, #D4796A);
    color: #fff;
    border-radius: 14px;
    padding: 4px 12px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    flex-shrink: 1;
    overflow: hidden;
    min-width: 0;
}
.xhclaw-agent-tab-collapsed-btn #xhclaw-collapsed-name {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
    display: inline-block;
    vertical-align: middle;
}
.xhclaw-agent-tab-collapsed-btn:active {
    opacity: 0.8;
}

/* 智能体选择弹窗 */
.xhclaw-agent-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 100000;
    align-items: flex-end;
    justify-content: center;
}
.xhclaw-agent-modal.show {
    display: flex;
}
.xhclaw-agent-modal-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
}
.xhclaw-agent-modal-content {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 16px 16px 0 0;
    padding: 20px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-width: 400px;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
    margin: 0 auto;
}
.xhclaw-agent-modal-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    text-align: center;
    margin-bottom: 16px;
}
.xhclaw-agent-modal-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: 2px solid #f0f0f0;
    background: #fff;
    border-radius: 12px;
    padding: 14px 16px;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    text-align: left;
}
.xhclaw-agent-modal-option:last-child {
    margin-bottom: 0;
}
.xhclaw-agent-modal-option:active {
    background: #f9f9f9;
}
.xhclaw-agent-modal-option.active {
    border-color: #E8A87C;
    background: rgba(232,168,124,0.06);
}
.xhclaw-agent-modal-icon {
    font-size: 22px;
    line-height: 1;
    width: 28px;
    text-align: center;
}
.xhclaw-agent-modal-info {
    flex: 1;
    min-width: 0;
}
.xhclaw-agent-modal-name {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #333;
}
.xhclaw-agent-modal-desc {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}
.xhclaw-agent-modal-check {
    display: none;
    color: #E8A87C;
    font-size: 16px;
    font-weight: bold;
}
.xhclaw-agent-modal-option.active .xhclaw-agent-modal-check {
    display: inline;
}
.xhclaw-user-name {
    font-size: 13px;
    color: var(--xhclaw-text-light);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.xhclaw-points-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 4px 10px;
    background: var(--xhclaw-gradient);
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.xhclaw-points-badge:hover {
    box-shadow: var(--xhclaw-shadow);
    transform: translateY(-1px);
}
.xhclaw-points-icon {
    color: var(--xhclaw-orange-deep);
}
.xhclaw-points-value {
    font-weight: 600;
    color: var(--xhclaw-orange-deep);
}
.xhclaw-points-unit {
    color: var(--xhclaw-text-light);
}
.xhclaw-login-btn {
    padding: 4px 14px;
    background: var(--xhclaw-gradient-btn);
    color: #fff;
    border-radius: 20px;
    font-size: 12px;
    text-decoration: none;
    transition: all 0.2s;
}
.xhclaw-login-btn:hover {
    opacity: 0.9;
    color: #fff;
}

/* Chat Area - 参与页面整体滚动 */
.xhclaw-chat-area {
    padding: 16px;
    padding-bottom: 180px; /* 为底部悬浮栏预留空间，防止消息被遮挡 */
    margin-top: -15px !important;
    background: transparent;
    overflow: visible; /* 不设独立滚动，跟随页面 */
}

/* 分页按钮 */
.xhclaw-page-btn {
    padding: 6px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #555;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.xhclaw-page-btn:hover:not(:disabled) {
    background: #f0f0f0;
    border-color: #bbb;
}
.xhclaw-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Chat Messages Container */
.xhclaw-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 100%;
}

/* Messages */
.xhclaw-msg {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    animation: xhclaw-fade-in 0.3s ease;
}
@keyframes xhclaw-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.xhclaw-msg-user {
    flex-direction: row-reverse;
}
.xhclaw-msg-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}
.xhclaw-ai-avatar {
    background: var(--xhclaw-gradient);
    color: #fff;
}
.xhclaw-user-avatar {
    background: var(--xhclaw-blue);
    color: #fff;
}
.xhclaw-msg-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: var(--xhclaw-radius-sm);
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
    overflow-wrap: break-word;
    overflow-x: auto;
}
.xhclaw-msg-assistant .xhclaw-msg-bubble {
    background: var(--xhclaw-card);
    backdrop-filter: var(--xhclaw-blur);
    -webkit-backdrop-filter: var(--xhclaw-blur);
    border: 1px solid var(--xhclaw-border);
    border-top-left-radius: 4px;
    box-shadow: var(--xhclaw-shadow);
    min-width: 0;
}
/* 图片卡片气泡 - 限制最大宽度 */
.xhclaw-msg-assistant[data-msg-type="image_card"] .xhclaw-msg-bubble {
    max-width: 360px;
    width: fit-content;
}
/* AI 思考过程框 */
.xhclaw-thinking-box {
    background: #f8f9fa;
    border-left: 3px solid #d0d5dd;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
    position: relative;
}
.xhclaw-thinking-box .xhclaw-thinking-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-weight: 600;
    color: #9ca3af;
    font-size: 12px;
}
.xhclaw-thinking-box .xhclaw-thinking-header .xhclaw-thinking-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #9ca3af;
    border-top-color: transparent;
    border-radius: 50%;
    animation: xhclaw-thinking-spin 1s linear infinite;
}
.xhclaw-thinking-box.xhclaw-thinking-done .xhclaw-thinking-header .xhclaw-thinking-icon {
    animation: none;
    border: none;
    content: '';
}
.xhclaw-thinking-box .xhclaw-thinking-text {
    white-space: pre-wrap;
}
.xhclaw-thinking-box.xhclaw-thinking-collapsed {
    max-height: 40px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}
.xhclaw-thinking-box.xhclaw-thinking-collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 24px;
    background: linear-gradient(transparent, #f8f9fa);
}
@keyframes xhclaw-thinking-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.xhclaw-msg-content {
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}
.xhclaw-msg-content * {
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}
.xhclaw-msg-user .xhclaw-msg-bubble {
    background: var(--xhclaw-gradient-btn);
    color: #fff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(212, 132, 90, 0.25);
}
.xhclaw-msg-content p {
    margin: 0 0 4px 0;
}
.xhclaw-msg-content p:last-child {
    margin-bottom: 0;
}
.xhclaw-msg-content pre {
    background: rgba(0,0,0,0.06);
    padding: 8px 12px;
    border-radius: var(--xhclaw-radius-xs);
    overflow-x: auto;
    font-size: 13px;
    margin: 8px 0;
}
.xhclaw-msg-content code {
    background: rgba(0,0,0,0.06);
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 13px;
}
.xhclaw-msg-content pre code {
    background: none;
    padding: 0;
}
.xhclaw-msg-content ul, .xhclaw-msg-content ol {
    margin: 4px 0;
    padding-left: 18px;
    list-style-position: inside;
}
.xhclaw-msg-content li {
    margin: 2px 0;
    overflow-wrap: break-word;
    word-break: break-word;
}
.xhclaw-msg-content strong {
    color: var(--xhclaw-orange-deep);
}
.xhclaw-msg-content ul {
    list-style: none;
    padding-left: 0;
}
.xhclaw-msg-content ul li::before {
    content: '';
    display: none;
}
.xhclaw-msg-content li {
    list-style: none;
    padding-left: 0;
}

/* Thinking area */
.xhclaw-thinking {
    margin-top: 8px;
    border-top: 1px dashed var(--xhclaw-border);
    padding-top: 8px;
}
.xhclaw-thinking-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--xhclaw-text-muted);
    cursor: pointer;
    user-select: none;
}
.xhclaw-thinking-toggle:hover {
    color: var(--xhclaw-orange-deep);
}
.xhclaw-thinking-toggle svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
}
.xhclaw-thinking-toggle.open svg {
    transform: rotate(90deg);
}
.xhclaw-thinking-content {
    display: none;
    margin-top: 6px;
    padding: 8px;
    background: rgba(168, 200, 216, 0.15);
    border-radius: var(--xhclaw-radius-xs);
    font-size: 12px;
    color: var(--xhclaw-text-light);
    line-height: 1.5;
}
.xhclaw-thinking-content.show {
    display: block;
}

/* 智能体思考中加载动画 */
.xhclaw-thinking-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    margin-bottom: 4px;
}
.xhclaw-thinking-loading-dots {
    display: flex;
    align-items: center;
    gap: 4px;
}
.xhclaw-thinking-loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--xhclaw-primary, #D4845A);
    animation: xhclaw-loading-bounce 1.4s ease-in-out infinite both;
}
.xhclaw-thinking-loading-dots span:nth-child(1) { animation-delay: 0s; }
.xhclaw-thinking-loading-dots span:nth-child(2) { animation-delay: 0.16s; }
.xhclaw-thinking-loading-dots span:nth-child(3) { animation-delay: 0.32s; }
.xhclaw-thinking-loading-text {
    font-size: 13px;
    color: var(--xhclaw-text-light, #999);
    letter-spacing: 0.5px;
}
@keyframes xhclaw-loading-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Confirm Card */
/* 确认步骤卡片 - 匹配参考图设计 */
/* ===== 确认卡片 ===== */
.xhclaw-confirm-card {
    background: rgba(255, 252, 248, 0.95);
    border: 1px solid rgba(232, 168, 124, 0.25);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 6px 24px rgba(212, 132, 90, 0.1);
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}
/* 文件上传区域 */
.xhclaw-file-upload-section { margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(0,0,0,0.06); }
.xhclaw-file-upload-label { font-size: 12px; color: #666; margin-bottom: 6px; }
.xhclaw-file-upload-area {
    margin-top: 10px;
    padding: 10px;
    background: #f8f6f3;
    border-radius: 8px;
    border: 1px dashed rgba(232, 168, 124, 0.4);
}
.xhclaw-file-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: var(--xhclaw-orange);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}
.xhclaw-file-upload-btn:hover { background: var(--xhclaw-orange-deep); }
.xhclaw-file-list { margin-top: 8px; }
.xhclaw-file-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    background: #fff;
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: 12px;
    color: #555;
}
.xhclaw-file-item-icon { color: var(--xhclaw-orange); font-size: 14px; }
.xhclaw-file-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xhclaw-file-item-size { color: #999; font-size: 11px; white-space: nowrap; }
.xhclaw-file-item-remove {
    color: #999;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
}
.xhclaw-file-item-remove:hover { color: #e74c3c; }
.xhclaw-confirm-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--xhclaw-orange-deep);
    margin: 0 0 12px 0;
    text-align: center;
    line-height: 1.4;
    overflow-wrap: break-word;
    word-break: break-word;
}
.xhclaw-confirm-req-section {
    background: #F5F5F5;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
}
.xhclaw-confirm-req-label {
    font-size: 11px;
    color: var(--xhclaw-text-muted);
    margin-bottom: 4px;
}
.xhclaw-confirm-req-text {
    font-size: 14px;
    color: var(--xhclaw-text);
    font-weight: 500;
    line-height: 1.5;
}
.xhclaw-confirm-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}
.xhclaw-confirm-tag {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.3px;
}
.xhclaw-confirm-steps-section {
    margin-bottom: 16px;
}
.xhclaw-confirm-steps-label {
    font-size: 11px;
    color: var(--xhclaw-text-muted);
    margin-bottom: 8px;
}
.xhclaw-confirm-steps-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.xhclaw-confirm-step-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}
.xhclaw-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #E8E8E8;
    color: var(--xhclaw-text-light);
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}
.xhclaw-step-text {
    font-size: 13px;
    color: var(--xhclaw-text);
    line-height: 22px;
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 0;
}
.xhclaw-confirm-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.xhclaw-btn-confirm {
    flex: 1;
    min-width: 0;
    padding: 9px 12px;
    background: linear-gradient(135deg, var(--xhclaw-orange), var(--xhclaw-blue-deep));
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.xhclaw-btn-confirm:hover {
    box-shadow: 0 4px 16px rgba(212, 132, 90, 0.4);
    transform: translateY(-1px);
}
.xhclaw-btn-retry {
    padding: 9px 16px;
    background: #F0F0F0;
    color: var(--xhclaw-text-light);
    border: none;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.xhclaw-btn-retry:hover {
    background: #E5E5E5;
}
.xhclaw-btn-edit {
    padding: 9px 16px;
    background: transparent;
    color: var(--xhclaw-orange);
    border: 1px solid var(--xhclaw-orange);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.xhclaw-btn-edit:hover {
    background: rgba(232, 168, 124, 0.08);
}
.xhclaw-confirm-hint {
    text-align: center;
    font-size: 11px;
    color: var(--xhclaw-text-muted);
    margin-bottom: 6px;
}
.xhclaw-confirm-disclaimer {
    text-align: center;
    font-size: 10px;
    color: var(--xhclaw-text-muted);
    opacity: 0.7;
}

/* AI 分析中指示器 */
.xhclaw-analyzing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}
.xhclaw-analyzing-icon {
    animation: xhclaw-pulse 1.5s ease-in-out infinite;
}
.xhclaw-analyzing-text {
    font-size: 13px;
    color: var(--xhclaw-text-light);
}
.xhclaw-analyzing-dots span {
    animation: xhclaw-dot-blink 1.4s infinite;
    opacity: 0;
}
.xhclaw-analyzing-dots span:nth-child(1) { animation-delay: 0s; }
.xhclaw-analyzing-dots span:nth-child(2) { animation-delay: 0.2s; }
.xhclaw-analyzing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes xhclaw-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.95); }
}
@keyframes xhclaw-dot-blink {
    0%, 20% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

/* Task Card */
.xhclaw-task-card {
    background: var(--xhclaw-card);
    backdrop-filter: var(--xhclaw-blur);
    -webkit-backdrop-filter: var(--xhclaw-blur);
    border: 1px solid var(--xhclaw-border);
    border-radius: var(--xhclaw-radius-sm);
    padding: 14px;
    margin-top: 8px;
    box-shadow: var(--xhclaw-shadow);
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}
.xhclaw-task-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 8px;
    flex-wrap: wrap;
}
.xhclaw-task-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--xhclaw-orange-deep);
    overflow-wrap: break-word;
    word-break: break-word;
    flex: 1;
    min-width: 0;
}
.xhclaw-task-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}
.xhclaw-status-pending { background: #FFF3E0; color: #E65100; }
.xhclaw-status-processing { background: #E3F2FD; color: #1565C0; }
.xhclaw-status-completed { background: #E8F5E9; color: #2E7D32; }
.xhclaw-status-cancelled { background: #F5F5F5; color: #757575; }
.xhclaw-status-error { background: #FFEBEE; color: #C62828; }

.xhclaw-task-steps {
    margin: 0 0 8px 0;
    padding-left: 18px;
}
.xhclaw-task-steps li {
    font-size: 12px;
    color: var(--xhclaw-text-light);
    margin-bottom: 3px;
    position: relative;
    list-style: none;
    padding-left: 16px;
}
.xhclaw-task-steps li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--xhclaw-blue-light);
}
.xhclaw-task-steps li.step-completed::before {
    background: #4CAF50;
}
.xhclaw-task-steps li.step-processing::before {
    background: #2196F3;
    animation: xhclaw-pulse 1.5s infinite;
}
@keyframes xhclaw-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.xhclaw-task-progress {
    margin-top: 8px;
}
.xhclaw-progress-bar {
    height: 6px;
    background: var(--xhclaw-blue-light);
    border-radius: 3px;
    overflow: hidden;
}
.xhclaw-progress-fill {
    height: 100%;
    background: var(--xhclaw-gradient-btn);
    border-radius: 3px;
    transition: width 0.5s ease;
}
.xhclaw-progress-text {
    font-size: 11px;
    color: var(--xhclaw-text-muted);
    margin-top: 3px;
    text-align: right;
}

/* Quick Actions */
.xhclaw-quick-actions {
    display: flex;
    gap: 6px;
    padding: 0 0 8px 0;
    background: transparent;
    overflow-x: auto;
    flex-wrap: nowrap;
}
.xhclaw-quick-btn {
    padding: 5px 12px;
    background: rgba(255,255,255,0.5);
    border: 1px solid var(--xhclaw-border);
    border-radius: 16px;
    font-size: 12px;
    color: var(--xhclaw-text-light);
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.2s;
}
.xhclaw-quick-btn:hover {
    background: var(--xhclaw-orange-light);
    color: var(--xhclaw-orange-deep);
}

/* Input Area - 已改由 JS 动态创建悬浮栏，此处不再需要 */
.xhclaw-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: rgba(255,255,255,0.6);
    border: 1px solid var(--xhclaw-border);
    border-radius: var(--xhclaw-radius-sm);
    padding: 6px 8px;
    transition: border-color 0.2s;
}
.xhclaw-input-wrapper:focus-within {
    border-color: var(--xhclaw-orange);
    box-shadow: 0 0 0 3px rgba(232, 168, 124, 0.15);
}
.xhclaw-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    font-size: 14px;
    line-height: 1.5;
    color: var(--xhclaw-text);
    max-height: 100px;
    min-height: 22px;
    font-family: inherit;
}
.xhclaw-input::placeholder {
    color: var(--xhclaw-text-muted);
}
.xhclaw-attach-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--xhclaw-text-muted);
    font-size: 20px;
    line-height: 28px;
    text-align: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.xhclaw-attach-btn:hover {
    background: rgba(232,168,124,0.15);
    color: var(--xhclaw-orange);
}
.xhclaw-chat-img-preview {
    position: relative;
    display: inline-block;
    margin: 4px 0;
}
.xhclaw-chat-img-thumb {
    position: relative;
    display: inline-block;
    margin-right: 6px;
}
.xhclaw-chat-img-thumb img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--xhclaw-border);
    cursor: pointer;
    transition: transform 0.15s;
}
.xhclaw-chat-img-thumb img:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
/* 图片弹窗 */
.xhclaw-img-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    cursor: pointer;
    animation: xhclaw-modal-fadein 0.2s;
}
.xhclaw-img-modal img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
@keyframes xhclaw-modal-fadein {
    from { opacity: 0; }
    to { opacity: 1; }
}
.xhclaw-chat-img-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #ff4d4f;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.xhclaw-chat-img-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0;
}
.xhclaw-chat-images {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}
.xhclaw-chat-img-wrap {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    display: inline-block;
    margin: 2px 4px 2px 0;
}
.xhclaw-chat-img-wrap img.xhclaw-chat-img {
    width: 80px !important;
    height: 80px !important;
    max-width: 80px !important;
    max-height: 80px !important;
    object-fit: cover;
    margin: 0;
    display: block;
    transition: transform 0.2s;
}
.xhclaw-chat-img-wrap:hover img.xhclaw-chat-img {
    transform: scale(1.05);
}
.xhclaw-send-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--xhclaw-gradient-btn);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}
.xhclaw-send-btn:hover {
    box-shadow: 0 4px 12px rgba(212, 132, 90, 0.4);
    transform: scale(1.05);
}
.xhclaw-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.xhclaw-send-btn.loading svg {
    animation: xhclaw-spin 1s linear infinite;
}
@keyframes xhclaw-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.xhclaw-disclaimer {
    font-size: 11px;
    color: var(--xhclaw-text-muted);
    text-align: center;
    margin-top: 6px;
}

/* Load More */
.xhclaw-load-more, .xhclaw-no-more {
    text-align: center;
    padding: 8px;
}
.xhclaw-btn-text {
    background: none;
    border: none;
    color: var(--xhclaw-blue-deep);
    font-size: 12px;
    cursor: pointer;
}
.xhclaw-btn-text:hover {
    text-decoration: underline;
}
.xhclaw-no-more {
    font-size: 12px;
    color: var(--xhclaw-text-muted);
}

/* Modals */
.xhclaw-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000 !important;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: xhclaw-fade-in 0.2s ease;
}
.xhclaw-modal-content {
    background: rgba(255,255,255,0.92);
    backdrop-filter: var(--xhclaw-blur);
    -webkit-backdrop-filter: var(--xhclaw-blur);
    border: 1px solid var(--xhclaw-border);
    border-radius: var(--xhclaw-radius);
    box-shadow: var(--xhclaw-shadow-lg);
    width: 90%;
    max-width: 440px;
    max-height: 85vh;
    overflow-y: auto;
}
.xhclaw-modal-content.xhclaw-modal-large {
    max-width: 560px;
}
.xhclaw-modal-content.xhclaw-modal-small {
    max-width: 320px;
}
.xhclaw-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--xhclaw-border);
}
.xhclaw-modal-header h2, .xhclaw-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--xhclaw-text);
}
.xhclaw-modal-close {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(0,0,0,0.06);
    border-radius: 50%;
    font-size: 18px;
    color: var(--xhclaw-text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.xhclaw-modal-close:hover {
    background: rgba(0,0,0,0.12);
}
.xhclaw-modal-body {
    padding: 18px;
}

/* Form */
.xhclaw-form-group {
    margin-bottom: 14px;
}
.xhclaw-form-group label {
    display: block;
    font-size: 13px;
    color: var(--xhclaw-text-light);
    margin-bottom: 5px;
}
.xhclaw-input-field {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--xhclaw-border);
    border-radius: var(--xhclaw-radius-xs);
    background: rgba(255,255,255,0.6);
    font-size: 14px;
    color: var(--xhclaw-text);
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.xhclaw-input-field:focus {
    border-color: var(--xhclaw-orange);
    box-shadow: 0 0 0 3px rgba(232, 168, 124, 0.12);
}
.xhclaw-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}
.xhclaw-create-site-link {
    margin-top: 12px;
    font-size: 12px;
    color: var(--xhclaw-text-muted);
    text-align: center;
}
.xhclaw-create-site-link a {
    color: var(--xhclaw-orange-deep);
    text-decoration: none;
}
.xhclaw-create-site-link a:hover {
    text-decoration: underline;
}

/* Points Center */
.xhclaw-points-summary {
    text-align: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--xhclaw-border);
    margin-bottom: 14px;
}
.xhclaw-points-total {
    font-size: 36px;
    font-weight: 700;
    color: var(--xhclaw-orange-deep);
}
.xhclaw-points-total-unit {
    font-size: 14px;
    color: var(--xhclaw-text-muted);
    margin-left: 4px;
}
.xhclaw-recharge-btn {
    display: inline-block;
    margin-top: 8px;
}
.xhclaw-points-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--xhclaw-border);
}
.xhclaw-points-tab {
    flex: 1;
    padding: 8px 0;
    border: none;
    background: none;
    font-size: 13px;
    color: var(--xhclaw-text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.xhclaw-points-tab.active {
    color: var(--xhclaw-orange-deep);
    border-bottom-color: var(--xhclaw-orange-deep);
}
.xhclaw-points-tab:hover {
    color: var(--xhclaw-orange);
}
.xhclaw-points-list {
    min-height: 100px;
}
.xhclaw-points-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    font-size: 13px;
}
.xhclaw-points-list-item:last-child {
    border-bottom: none;
}
.xhclaw-points-item-desc {
    color: var(--xhclaw-text);
}
.xhclaw-points-item-time {
    font-size: 11px;
    color: var(--xhclaw-text-muted);
}
.xhclaw-points-item-value {
    font-weight: 600;
}
.xhclaw-points-item-value.positive {
    color: #4CAF50;
}
.xhclaw-points-item-value.negative {
    color: #E53935;
}

/* Points status tags */
.xhclaw-tag {
    display: inline-block;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: middle;
    font-weight: 500;
}
.xhclaw-tag-pending { background: #FFF3E0; color: #E65100; }
.xhclaw-tag-processing { background: #E3F2FD; color: #1565C0; }
.xhclaw-tag-done { background: #E8F5E9; color: #2E7D32; }
.xhclaw-tag-cancelled { background: #F5F5F5; color: #757575; }
.xhclaw-tag-error { background: #FFEBEE; color: #C62828; }

/* Customer Service */
.xhclaw-cs-body {
    text-align: center;
}
.xhclaw-qr-img {
    width: 200px;
    height: 200px;
    object-fit: contain;
    border-radius: var(--xhclaw-radius-sm);
    margin: 10px 0;
}
.xhclaw-muted {
    color: var(--xhclaw-text-muted);
}

/* Loading dots */
.xhclaw-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}
.xhclaw-typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--xhclaw-orange);
    animation: xhclaw-typing 1.4s infinite both;
}
.xhclaw-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.xhclaw-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes xhclaw-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Follow-up question button */
.xhclaw-follow-up-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0,0,0,0.05);
    color: #999;
    cursor: pointer;
    margin-top: 6px;
    transition: all 0.2s;
    border: none;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.xhclaw-follow-up-btn:hover {
    background: var(--xhclaw-gradient-btn);
    color: #fff;
    transform: scale(1.1);
}
.xhclaw-follow-up-btn:active {
    transform: scale(0.95);
}
.xhclaw-msg-user .xhclaw-follow-up-btn {
    display: none;
}

/* Pagination */
.xhclaw-pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 16px;
}
.xhclaw-pagination button {
    padding: 4px 10px;
    border: 1px solid var(--xhclaw-border);
    background: rgba(255,255,255,0.5);
    border-radius: var(--xhclaw-radius-xs);
    font-size: 12px;
    cursor: pointer;
}
.xhclaw-pagination button.active {
    background: var(--xhclaw-gradient-btn);
    color: #fff;
    border-color: transparent;
}
.xhclaw-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Shortcode wrapper */
.xhclaw-shortcode-wrapper {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
    margin-top: -15px !important;
}

/* 隐藏子比悬浮按钮 - 仅在插件容器内生效，由JS控制更安全 */
.xhclaw-app .zib-widget {
    margin-top: -15px !important;
}

.xhclaw-shortcode-wrapper .xhclaw-app {
    width: 100%;
    overflow: visible !important;
    height: auto !important;
}

/* AI消息内容Markdown样式+防溢出 */
.xhclaw-msg-content pre {
    background: #f4f4f4;
    border-radius: 6px;
    padding: 8px 10px;
    overflow-x: auto;
    max-width: 100%;
    font-size: 12px;
    margin: 6px 0;
}
.xhclaw-msg-content code {
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 12px;
    word-break: break-all;
}
.xhclaw-msg-content pre code {
    background: none;
    padding: 0;
    word-break: normal;
}
.xhclaw-msg-content li {
    margin-left: 16px;
    line-height: 1.6;
}
/* 增强Markdown样式 */
.xhclaw-msg-content .xhclaw-code-block {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 12px 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 13px;
    line-height: 1.5;
}
.xhclaw-msg-content .xhclaw-code-block code {
    background: none;
    padding: 0;
    word-break: normal;
    color: inherit;
}
.xhclaw-msg-content .xhclaw-inline-code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #c7254e;
}
.xhclaw-msg-content .xhclaw-h {
    margin: 12px 0 6px 0;
    font-weight: 700;
    line-height: 1.4;
}
.xhclaw-msg-content .xhclaw-h2 { font-size: 1.15em; }
.xhclaw-msg-content .xhclaw-h3 { font-size: 1.05em; }
.xhclaw-msg-content .xhclaw-h4 { font-size: 1em; }
.xhclaw-msg-content .xhclaw-quote {
    border-left: 3px solid #e8a87c;
    padding: 6px 12px;
    margin: 8px 0;
    background: #fff8f3;
    border-radius: 0 6px 6px 0;
    color: #555;
    font-size: 0.95em;
}
.xhclaw-msg-content .xhclaw-link {
    color: #e8a87c;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.xhclaw-msg-content .xhclaw-link:hover {
    color: #d4935e;
}
.xhclaw-msg-content .xhclaw-hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 12px 0;
}
.xhclaw-msg-content .xhclaw-ol {
    padding-left: 20px;
    margin: 6px 0;
}
.xhclaw-msg-content .xhclaw-ol li {
    margin-left: 0;
    padding-left: 4px;
    line-height: 1.7;
}
.xhclaw-msg-content .xhclaw-ul {
    padding-left: 20px;
    margin: 6px 0;
    list-style: disc;
}
.xhclaw-msg-content .xhclaw-ul li {
    margin-left: 0;
    padding-left: 4px;
    line-height: 1.7;
}
.xhclaw-msg-content h1, .xhclaw-msg-content h2, .xhclaw-msg-content h3 {
    margin: 8px 0 4px;
    font-weight: 600;
}
.xhclaw-msg-content h1 { font-size: 16px; }
.xhclaw-msg-content h2 { font-size: 15px; }
.xhclaw-msg-content h3 { font-size: 14px; }
.xhclaw-msg-content hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 8px 0;
}
.xhclaw-msg-content a {
    color: var(--xhclaw-orange);
    word-break: break-all;
}

/* 追加描述提示行 */
.xhclaw-append-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #FFF8F0;
    border: 1px solid #FFD8A8;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 12px;
    line-height: 1.4;
}
.xhclaw-append-hint-label {
    display: inline-block;
    padding: 1px 8px;
    background: linear-gradient(135deg, #FF8A50, #E65100);
    color: #fff;
    border-radius: 10px;
    font-weight: 600;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
}
.xhclaw-append-hint-text {
    color: #5D4037;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.xhclaw-append-hint-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #F5F5F5;
    color: #999;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
}
.xhclaw-append-hint-close:hover {
    background: #FFCDD2;
    color: #C62828;
}
.xhclaw-msg-content img {
    max-width: 100%;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s;
}
/* 用户上传的图片缩略图 - 必须覆盖上面通用img样式 */
.xhclaw-msg-content .xhclaw-chat-img-wrap {
    width: 80px;
    height: 80px;
    display: inline-block;
    margin: 2px 4px 2px 0;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
}
.xhclaw-msg-content .xhclaw-chat-img {
    width: 80px !important;
    height: 80px !important;
    max-width: 80px !important;
    max-height: 80px !important;
    object-fit: cover;
    border-radius: 6px;
}
.xhclaw-msg-content img:hover {
    opacity: 0.85;
}
/* 图片弹窗 */
.xhclaw-img-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    animation: xhclaw-fade-in 0.2s ease;
}
.xhclaw-img-modal img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    cursor: default;
}
.xhclaw-img-modal-close {
    position: absolute;
    top: 16px; right: 20px;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    z-index: 1000000;
}
.xhclaw-img-modal-close:hover { opacity: 1; }
@keyframes xhclaw-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.xhclaw-confirm-card, .xhclaw-task-card {
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 0;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .xhclaw-app {
        max-height: none;
        min-height: 300px;
        border-radius: 0;
    }
    .xhclaw-banner {
        border-radius: 0;
    }
    .xhclaw-header {
        padding: 10px 12px;
        flex-wrap: wrap;
        justify-content: center;
    }
    .xhclaw-header-left, .xhclaw-header-right {
        flex-wrap: wrap;
    }
    .xhclaw-site-select {
        max-width: 120px;
    }
    .xhclaw-agent-opt-desc {
        display: none;
    }
    .xhclaw-agent-tabs {
        order: 3;
        width: auto;
        max-width: 100%;
    }
        margin-top: 4px;
    }
    .xhclaw-user-name {
        max-width: 60px;
    }
    .xhclaw-msg-bubble {
        max-width: 90%;
        font-size: 14px;
    }
    .xhclaw-msg-content {
        word-break: break-word;
        overflow-wrap: break-word;
    }
    .xhclaw-confirm-card {
        padding: 12px;
    }
    .xhclaw-confirm-title {
        font-size: 14px;
    }
    .xhclaw-confirm-actions {
        flex-direction: column;
        gap: 8px;
    }
    .xhclaw-btn-confirm,
    .xhclaw-btn-retry,
    .xhclaw-btn-edit {
        width: 100%;
        text-align: center;
        padding: 10px 12px;
    }
    .xhclaw-task-card {
        padding: 12px;
    }
    .xhclaw-task-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .xhclaw-task-status {
        align-self: flex-start;
    }
    .xhclaw-quick-actions {
        padding: 0 0 6px 0;
    }
    .xhclaw-chat-area {
        padding-bottom: 160px;
    }
    .xhclaw-modal-content {
        width: 95%;
    }
}

/* ===== 作图相关样式 ===== */
.xhclaw-image-controls {
    display: none;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    overflow: hidden;
}
.xhclaw-img-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    color: #999;
    flex-shrink: 0;
    transition: all 0.2s;
}
.xhclaw-img-upload-btn:hover {
    border-color: #E8A87C;
    color: #E8A87C;
}
.xhclaw-img-ref-preview {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}
.xhclaw-img-ref-preview img {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid #e0e0e0;
}
.xhclaw-img-ref-preview button {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ff4d4f;
    color: #fff;
    border: none;
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 图片卡片 */
.xhclaw-img-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
}
.xhclaw-img-card-model {
    color: #999;
}
.xhclaw-img-card-cost {
    color: #E8A87C;
    font-weight: 500;
}
.xhclaw-img-card-prompt {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    padding: 6px 10px;
    background: rgba(0,0,0,0.03);
    border-radius: 6px;
    word-break: break-all;
}
.xhclaw-img-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}
.xhclaw-img-card-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #f0f0f0;
    aspect-ratio: auto;
    max-width: 100%;
}
.xhclaw-img-card-item img {
    width: 100%;
    display: block;
    border-radius: 7px;
}
.xhclaw-img-card-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 6px;
    background: linear-gradient(transparent, rgba(0,0,0,0.5));
    opacity: 0;
    transition: opacity 0.2s;
}
.xhclaw-img-card-item:hover .xhclaw-img-card-actions {
    opacity: 1;
}
.xhclaw-img-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.xhclaw-img-btn:hover {
    transform: scale(1.1);
}
.xhclaw-img-card-errors {
    margin-top: 8px;
    font-size: 12px;
    color: #ff4d4f;
}
.xhclaw-loading-dots span {
    animation: xhclaw-dots 1.4s infinite;
    opacity: 0;
}
.xhclaw-loading-dots span:nth-child(1) { animation-delay: 0s; }
.xhclaw-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.xhclaw-loading-dots span:nth-child(3) { animation-delay: 0.4s; }
/* 图片放大查看遮罩 */
.xhclaw-img-zoom-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85); z-index: 99999;
    display: flex; align-items: center; justify-content: center;
}
.xhclaw-img-zoom-container {
    position: relative; max-width: 90vw; max-height: 90vh;
}
.xhclaw-img-zoom-container img {
    max-width: 90vw; max-height: 85vh; object-fit: contain;
    border-radius: 8px; box-shadow: 0 4px 32px rgba(0,0,0,0.5);
}
.xhclaw-img-zoom-close {
    position: absolute; top: -12px; right: -12px;
    width: 36px; height: 36px; border-radius: 50%;
    background: #fff; border: none; font-size: 20px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.xhclaw-img-zoom-close:hover { background: #f0f0f0; }

/* 图片卡片底部 */
.xhclaw-img-card-footer {
    margin-top: 8px;
    display: flex;
    align-items: center;
}
.xhclaw-img-regen-btn {
    background: transparent; color: #999; border: 1px solid #e0e0e0;
    padding: 3px 10px; border-radius: 4px; cursor: pointer;
    font-size: 11px; transition: all 0.2s; line-height: 1.4;
}
.xhclaw-img-regen-btn:hover {
    color: #E8A87C; border-color: #E8A87C; background: rgba(232,168,124,0.06);
}

/* 图片生成中动画 */
.xhclaw-img-gen-loading {
    padding: 12px 16px;
}
.xhclaw-img-gen-loading-row {
    display: flex; align-items: center; gap: 10px;
}
.xhclaw-img-gen-spinner {
    width: 28px; height: 28px; border: 3px solid #f0f0f0;
    border-top-color: #E8A87C; border-radius: 50%;
    animation: xhclaw-spin 0.8s linear infinite;
    flex-shrink: 0;
}
.xhclaw-img-gen-text {
    font-size: 13px; color: #999;
}
.xhclaw-img-gen-text .count {
    color: #E8A87C; font-weight: 600;
}
.xhclaw-img-generating-tip {
    margin-top: 8px; font-size: 12px; color: #bbb;
    min-height: 18px; line-height: 18px;
}

/* 图片懒加载占位 */
.xhclaw-img-lazy-wrap {
    position: relative; background: #f8f8f8; border-radius: 7px;
    min-height: 120px; display: flex; align-items: center; justify-content: center;
}
.xhclaw-img-lazy-wrap img {
    transition: opacity 0.3s;
}
.xhclaw-img-lazy-spinner {
    position: absolute; width: 24px; height: 24px;
    border: 2px solid #eee; border-top-color: #E8A87C;
    border-radius: 50%; animation: xhclaw-spin 0.7s linear infinite;
}

@keyframes xhclaw-dots {
    0%, 80%, 100% { opacity: 0; }
    40% { opacity: 1; }
}
@keyframes xhclaw-spin {
    to { transform: rotate(360deg); }
}

/* 作图模式选择菜单 */
.xhclaw-img-mode-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.35); z-index: 999;
    display: flex; align-items: center; justify-content: center;
    animation: xhclaw-overlay-fadein 0.15s ease;
}
.xhclaw-img-mode-menu {
    background: #fff; border-radius: 14px; box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    padding: 16px; min-width: 240px; max-width: 90vw;
    animation: xhclaw-menu-fadein 0.2s ease;
}
.xhclaw-img-mode-title {
    font-size: 14px; font-weight: 600; color: #333; margin-bottom: 12px;
    text-align: center;
}
.xhclaw-img-mode-item {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 14px; cursor: pointer; font-size: 13px;
    color: #333; border-radius: 10px; transition: background 0.15s;
}
.xhclaw-img-mode-item:hover {
    background: #f5f5f5;
}
.xhclaw-img-mode-item.active {
    background: #FFF5EE; color: #E8A87C; font-weight: 600;
}
.xhclaw-img-mode-item .mode-icon {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0;
}
.xhclaw-img-mode-item .mode-name { flex: 1; }
.xhclaw-img-mode-item .mode-cost {
    font-size: 11px; color: #bbb;
}
.xhclaw-img-mode-item.active .mode-cost { color: #E8A87C; }

@keyframes xhclaw-overlay-fadein {
    from { opacity: 0; } to { opacity: 1; }
}
@keyframes xhclaw-menu-fadein {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* 对话模型选择器 */
.xhclaw-chat-model-arrow {
    font-size: 10px; cursor: pointer; margin-left: 4px; opacity: 0.6;
    transition: transform 0.2s;
}
.xhclaw-chat-model-arrow:hover { opacity: 1; }
.xhclaw-chat-model-arrow.open { transform: rotate(180deg); }
.xhclaw-chat-model-menu {
    display: none; position: absolute; top: 100%; left: 0; z-index: 100;
    background: #fff; border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    padding: 8px; min-width: 180px; margin-top: 4px;
    animation: xhclaw-menu-fadein 0.2s ease;
}
.xhclaw-chat-model-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; cursor: pointer; font-size: 13px;
    color: #333; border-radius: 8px; transition: background 0.15s;
}
.xhclaw-chat-model-item:hover { background: #f5f5f5; }
.xhclaw-chat-model-item.active { background: #FFF5EE; color: #E8A87C; font-weight: 600; }
.xhclaw-chat-model-item .model-name { flex: 1; }
.xhclaw-chat-model-item .model-cost { font-size: 11px; color: #bbb; }
.xhclaw-chat-model-item.active .model-cost { color: #E8A87C; }

/* 图片生成中 loading */
.xhclaw-img-loading {
    text-align: center;
    padding: 20px;
}
.xhclaw-img-loading-spinner {
    width: 32px; height: 32px;
    border: 3px solid #f0f0f0;
    border-top-color: #E8A87C;
    border-radius: 50%;
    animation: xhclaw-spin 0.8s linear infinite;
    margin: 0 auto 10px;
}
@keyframes xhclaw-spin {
    to { transform: rotate(360deg); }
}
.xhclaw-img-loading > span {
    display: block;
    font-size: 13px;
    color: #999;
    margin-bottom: 8px;
}
.xhclaw-img-generating-tip {
    font-size: 12px;
    color: #bbb;
    min-height: 18px;
    line-height: 18px;
    transition: opacity 0.5s ease-in-out;
}

/* ===== 指令面板 ===== */
.xhclaw-cmd-tab {
    transition: color 0.2s;
}
.xhclaw-cmd-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    width: 60%;
    height: 2px;
    background: linear-gradient(135deg, #E8A87C, #D4845A);
    border-radius: 1px;
}
.xhclaw-cmd-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    background: #fafafa;
    cursor: pointer;
    transition: background 0.2s;
    gap: 10px;
}
.xhclaw-cmd-item:hover {
    background: #f0ebe6;
}
.xhclaw-cmd-item-info {
    flex: 1;
    min-width: 0;
}
.xhclaw-cmd-item-title {
    font-size: 13px;
    font-weight: 500;
    color: #3D3D3D;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.xhclaw-cmd-item-content {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.xhclaw-cmd-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.xhclaw-cmd-item-actions button {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 12px;
    transition: all 0.2s;
}
.xhclaw-cmd-item-actions button:hover {
    background: #f0ebe6;
    color: #E8A87C;
}
.xhclaw-cmd-item-actions button.xhclaw-cmd-delete:hover {
    color: #e74c3c;
}
.xhclaw-cmd-cat-header {
    font-size: 12px;
    font-weight: 600;
    color: #999;
    padding: 8px 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.xhclaw-cmd-fold-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    font-size: 12px;
    color: #E8A87C;
    cursor: pointer;
    gap: 4px;
}
.xhclaw-cmd-fold-toggle:hover {
    text-decoration: underline;
}
.xhclaw-cmd-star {
    color: #E8A87C;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.xhclaw-cmd-star:hover {
    transform: scale(1.2);
}
.xhclaw-cmd-star.inactive {
    color: #ddd;
}
.xhclaw-cmd-edit-area {
    background: #f8f6f4;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 6px;
}
.xhclaw-cmd-edit-area input,
.xhclaw-cmd-edit-area textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    font-size: 13px;
    box-sizing: border-box;
    margin-bottom: 6px;
    font-family: inherit;
}
.xhclaw-cmd-edit-area textarea {
    resize: vertical;
    min-height: 60px;
}
.xhclaw-cmd-edit-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}
.xhclaw-cmd-edit-actions button {
    padding: 4px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}
.xhclaw-cmd-apply-btn {
    background: linear-gradient(135deg, #E8A87C, #D4845A) !important;
    color: #fff !important;
}
.xhclaw-cmd-apply-btn:hover {
    opacity: 0.9;
}
.xhclaw-cmd-cancel-btn {
    background: #f0f0f0 !important;
    color: #666 !important;
}
