/* 拓域 AI 咨询顾问浮窗样式
 * 令牌依赖 main.css 的 :root 变量（--grad-brand/--surface/--text-*/--border/--radius/--shadow），
 * 全部带回退值，保证在缺少变量的页面上仍可正常渲染。样式作用域以 .cns- 前缀隔离。 */
.cns-mask { position: fixed; inset: 0; background: rgba(0, 0, 0, .28); z-index: 1200; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.cns-mask.is-open { opacity: 1; pointer-events: auto; }

.cns-panel {
    position: fixed; right: 18px; bottom: 84px; z-index: 1210;
    width: 380px; max-width: calc(100vw - 24px); height: 560px; max-height: calc(100vh - 120px);
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--surface, #fff); color: var(--text-1, #1d1d1f);
    border: 1px solid var(--border, #e5e5ea); border-radius: var(--radius, 18px);
    box-shadow: var(--shadow-lg, 0 30px 70px -24px rgba(0,0,0,.28));
    transform: translateY(16px) scale(.98); opacity: 0; pointer-events: none;
    transition: transform .2s ease, opacity .2s ease;
}
.cns-panel.is-open { transform: none; opacity: 1; pointer-events: auto; }

.cns-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--grad-brand, linear-gradient(135deg,#0a84ff,#5e5ce6)); color: #fff; }
.cns-head .cns-title { font-size: 15px; font-weight: 700; }
.cns-head .cns-sub { font-size: 12px; opacity: .85; font-weight: 500; }
.cns-head .cns-spacer { flex: 1; }
.cns-close { border: 0; background: rgba(255,255,255,.18); color: #fff; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 16px; line-height: 1; }
.cns-close:hover { background: rgba(255,255,255,.3); }

.cns-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2, #f5f5f7); }
.cns-msg { display: flex; gap: 8px; max-width: 92%; }
.cns-msg .cns-bubble { padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.cns-msg.user { align-self: flex-end; }
.cns-msg.user .cns-bubble { background: var(--primary, #0071e3); color: #fff; border-bottom-right-radius: 4px; }
.cns-msg.bot { align-self: flex-start; }
.cns-msg.bot .cns-bubble { background: var(--surface, #fff); border: 1px solid var(--border, #e5e5ea); border-bottom-left-radius: 4px; }
.cns-msg.sys { align-self: center; max-width: 100%; }
.cns-msg.sys .cns-bubble { background: transparent; color: var(--text-2, #6e6e73); font-size: 12px; text-align: center; }
.cns-caret::after { content: "▍"; margin-left: 1px; animation: cns-blink 1s steps(2) infinite; }
@keyframes cns-blink { 0%,100%{opacity:1} 50%{opacity:0} }

.cns-cards { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.cns-card { display: block; padding: 9px 11px; border: 1px solid var(--border, #e5e5ea); border-radius: 12px; background: var(--surface, #fff); text-decoration: none; color: inherit; min-width: 140px; flex: 1 1 40%; transition: border-color .15s ease, transform .15s ease; }
.cns-card:hover { border-color: var(--primary, #0071e3); transform: translateY(-1px); }
.cns-card .cns-card-t { font-size: 13px; font-weight: 700; }
.cns-card .cns-card-p { font-size: 12px; color: var(--primary, #0071e3); font-weight: 600; margin-top: 2px; }
.cns-card .cns-card-s { font-size: 12px; color: var(--text-2, #6e6e73); margin-top: 3px; }

.cns-quick { display: flex; flex-wrap: wrap; gap: 7px; padding: 10px 14px 0; background: var(--surface-2, #f5f5f7); }
.cns-chip { border: 1px solid var(--border-strong, #d2d2d7); background: var(--surface, #fff); color: var(--text-1, #1d1d1f); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; cursor: pointer; font-family: inherit; }
.cns-chip:hover { border-color: var(--primary, #0071e3); color: var(--primary, #0071e3); }

.cns-form { display: none; flex-direction: column; gap: 8px; padding: 12px 14px; background: var(--surface, #fff); border-top: 1px solid var(--border, #e5e5ea); }
.cns-form.is-open { display: flex; }
.cns-form input, .cns-form textarea { border: 1px solid var(--border-strong, #d2d2d7); border-radius: 10px; padding: 8px 10px; font-size: 13px; font-family: inherit; background: var(--surface, #fff); color: inherit; }
.cns-form textarea { resize: vertical; min-height: 44px; }

.cns-input { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border, #e5e5ea); background: var(--surface, #fff); }
.cns-input textarea { flex: 1; border: 1px solid var(--border-strong, #d2d2d7); border-radius: 12px; padding: 9px 12px; font-size: 14px; font-family: inherit; resize: none; max-height: 96px; background: var(--surface, #fff); color: inherit; }
.cns-input .cns-send { border: 0; background: var(--grad-brand, linear-gradient(135deg,#0a84ff,#5e5ce6)); color: #fff; border-radius: 12px; padding: 0 16px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit; }
.cns-input .cns-send:disabled { opacity: .55; cursor: default; }
.cns-foot { display: flex; align-items: center; gap: 10px; padding: 0 14px 10px; background: var(--surface, #fff); }
.cns-linkbtn { border: 0; background: none; color: var(--text-2, #6e6e73); font-size: 12px; cursor: pointer; font-family: inherit; text-decoration: underline; }
.cns-linkbtn:hover { color: var(--primary, #0071e3); }

@media (max-width: 760px) {
    .cns-panel { right: 8px; left: 8px; bottom: 72px; width: auto; height: calc(100vh - 96px); max-height: none; }
}
