:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --text: #162033;
  --muted: #667085;
  --line: #dbe3ee;
  --line-strong: #c8d4e3;
  --accent: #1268b3;
  --accent-dark: #0b4f8a;
  --accent-soft: #eaf4ff;
  --shadow: 0 18px 45px rgba(22, 32, 51, 0.08);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.app-shell { min-height: 100vh; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.9); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 10; }
.brand { display: inline-flex; align-items: center; gap: 14px; min-width: 0; }
.brand-logo { width: auto; height: 34px; display: block; }
.brand-title { color: var(--text); font-size: 18px; font-weight: 760; white-space: nowrap; }
.top-actions { display: inline-flex; align-items: center; gap: 8px; }
.ghost-btn, .primary-light-btn, #sendBtn, .quick, .product-card a { min-height: 38px; border-radius: 8px; border: 1px solid var(--line-strong); background: #fff; color: var(--text); padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; transition: border-color .18s ease, background .18s ease, color .18s ease; }
.ghost-btn:hover, .primary-light-btn:hover, .quick:hover, .product-card a:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.primary-light-btn { background: var(--accent); border-color: var(--accent); color: #fff; }
.primary-light-btn:hover { background: var(--accent-dark); color: #fff; }
.chat-layout { width: min(100%, 960px); min-height: 0; margin: 0 auto; padding: 18px 18px 24px; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 14px; }
.messages { min-height: 0; overflow-y: auto; padding: 10px 4px 18px; scroll-behavior: smooth; }
.empty-state { min-height: calc(100vh - 190px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); }
.empty-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 820; margin-bottom: 18px; }
.empty-state h1 { margin: 0; color: var(--text); font-size: 30px; line-height: 1.25; font-weight: 780; }
.empty-state p { width: min(100%, 650px); margin: 14px auto 0; font-size: 15px; line-height: 1.75; }
.quick-grid { width: min(100%, 720px); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 24px; }
.quick { min-height: 46px; justify-content: flex-start; text-align: left; color: #304057; }
.message { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; margin: 0 0 22px; }
.message.user { grid-template-columns: minmax(0, 1fr) 34px; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 820; }
.message.user .avatar { grid-column: 2; grid-row: 1; background: #e7edf4; color: var(--accent-dark); }
.message.user .bubble-wrap { grid-column: 1; justify-self: end; }
.bubble-wrap { min-width: 0; max-width: 780px; }
.bubble { line-height: 1.78; font-size: 15px; word-break: break-word; }
.message.user .bubble { background: #eaf4ff; border: 1px solid #cde2f8; border-radius: 8px; padding: 10px 14px; max-width: 720px; }
.message.assistant .bubble { padding-top: 3px; }
.bubble p { margin: 0 0 10px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble h3, .bubble h4 { margin: 16px 0 8px; font-size: 16px; line-height: 1.45; }
.bubble ul, .bubble ol { margin: 8px 0 12px; padding-left: 1.35em; }
.bubble li { margin: 4px 0; }
.bubble strong { color: var(--accent-dark); font-weight: 760; }
.bubble a { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; }
.product-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-top: 12px; }
.product-card { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 12px; }
.product-card-title { color: var(--text); font-weight: 760; line-height: 1.45; }
.product-card-model { color: var(--muted); font-size: 13px; margin-top: 4px; }
.product-card a { width: 100%; min-height: 34px; margin-top: 10px; color: var(--accent-dark); }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 18px 45px rgba(18,104,179,.13); }
.composer textarea { width: 100%; max-height: 180px; min-height: 44px; resize: none; border: 0; outline: none; padding: 10px 4px; line-height: 1.55; background: transparent; color: var(--text); }
.composer textarea::placeholder { color: #8a96a8; }
#sendBtn { min-width: 82px; border-color: var(--accent); background: var(--accent); color: #fff; }
#sendBtn:hover { background: var(--accent-dark); }
#sendBtn:disabled { opacity: .66; cursor: wait; }
.btn-spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: btn-spin .7s linear infinite; flex: none; margin-right: 6px; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
.visually-hidden, .visually-hidden-input { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
@media (max-width: 760px) {
  .topbar { height: auto; padding: 12px; align-items: stretch; flex-direction: column; }
  .top-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; }
  .ghost-btn, .primary-light-btn { padding: 0 8px; }
  .chat-layout { padding: 12px; }
  .empty-state { min-height: calc(100vh - 230px); }
  .empty-state h1 { font-size: 24px; }
  .quick-grid { grid-template-columns: 1fr; }
  .message, .message.user { grid-template-columns: 1fr; }
  .avatar { display: none; }
  .message.user .bubble-wrap { grid-column: auto; }
  .composer { grid-template-columns: 1fr; }
  #sendBtn { width: 100%; }
}
