@charset "UTF-8";

/* =========================================
           1. Base UI styles
           ========================================= */
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
        }

        html, body {
            height: 100%;
            overflow: hidden;
        }

        .sr-only {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border: 0;
        }

        body {
            background-color: #fcfcfc;
            padding: 20px;
            color: #333;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            -webkit-text-size-adjust: 100%;
        }

        .main-container {
            width: 100%;
            max-width: 1000px;
            background-color: #fff;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            padding: 24px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.02);
            display: flex;
            flex-direction: column;
            flex: 1;
            min-height: 0;
        }

        .page-title {
            font-size: 18px;
            font-weight: 700;
            margin: 0 0 24px 0;
            color: #111;
        }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header .page-title {
    margin: 0;
}

.page-header .chat-close {
    margin-left: auto;
}

        @supports (-webkit-touch-callout: none) {
            body {
                min-height: -webkit-fill-available;
            }
        }

        .chat-interface {
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            flex: 1;
            min-height: 0;
            max-height: 100%;
        }

        .chat-header {
            padding: 16px 20px;
            border-bottom: 1px solid #f0f0f0;
            display: flex;
            align-items: center;
            background-color: #fff;
            flex-shrink: 0;
            justify-content: space-between;
        }

        .chat-header h3 {
            font-size: 16px;
            font-weight: 600;
            margin-right: 10px;
        }

        .chat-close {
            border: 1px solid #e5e7eb;
            background: #fff;
            color: #111827;
            border-radius: 999px;
            width: 32px;
            height: 32px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            padding: 0;
        }

        .chat-close:hover {
            background: #f9fafb;
        }

        .chat-close svg {
            width: 18px;
            height: 18px;
        }

        .status-badge {
            display: inline-flex;
            align-items: center;
            background-color: #f3f4f6;
            border: 1px solid #e5e7eb;
            border-radius: 4px;
            padding: 2px 8px;
            font-size: 12px;
            color: #374151;
        }

        .status-dot {
            width: 8px;
            height: 8px;
            background-color: #10b981;
            border-radius: 50%;
            margin-right: 6px;
            animation: pulse 1.5s infinite;
        }

        @keyframes pulse {
            0% { opacity: 0.3; }
            50% { opacity: 1; }
            100% { opacity: 0.3; }
        }

        /* 聊天记录区域 */
        .chat-messages {
            background-color: #fff;
            padding: 20px 40px;
            flex: 1;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 24px;
        }

        /* 娑堟伅琛岀粨鏋?*/
        .message-row {
            display: flex;
            align-items: flex-start;
            max-width: 85%;
            animation: fadeIn 0.3s ease;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }

        @keyframes cardReveal {
            from { opacity: 0; transform: translateY(12px) scale(0.98); }
            to { opacity: 1; transform: translateY(0) scale(1); }
        }

        .message-row.me {
            align-self: flex-end;
            flex-direction: column;
            align-items: flex-end;
        }

        .message-row.other {
            align-self: flex-start;
            flex-direction: row;
        }

        /* 头像 */
        .avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            margin-right: 12px;
            flex-shrink: 0;
            background-color: #0f172a;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .avatar img {
            width: 100%;
            height: 100%;
            border-radius: 50%;
            object-fit: cover;
            display: block;
        }
        
        /* 娑堟伅鍏冩暟鎹?*/
        .message-meta {
            font-size: 12px;
            color: #6b7280;
            margin-bottom: 4px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .message-row.me .message-meta {
            justify-content: flex-end;
        }

        .message-content-wrapper {
            display: flex;
            flex-direction: column;
        }

        /* 气泡样式 */
        .bubble {
            padding: 12px 16px;
            border-radius: 8px;
            font-size: 16px;
            line-height: 1.5;
            position: relative;
            word-wrap: break-word;
        }

        .message-row.me .bubble {
            background-color: #2563eb;
            color: white;
            border-top-right-radius: 2px;
        }

        .message-row.other .bubble {
            background-color: #f1f5f9;
            color: #1e293b;
            margin-top: 2px;
            border-top-left-radius: 2px;
        }
        
        .message-row .bubble {
            font-size: 14px;
            line-height: 1.5;
        }

        /* 底部输入区域 */
        .input-area {
            padding: 20px;
            border-top: 1px solid #f0f0f0;
            background-color: #fff;
            flex-shrink: 0;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .input-bar {
            display: flex;
            align-items: flex-end;
            gap: 10px;
        }

        .textarea-wrapper {
            border: 1px solid #d1d5db;
            border-radius: 6px;
            padding: 12px;
            background: #fff;
            margin: 0;
            transition: border-color 0.2s;
            flex: 1;
        }

        .textarea-wrapper:focus-within {
            border-color: #2563eb;
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
        }

        textarea {
            width: 100%;
            border: none;
            resize: none;
            outline: none;
            font-size: 14px;
            color: #333;
            height: 60px;
            font-family: inherit;
        }
        
        textarea::placeholder {
            color: #9ca3af;
        }

        .button-wrapper {
            display: flex;
            justify-content: flex-end;
            align-items: center;
            gap: 12px;
            flex-wrap: wrap;
        }

        .send-btn {
            background-color: #2563eb;
            color: white;
            border: none;
            padding: 8px 24px;
            border-radius: 6px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .send-btn:hover:not(:disabled) {
            background-color: #1d4ed8;
        }

        .send-btn:disabled {
            background-color: #93c5fd;
            cursor: not-allowed;
        }

        .send-icon {
            display: none;
            width: 20px;
            height: 20px;
            fill: #fff;
        }

        .send-btn.restart-mode {
            width: 40px;
            height: 40px;
            padding: 0;
            border-radius: 50%;
            background-color: #0f172a;
        }

        .send-btn.restart-mode .restart-icon {
            width: 18px;
            height: 18px;
            border: 2px solid #fff;
            border-radius: 50%;
            position: relative;
            display: inline-block;
        }

        .send-btn.restart-mode .restart-icon::after {
            content: "";
            position: absolute;
            width: 6px;
            height: 6px;
            border-top: 2px solid #fff;
            border-right: 2px solid #fff;
            top: -3px;
            right: -1px;
            transform: rotate(45deg);
            background: transparent;
        }

        .direct-summary-btn {
            background-color: #0f172a;
            color: #fff;
            border: none;
            padding: 8px 18px;
            border-radius: 999px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
        }

        .direct-summary-btn:hover:not(:disabled) {
            background-color: #1e293b;
        }

        .direct-summary-btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }


        .mobile-nav {
            display: none;
        }

        .mobile-nav {
            align-items: center;
            justify-content: space-between;
            padding: 12px 20px;
        }

        .mobile-nav .app-name {
            font-size: 18px;
            font-weight: 600;
            color: #111;
        }

        .mobile-nav .app-name span {
            font-size: 13px;
            color: #9ca3af;
            margin-left: 4px;
        }

        .mobile-nav .nav-subtitle {
            font-size: 12px;
            color: #94a3b8;
        }

        .mobile-nav .nav-icons {
            display: flex;
            gap: 12px;
        }

        .mobile-nav .nav-icon {
            width: 32px;
            height: 32px;
            border-radius: 16px;
            border: 1px solid #e2e8f0;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #0f172a;
            background: #fff;
            cursor: pointer;
            padding: 0;
        }


        /* ===========
           鍝嶅簲寮忎紭鍖?
           =========== */

        @media (max-width: 768px) {
            body {
                padding: 0;
                min-height: 100svh;
                background-color: #fff;
                width: 100%;
                align-items: stretch;
                justify-content: center;
            }

            .mobile-nav {
                display: flex;
            }

            .page-header {
                display: none;
            }

            .main-container {
                padding: 0;
                border: none;
                border-radius: 0;
                box-shadow: none;
                width: 100%;
                height: 100vh;
                display: flex;
                flex-direction: column;
            }

            .page-title {
                display: none;
            }

            .chat-interface {
                flex: 1;
                height: 100%;
                border: none;
                border-radius: 0;
                margin-top: 4px;
            }

            .chat-header {
                display: none;
            }

            .chat-messages {
                padding: 14px 16px;
                gap: 16px;
            }

            .message-row {
                max-width: 100%;
            }

            .avatar {
                margin-right: 8px;
            }

            .input-area {
                padding: 12px 16px 20px;
                flex-direction: row;
                align-items: flex-end;
            }

            .button-wrapper {
                flex-direction: column;
                align-items: flex-end;
                gap: 8px;
            }

            .input-bar {
                flex: 1;
                padding: 4px 14px;
                border-radius: 28px;
                background: #f5f5f5;
                align-items: center;
                justify-content: flex-start;
            }

            .textarea-wrapper {
                padding: 0;
                border: none;
                background: transparent;
                max-width: 180px;
            }

            .textarea-wrapper:focus-within {
                box-shadow: none;
            }

            textarea {
                font-size: 14px;
                height: 24px;
                line-height: 24px;
                background: transparent;
                text-align: left;
                padding: 0;
            }

            .send-btn {
                width: 40px;
                height: 40px;
                padding: 0;
                border-radius: 50%;
                background-color: #4f46e5;
            }

            .send-btn:disabled {
                background-color: #c7d2fe;
            }

            .send-label {
                display: none;
            }

            .send-icon {
                display: block;
            }

            .direct-summary-btn {
                width: 100%;
                max-width: 180px;
                padding: 8px 16px;
            }

            .summary-card,
            .rag-card,
            .service-options,
            .confirmation-card {
                padding: 14px;
            }
        }

        @media (max-width: 480px) {
            .chat-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 8px;
            }

            .status-badge {
                width: 100%;
                justify-content: center;
            }

            .chat-messages {
                padding: 12px;
            }

            .service-options {
                flex-direction: column;
                gap: 8px;
            }

            .confirmation-actions {
                flex-direction: column;
            }

            .confirmation-actions button {
                width: 100%;
            }

            .input-area {
                padding: 10px 12px 16px;
            }

            .send-btn {
                padding: 12px 16px;
            }
        }

        /* =========================================
           2. Component styles
           ========================================= */
        
        /* 加载动画 Spinner */
        .spinner {
            width: 16px;
            height: 16px;
            border-radius: 50%;
            border: 2px solid #cbd5e1;
            border-top-color: #2563eb;
            animation: spin 0.9s linear infinite;
            display: inline-block;
            vertical-align: middle;
            margin-right: 8px;
        }
        @keyframes spin { to { transform: rotate(360deg); } }

        /* 系统/错误提示 */
        .system-note {
            font-size: 12px;
            color: #ef4444; /* 红色用于错误 */
            background-color: #fef2f2;
            padding: 8px 12px;
            border-radius: 6px;
            align-self: center;
            margin: 10px 0;
            border: 1px solid #fee2e2;
        }

        /* 鏈嶅姟閫夐」鎸夐挳缁?*/
        .service-options {
            margin-top: 12px;
            padding: 16px;
            background-color: #fff;
            border: 1px dashed #cbd5e1;
            border-radius: 8px;
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            animation: cardReveal 0.35s ease;
        }
        
        .service-options strong {
            display: block;
            width: 100%;
            font-size: 13px;
            color: #64748b;
            margin-bottom: 8px;
        }

        .support-card {
            margin-top: 12px;
            padding: 16px;
            background-color: #fff;
            border: 1px dashed #cbd5e1;
            border-radius: 8px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            animation: cardReveal 0.35s ease;
        }

        .support-card strong {
            font-size: 13px;
            color: #475569;
        }

        .support-actions {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }

        .support-actions .service-button {
            flex: 1;
            min-width: 160px;
        }

        .service-button {
            background-color: #fff;
            border: 1px solid #cbd5e1;
            color: #475569;
            padding: 6px 16px;
            border-radius: 20px;
            font-size: 13px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .service-button:hover:not(:disabled) {
            border-color: #2563eb;
            color: #2563eb;
            background-color: #eff6ff;
        }
        
        .service-button:disabled {
            opacity: 0.6;
            cursor: default;
        }

        .confirmation-card {
            margin-top: 12px;
            padding: 16px;
            border-radius: 10px;
            border: 1px solid #dbeafe;
            background: #f8fbff;
            display: flex;
            flex-direction: column;
            gap: 10px;
            box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
            animation: cardReveal 0.35s ease;
        }
        .confirmation-card strong {
            font-size: 13px;
            color: #1e293b;
        }
        .confirmation-actions {
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
        }
        .live-support-actions {
            margin-top: 8px;
        }
        .confirmation-actions button {
            flex: 1;
            min-width: 120px;
            padding: 10px 16px;
            border-radius: 999px;
            border: none;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
        }
        .confirmation-actions .confirm-btn {
            background-color: #2563eb;
            color: #fff;
        }
        .confirmation-actions .confirm-btn:hover:not(:disabled) {
            background-color: #1d4ed8;
        }
        .confirmation-actions .reset-btn {
            background-color: #e2e8f0;
            color: #1e293b;
        }
        .confirmation-actions button:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        /* 总结卡片 (Summary Card) */
        .summary-card {
            background: linear-gradient(135deg, #f8fbff 0%, #ffffff 100%);      
            border: 1px solid #dbeafe;
            border-radius: 10px;
            padding: 16px;
            margin-top: 10px;
            border-left: 4px solid #2563eb;
            box-shadow: 0 6px 18px rgba(37, 99, 235, 0.08);
            animation: cardReveal 0.35s ease;
        }
        .summary-card h4 {
            margin: 0 0 8px 0;
            font-size: 14px;
            color: #0f172a;
            letter-spacing: 0.2px;
        }
        .summary-card p {
            font-size: 13px;
            color: #475569;
            margin: 0 0 12px 0;
        }
        .summary-list {
            list-style: none;
            margin: 0 0 10px 0;
            padding: 0;
        }
        .summary-list li {
            font-size: 13px;
            color: #334155;
            padding: 6px 0;
            border-bottom: 1px dashed #e2e8f0;
            display: flex;
            align-items: flex-start;
            gap: 8px;
        }
        .summary-list li:last-child {
            border-bottom: none;
        }
        .summary-list li::before {
            content: "•";
            color: #2563eb;
            font-weight: 600;
            line-height: 1;
        }
        .summary-hint {
            font-size: 12px;
            color: #1d4ed8;
            font-style: italic;
        }

        .rag-card {
            background: #ffffff;
            border: 1px solid #e2e8f0;
            border-left: 4px solid #f97316;
            border-radius: 12px;
            padding: 18px;
            margin-top: 12px;
            box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
            animation: cardReveal 0.35s ease;
        }
        .rag-card h4 {
            margin: 0 0 10px 0;
            font-size: 15px;
            color: #1f2937;
            letter-spacing: 0.2px;
        }
        .rag-card p {
            margin: 0 0 8px 0;
            font-size: 13px;
            line-height: 1.7;
            color: #374151;
        }
        .rag-card ul {
            margin: 0;
            padding-left: 18px;
        }
        .rag-card li {
            margin-bottom: 6px;
            font-size: 13px;
            line-height: 1.6;
            color: #1f2937;
        }

        @media (prefers-reduced-motion: reduce) {
            .service-options,
            .confirmation-card,
            .summary-card,
            .rag-card {
                animation: none;
            }
        }
