:root{--ink:#17201d;--muted:#6d7773;--line:#dce2df;--surface:#fff;--canvas:#f3f5f4;--green:#176b52;--green-dark:#0f523e;--green-soft:#e7f2ed;--warning:#b56a06}
*{box-sizing:border-box}body{margin:0;min-width:320px;height:100vh;overflow:hidden;color:var(--ink);background:var(--canvas);font-family:Arial,"Microsoft YaHei",sans-serif;letter-spacing:0}button,select,textarea{font:inherit;letter-spacing:0}button,select{min-height:38px}button{cursor:pointer}
.topbar{height:58px;padding:0 22px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);background:var(--surface)}.brand{display:flex;align-items:center;gap:10px;color:#36413d;font-size:14px}.brand strong{color:var(--ink);font-size:15px}.brand-mark{width:32px;height:32px;display:grid;place-items:center;color:#fff;background:var(--green);border-radius:5px;font-size:12px;font-weight:700}.model-status{display:flex;align-items:center;gap:7px;color:var(--muted);font-size:13px}.model-status i{width:8px;height:8px;border-radius:50%;background:var(--warning)}.model-status.connected i{background:#1f9d68}
.model-controls{display:flex;align-items:center;gap:10px}.icon-button{width:34px;min-height:34px;padding:0;border:1px solid var(--line);border-radius:5px;color:#4d5954;background:#fff;font-size:17px}.icon-button:hover{border-color:#aab6b1;background:#f7f9f8}
.workspace{height:calc(100vh - 58px);display:grid;grid-template-columns:250px minmax(420px,1fr) 320px}.settings-pane,.analysis-pane{min-height:0;padding:22px 18px;overflow:auto;background:var(--surface)}.settings-pane{border-right:1px solid var(--line)}.analysis-pane{border-left:1px solid var(--line)}.pane-heading,.conversation-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}h1,h2,h3{margin:0;font-weight:650}h1,h2{font-size:18px}h3{font-size:13px}.eyebrow{display:block;margin-bottom:5px;color:var(--green);font-size:10px;font-weight:700;text-transform:uppercase}
.secondary-button{padding:0 12px;border:1px solid var(--line);border-radius:5px;color:var(--ink);background:#fff}.secondary-button:hover{border-color:#aab6b1;background:#f7f9f8}.role-map{margin:24px 0;padding:5px 0;border-top:1px solid var(--line);border-bottom:1px solid var(--line)}.role-map div{min-height:42px;display:grid;grid-template-columns:12px 1fr auto;align-items:center;gap:8px;font-size:13px}.role-map span{color:var(--muted)}.role-map strong{font-size:13px}.role-dot{width:8px;height:8px;border-radius:50%}.customer-dot{background:#8c9793}.sales-dot{background:var(--green)}.field-label{display:block;margin:17px 0 7px;color:var(--muted);font-size:12px;font-weight:600}select{width:100%;padding:0 34px 0 10px;border:1px solid var(--line);border-radius:5px;color:var(--ink);background:#fff}select:focus,textarea:focus{outline:2px solid rgba(23,107,82,.16);border-color:var(--green)}
.conversation-pane{min-width:0;min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr) auto;background:#f8faf9}.conversation-heading{min-height:72px;padding:0 24px;border-bottom:1px solid var(--line);background:rgba(255,255,255,.82)}.turn-count{color:var(--muted);font-size:12px}.messages{min-height:0;padding:24px clamp(18px,4vw,54px);overflow:auto}.empty-state{height:100%;min-height:180px;display:grid;place-content:center;justify-items:center;gap:9px;color:var(--muted)}.empty-state strong{color:#48534f;font-size:15px}.empty-state span{padding:4px 8px;border:1px solid var(--line);border-radius:4px;font-size:11px}.message-row{margin-bottom:18px;display:flex;align-items:flex-start;gap:10px}.message-row.customer{flex-direction:row-reverse}.avatar{width:30px;height:30px;flex:0 0 30px;display:grid;place-items:center;border-radius:5px;color:#fff;background:var(--green);font-size:11px;font-weight:700}.customer .avatar{color:#4d5954;background:#dde2e0}.message-content{max-width:min(680px,78%)}.message-meta{margin-bottom:5px;display:flex;gap:8px;color:var(--muted);font-size:11px}.customer .message-meta{justify-content:flex-end}.bubble{padding:11px 13px;border:1px solid var(--line);border-radius:6px;background:var(--surface);white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.55;font-size:14px}.customer .bubble{border-color:#d3dfda;background:var(--green-soft)}.message-row.pending .bubble{color:var(--muted)}.message-row.error .bubble{color:#a2382f;border-color:#e4c9c6;background:#fff8f7}
.composer{position:relative;z-index:1;padding:15px 20px 18px;border-top:1px solid var(--line);background:var(--surface)}.composer label{display:block;margin-bottom:7px;color:var(--muted);font-size:12px;font-weight:650}textarea{width:100%;min-height:72px;max-height:170px;resize:vertical;padding:11px 12px;border:1px solid var(--line);border-radius:5px;color:var(--ink);background:#fbfcfc;line-height:1.45}.composer-footer{margin-top:9px;display:flex;align-items:center;justify-content:space-between;gap:12px}.composer-footer span{color:var(--muted);font-size:11px}.primary-button{min-width:124px;padding:0 16px;border:0;border-radius:5px;color:#fff;background:var(--green);font-weight:650}.primary-button:hover{background:var(--green-dark)}.primary-button:disabled{cursor:not-allowed;background:#8d9b96}
.analysis-list{margin:24px 0 0}.analysis-list div{min-height:42px;display:flex;align-items:center;justify-content:space-between;gap:12px;border-bottom:1px solid var(--line)}.analysis-list dt{color:var(--muted);font-size:12px}.analysis-list dd{margin:0;max-width:150px;text-align:right;font-size:12px;font-weight:650;overflow-wrap:anywhere}.analysis-section{margin-top:24px}.section-heading{display:flex;align-items:center;justify-content:space-between;gap:10px}.section-heading>span{color:var(--muted);font-size:10px}.case-list{margin-top:10px;display:flex;flex-wrap:wrap;gap:6px}.case-list span{padding:5px 7px;border:1px solid var(--line);border-radius:4px;color:#53605b;background:#f8faf9;font-size:11px;overflow-wrap:anywhere}.product-list{margin-top:10px;display:grid;gap:8px}.product-empty{color:var(--muted);font-size:11px}.product-card{min-width:0;display:grid;grid-template-columns:58px minmax(0,1fr);gap:10px;padding:8px;border:1px solid var(--line);border-radius:6px;background:#fff}.product-card img{width:58px;height:58px;object-fit:contain;border:1px solid #edf0ee;border-radius:4px;background:#f8faf9}.product-card-content{min-width:0;display:flex;flex-direction:column;gap:3px}.product-card-content strong{font-size:12px;line-height:1.35;overflow-wrap:anywhere}.product-card-content span{font-size:10px;line-height:1.35;overflow-wrap:anywhere}.product-sku{color:var(--green);font-weight:700}.product-details{color:var(--muted)}.product-price{color:#173f32;font-weight:750}.product-activity{color:#a24f13}.product-stock{color:#53605b}.product-order{margin-top:2px;color:#44514c}
dialog{width:min(440px,calc(100vw - 28px));padding:0;border:1px solid var(--line);border-radius:6px;color:var(--ink);background:#fff;box-shadow:0 22px 65px rgba(23,32,29,.22)}dialog::backdrop{background:rgba(23,32,29,.36)}#modelForm{padding:22px}.dialog-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:20px}input{width:100%;height:40px;padding:0 10px;border:1px solid var(--line);border-radius:5px;color:var(--ink);background:#fff}input:focus{outline:2px solid rgba(23,107,82,.16);border-color:var(--green)}.dialog-actions{margin-top:22px;display:flex;justify-content:flex-end}.form-error{margin:12px 0 0;color:#a2382f;font-size:12px}
@media(max-width:980px){body{height:auto;min-height:100vh;overflow:auto}.workspace{height:auto;min-height:calc(100vh - 58px);grid-template-columns:220px minmax(0,1fr)}.analysis-pane{grid-column:1/-1;border-top:1px solid var(--line);border-left:0}.conversation-pane{height:calc(100dvh - 58px);min-height:520px}}@media(max-width:700px){.topbar{padding:0 14px}.brand>span:last-child{display:none}.workspace{display:block}.settings-pane,.analysis-pane{border:0;border-bottom:1px solid var(--line)}.conversation-pane{height:calc(100dvh - 58px);min-height:500px}.conversation-heading{min-height:62px;padding:0 16px}.messages{padding:18px 14px}.message-content{max-width:86%}.composer{padding:12px 14px 14px}.composer-footer{align-items:flex-end}}

.environment-badge{display:inline-flex!important;padding:4px 7px;border:1px solid #d59a44;border-radius:4px;color:#8a4f00;background:#fff8e8;font-size:11px;font-weight:700}.model-status.error{color:#9f312a}.model-status.error i{background:#c7473d}.model-status.checking i{animation:model-pulse 1.2s ease-in-out infinite}.model-controls{gap:9px}.topbar-button{min-height:34px;padding:0 10px;border:1px solid var(--line);border-radius:5px;color:#36413d;background:#fff;font-size:12px}.topbar-button:hover{border-color:#aab6b1;background:#f7f9f8}.icon-button:disabled{cursor:wait;color:#9ba49f;background:#f4f6f5}@keyframes model-pulse{50%{opacity:.35}}
.message-row.sales[data-turn-id]{cursor:pointer}.message-row.selected-turn .bubble{outline:2px solid rgba(23,107,82,.2)}.section-heading>span[data-tone="success"],.inline-notice[data-tone="success"]{color:#18724f}.section-heading>span[data-tone="error"],.inline-notice[data-tone="error"]{color:#a2382f}
.product-card.no-image{grid-template-columns:minmax(0,1fr)}
.feedback-section{padding-top:20px;border-top:1px solid var(--line)}.rating-options{margin-top:12px;display:grid;grid-template-columns:1fr 1fr;gap:6px}.rating-options button{min-height:34px;border:1px solid var(--line);border-radius:5px;color:#3f4a46;background:#fff;font-size:12px}.rating-options button.active[data-rating="correct"]{color:#116044;border-color:#68aa91;background:#edf8f3}.rating-options button.active[data-rating="mostly_correct"]{color:#795208;border-color:#d4ae5c;background:#fff9e9}.rating-options button.active[data-rating="incorrect"]{color:#94382f;border-color:#d98f87;background:#fff4f3}.rating-options button.active[data-rating="dangerous"]{color:#fff;border-color:#9e2923;background:#a8322b}.error-reasons{margin:15px 0 0;padding:0;border:0}.error-reasons legend{margin-bottom:8px;color:var(--muted);font-size:12px;font-weight:600}.error-reasons label{min-height:27px;display:flex;align-items:center;gap:7px;color:#48534f;font-size:11px}.error-reasons input{width:15px;height:15px;margin:0;accent-color:var(--green)}.feedback-section textarea{min-height:58px}.full-button{width:100%;margin-top:14px}.feedback-summary{margin-top:7px;padding:7px;border-left:3px solid #9aa5a0;color:#53605b;background:#f6f8f7;font-size:11px}.feedback-summary.correct{border-color:#1f8b63}.feedback-summary.mostly_correct{border-color:#c58a1b}.feedback-summary.incorrect,.feedback-summary.dangerous{border-color:#b43a31}
.toast{position:fixed;top:72px;right:20px;z-index:30;width:min(360px,calc(100vw - 32px));min-height:46px;padding:13px 16px;border:1px solid #86b7a4;border-radius:6px;color:#145c43;background:#f0faf6;box-shadow:0 12px 30px rgba(23,32,29,.18);font-size:13px;line-height:1.45;opacity:0;transform:translateY(-8px);transition:opacity .18s ease,transform .18s ease}.toast.visible{opacity:1;transform:translateY(0)}.toast[data-tone="error"]{color:#8e3029;border-color:#d9a39d;background:#fff5f4}
.wide-dialog{width:min(1120px,calc(100vw - 32px));max-width:none;height:min(760px,calc(100dvh - 32px));max-height:none}.dialog-body{height:100%;padding:22px;display:flex;flex-direction:column;min-height:0}.filter-grid{display:grid;grid-template-columns:repeat(6,minmax(110px,1fr));align-items:end;gap:10px;padding-bottom:16px;border-bottom:1px solid var(--line)}.filter-grid label{display:grid;gap:5px;color:var(--muted);font-size:11px}.filter-grid input,.filter-grid select{height:36px;min-height:36px}.filter-grid .primary-button{min-height:36px}.secondary-link{min-height:36px;display:flex;align-items:center;justify-content:center;padding:0 10px;border:1px solid var(--line);border-radius:5px;color:#30403a;background:#fff;text-decoration:none;font-size:12px}.history-layout{min-height:0;flex:1;display:grid;grid-template-columns:310px minmax(0,1fr)}.record-list{min-height:0;overflow:auto;border-right:1px solid var(--line)}.record-item{width:100%;min-height:66px;padding:10px 12px;display:flex;flex-direction:column;align-items:flex-start;gap:6px;border:0;border-bottom:1px solid var(--line);color:var(--ink);background:#fff;text-align:left}.record-item:hover,.record-item.active{background:#f1f7f4}.record-item strong{max-width:100%;font-size:12px;overflow-wrap:anywhere}.record-item span{color:var(--muted);font-size:10px;line-height:1.4;overflow-wrap:anywhere}.record-detail{min-height:0;padding:18px 20px;overflow:auto}.empty-detail,.loading-row{padding:24px;color:var(--muted);font-size:12px;text-align:center}.detail-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;padding-bottom:12px;border-bottom:1px solid var(--line)}.detail-heading strong{font-size:14px}.detail-heading span{color:var(--muted);font-size:11px}.history-turn{padding:15px 0;border-bottom:1px solid var(--line)}.history-turn>strong{font-size:11px;color:var(--green)}.history-turn p{position:relative;margin:10px 0 0;padding-left:58px;white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:1.55}.history-turn p::before{content:attr(data-role);position:absolute;left:0;top:1px;color:var(--muted);font-size:10px}
.batch-toolbar{display:grid;grid-template-columns:auto minmax(180px,1fr) auto;gap:10px}.file-picker{min-height:40px;display:flex;align-items:center;padding:0 14px;border:1px solid var(--line);border-radius:5px;color:#36413d;background:#fff;font-size:12px;cursor:pointer}.file-picker input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}.inline-notice{min-height:30px;margin:10px 0 0;color:var(--muted);font-size:11px}.batch-layout{min-height:0;flex:1;display:grid;grid-template-columns:250px minmax(0,1fr);gap:16px;border-top:1px solid var(--line);padding-top:16px}.batch-layout>div{min-width:0;min-height:0;display:flex;flex-direction:column;gap:10px}.compact-list{border:1px solid var(--line)}.table-wrap{min-width:0;min-height:0;overflow:auto;border:1px solid var(--line)}table{width:100%;border-collapse:collapse;font-size:11px}th{position:sticky;top:0;z-index:1;padding:9px 8px;border-bottom:1px solid #cdd5d1;color:#46524d;background:#f1f4f2;text-align:left;white-space:nowrap}td{min-width:90px;max-width:260px;padding:9px 8px;border-bottom:1px solid var(--line);vertical-align:top;line-height:1.45;overflow-wrap:anywhere}.review-control{min-width:160px;display:grid;gap:5px}.review-control select,.review-control input{height:30px;min-height:30px;font-size:10px}.mini-button{min-height:28px;border:1px solid var(--line);border-radius:4px;color:#fff;background:var(--green);font-size:10px}
@media(max-width:980px){.filter-grid{grid-template-columns:repeat(3,1fr)}.history-layout{grid-template-columns:250px minmax(0,1fr)}}
@media(max-width:700px){.topbar{height:auto;min-height:58px;padding:7px 12px;flex-wrap:wrap;gap:7px}.brand>span:nth-of-type(2){display:none}.model-controls{width:100%;justify-content:flex-end;flex-wrap:wrap}.model-status{font-size:11px}.conversation-pane{height:calc(100dvh - 102px)}.wide-dialog{width:calc(100vw - 16px);height:calc(100dvh - 16px)}.dialog-body{padding:14px}.filter-grid{grid-template-columns:1fr 1fr}.history-layout{display:block;overflow:auto}.record-list{max-height:220px;border-right:0;border-bottom:1px solid var(--line)}.record-detail{overflow:visible}.batch-toolbar{grid-template-columns:1fr}.batch-layout{display:block;overflow:auto}.batch-layout .record-list{max-height:180px;margin-bottom:14px}.toast{top:auto;right:16px;bottom:16px}}
