/* ============================================================
   月子会所销售AI助手 - 全局样式 (豆包风格)
   主色调: #4F6BFF  背景: #F7F7F8
   ============================================================ */

/* ---------- 基础重置 ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #4F6BFF;
    --primary-hover: #3D56E0;
    --primary-light: #EEF1FF;
    --primary-soft: rgba(79, 107, 255, 0.1);
    --bg: #F7F7F8;
    --card-bg: #FFFFFF;
    --text-primary: #1A1A1A;
    --text-secondary: #6B6B6B;
    --text-tertiary: #9CA3AF;
    --border: #ECECEF;
    --border-strong: #E0E0E6;
    --success: #00B96B;
    --danger: #FF4D4F;
    --danger-bg: #FFF1F0;
    --warning: #FAAD14;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.10);
    --radius-sm: 8px;
    --radius: 10px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --sidebar-w: 260px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica,
        Arial, sans-serif;
}

html,
body {
    height: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input,
textarea,
select {
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
}

/* ---------- 通用按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    transition: all 0.18s ease;
    white-space: nowrap;
    user-select: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: #fff;
    color: var(--danger);
    border: 1px solid #ffd6d6;
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-bg);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.btn-block {
    width: 100%;
}

.btn-link {
    padding: 4px 8px;
    color: var(--primary);
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.btn-link:hover {
    background: var(--primary-soft);
}

/* ---------- 通用卡片 ---------- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

/* ============================================================
   入口页 / 登录页 / 注册页 公共布局
   ============================================================ */
.auth-wrap,
.entry-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
}

/* ---------- 入口页 ---------- */
.entry-container {
    width: 100%;
    max-width: 820px;
    text-align: center;
}

.entry-logo {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.entry-logo span {
    color: var(--primary);
}

.entry-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 48px;
}

.entry-cards {
    display: flex;
    gap: 28px;
    justify-content: center;
    flex-wrap: wrap;
}

.entry-card {
    flex: 1;
    min-width: 280px;
    max-width: 340px;
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 44px 32px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid transparent;
}

.entry-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-soft);
}

.entry-card-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    margin-bottom: 22px;
}

.entry-card-icon.admin {
    background: var(--primary-light);
    color: var(--primary);
}

.entry-card-icon.sales {
    background: #E8FAF1;
    color: var(--success);
}

.entry-card-title {
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 8px;
}

.entry-card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ---------- 登录/注册 ---------- */
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 40px 36px;
    box-shadow: var(--shadow);
}

.auth-card.wide {
    max-width: 440px;
}

.auth-title {
    font-size: 22px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 6px;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 7px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text-primary);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    outline: none;
}

.form-control::placeholder {
    color: var(--text-tertiary);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
}

.form-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.form-error {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.form-error.show {
    display: block;
}

/* ============================================================
   管理后台
   ============================================================ */
.admin-layout {
    min-height: 100vh;
    background: var(--bg);
}

.admin-nav {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-nav-brand {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-nav-brand .dot {
    color: var(--primary);
}

.admin-nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-nav-user {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Tab */
.tabs {
    display: flex;
    gap: 4px;
    padding: 16px 24px 0;
    max-width: 1200px;
    margin: 0 auto;
}

.tab {
    padding: 10px 18px;
    font-size: 14px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.tab:hover {
    color: var(--primary);
}

.tab.active {
    color: var(--primary);
    font-weight: 600;
}

.tab.active::after {
    content: '';
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: -1px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

.tab-panel {
    display: none;
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.tab-panel.active {
    display: block;
}

/* 表格 */
.table-wrap {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead th {
    background: #FAFAFB;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: left;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: #FAFAFB;
}

.status-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-tag.active {
    background: #E8FAF1;
    color: var(--success);
}

.status-tag.inactive {
    background: var(--danger-bg);
    color: var(--danger);
}

.action-group {
    display: flex;
    gap: 8px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.empty-state .empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

/* 配置表单 */
.config-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    padding: 28px 32px;
    max-width: 760px;
}

.config-card h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.config-card .config-hint {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 22px;
}

.config-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
}

/* ============================================================
   销售聊天界面 (核心)
   ============================================================ */
.chat-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--bg);
}

/* ---------- 侧边栏 ---------- */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease;
}

.sidebar-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand {
    font-size: 15px;
    font-weight: 600;
    flex: 1;
}

.sidebar-brand span {
    color: var(--primary);
}

.new-chat-btn {
    margin: 14px 16px 6px;
    padding: 12px 16px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.18s ease;
}

.new-chat-btn:hover {
    background: var(--primary-hover);
}

.new-chat-btn .plus {
    font-size: 18px;
    line-height: 1;
}

.conv-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px 16px;
}

.conv-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s ease;
    gap: 8px;
}

.conv-item:hover {
    background: var(--bg);
}

.conv-item.active {
    background: var(--primary-light);
}

.conv-item.active .conv-title {
    color: var(--primary);
    font-weight: 500;
}

.conv-title-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.conv-title {
    font-size: 14px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conv-meta {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.conv-ops {
    display: none;
    gap: 2px;
    flex-shrink: 0;
}

.conv-item:hover .conv-ops {
    display: flex;
}

.conv-op {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    font-size: 13px;
    transition: all 0.15s ease;
}

.conv-op:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-primary);
}

.conv-op.del:hover {
    color: var(--danger);
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-footer .logout-link {
    color: var(--text-secondary);
    cursor: pointer;
}

.sidebar-footer .logout-link:hover {
    color: var(--danger);
}

/* ---------- 主聊天区 ---------- */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg);
}

.chat-header {
    height: 56px;
    flex-shrink: 0;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
}

.hamburger {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-primary);
}

.hamburger:hover {
    background: var(--bg);
}

.chat-title {
    font-size: 15px;
    font-weight: 600;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-profile-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- 消息区 ---------- */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0 12px;
    scroll-behavior: smooth;
}

.msg-row {
    display: flex;
    margin-bottom: 20px;
    padding: 0 20px;
}

.msg-row.user {
    justify-content: flex-end;
}

.msg-row.assistant {
    justify-content: flex-start;
}

.msg-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.7;
    word-break: break-word;
    white-space: pre-wrap;
    box-shadow: var(--shadow-sm);
}
/* AI回复已渲染为HTML，取消pre-wrap避免源码换行符变成多余空行 */
.msg-row.assistant .msg-bubble {
    white-space: normal;
}

.msg-row.user .msg-bubble {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.msg-row.assistant .msg-bubble {
    background: #fff;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.msg-bubble img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin-top: 8px;
    cursor: pointer;
    display: block;
    transition: opacity 0.15s ease;
}

.msg-bubble img:hover {
    opacity: 0.9;
}

.msg-bubble img:first-child {
    margin-top: 0;
}

.msg-image-thumb {
    width: 200px;
    max-width: 100%;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: block;
}

.msg-time {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 5px;
    text-align: right;
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 7px;
    height: 7px;
    background: var(--text-tertiary);
    border-radius: 50%;
    animation: typing 1.2s infinite ease-in-out;
}

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

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

@keyframes typing {

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

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

/* 欢迎占位 */
.welcome-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    text-align: center;
    padding: 20px;
}

.welcome-placeholder .welcome-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 18px;
}

.welcome-placeholder h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.welcome-placeholder p {
    font-size: 13px;
}

/* ---------- 输入区 ---------- */
.input-area {
    flex-shrink: 0;
    padding: 12px 20px 18px;
    background: var(--bg);
}

.input-box {
    background: #fff;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 10px 12px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.input-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.upload-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: all 0.15s ease;
    position: relative;
}

.upload-btn:hover {
    background: var(--bg);
    color: var(--primary);
}

.upload-btn svg {
    width: 22px;
    height: 22px;
}

.upload-btn input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.input-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 0 6px;
}

.preview-item {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-strong);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.msg-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    max-height: 120px;
    min-height: 24px;
    padding: 6px 4px;
    font-size: 14px;
    line-height: 1.5;
    background: transparent;
}

.send-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.18s ease;
}

.send-btn:hover:not(:disabled) {
    background: var(--primary-hover);
}

.send-btn:disabled {
    background: var(--border-strong);
    color: #fff;
}

.send-btn svg {
    width: 18px;
    height: 18px;
}

.input-tip {
    font-size: 11px;
    color: var(--text-tertiary);
    text-align: center;
    margin-top: 6px;
}

/* ---------- 图片放大遮罩 ---------- */
.img-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 30px;
    cursor: zoom-out;
}

.img-overlay.show {
    display: flex;
}

.img-overlay img {
    max-width: 92%;
    max-height: 92%;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

/* ---------- 通用遮罩 (移动端侧边栏) ---------- */
.overlay-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 900;
}

/* ---------- 模态弹窗 ---------- */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1500;
    padding: 20px;
}

.modal-mask.show {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
}

.modal-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
}

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

.modal-body .modal-new-pwd {
    background: var(--primary-light);
    color: var(--primary);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    margin-top: 12px;
    letter-spacing: 1px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal input.modal-input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    margin-bottom: 18px;
    outline: none;
}

.modal input.modal-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ---------- Toast 提示 ---------- */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(26, 26, 26, 0.92);
    color: #fff;
    padding: 11px 22px;
    border-radius: var(--radius);
    font-size: 14px;
    z-index: 3000;
    opacity: 0;
    transition: all 0.25s ease;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

/* ============================================================
   响应式 (768px 以下手机布局)
   ============================================================ */
@media (max-width: 768px) {

    .entry-cards {
        flex-direction: column;
        align-items: center;
    }

    .entry-card {
        max-width: 100%;
        width: 100%;
    }

    .auth-card {
        padding: 32px 24px;
    }

    /* 管理后台 */
    .admin-nav {
        padding: 0 14px;
    }

    .tabs,
    .tab-panel {
        padding-left: 14px;
        padding-right: 14px;
    }

    .config-card {
        padding: 22px 18px;
    }

    .data-table {
        font-size: 13px;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 11px 10px;
    }

    /* 聊天 - 侧边栏变抽屉 */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .overlay-mask.show {
        display: block;
    }

    .hamburger {
        display: flex;
    }

    .msg-bubble {
        max-width: 85%;
    }

    .messages {
        padding: 16px 0 8px;
    }

    .msg-row {
        padding: 0 14px;
    }

    .input-area {
        padding: 10px 14px 14px;
    }

    .chat-profile-hint {
        display: none;
    }

    .action-group {
        flex-direction: column;
    }
}


/* Markdown 渲染样式 */
.msg-row.assistant .msg-bubble { font-size: 14.5px; line-height: 1.75; }
.msg-bubble p { margin: 0 0 10px 0; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble ul, .msg-bubble ol { margin: 6px 0 12px 0; padding-left: 18px; }
.msg-bubble li { margin-bottom: 6px; }
.msg-bubble strong { font-weight: 600; }
.msg-bubble em { font-style: italic; }
.msg-bubble code { background: rgba(0,0,0,0.06); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.msg-bubble pre { background: rgba(0,0,0,0.06); padding: 10px; border-radius: 6px; overflow-x: auto; margin: 8px 0; }
.msg-bubble pre code { background: none; padding: 0; }
.msg-bubble blockquote { border-left: 3px solid var(--primary); background: var(--primary-light); margin: 10px 0 12px 0; padding: 8px 12px; color: var(--text-secondary); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3 { margin: 16px 0 8px 0; font-weight: 700; color: var(--text-primary); line-height: 1.4; }
.msg-bubble h1 { font-size: 17px; }
.msg-bubble h2 { font-size: 16px; }
.msg-bubble h3 { font-size: 15px; }
.msg-bubble > :first-child { margin-top: 0 !important; }
.msg-bubble > :last-child { margin-bottom: 0 !important; }
.msg-bubble hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.msg-bubble table { border-collapse: collapse; margin: 8px 0; }
.msg-bubble th, .msg-bubble td { border: 1px solid #ddd; padding: 6px 10px; }
.msg-bubble th { background: rgba(0,0,0,0.03); }

/* ============ 客户档案（2026-08-19 新增） ============ */
.header-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-shrink: 0; }
.cust-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 6px 12px; border-radius: var(--radius);
    border: 1px solid var(--border-strong); background: var(--card-bg);
    color: var(--text-primary); font-size: 13px; cursor: pointer;
    transition: all .15s; white-space: nowrap;
}
.cust-btn:hover { border-color: var(--primary); color: var(--primary); }
.cust-bind-btn {
    padding: 6px 12px; border-radius: var(--radius);
    border: 1px solid transparent; background: var(--primary-soft);
    color: var(--primary); font-size: 13px; cursor: pointer;
    transition: all .15s; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis;
}
.cust-bind-btn:hover { background: var(--primary-light); }

.modal-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-title-row .modal-title { margin-bottom: 0; }
.customer-modal { max-width: 560px; max-height: 86vh; overflow-y: auto; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

.cust-list { display: flex; flex-direction: column; gap: 10px; max-height: 46vh; overflow-y: auto; padding: 2px; }
.cust-card {
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 10px 12px; background: var(--card-bg); cursor: default;
    transition: border-color .15s;
}
.cust-card:hover { border-color: var(--primary); }
.cust-card.bind-item { cursor: pointer; }
.cust-card.bind-item.active { border-color: var(--primary); background: var(--primary-light); }
.cust-card-head { display: flex; align-items: center; gap: 10px; }
.cust-name { font-weight: 600; font-size: 14.5px; color: var(--text-primary); }
.cust-phone { font-size: 12.5px; color: var(--text-tertiary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cust-card-edit { flex-shrink: 0; }
.cust-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
    font-size: 12px; padding: 2px 8px; border-radius: 999px;
    background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border);
}
.chip-stage { background: var(--primary-light); color: var(--primary); border-color: transparent; }
.cust-extra { margin-top: 6px; font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.cust-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

@media (max-width: 768px) {
    .cust-btn { padding: 5px 8px; font-size: 12px; }
    .cust-btn svg { display: none; }
    .cust-bind-btn { padding: 5px 8px; font-size: 12px; max-width: 110px; }
    .cust-form-grid { grid-template-columns: 1fr; gap: 0; }
    .customer-modal { max-width: 94vw; }
}
