/* AI 销售客服：沿用系统原有的卡片、颜色和按钮风格 */
.sa-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.sa-model { flex: none; display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: #8a5a20; background: #fff6e8; border: 1px solid #f1dcb8; border-radius: 999px; padding: 6px 12px; white-space: nowrap; }
.sa-model.is-ready { color: #1f6f6c; background: #edf6f5; border-color: #cfe5e3; }
.sa-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .8; }

.sa-chat { display: grid; grid-template-columns: 270px minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.sa-chat > .card { margin: 0; }
.sa-list, .sa-thread { padding: 16px; }
.sa-list { position: sticky; top: calc(var(--sue-head-h, 0px) + 12px); max-height: calc(100vh - var(--sue-head-h, 0px) - 40px); display: flex; flex-direction: column; gap: 10px; }
.sa-list-head button { width: 100%; }
.sa-search { padding: 8px 10px; }
.sa-show { display: flex; gap: 4px; background: #f1f5f6; border-radius: 8px; padding: 3px; flex-wrap: wrap; }
.sa-show > span { flex: 1; text-align: center; padding: 5px 8px; border-radius: 6px; font-size: 12px; color: #5d7680; cursor: pointer; white-space: nowrap; user-select: none; }
.sa-show > span.is-on { background: #fff; color: #0b6f72; box-shadow: 0 1px 2px #12343a1f; font-weight: 600; }
.sa-show > span:focus-visible, .sa-role > span:focus-visible, .sa-item:focus-visible { outline: 2px solid color-mix(in srgb, var(--ui-accent, #087d80) 55%, #fff); outline-offset: 1px; }
.sa-items { overflow: auto; margin: 0 -6px; padding: 0 6px; display: flex; flex-direction: column; gap: 4px; min-height: 120px; }
.sa-item { padding: 10px 11px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; transition: background .15s, border-color .15s; }
.sa-item:hover { background: #f5f9f9; }
.sa-item.is-on { background: color-mix(in srgb, var(--ui-accent, #087d80) 9%, #fff); border-color: color-mix(in srgb, var(--ui-accent, #087d80) 22%, #fff); }
.sa-item-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.sa-item-top b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-item-top time { font-size: 11px; color: #8a9ba1; flex: none; }
.sa-item-last { font-size: 12px; color: #72858e; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-who { display: inline-block; font-size: 11px; color: #4b6570; background: #eef3f4; border-radius: 4px; padding: 0 5px; margin-right: 5px; }
.sa-who-agent { color: #0b6f72; background: #e6f2f1; }
.sa-pin { font-size: 11px; margin-right: 3px; }
.sa-item-actions { display: flex; gap: 6px; margin-top: 8px; }

#app .sa-mini, .sa-dialog .sa-mini { padding: 5px 10px !important; font-size: 12px; min-height: 0 !important; height: auto !important; line-height: 1.5; }

.sa-thread { display: flex; flex-direction: column; min-height: calc(100vh - var(--sue-head-h, 0px) - 230px); }
.sa-thread-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid #e8eef0; margin: 0 0 4px; }
.sa-title h2 { margin: 0 0 2px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.sa-pen { font-size: 13px; color: #9aaeb4; opacity: 0; transition: opacity .15s; }
.sa-title h2:hover .sa-pen, .sa-title h2:focus .sa-pen { opacity: 1; }
.sa-head-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.sa-msgs { flex: 1; overflow: auto; max-height: calc(100vh - var(--sue-head-h, 0px) - 360px); min-height: 280px; padding: 14px 4px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }
.sa-hint { background: #f5f9f9; border: 1px dashed #cfe0e2; border-radius: 10px; padding: 16px 18px; color: #4b6570; line-height: 1.8; }
.sa-msg { max-width: 82%; border-radius: 12px; padding: 10px 14px; position: relative; }
.sa-msg-head { display: flex; gap: 8px; align-items: center; font-size: 11px; color: #7e9299; margin-bottom: 4px; }
.sa-msg-head time { margin-left: auto; }
.sa-text { white-space: pre-wrap; line-height: 1.75; word-break: break-word; }
.sa-customer { align-self: flex-start; background: #f2f5f6; border: 1px solid #e3eaec; border-top-left-radius: 4px; }
.sa-staff { align-self: flex-end; background: #eaf5f1; border: 1px solid #d3e9e1; border-top-right-radius: 4px; }
.sa-agent { align-self: flex-end; background: #fff; border: 1px solid color-mix(in srgb, var(--ui-accent, #087d80) 28%, #fff); border-top-right-radius: 4px; box-shadow: 0 2px 10px #12343a0d; max-width: 88%; }
.sa-agent .sa-msg-head span:first-child { color: #0b6f72; font-weight: 600; }
.sa-agent.is-adopted { border-color: #9fd2bf; background: #fbfefd; }
.sa-agent.is-adopted .sa-msg-head span:first-child::after { content: " · 已采用"; color: #2f8a62; font-weight: 500; }
.sa-note { align-self: center; max-width: 90%; font-size: 12px; color: #6e818a; background: #fbf8ee; border: 1px solid #efe6c9; border-radius: 8px; padding: 6px 12px; display: flex; gap: 8px; align-items: center; }
.sa-x { background: transparent !important; border: 0 !important; color: #a3b3b8 !important; padding: 0 4px !important; font-size: 13px; line-height: 1; opacity: 0; transition: opacity .15s; min-height: 0 !important; height: auto !important; }
.sa-msg:hover .sa-x, .sa-files li:hover .sa-x, .sa-x:focus-visible { opacity: 1; }
.sa-x:hover { color: #ae4c38 !important; }
.sa-missing, .sa-next, .sa-src { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; font-size: 12px; margin-top: 8px; color: #4b6570; }
.sa-missing b, .sa-next b, .sa-src b { font-weight: 600; color: #6e818a; margin-right: 2px; }
.sa-missing span { background: #fff4e6; color: #9a5b14; border-radius: 4px; padding: 2px 7px; }
.sa-src span { background: #eef4f5; border-radius: 4px; padding: 2px 7px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-src .sa-src-quote { background: #e8f3ee; color: #276b4c; }
.sa-src .sa-src-file { background: #eef0f8; color: #48508a; }
.sa-src-none span { background: #fff0eb; color: #ae4c38; }
.sa-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #e3eaec; }
.sa-foot { font-size: 11px; color: #9aaab0; margin-top: 6px; }
.sa-typing .sa-dots { display: flex; gap: 5px; padding: 6px 0; }
.sa-dots i { width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--ui-accent, #087d80) 55%, #fff); animation: sa-bounce 1.1s infinite ease-in-out; }
.sa-dots i:nth-child(2) { animation-delay: .15s; }
.sa-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes sa-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-5px); opacity: 1; } }
html[data-motion="off"] .sa-dots i { animation: none; }

.sa-setup { margin: 6px 0 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sa-composer { border-top: 1px solid #e8eef0; padding-top: 12px; margin-top: 4px; display: flex; flex-direction: column; gap: 8px; }
.sa-composer textarea { min-height: 84px; }
.sa-role { display: inline-flex; gap: 4px; background: #f1f5f6; border-radius: 8px; padding: 3px; align-self: flex-start; }
.sa-role > span { padding: 5px 12px; border-radius: 6px; font-size: 12px; color: #5d7680; cursor: pointer; user-select: none; }
.sa-role > span.is-on { background: #fff; color: #0b6f72; font-weight: 600; box-shadow: 0 1px 2px #12343a1f; }
.sa-compose-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sa-compose-row .sa-extra { flex: 1 1 260px; padding: 9px 10px; }
.sa-attach { display: inline-flex !important; align-items: center; margin: 0 !important; cursor: pointer; border-radius: 7px; padding: 9px 14px; background: #e7eff0; color: #31535e; font-size: 13px; white-space: nowrap; }
.sa-attach:hover { background: #dce8ea; }
.sa-composer > small { font-size: 11px; }

.sa-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: calc(var(--sue-head-h, 0px) + 12px); max-height: calc(100vh - var(--sue-head-h, 0px) - 40px); overflow: auto; }
.sa-card { margin: 0 !important; padding: 16px !important; }
.sa-card h3 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.sa-card h3 small { font-weight: 400; font-size: 11px; }
.sa-card label { margin: 6px 0 3px; font-size: 12px; }
.sa-card input, .sa-card textarea { padding: 7px 9px; }
.sa-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sa-grid-2 { grid-template-columns: 1.3fr 1fr; }
.sa-prefs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.sa-prefs label { margin: 0 !important; cursor: pointer; }
.sa-prefs input { position: absolute; opacity: 0; width: 1px !important; height: 1px; pointer-events: none; }
.sa-prefs span { display: inline-block; font-size: 12px; border: 1px solid #dbe5e7; border-radius: 999px; padding: 3px 9px; color: #5d7680; background: #fff; transition: all .15s; }
.sa-prefs label.is-on span { background: color-mix(in srgb, var(--ui-accent, #087d80) 12%, #fff); border-color: color-mix(in srgb, var(--ui-accent, #087d80) 35%, #fff); color: #0b6f72; }
.sa-prefs input:focus-visible + span { outline: 2px solid color-mix(in srgb, var(--ui-accent, #087d80) 55%, #fff); }
.sa-hotels { font-size: 12px; margin: 10px 0 0; color: #6e818a; }
.sa-card .actions { margin: 10px 0 0; }
.sa-quotes { display: flex; flex-direction: column; gap: 8px; }
.sa-quote { display: grid; gap: 2px; padding: 9px 10px; background: #f7fafa; border: 1px solid #e5eded; border-radius: 8px; font-size: 12px; position: relative; }
.sa-quote b { font-size: 13px; }
.sa-quote span { color: #5d7680; }
.sa-quote strong { color: #12676c; font-size: 15px; }
.sa-alt { position: absolute; right: 8px; top: 8px; font-style: normal; font-size: 11px; color: #9a5b14; background: #fff4e6; border-radius: 4px; padding: 0 6px; }
.sa-files { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.sa-files li { display: grid; grid-template-columns: 1fr auto; font-size: 12px; gap: 0 6px; }
.sa-files li a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-files li small { grid-column: 1; font-size: 11px; }
.sa-files li .sa-x { grid-row: 1 / span 2; grid-column: 2; }

.sa-empty { margin: auto; text-align: center; padding: 50px 20px; max-width: 420px; }
.sa-empty-icon { font-size: 34px; margin-bottom: 8px; }

/* 知识库 */
.sa-kb-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.sa-kb-head .sa-show { flex: 0 1 auto; }
.sa-drop { display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1.5px dashed #c5d9dc; border-radius: 10px; padding: 26px; cursor: pointer; background: #f8fbfb; margin-top: 14px !important; color: #31535e; transition: background .15s, border-color .15s; }
.sa-drop:hover, .sa-drop.is-over { background: color-mix(in srgb, var(--ui-accent, #087d80) 7%, #fff); border-color: color-mix(in srgb, var(--ui-accent, #087d80) 45%, #fff); }
.sa-kb-act { white-space: nowrap; }
.sa-kb-act > * { margin-right: 4px; }
#app a.sa-link { display: inline-block; border-radius: 7px; background: #e7eff0; color: #31535e; }
.sa-hit { border-top: 1px solid #e8eef0; padding: 10px 0; }
.sa-hit p { margin: 6px 0 0; line-height: 1.7; white-space: pre-wrap; color: #4b6570; }
.sa-hit small { margin-left: 6px; }
.sa-pre { max-height: 60vh; overflow: auto; background: #f7fafa; border: 1px solid #e5eded; border-radius: 8px; padding: 14px; font-size: 13px; }

/* 设置 */
.sa-checks { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0; }
.sa-checks label { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: #31535e; }
.sa-checks input { width: auto; }
.sa-key-hint { margin: 4px 0 0; font-size: 12px; }
.sa-test-out { font-size: 12px; align-self: center; }

.sa-dialog.sa-wide { width: min(820px, 94vw); }
.sa-dialog textarea { min-height: 140px; }
.sa-imp-map table { margin-top: 8px; }
.sa-imp-map select { padding: 6px 8px; }
.sa-imp-map h3 { margin-top: 16px; }

@media (max-width: 1280px) {
  .sa-chat { grid-template-columns: 240px minmax(0, 1fr); }
  .sa-side { grid-column: 1 / -1; position: static; max-height: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 760px) {
  .sa-hero { flex-direction: column; }
  .sa-chat { grid-template-columns: 1fr; }
  .sa-list { position: static; max-height: 300px; }
  .sa-msgs { max-height: 60vh; }
  .sa-msg, .sa-agent { max-width: 96%; }
}
.sa-side > * { flex: none; }
.sa-dialog > form > :not(.dialog-head), .sa-dialog > :not(.dialog-head):not(form) { margin-left: 26px; margin-right: 26px; }
.sa-dialog > form > .actions:last-child, .sa-dialog > .actions:last-child { margin-bottom: 22px; }
@media (max-width: 1280px) { .sa-side { align-items: start; } }
