:root {
    --ink: #1d2a27;
    --muted: #74807d;
    --line: #e7ebe9;
    --soft: #f5f8f6;
    --paper: #ffffff;
    --green: #1f7a5a;
    --green-dark: #145c43;
    --green-soft: #eaf5f0;
    --orange: #f2a542;
    --red: #bd4b4b;
    --shadow: 0 18px 50px rgba(30, 57, 48, .11);
}

body[data-theme="ocean"] { --green:#3474c8; --green-dark:#275a9d; --green-soft:#eaf2fc; }
body[data-theme="azure"] { --green:#2080EA; --green-dark:#1169C4; --green-soft:#EAF4FF; }
body[data-theme="violet"] { --green:#7557b8; --green-dark:#5b4095; --green-soft:#f0ebfa; }
body[data-theme="sunset"] { --green:#c46b35; --green-dark:#9b4f27; --green-soft:#fbefe7; }
body[data-theme="slate"] { --green:#56716c; --green-dark:#3e5753; --green-soft:#ebf1f0; }
body[data-theme="rose"] { --green:#b95770; --green-dark:#913e55; --green-soft:#faebef; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    overflow: hidden;
    color: var(--ink);
    background: #eef3f0;
    font-size: 15px;
    font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.app-shell {
    width: 100%;
    height: 100vh;
    min-height: 0;
    display: grid;
    grid-template-columns: 218px minmax(0, 1fr);
    overflow: hidden;
    background: var(--paper);
}

.sidebar {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 22px 16px 14px;
    color: #e9f4ef;
    background: var(--green);
    min-height: 0;
}
.brand, .auth-brand { display: flex; align-items: center; gap: 11px; }
.brand { padding: 0 8px 22px; }
.brand-mark {
    width: 39px; height: 39px; display: grid; place-items: center;
    flex: none; color: #173d30; background: #d6f1e4;
    border-radius: 12px; font-weight: 900; box-shadow: inset 0 0 0 1px rgba(255,255,255,.6);
}
.brand strong { display: block; font-size: 17px; letter-spacing: .04em; }
.brand span { display: block; color: #9db6ad; font-size: 11px; margin-top: 3px; }
.sidebar .brand-mark { color: var(--green); background: #fff; box-shadow: none; }
.sidebar .brand span { color: #eef7ff; }

.new-customer {
    width: 100%; height: 43px; border: 1px solid rgba(255,255,255,.09); border-radius: 10px;
    background: #def2e9; color: #163f31; font-weight: 700;
    box-shadow: 0 8px 22px rgba(0,0,0,.12);
}
.new-customer:hover { background: #eff9f4; transform: translateY(-1px); }
.new-customer span { font-size: 18px; margin-right: 5px; }
.search-box {
    height: 38px; margin: 18px 2px 16px; padding: 0 11px; display: flex; align-items: center; gap: 7px;
    background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08); border-radius: 9px; color: #94aaa2;
}
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: #eaf3ef; font-size: 13px; }
.search-box input::placeholder { color: #8da39b; }
.list-title { display: flex; justify-content: space-between; padding: 0 7px 8px; color: #8fa69e; font-size: 11px; letter-spacing: .05em; }
.customer-list { min-height: 0; flex: 1; overflow-y: auto; padding-right: 2px; }
.customer-item {
    width: 100%; display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center;
    margin: 2px 0; padding: 11px 9px; border: 0; border-radius: 11px; text-align: left;
    background: transparent; color: #e5eeea; transition: .18s ease;
}
.customer-item:hover { background: rgba(255,255,255,.07); }
.customer-item.active { background: rgba(218, 242, 231, .14); box-shadow: inset 3px 0 #79c5a2; }
.avatar {
    width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
    color: #214438; background: #cceadd; font-weight: 800; font-size: 14px;
}
.customer-copy { min-width: 0; }
.customer-copy strong, .customer-copy span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.customer-copy strong { font-size: 13px; font-weight: 650; }
.customer-copy span { margin-top: 5px; color: #8fa69e; font-size: 11px; }
.customer-copy .customer-name-row { display: flex; align-items: center; gap: 5px; min-width: 0; margin-top: 0; overflow: visible; }
.customer-name-row strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-copy .session-status-tag { flex: none; display: inline-block; margin: 0; padding: 2px 5px; overflow: visible; border-radius: 8px; color: var(--green-dark); background: var(--green-soft); font-size: 8px; font-weight: 700; line-height: 1.35; }
.customer-copy .session-status-tag.following { color: #8a6322; background: #fff1d8; }
.customer-copy .session-status-tag.won { color: #24704f; background: #e3f4ea; }
.customer-copy .session-status-tag.lost { color: #995252; background: #faeaea; }
.customer-copy .session-status-tag.paused { color: #68736f; background: #e9edeb; }
.customer-time { color: #7f978e; font-size: 10px; align-self: start; margin-top: 2px; }
.sidebar-footer { border-top: 1px solid var(--green-dark); padding-top: 9px; }
.sidebar-link { width: 100%; padding: 8px 9px; border: 0; background: var(--green); text-align: left; color: #fff; font-size: 12px; border-radius: 8px; }
.sidebar-link:hover { color: #fff; background: var(--green-dark); }
.sidebar-link span { display: inline-block; width: 23px; }

.admin-sidebar { padding: 22px 14px 14px; }
.admin-nav { display: grid; gap: 6px; margin-top: 8px; }
.nav-item { width: 100%; height: 45px; display: flex; align-items: center; gap: 12px; padding: 0 13px; border: 0; border-radius: 10px; color: #fff; background: var(--green); text-align: left; }
.nav-item span { width: 22px; font-size: 17px; text-align: center; }
.nav-item b { font-size: 13px; font-weight: 600; }
.nav-item:hover { color: #fff; background: var(--green-dark); }
.nav-item.active { color: var(--green); background: #fff; box-shadow: none; }
.admin-sidebar .sidebar-footer { margin-top: auto; }
.app-content { min-width: 0; min-height: 0; height: 100vh; overflow: hidden; background: #f4f7f5; }
.page-view { min-width: 0; min-height: 0; height: 100%; }
.sessions-page { display: grid; grid-template-columns: 238px minmax(400px, 1fr) 350px; background: #fff; }
.session-rail { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 18px 12px 12px; border-right: 1px solid var(--line); background: #f8faf9; }
.rail-header { display: flex; align-items: center; justify-content: space-between; padding: 2px 5px 8px; }
.rail-header > div { display: flex; align-items: baseline; gap: 7px; }
.rail-header h2 { margin: 0; font-size: 15px; }
.rail-header span { color: #8c9793; font-size: 10px; }
.square-add { width: 31px; height: 31px; padding: 0; border: 0; border-radius: 8px; color: #fff; background: var(--green); font-size: 18px; }
.light-search { margin: 8px 0 9px; background: #fff; border-color: #dfe6e2; color: #7e8a86; }
.light-search input { color: var(--ink); }
.light-search input::placeholder { color: #a3aca9; }
.rail-filter { width: 100%; margin-bottom: 9px; padding: 8px 10px; border: 1px solid #dfe6e2; border-radius: 8px; outline: none; color: #5c6965; background: #fff; font-size: 11px; }
.session-rail .customer-item { color: #35433f; }
.session-rail .customer-item:hover { background: #edf3f0; }
.session-rail .customer-item.active { background: var(--green-soft); box-shadow: inset 3px 0 var(--green); }
.session-rail .customer-copy .customer-preview, .session-rail .customer-time { color: #8b9692; }

.workspace { min-width: 0; min-height: 0; height: 100%; position: relative; overflow: hidden; background: #fbfcfb; border-right: 1px solid var(--line); }
.empty-state { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; text-align: center; }
.empty-illustration { width: 110px; height: 110px; display: grid; place-items: center; border-radius: 36px; color: var(--green); background: var(--green-soft); font-size: 40px; transform: rotate(-5deg); }
.empty-illustration span { transform: rotate(5deg); }
.empty-state h1 { margin: 25px 0 7px; font-size: 24px; }
.empty-state p { max-width: 420px; margin: 0 0 24px; color: var(--muted); font-size: 14px; line-height: 1.8; }
.chat-view { height: 100%; min-height: 0; overflow: hidden; display: grid; grid-template-rows: 78px minmax(0, 1fr) auto; }
.chat-header { display: flex; align-items: center; gap: 12px; padding: 0 22px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.88); backdrop-filter: blur(12px); }
.avatar.large { width: 43px; height: 43px; }
.chat-heading { min-width: 0; flex: 1; }
.heading-row { display: flex; align-items: center; gap: 8px; }
.chat-heading h1 { margin: 0; font-size: 16px; }
.chat-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-pill { padding: 3px 8px; border-radius: 12px; color: var(--green-dark); background: var(--green-soft); font-size: 10px; }
.ghost-button, .secondary-button, .primary-button { border-radius: 9px; padding: 9px 14px; font-weight: 650; border: 1px solid transparent; transition: .16s ease; }
.ghost-button, .secondary-button { color: #43514d; background: #fff; border-color: #dde4e1; }
.ghost-button:hover, .secondary-button:hover { background: #f5f8f6; }
.primary-button { color: #fff; background: var(--green); box-shadow: 0 7px 16px rgba(31, 122, 90, .17); }
.primary-button:hover { background: var(--green-dark); transform: translateY(-1px); }
.primary-button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.primary-button.wide { width: 100%; padding: 12px; }
.secondary-button.wide { width: 100%; padding: 11px; }
.mobile-menu { display: none; }

.conversation { min-height: 0; overflow-y: auto; padding: 24px max(24px, 6vw) 32px; scroll-behavior: smooth; }
.day-divider { display: flex; align-items: center; gap: 12px; margin: 3px 0 22px; color: #98a29f; font-size: 10px; }
.day-divider::before, .day-divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.message-row { display: flex; align-items: flex-end; gap: 9px; margin: 15px 0; }
.message-row.sales { justify-content: flex-end; }
.message-avatar { width: 29px; height: 29px; display: grid; place-items: center; flex: none; border-radius: 50%; color: #49605a; background: #edf1ef; font-size: 10px; font-weight: 700; }
.message-bubble { max-width: min(76%, 560px); padding: 11px 14px; border-radius: 4px 15px 15px 15px; background: #fff; border: 1px solid #e3e9e6; box-shadow: 0 5px 18px rgba(30, 55, 47, .045); font-size: 13px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.message-row.sales .message-bubble { order: -1; color: #17392e; background: #dff2e9; border-color: #d0e9dd; border-radius: 15px 4px 15px 15px; }
.message-row.sales .message-bubble.case-demo-message { border-color: #e2c98d; background: #fff8e8; box-shadow: 0 7px 22px rgba(125, 91, 28, .08); }
.message-content { display: block; }
.message-image { display: block; width: auto; max-width: min(100%, 360px); max-height: 340px; margin: 0 0 8px; border-radius: 9px; object-fit: contain; background: #f1f3f2; cursor: zoom-in; }
.message-image:only-child { margin-bottom: 0; }
.message-time { display: block; margin-top: 6px; color: #9aa5a1; font-size: 9px; }
.start-note { padding: 16px; border: 1px dashed #ccd9d4; border-radius: 12px; background: #f7faf8; color: #6f7c78; text-align: center; font-size: 12px; line-height: 1.7; }

.composer-wrap { position: relative; z-index: 2; flex: none; padding: 0 18px 18px; background: linear-gradient(to top, #fbfcfb 80%, rgba(251,252,251,0)); }
.composer-tabs { display: flex; align-items: center; height: 34px; padding: 0 4px; }
.composer-tab { align-self: stretch; padding: 0 11px; border: 0; border-bottom: 2px solid transparent; color: #8a9592; background: transparent; font-size: 11px; }
.composer-tab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 700; }
.context-hint { margin-left: auto; color: #95a09c; font-size: 10px; }
.pending-badge { margin-left: 8px; padding: 3px 7px; border-radius: 10px; color: var(--green-dark); background: var(--green-soft); font-size: 9px; font-weight: 700; }
.composer { border: 1px solid #dce4e0; border-radius: 13px; background: #fff; box-shadow: 0 9px 28px rgba(39, 70, 60, .07); overflow: hidden; }
.composer textarea { width: 100%; min-height: 72px; padding: 14px 15px 5px; resize: none; border: 0; outline: 0; color: var(--ink); font-size: 13px; line-height: 1.6; }
.composer textarea::placeholder { color: #acb5b2; }
.image-preview { display: grid; grid-template-columns: 58px minmax(0, 1fr) 30px; align-items: center; gap: 10px; margin: 2px 12px 6px; padding: 9px; border: 1px solid #dce5e1; border-radius: 10px; background: #f7faf8; }
.image-preview img { width: 58px; height: 48px; border-radius: 7px; object-fit: cover; background: #e9eeeb; }
.image-preview strong, .image-preview span { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-preview strong { color: #394943; font-size: 13px; }
.image-preview span { margin-top: 4px; color: #83908b; font-size: 11px; }
.image-preview button { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 7px; color: #a04f4f; background: #faeeee; font-size: 18px; line-height: 1; }
.composer-actions { display: flex; align-items: center; gap: 10px; padding: 7px 9px 9px 14px; }
.composer-actions > span { flex: 1; color: #98a29f; font-size: 10px; }
.send-button { min-width: 138px; }
.record-button { min-width: 118px; font-size: 11px; }
.image-picker-button { flex: none; padding-left: 11px; padding-right: 11px; font-size: 12px; }

.insight-panel { min-width: 0; min-height: 0; height: 100%; overflow: hidden; background: #fff; }
.panel-scroll { height: 100%; overflow-y: auto; }
.insight-section { padding: 22px 20px; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.section-heading h2 { margin: 0; font-size: 14px; }
.section-heading > span { color: #8b9692; font-size: 10px; }
.online-dot::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: #37a675; box-shadow: 0 0 0 3px #e7f5ee; }
.suggestion-empty { display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 9px; padding: 16px; border-radius: 11px; background: var(--soft); color: #7c8884; }
.suggestion-empty span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: var(--green); background: #deeee7; }
.suggestion-empty p { margin: 0; font-size: 11px; line-height: 1.65; }
.suggestion-empty button { margin: 8px 0 0; padding: 0; border: 0; color: var(--green); background: transparent; font-size: 10px; font-weight: 700; }
.suggestion-empty button:hover { text-decoration: underline; }
.suggestion-card > label { color: #76817e; font-size: 10px; }
.suggestion-segments { display: grid; gap: 8px; margin: 7px 0 10px; }
.suggestion-segment { position: relative; padding: 0 25px 0 22px; }
.suggestion-segment::before { content: attr(data-index); position: absolute; left: 0; top: 10px; width: 16px; height: 16px; display: grid; place-items: center; border-radius: 50%; color: var(--green); background: var(--green-soft); font-size: 9px; font-weight: 800; }
.suggestion-segment textarea { width: 100%; min-height: 58px; margin: 0; padding: 10px 11px; resize: vertical; border: 1px solid #dce5e1; border-radius: 10px; outline: 0; color: #26332f; background: #fbfdfc; font-size: 12px; line-height: 1.6; }
.suggestion-segment textarea:focus { border-color: #77af99; box-shadow: 0 0 0 3px #edf6f2; }
.suggestion-segment.case-demo-segment textarea { border-color: #e4c983; color: #694f20; background: #fff9e9; }
.segment-delete { position: absolute; right: 0; top: 7px; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 6px; color: #a0aaa6; background: transparent; font-size: 16px; line-height: 1; }
.segment-delete:hover { color: #b64f4f; background: #faeeee; }
.segment-delete:disabled { cursor: not-allowed; opacity: .35; background: transparent; }
.suggestion-actions { display: grid; grid-template-columns: .8fr .8fr 1.2fr; gap: 7px; }
.suggestion-actions button { font-size: 11px; padding: 8px; }
.why-box, .caution-box { margin-top: 13px; padding: 10px 11px; border-radius: 9px; font-size: 10px; line-height: 1.65; }
.why-box { color: #52635d; background: #f0f5f2; }
.why-box::before { content: "接话思路 · "; color: var(--green); font-weight: 700; }
.caution-box { color: #805c27; background: #fff6e9; border: 1px solid #f5e3c6; }
.caution-box::before { content: "发送前核实 · "; font-weight: 700; }
.model-label { margin-top: 8px; color: #9aa4a1; font-size: 9px; text-align: right; }
.stage-card { display: flex; justify-content: space-between; align-items: end; padding: 12px 13px 10px; border-radius: 10px; background: #f5f8f6; }
.stage-card small { display: block; color: #8d9894; font-size: 9px; }
.stage-card strong { display: inline-block; margin-top: 5px; color: #315148; font-size: 13px; }
.intent-score strong { color: var(--green); font-size: 20px; }
.intent-score span { color: #9aa4a1; font-size: 9px; }
.progress-track { height: 4px; margin: 10px 2px 16px; background: #e8eeeb; border-radius: 9px; overflow: hidden; }
.progress-track span { display: block; width: 20%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #6fbc99, #1f7a5a); transition: width .4s ease; }
.profile-list { margin: 0; }
.profile-row { display: grid; grid-template-columns: 70px 1fr; gap: 9px; padding: 8px 1px; border-bottom: 1px dashed #edf0ef; font-size: 11px; line-height: 1.45; }
.profile-row:last-child { border-bottom: 0; }
.profile-row dt { color: #8c9693; }
.profile-row dd { margin: 0; color: #3e4d48; text-align: right; word-break: break-word; }
.profile-row dd.unknown { color: #b0b7b5; }
.summary-section p { margin: 0; color: #63706c; font-size: 11px; line-height: 1.75; }

.management-page, .settings-page { overflow-y: auto; padding: 34px clamp(24px, 4vw, 58px) 50px; }
.page-header { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 0 auto 24px; max-width: 1180px; }
.page-header .eyebrow { color: var(--green); font-size: 9px; font-weight: 800; letter-spacing: .18em; }
.page-header h1 { margin: 5px 0 6px; font-size: 25px; }
.page-header p { margin: 0; color: var(--muted); font-size: 12px; }
.stats-grid { max-width: 1180px; margin: 0 auto 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat-card { padding: 16px 18px; border: 1px solid #e3e9e6; border-radius: 12px; background: #fff; box-shadow: 0 6px 22px rgba(34,61,52,.035); }
.stat-card span, .stat-card strong { display: block; }
.stat-card span { color: #7d8985; font-size: 10px; }
.stat-card strong { margin-top: 7px; color: var(--green-dark); font-size: 23px; }
.management-card { max-width: 1180px; margin: auto; border: 1px solid #e1e7e4; border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 10px 30px rgba(35,62,53,.045); }
.management-toolbar { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.management-search { width: min(420px, 65%); display: flex; align-items: center; gap: 8px; margin: 0; padding: 0 11px; border: 1px solid #dce4e0; border-radius: 9px; color: #8a9692; background: #fafcfb; }
.management-search input { width: 100%; min-width: 0; flex: 1; margin: 0; padding: 10px 0; border: 0; outline: 0; box-shadow: none; background: transparent; font-size: 14px; }
.management-toolbar select { min-width: 145px; padding: 8px 10px; border: 1px solid #dce4e0; border-radius: 9px; color: #52605c; background: #fff; font-size: 11px; }
.table-wrap { overflow-x: auto; }
.customer-table { width: 100%; border-collapse: collapse; }
.customer-table th { padding: 11px 15px; color: #89948f; background: #f8faf9; font-size: 10px; font-weight: 600; text-align: left; white-space: nowrap; }
.customer-table td { padding: 14px 15px; border-top: 1px solid #edf0ef; color: #4c5b56; font-size: 11px; vertical-align: middle; }
.customer-cell { display: flex; align-items: center; gap: 10px; min-width: 155px; }
.customer-cell .avatar { width: 34px; height: 34px; }
.customer-cell strong, .customer-cell small { display: block; }
.customer-cell strong { color: #2e3d38; font-size: 12px; }
.customer-cell small { max-width: 180px; margin-top: 3px; color: #929c98; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-tag { display: inline-block; padding: 4px 8px; border-radius: 12px; color: var(--green-dark); background: var(--green-soft); font-size: 9px; font-weight: 700; }
.status-tag.lost { color: #8c5454; background: #faeeee; }
.status-tag.paused { color: #82642f; background: #fff5df; }
.table-action { padding: 5px 8px; border: 0; color: var(--green); background: transparent; font-size: 10px; font-weight: 700; }
.table-action.danger { color: #b45555; }
.table-action.danger:hover { color: #923e3e; background: #faeeee; border-radius: 6px; }
.empty-table { padding: 42px !important; color: #96a09c !important; text-align: center; }

.settings-layout { max-width: 1180px; margin: auto; display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; align-items: start; }
.settings-main { display: grid; gap: 14px; }
.settings-card { margin: 0; padding: 22px; border: 1px solid #e1e7e4; border-radius: 14px; background: #fff; box-shadow: 0 8px 26px rgba(35,62,53,.035); }
.settings-card-title { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 19px; }
.settings-card-title h2 { margin: 0; font-size: 15px; }
.settings-card-title p { margin: 6px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 7px 0 2px; }
.theme-choice { margin: 0; }
.theme-choice input { position: absolute; opacity: 0; pointer-events: none; }
.theme-choice span { display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid #dfe6e2; border-radius: 9px; color: #5a6763; cursor: pointer; font-size: 10px; }
.theme-choice input:checked + span { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); background: var(--green-soft); }
.theme-choice i { width: 14px; height: 14px; border-radius: 50%; background: #1f7a5a; box-shadow: 0 0 0 3px rgba(0,0,0,.04); }
.theme-choice.ocean i { background:#3474c8; }.theme-choice.violet i { background:#7557b8; }.theme-choice.sunset i { background:#c46b35; }.theme-choice.slate i { background:#56716c; }.theme-choice.rose i { background:#b95770; }
.theme-choice.azure i { background:#2080EA; }
.theme-choice.custom i { background:#2080EA; }
.custom-theme-control { display: flex; align-items: end; gap: 10px; margin-top: 12px; padding: 12px; border: 1px solid #dfe6e2; border-radius: 10px; background: #f9fbfa; }
.custom-theme-control > input[type="color"] { width: 46px; height: 39px; flex: none; margin: 0; padding: 3px; cursor: pointer; }
.custom-theme-control label { flex: 1; margin: 0; }
.settings-savebar { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid #dfe6e2; border-radius: 12px; background: rgba(255,255,255,.94); box-shadow: 0 -5px 25px rgba(32,57,49,.07); backdrop-filter: blur(8px); }
.settings-savebar span { color: #8c9793; font-size: 10px; }
.settings-side { display: grid; gap: 13px; }
.security-note { padding: 15px; border: 1px solid #e6e9d8; border-radius: 12px; color: #6d6a50; background: #fbfbf3; }
.security-note b { font-size: 11px; }
.security-note p { margin: 6px 0 0; font-size: 10px; line-height: 1.65; }

.knowledge-page { overflow-y: auto; padding: 34px clamp(24px, 4vw, 58px) 50px; }
.knowledge-summary { max-width: 1180px; margin: 0 auto 14px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 18px; border: 1px solid #dfe7e3; border-radius: 12px; background: var(--green-soft); }
.knowledge-summary > div { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.knowledge-summary strong { color: var(--green-dark); font-size: 23px; }
.knowledge-summary span { color: var(--green-dark); font-size: 10px; }
.knowledge-summary p { margin: 0; color: #687772; font-size: 10px; line-height: 1.6; }
.knowledge-workbench { max-width: 1180px; margin: auto; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; align-items: start; }
.knowledge-categories { position: sticky; top: 0; min-width: 0; padding: 14px 10px; border: 1px solid #dfe7e3; border-radius: 13px; background: #fff; box-shadow: 0 7px 24px rgba(35,62,53,.035); }
.knowledge-categories-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 12px; border-bottom: 1px solid #edf0ef; }
.knowledge-categories-head strong, .knowledge-categories-head span { display: block; }
.knowledge-categories-head strong { color: #34443f; font-size: 15px; }
.knowledge-categories-head span { margin-top: 4px; color: #929c98; font-size: 11px; }
.knowledge-categories-head button { flex: none; padding: 6px 8px; border: 0; border-radius: 7px; color: var(--green); background: var(--green-soft); font-size: 12px; font-weight: 700; }
.knowledge-category-list { display: grid; gap: 4px; margin-top: 10px; }
.knowledge-category-row { position: relative; display: flex; align-items: center; min-width: 0; }
.knowledge-category-button { width: 100%; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 28px 10px 10px; border: 0; border-radius: 8px; color: #5d6b66; background: transparent; text-align: left; }
.knowledge-category-button:hover { background: #f3f7f5; }
.knowledge-category-button.active { color: var(--green-dark); background: var(--green-soft); font-weight: 700; }
.knowledge-category-button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-category-button b { flex: none; min-width: 22px; padding: 2px 6px; border-radius: 9px; color: #7e8b87; background: #edf1ef; font-size: 11px; text-align: center; }
.knowledge-category-button.active b { color: var(--green-dark); background: #fff; }
.knowledge-category-delete { position: absolute; right: 5px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; color: #a4ada9; background: transparent; font-size: 16px; line-height: 1; }
.knowledge-category-delete:hover { color: #b45555; background: #faeeee; }
.knowledge-content-pane { min-width: 0; }
.knowledge-toolbar { max-width: none; margin: 0 0 14px; display: flex; justify-content: space-between; gap: 12px; }
.knowledge-toolbar .management-search { width: auto; max-width: none; min-width: 0; flex: 1; background: #fff; }
.knowledge-toolbar select { min-width: 130px; padding: 8px 10px; border: 1px solid #dce4e0; border-radius: 9px; color: #52605c; background: #fff; font-size: 11px; }
.knowledge-list { max-width: none; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.knowledge-card { min-width: 0; padding: 18px; border: 1px solid #e0e7e3; border-radius: 13px; background: #fff; box-shadow: 0 7px 24px rgba(35,62,53,.035); }
.knowledge-card.disabled { opacity: .66; }
.knowledge-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.knowledge-card-title { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.knowledge-card h3 { margin: 0; color: #2d3d38; font-size: 14px; }
.knowledge-category { padding: 3px 7px; border-radius: 10px; color: var(--green-dark); background: var(--green-soft); font-size: 9px; white-space: nowrap; }
.knowledge-type { padding: 3px 7px; border-radius: 10px; color: #53615d; background: #edf1ef; font-size: 9px; white-space: nowrap; }
.knowledge-type.script { color: #805c27; background: #fff2dd; }
.knowledge-card-status { padding: 3px 7px; border-radius: 10px; color: var(--green-dark); background: var(--green-soft); font-size: 9px; white-space: nowrap; }
.knowledge-card.disabled .knowledge-card-status { color: #747f7b; background: #edf0ef; }
.knowledge-keywords { min-height: 22px; margin: 10px 0 8px; color: var(--green); font-size: 9px; line-height: 1.6; }
.knowledge-content { display: -webkit-box; min-height: 54px; margin: 0; overflow: hidden; color: #687570; font-size: 11px; line-height: 1.7; white-space: pre-line; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.knowledge-card-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 13px; padding-top: 11px; border-top: 1px solid #edf0ef; }
.knowledge-card-actions button { padding: 5px 8px; border: 0; color: var(--green); background: transparent; font-size: 10px; font-weight: 700; }
.knowledge-card-actions button.danger { color: #b45555; }
.knowledge-empty { grid-column: 1 / -1; padding: 50px 20px; border: 1px dashed #ccd9d4; border-radius: 13px; color: #8b9692; background: #fafcfb; text-align: center; font-size: 12px; }
.knowledge-modal { width: min(590px, 100%); }
.knowledge-answer-field { margin-bottom: 15px; }
.knowledge-answer-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 9px; }
.knowledge-answer-heading strong { display: block; color: #52605c; font-size: 12px; }
.knowledge-answer-heading em { color: #d05d5d; font-style: normal; }
.knowledge-answer-heading small { display: block; margin-top: 5px; color: #8b9692; font-size: 10px; font-weight: 400; line-height: 1.5; }
.knowledge-answer-heading button { flex: none; padding: 7px 10px; }
.knowledge-answer-list { display: grid; gap: 9px; }
.knowledge-answer-row { display: grid; grid-template-columns: 49px minmax(0, 1fr) auto; align-items: start; gap: 8px; padding: 9px; border: 1px solid #e1e7e4; border-radius: 10px; background: #f9fbfa; }
.knowledge-answer-number { padding-top: 11px; color: var(--green-dark); font-size: 10px; font-weight: 700; text-align: center; }
.knowledge-answer-row textarea { width: 100%; min-height: 60px; margin: 0; padding: 9px 10px; resize: vertical; }
.knowledge-answer-remove { margin-top: 6px; padding: 6px; border: 0; color: #b45555; background: transparent; font-size: 10px; font-weight: 700; }
.toggle-row { display: flex; align-items: center; gap: 8px; }
.toggle-row input { width: auto; margin: 0; }
.toggle-row span { font-size: 11px; }

.auth-screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #dceee6, transparent 36%), linear-gradient(145deg, #f6f9f7, #e7efeb); }
.auth-card { width: min(410px, 100%); padding: 34px; border: 1px solid rgba(255,255,255,.8); border-radius: 20px; background: rgba(255,255,255,.91); box-shadow: var(--shadow); }
.auth-brand { margin-bottom: 32px; }
.auth-brand strong { font-size: 17px; }
.auth-card h1 { margin: 0 0 8px; font-size: 25px; }
.auth-card > p { margin: 0 0 24px; color: var(--muted); font-size: 13px; line-height: 1.6; }
form label { display: block; margin-bottom: 15px; color: #52605c; font-size: 12px; font-weight: 600; }
form label em { color: #d05d5d; font-style: normal; }
form input, form select, form textarea { width: 100%; margin-top: 7px; padding: 10px 11px; border: 1px solid #dbe3df; border-radius: 9px; outline: 0; color: var(--ink); background: #fff; font-size: 12px; font-weight: 400; }
form input:focus, form select:focus, form textarea:focus { border-color: #73ae96; box-shadow: 0 0 0 3px #edf6f2; }
.form-error { min-height: 18px; margin: 12px 0 0 !important; color: var(--red) !important; font-size: 11px !important; }

.modal-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(17, 36, 30, .43); backdrop-filter: blur(3px); }
.modal-card { width: min(680px, 100%); max-height: 92vh; overflow-y: auto; padding: 24px; border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.small-modal { width: min(430px, 100%); }
.modal-header { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.modal-header h2 { margin: 0; font-size: 18px; }
.modal-header p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.close-button { align-self: start; width: 31px; height: 31px; border: 0; border-radius: 8px; color: #75817d; background: #f3f6f4; font-size: 21px; line-height: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.provider-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.provider-option { margin: 0; }
.provider-option input { position: absolute; opacity: 0; pointer-events: none; }
.provider-option span { display: block; padding: 13px; border: 1px solid #dfe6e2; border-radius: 10px; cursor: pointer; }
.provider-option input:checked + span { border-color: var(--green); background: var(--green-soft); box-shadow: inset 0 0 0 1px var(--green); }
.provider-option b, .provider-option small { display: block; }
.provider-option b { color: #32423d; font-size: 13px; }
.provider-option small { margin-top: 4px; color: #8b9692; font-size: 9px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.settings-tip { margin: -4px 0 0; color: #8c9793; font-size: 10px; line-height: 1.6; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 26px; max-width: 460px; padding: 10px 16px; border-radius: 10px; color: white; background: #233e35; box-shadow: 0 8px 30px rgba(0,0,0,.2); opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: .2s ease; font-size: 12px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #934444; }

/* 提升后台整体文字可读性，避免大量 9-11px 小字号。 */
.brand strong { font-size: 18px; }
.brand span, .list-title { font-size: 12px; }
.search-box input, .customer-copy strong, .nav-item b { font-size: 14px; }
.customer-copy span, .sidebar-link, .rail-header span, .chat-heading p, .status-pill { font-size: 12px; }
.customer-copy .session-status-tag { font-size: 11px; }
.customer-time { font-size: 11px; }
.rail-header h2 { font-size: 17px; }
.rail-filter { font-size: 13px; }
.chat-heading h1 { font-size: 18px; }
.day-divider, .message-time, .context-hint, .composer-actions > span { font-size: 11px; }
.message-avatar { font-size: 12px; }
.message-bubble, .composer textarea { font-size: 15px; }
.start-note, .composer-tab, .record-button { font-size: 13px; }
.pending-badge, .suggestion-segment::before, .model-label, .stage-card small, .intent-score span { font-size: 11px; }
.section-heading h2 { font-size: 16px; }
.section-heading > span, .suggestion-card > label { font-size: 12px; }
.suggestion-empty p, .profile-row, .summary-section p { font-size: 13px; }
.suggestion-empty button, .why-box, .caution-box { font-size: 12px; }
.suggestion-segment textarea { font-size: 14px; }
.suggestion-actions button { font-size: 13px; }
.stage-card strong { font-size: 14px; }
.page-header .eyebrow { font-size: 11px; }
.page-header h1 { font-size: 28px; }
.page-header p { font-size: 14px; }
.stat-card span, .settings-card-title p, .settings-savebar span, .security-note p, .knowledge-summary span, .knowledge-summary p { font-size: 12px; }
.management-toolbar select, .knowledge-toolbar select { font-size: 13px; }
.customer-table th { font-size: 12px; }
.customer-table td, .customer-cell small { font-size: 13px; }
.customer-cell strong, .settings-card-title h2 { font-size: 16px; }
.status-tag, .table-action, .knowledge-category, .knowledge-type, .knowledge-card-status { font-size: 11px; }
.theme-choice span, .security-note b { font-size: 13px; }
.knowledge-card h3 { font-size: 16px; }
.knowledge-keywords, .knowledge-answer-heading small, .knowledge-answer-number, .knowledge-answer-remove { font-size: 12px; }
.knowledge-content, .knowledge-empty { font-size: 14px; }
.knowledge-card-actions button { font-size: 12px; }
.knowledge-answer-heading strong { font-size: 14px; }
.toggle-row span, .modal-header p, .provider-option small, .settings-tip { font-size: 12px; }
form label { font-size: 14px; }
form input, form select, form textarea { font-size: 14px; }
.form-error { font-size: 12px !important; }
.toast { font-size: 14px; }

::-webkit-scrollbar { width: 7px; }
::-webkit-scrollbar-thumb { background: #d5ddd9; border-radius: 10px; }
.sidebar ::-webkit-scrollbar-thumb { background: #fff; }

@media (max-width: 1280px) {
    .app-shell { grid-template-columns: 190px minmax(0, 1fr); }
    .sessions-page { grid-template-columns: 215px minmax(390px, 1fr) 320px; }
    .conversation { padding-left: 24px; padding-right: 24px; }
    .insight-section { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 1040px) {
    .app-shell { grid-template-columns: 78px minmax(0, 1fr); }
    .admin-sidebar { padding-left: 10px; padding-right: 10px; }
    .admin-sidebar .brand > div:last-child, .nav-item b, .admin-sidebar .sidebar-link { display: none; }
    .admin-sidebar .brand { justify-content: center; padding-left: 0; padding-right: 0; }
    .nav-item { justify-content: center; padding: 0; }
    .sessions-page { grid-template-columns: 215px minmax(390px, 1fr) 310px; }
    .settings-layout { grid-template-columns: 1fr; }
    .settings-side { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 820px) {
    .app-shell { display: block; }
    .admin-sidebar { position: fixed; z-index: 15; inset: 0 auto 0 0; width: min(240px, 84vw); transform: translateX(-105%); transition: transform .22s ease; box-shadow: 16px 0 40px rgba(0,0,0,.2); }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-sidebar .brand > div:last-child, .nav-item b, .admin-sidebar .sidebar-link { display: block; }
    .nav-item { justify-content: flex-start; padding: 0 13px; }
    .sessions-page { grid-template-columns: 190px minmax(390px, 1fr); }
    .insight-panel { position: fixed; z-index: 11; right: 0; top: 0; bottom: 0; width: min(350px, 92vw); box-shadow: -12px 0 35px rgba(22,45,37,.15); }
    .workspace { height: 100%; border: 0; }
    .mobile-menu { display: block; border: 0; padding: 5px; color: #60706a; background: transparent; font-size: 19px; }
    .chat-header { padding: 0 12px; }
    .ghost-button { padding: 8px 9px; font-size: 11px; }
    .conversation { padding: 18px 14px 24px; }
    .message-bubble { max-width: 84%; }
    .composer-wrap { padding: 0 9px 9px; }
    .context-hint, .composer-actions > span { display: none; }
    .composer-actions { justify-content: flex-end; }
    .field-grid { grid-template-columns: 1fr; }
    .suggestion-actions { grid-template-columns: 1fr 1fr; }
    #markSentButton { grid-column: 1 / -1; }
    .management-page, .settings-page, .knowledge-page { padding: 24px 16px 40px; }
    .theme-grid, .stats-grid { grid-template-columns: 1fr 1fr; }
    .settings-side { grid-template-columns: 1fr; }
    .knowledge-workbench { grid-template-columns: 1fr; }
    .knowledge-categories { position: static; }
    .knowledge-category-list { display: flex; overflow-x: auto; padding-bottom: 3px; }
    .knowledge-category-row { flex: none; min-width: 145px; }
}

@media (max-width: 600px) {
    .sessions-page { grid-template-columns: 1fr; }
    .session-rail { display: none; }
    .composer-actions { flex-wrap: wrap; }
    .record-button, .send-button { flex: 1; min-width: 120px; }
    .management-toolbar { align-items: stretch; flex-direction: column; }
    .knowledge-toolbar, .knowledge-summary { align-items: stretch; flex-direction: column; }
    .knowledge-list { grid-template-columns: 1fr; }
    .management-search { width: 100%; }
    .page-header { align-items: flex-start; flex-direction: column; }
    .theme-grid, .stats-grid { grid-template-columns: 1fr; }
}
