/* ========== Chatway 风格变量 ========== */
:root {
    --sc-green: #5aad52;
    --sc-green-dark: #4a9a42;
    --sc-green-soft: #e8f5e6;
    --sc-green-gradient-top: #6bbf63;
    --sc-green-gradient-mid: #b8e0b3;
    --sc-lavender-bubble: #e8eaf6;
    --sc-user-bubble: #d1fae5;
    --sc-text: #1a1a1a;
    --sc-text-muted: #6b7280;
    --sc-card-shadow: 0 8px 28px rgba(34, 85, 34, 0.12);
    --sc-radius-widget: 24px;
    --sc-radius-card: 20px;
    --sc-radius-bubble: 18px;
}

/* ========== 悬浮入口锚点（气泡 + 按钮） ========== */
.chat-toggle-anchor {
    position: fixed;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    max-width: min(280px, calc(100vw - 24px));
}

.chat-toggle-anchor--left {
    align-items: flex-start;
}

/* ========== 悬浮按钮 ========== */
.chat-toggle-button {
    position: relative;
    background: linear-gradient(135deg, var(--sc-green-gradient-top), var(--sc-green));
    color: #fff;
    border-radius: 999px;
    display: none;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(90, 173, 82, 0.45);
    z-index: 1;
    padding: 12px 18px;
    font-size: 14px;
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-toggle-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(90, 173, 82, 0.5);
}

.chat-toggle-button span {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.chat-toggle-button img {
    height: 22px;
    width: 22px;
    margin-right: 8px;
}

/* ========== 悬浮按钮旁气泡提示 ========== */
.chat-toggle-bubble {
    position: relative;
    order: -1;
    background: #fff;
    color: var(--sc-text);
    border-radius: 16px;
    padding: 12px 36px 12px 14px;
    font-size: 14px;
    line-height: 1.45;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(90, 173, 82, 0.2);
    max-width: 260px;
    opacity: 0;
    transform: translateY(8px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.28s ease, transform 0.28s ease;
}

.chat-toggle-bubble.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.chat-toggle-bubble::after {
    content: "";
    position: absolute;
    bottom: -7px;
    right: 28px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-right: 1px solid rgba(90, 173, 82, 0.15);
    border-bottom: 1px solid rgba(90, 173, 82, 0.15);
    transform: rotate(45deg);
}

.chat-toggle-anchor--left .chat-toggle-bubble::after {
    right: auto;
    left: 28px;
}

.chat-toggle-bubble-close {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    color: var(--sc-text-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-toggle-bubble-close:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--sc-text);
}

.chat-toggle-bubble-text {
    word-break: break-word;
}

/* ========== 主窗口（PC 默认更大） ========== */
.chat-widget {
    width: 440px;
    height: 660px;
    max-height: calc(100vh - 40px);
    position: fixed;
    background: #fff;
    border-radius: var(--sc-radius-widget);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    border: none;
    z-index: 999;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-sizing: border-box;
    transition: width 0.25s ease, height 0.25s ease, border-radius 0.2s ease;
}

/* PC 放大模式（点 ⤢） */
.chat-widget.chat-widget--expanded {
    width: min(560px, 94vw);
    height: min(820px, 90vh);
    max-height: 90vh;
}

.chat-widget.hidden {
    display: none;
}

/* ========== 首页 ========== */
.chat-home {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: linear-gradient(180deg, var(--sc-green-gradient-top) 0%, var(--sc-green-gradient-mid) 38%, #f3faf2 72%, #fafcfa 100%);
}

.chat-home-top {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 10px 12px 0;
    flex-shrink: 0;
}

.chat-home-top-spacer {
    flex: 1;
}

.chat-home-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header-trailing {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.chat-expand-btn .chat-expand-icon {
    font-size: 16px;
    line-height: 1;
    display: block;
}

.chat-icon-btn {
    background: rgba(255, 255, 255, 0.35);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.chat-icon-btn:hover {
    background: rgba(255, 255, 255, 0.55);
}

.chat-home-scroll {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 16px 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--sc-green) #e8f5e6;
}

.chat-home-scroll::-webkit-scrollbar {
    width: 6px;
}

.chat-home-scroll::-webkit-scrollbar-thumb {
    background: var(--sc-green);
    border-radius: 10px;
}

.chat-home-hero-title {
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    text-align: center;
    margin: 4px 8px 16px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.chat-card {
    background: #fff;
    border-radius: var(--sc-radius-card);
    box-shadow: var(--sc-card-shadow);
    padding: 18px;
    margin-bottom: 14px;
}

.chat-card-start-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.chat-card-avatar-lg {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--sc-green-soft);
}

.chat-home-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--sc-green-soft);
    color: var(--sc-green-dark);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
}

.chat-home-status-pill .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sc-green);
    box-shadow: 0 0 0 2px rgba(90, 173, 82, 0.35);
}

.chat-home-status-pill.is-offline .status-dot {
    background: #9ca3af;
    box-shadow: none;
}

.chat-home-status-pill.is-offline {
    background: #f3f4f6;
    color: #6b7280;
}

.chat-card-intro {
    font-size: 14px;
    line-height: 1.55;
    color: var(--sc-text-muted);
    margin: 0 0 16px;
}

.chat-btn-primary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--sc-green-gradient-top), var(--sc-green));
    color: #fff;
    border: none;
    border-radius: 16px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(90, 173, 82, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chat-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(90, 173, 82, 0.42);
}

.chat-btn-primary-icon {
    font-size: 14px;
    opacity: 0.95;
}

.chat-card-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.chat-card-ico {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    background: #ede7f6;
    color: #5e35b1;
}

.chat-card-ico--faq {
    background: #e8eaf6;
    color: #3949ab;
}

.chat-card-ico--contact {
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 14px;
}

.chat-contact-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.chat-contact-list li {
    border-bottom: 1px solid #f0f0f0;
}

.chat-contact-list li:last-child {
    border-bottom: none;
}

.chat-contact-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 4px;
    font-size: 14px;
    color: #374151;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: color 0.15s ease;
}

.chat-contact-row:hover {
    color: var(--sc-green-dark);
}

.chat-contact-label {
    flex: 1;
    text-align: left;
}

.chat-contact-external {
    color: #9ca3af;
    font-size: 14px;
    margin-left: 8px;
}

.chat-home-faq-detail {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 2;
    flex-direction: column;
    background: linear-gradient(180deg, var(--sc-green-gradient-top) 0%, var(--sc-green-gradient-mid) 28%, #f3faf2 60%, #fafcfa 100%);
    padding: 8px 16px 20px;
    box-sizing: border-box;
}

.chat-home-faq-detail-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.chat-home-faq-detail-head .chat-faq-back {
    flex-shrink: 0;
}

.chat-home-faq-detail-title {
    flex: 1;
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    line-height: 1.3;
}

.chat-home-faq-detail-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: #fff;
    border-radius: var(--sc-radius-card);
    box-shadow: var(--sc-card-shadow);
    padding: 16px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--sc-text);
}

.chat-home-faq-detail-body img {
    max-width: 100%;
    height: auto;
}

.chat-card-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--sc-text);
}

.chat-faq-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.chat-faq-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 4px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease;
}

.chat-faq-list li:last-child {
    border-bottom: none;
}

.chat-faq-list li::after {
    content: "›";
    color: #c4c4c4;
    font-size: 18px;
    font-weight: 300;
}

.chat-faq-list li:hover {
    color: var(--sc-green-dark);
}

.chat-faq-empty {
    color: var(--sc-text-muted) !important;
    font-size: 13px !important;
    cursor: default !important;
    padding: 8px 4px !important;
}

.chat-faq-empty::after {
    content: none !important;
}

.chat-foot-note {
    text-align: center;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    margin: 8px 0 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* ========== 对话页 ========== */
.chat-conversation {
    flex: 1;
    min-height: 0;
    display: none;
    flex-direction: column;
    background: #fff;
}

.chat-widget .chat-header {
    flex-shrink: 0;
    background: #fff;
    color: var(--sc-text);
    padding: 12px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid #f0f2f5;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    border-radius: 0;
}

.chat-header-main {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.chat-header-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.chat-widget .agent-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--sc-green-soft);
    margin: 0;
}

.avatar-online-dot {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 11px;
    height: 11px;
    background: var(--sc-green);
    border: 2px solid #fff;
    border-radius: 50%;
}

.chat-header-text {
    min-width: 0;
}

.chat-widget .agent-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--sc-text);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-widget .online-status {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: var(--sc-text-muted);
    margin-top: 2px;
}

.chat-widget .status-online {
    width: 7px;
    height: 7px;
    background-color: var(--sc-green);
    border-radius: 50%;
    margin-right: 5px;
    box-shadow: 0 0 0 2px rgba(90, 173, 82, 0.25);
}

.chat-widget .status-offline {
    width: 7px;
    height: 7px;
    background-color: #9ca3af;
    border-radius: 50%;
    margin-right: 5px;
}

.chat-conversation .chat-icon-btn {
    background: #f3f4f6;
    color: #4b5563;
}

.chat-conversation .chat-icon-btn:hover {
    background: #e5e7eb;
    color: #111827;
}

.chat-widget .chat-minimize-button {
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 12px;
    width: 36px;
    height: 36px;
    font-size: 20px;
}

.chat-widget .chat-minimize-button:hover {
    background: #e5e7eb;
    color: #374151;
}

.chat-widget .chat-history {
    background: transparent;
    text-align: center;
    font-size: 12px;
    cursor: pointer;
    color: var(--sc-text-muted);
    margin-bottom: 8px;
    user-select: none;
    padding: 4px;
    border-radius: 8px;
}

.chat-widget .chat-history:hover {
    background: #f9fafb;
}

.chat-widget .message-days {
    background: transparent;
    text-align: center;
    font-size: 11px;
    cursor: default;
    color: #9ca3af;
    position: relative;
    margin: 14px 0;
    user-select: none;
}

.chat-widget .message-days::before,
.chat-widget .message-days::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 26%;
    height: 1px;
    background: #e5e7eb;
}

.chat-widget .message-days::before {
    left: 12px;
}

.chat-widget .message-days::after {
    right: 12px;
}

.chat-widget .chat-body {
    flex: 1;
    min-height: 0;
    padding: 12px 14px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fafbfc;
}

.chat-widget .chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-widget .chat-body::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.chat-widget .chat-body::-webkit-scrollbar-thumb {
    background: var(--sc-green);
    border-radius: 10px;
}

.chat-widget .chat-body {
    scrollbar-width: thin;
    scrollbar-color: var(--sc-green) #f1f5f9;
}

/* ========== 消息气泡 ========== */
.chat-widget .chat-message {
    margin-bottom: 14px;
}

.chat-widget .msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 92%;
}

.chat-widget .msg-avatar {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--sc-lavender-bubble);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.chat-widget .msg-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.chat-widget .chat-message.bot {
    max-width: 100%;
    margin-right: auto;
    text-align: left;
}

.chat-widget .chat-message.bot .message-time {
    display: block;
    font-size: 11px;
    color: #9ca3af;
    text-align: left;
    padding: 0 2px 4px;
}

.chat-widget .chat-message.bot .message-content {
    display: block;
    background: var(--sc-lavender-bubble);
    padding: 12px 14px;
    border-radius: var(--sc-radius-bubble);
    font-size: 14px;
    color: #1f2937;
    text-align: left;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;
}

.chat-widget .chat-message.user {
    max-width: 85%;
    margin-left: auto;
    text-align: right;
}

.chat-widget .chat-message.user .message-time {
    display: block;
    font-size: 11px;
    color: #9ca3af;
    text-align: right;
    padding: 0 2px 4px;
}

.chat-widget .chat-message.user .message-content {
    display: inline-block;
    background: var(--sc-user-bubble);
    padding: 12px 14px;
    border-radius: var(--sc-radius-bubble);
    font-size: 14px;
    color: #065f46;
    text-align: left;
    line-height: 1.5;
    border: 1px solid rgba(90, 173, 82, 0.2);
}

.chat-widget .chat-message img {
    max-width: 220px;
    max-height: 160px;
    border-radius: 12px;
    cursor: pointer;
    object-fit: cover;
}

.chat-widget .chat-message video {
    max-width: 220px;
    border-radius: 12px;
}

.chat-widget .chat-message .file-download {
    color: var(--sc-green-dark);
    font-weight: 600;
    font-size: 13px;
}

.chat-widget .server-delay {
    color: var(--sc-green);
    font-weight: 500;
    margin-left: 4px;
    font-size: 11px;
}

.chat-widget .keywords-message-tips {
    font-size: 12px;
    margin-bottom: 8px;
    color: #6b7280 !important;
}

.chat-widget .auto-keywords {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chat-widget .auto-keywords li {
    position: relative;
    padding: 8px 0 8px 14px;
    margin-bottom: 4px;
    color: var(--sc-green-dark);
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    border-radius: 8px;
}

.chat-widget .auto-keywords li:hover {
    background: rgba(90, 173, 82, 0.08);
}

.chat-widget .auto-keywords li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    background-color: var(--sc-green);
    border-radius: 50%;
}

/* ========== 输入区 ========== */
.chat-widget .typing-indicator {
    font-size: 12px;
    color: var(--sc-text-muted);
    padding: 6px 14px;
    background: #fafbfc;
    flex-shrink: 0;
}

.chat-widget .chat-footer {
    flex-shrink: 0;
    padding: 10px 12px 14px;
    background: #fff;
    border-top: 1px solid #f0f2f5;
}

.chat-input-shell {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 8px 10px 10px;
    background: #fafbfc;
}

.chat-widget .chat-footer textarea,
.chat-widget #messageInput {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    line-height: 1.45;
    color: var(--sc-text);
    margin: 0;
    padding: 4px 2px;
}

.chat-widget .chat-footer textarea::placeholder {
    color: #9ca3af;
}

.chat-input-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.chat-input-ico {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
    border-radius: 10px;
    line-height: 1;
    opacity: 0.75;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.chat-input-ico:hover {
    background: #f3f4f6;
    opacity: 1;
}

.chat-input-ico.image-upload-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chat-upload-icon {
    display: block;
    color: #4b5563;
    flex-shrink: 0;
}

.chat-widget .send-button {
    margin-left: auto;
    background: linear-gradient(135deg, var(--sc-green-gradient-top), var(--sc-green));
    color: #fff;
    border: none;
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(90, 173, 82, 0.35);
    position: static;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.chat-widget .send-button:hover {
    transform: scale(1.03);
}

/* ========== 表情 ========== */
.chat-widget .emoji-picker {
    position: absolute;
    bottom: 118px;
    left: 8px;
    right: 8px;
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 10px;
    display: none;
    border-radius: 16px;
    box-shadow: var(--sc-card-shadow);
    z-index: 5;
}

.chat-widget .emoji-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-bottom: 10px;
    gap: 4px;
}

.chat-widget .tab-button {
    background: #f3f4f6;
    border: none;
    padding: 5px 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
    color: #4b5563;
}

.chat-widget .tab-button:hover {
    background: #e5e7eb;
}

.chat-widget .tab-button.active {
    background: var(--sc-green-soft);
    color: var(--sc-green-dark);
}

.chat-widget .emoji-content {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    height: 180px;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--sc-green) #f1f5f9;
}

.chat-widget .emoji-content::-webkit-scrollbar {
    width: 6px;
}

.chat-widget .emoji-content::-webkit-scrollbar-thumb {
    background: var(--sc-green);
    border-radius: 10px;
}

.chat-widget .emoji-content span {
    font-size: 20px;
    padding: 4px;
    cursor: pointer;
    border-radius: 8px;
}

.chat-widget .emoji-content span:hover {
    background: #f3f4f6;
}

.chat-drag-handle {
    cursor: grab;
}

.chat-drag-handle:active {
    cursor: grabbing;
}

/* ========== 手机端：全屏铺满视口（需配合 JS 打开时 removeClass('hidden')） ========== */
@media (max-width: 768px) {
    .chat-widget:not(.hidden) {
        position: fixed !important;
        inset: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 !important;
        padding: 0 !important;
        max-height: none !important;
        /* 占满可视区域，兼容 iOS 地址栏与刘海 */
        min-height: 100vh !important;
        min-height: -webkit-fill-available !important;
        height: 100vh !important;
        height: 100dvh !important;
        height: -webkit-fill-available !important;
        border-radius: 0 !important;
        z-index: 999999;
        transition: none;
        transform: none !important;
    }

    .chat-widget.chat-widget--expanded {
        width: 100vw !important;
        height: 100dvh !important;
        max-height: none !important;
    }

    /* 安全区内边距做在内部，外层保持真正贴边铺满 */
    .chat-home-top {
        padding-top: calc(10px + env(safe-area-inset-top, 0px));
        padding-right: calc(12px + env(safe-area-inset-right, 0px));
        padding-left: calc(12px + env(safe-area-inset-left, 0px));
    }

    .chat-home-scroll {
        padding-left: calc(16px + env(safe-area-inset-left, 0px));
        padding-right: calc(16px + env(safe-area-inset-right, 0px));
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }

    .chat-home-faq-detail {
        padding-left: calc(16px + env(safe-area-inset-left, 0px));
        padding-right: calc(16px + env(safe-area-inset-right, 0px));
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }

    .chat-widget .chat-header {
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
        padding-left: calc(8px + env(safe-area-inset-left, 0px));
        padding-right: calc(8px + env(safe-area-inset-right, 0px));
    }

    .chat-widget .chat-footer {
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
        padding-left: calc(12px + env(safe-area-inset-left, 0px));
        padding-right: calc(12px + env(safe-area-inset-right, 0px));
    }

    /* 手机已有全屏，隐藏放大按钮 */
    .chat-expand-btn {
        display: none !important;
    }

    .chat-drag-handle {
        cursor: default;
    }

    .chat-drag-handle:active {
        cursor: default;
    }
}
