/* ============ 金喜来 · 电商调研工具 · 视觉升级 ============ */
:root {
  --brand: #15315b;          /* 深商务蓝 */
  --brand-2: #1f4a86;
  --gold: #c8a24a;           /* 金喜来金 */
  --gold-soft: #f6efdc;
  --bg: #eef2f8;
  --card: #ffffff;
  --text: #1f2733;
  --muted: #6b7688;
  --border: #e3e8f0;
  --radius: 14px;
  --shadow: 0 6px 22px rgba(21, 49, 91, .08);
  --shadow-sm: 0 2px 8px rgba(21, 49, 91, .06);
  --green: #1f9d57;
  --red: #d6453d;
  --orange: #e08a1e;
  --blue: #2f6fd6;
}

* { box-sizing: border-box; }
/* hidden 属性必须真正隐藏元素：类选择器的 display 会覆盖 UA 的 [hidden]{display:none} */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(31, 74, 134, .10), transparent),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶部品牌栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px 30px;
  background: linear-gradient(110deg, var(--brand) 0%, var(--brand-2) 70%, #24579c 100%);
  color: #fff; box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 46px; height: 46px; flex: none; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 24px; font-weight: 800; color: #1c2c44;
  background: linear-gradient(145deg, #f3d27a, var(--gold));
  box-shadow: inset 0 1px 2px rgba(255,255,255,.6), 0 4px 12px rgba(200,160,74,.4);
}
.brand h1 { margin: 0; font-size: 20px; letter-spacing: .5px; font-weight: 800; }
.brand .sub { margin: 2px 0 0; font-size: 12.5px; color: #c7d6ec; max-width: 760px; }
.mode-badge {
  flex: none; padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 13px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.3);
  color: #fff; white-space: nowrap;
}

/* ---------- 布局 ---------- */
.layout {
  display: grid; grid-template-columns: 380px 1fr; gap: 22px;
  padding: 22px 30px 40px; max-width: 1480px; margin: 0 auto; align-items: start;
}
.panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
}
.panel h2 { margin: 0 0 16px; font-size: 16px; color: var(--brand); display: flex; align-items: center; gap: 8px; }
.panel h2::before { content: ""; width: 6px; height: 18px; border-radius: 3px; background: linear-gradient(var(--gold), #b8923f); }

/* ---------- 表单 ---------- */
form label { display: block; font-size: 13px; font-weight: 600; color: #3a4658; margin-bottom: 14px; }
form input[type=text], form textarea {
  width: 100%; margin-top: 6px; padding: 11px 12px; font-size: 14px; font-family: inherit;
  border: 1.5px solid var(--border); border-radius: 10px; background: #fbfcfe; color: var(--text);
  transition: border-color .15s, box-shadow .15s; resize: vertical;
}
form input[type=text]:focus, form textarea:focus {
  outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(31,74,134,.12); background: #fff;
}
form input::placeholder, form textarea::placeholder { color: #aab3c2; }

.markets { margin-bottom: 16px; }
.markets > .label { font-size: 13px; font-weight: 600; color: #3a4658; }
.market-group {
  margin-top: 10px; padding: 12px 14px; border: 1px dashed var(--border);
  border-radius: 10px; background: #fafbfe;
  display: grid; grid-template-columns: 1fr 1fr; column-gap: 10px;
}
.market-group strong { grid-column: 1 / -1; display: block; font-size: 12px; color: var(--gold); margin-bottom: 8px; letter-spacing: 1px; }
.chk {
  display: flex; align-items: center; gap: 7px; margin: 0 0 7px 0; min-width: 0;
  font-size: 13px; font-weight: 500; color: #6b7688; cursor: pointer; user-select: none;
}
.chk span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chk input {
  appearance: none; -webkit-appearance: none; width: 17px; height: 17px; flex: none;
  border: 1.6px solid #c2ccdb; border-radius: 5px; background: #fff; position: relative; cursor: pointer;
  transition: all .15s;
}
.chk input:checked { background: var(--brand); border-color: var(--brand); }
.chk input:checked::after {
  content: "✓"; position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; font-size: 12px; font-weight: 800;
}
.chk:has(input:checked) { color: var(--text); font-weight: 600; }

.preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.preview img { width: 70px; height: 70px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

button { font-family: inherit; cursor: pointer; }
.primary {
  width: 100%; margin-top: 6px; padding: 13px 18px; font-size: 15px; font-weight: 800; color: #fff;
  border: none; border-radius: 11px; letter-spacing: 1px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  box-shadow: 0 8px 18px rgba(21,49,91,.28); transition: transform .12s, box-shadow .12s;
}
.primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(21,49,91,.34); }
.primary:disabled, .ghost:disabled { opacity: .5; cursor: not-allowed; }
.ghost {
  padding: 8px 14px; font-size: 13px; font-weight: 700; color: var(--brand);
  background: #fff; border: 1.5px solid var(--brand-2); border-radius: 9px; transition: background .15s;
}
.ghost:not(:disabled):hover { background: #eef3fb; }

/* ---------- 历史 ---------- */
.history { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.history h3 { margin: 0 0 10px; font-size: 14px; color: #3a4658; }
#historyList { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow: auto; }
#historyList li {
  padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 9px;
  cursor: pointer; font-size: 13.5px; transition: all .15s; background: #fbfcfe;
}
#historyList li:hover { border-color: var(--brand-2); background: #eef3fb; transform: translateX(2px); }
#historyList .t { font-size: 11.5px; color: var(--muted); }
#historyList .empty { color: var(--muted); cursor: default; background: transparent; border-style: dashed; }

/* ---------- 报告区 ---------- */
.report-panel { min-height: 70vh; }
.report-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.report { font-size: 14.5px; }
.export-actions { display: flex; gap: 8px; align-items: center; }
.src-note { font-size: 12px; color: #6b7689; margin: 6px 0 10px; line-height: 1.6; }
.print-cover { display: none; }

/* PDF 下载专用：html2canvas 在屏幕态截图，需显式样式（不依赖 @media print） */
.pdf-export-root { box-sizing: border-box; }
.pdf-export-root .print-cover { display: block !important; margin-bottom: 20px; padding: 26px 30px 18px; background: linear-gradient(135deg, #15315b, #1f4a86); color: #fff; border-radius: 10px; box-shadow: none; }
.pdf-export-root .pc-band { display: flex; align-items: baseline; justify-content: space-between; }
.pdf-export-root .pc-brand { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.pdf-export-root .pc-brand span { opacity: .6; margin: 0 6px; }
.pdf-export-root .pc-tag { font-size: 10px; letter-spacing: 1px; opacity: .75; }
.pdf-export-root .pc-title { font-size: 23px; margin: 14px 0 14px; line-height: 1.3; }
.pdf-export-root .pc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; font-size: 12px; }
.pdf-export-root .pc-meta div { display: flex; gap: 8px; }
.pdf-export-root .pc-meta span { opacity: .65; min-width: 64px; }
.pdf-export-root .pc-meta b { font-weight: 600; }
.pdf-export-root .pc-desc { margin-top: 14px; font-size: 11px; line-height: 1.7; border-left: 3px solid #c8a24a; padding-left: 10px; opacity: .9; }
.placeholder {
  padding: 50px 24px; text-align: center; color: var(--muted); border: 1.5px dashed var(--border);
  border-radius: 12px; background: #fafbfe;
}
.meta-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.badge {
  padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  background: #eef2f8; color: #46506a; border: 1px solid var(--border);
}
.badge.llm { background: #e7f4ec; color: #1c7a44; border-color: #bfe3cd; }
.badge.demo { background: #efe9fb; color: #6b46c1; border-color: #d6c8f5; }
.badge.note { background: var(--gold-soft); color: #8a6d1f; border-color: #ecdca8; }

.methodology {
  margin: 0 0 18px; padding: 11px 14px; font-size: 13px; color: #6b5a22;
  background: var(--gold-soft); border-left: 4px solid var(--gold); border-radius: 8px;
}
.methodology .m-label { font-weight: 800; color: #8a6d1f; margin-right: 6px; }

.sec {
  margin: 26px 0 12px; padding-left: 13px; font-size: 17px; font-weight: 800; color: var(--brand);
  border-left: 5px solid var(--gold); line-height: 1.4;
}
.exec {
  padding: 16px 18px; background: linear-gradient(180deg, #f3f7fd, #fff);
  border: 1px solid var(--border); border-left: 5px solid var(--brand-2);
  border-radius: 12px; font-size: 14.5px; color: #2a3340;
}

.points { margin: 10px 0; padding-left: 4px; list-style: none; }
.points li { padding: 8px 0; border-bottom: 1px dashed #eef1f6; }
.points li:last-child { border-bottom: none; }
.points .aspect { font-weight: 700; color: var(--brand-2); }
.points .ev { display: block; margin-top: 3px; font-size: 12.5px; color: var(--muted); }

.sub-h { margin: 12px 0 6px; font-size: 14px; font-weight: 700; color: #3a4658; }

/* 表格 */
table.mini { width: 100%; border-collapse: separate; border-spacing: 0; margin: 10px 0; font-size: 13.5px; overflow: hidden; border-radius: 10px; box-shadow: var(--shadow-sm); }
table.mini th { background: var(--brand); color: #fff; font-weight: 700; text-align: left; padding: 10px 12px; }
table.mini td { padding: 9px 12px; border-top: 1px solid var(--border); color: #2a3340; }
table.mini tbody tr:nth-child(even) { background: #f7f9fc; }
table.mini tbody tr:hover { background: #eef3fb; }

/* SWOT 四宫格 */
.swot { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.swot > div { padding: 14px; border-radius: 12px; border: 1px solid; }
.swot h4 { margin: 0 0 8px; font-size: 14px; }
.swot ul { margin: 0; padding-left: 18px; font-size: 13px; }
.swot .s { background: #ecf8f0; border-color: #bfe6cc; } .swot .s h4 { color: var(--green); }
.swot .w { background: #fdeeec; border-color: #f3c9c4; } .swot .w h4 { color: var(--red); }
.swot .o { background: #eaf1fc; border-color: #c2d6f3; } .swot .o h4 { color: var(--blue); }
.swot .t { background: #fdf2e4; border-color: #f3dab4; } .swot .t h4 { color: var(--orange); }

/* 市场建议卡片 */
.recs { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.rec {
  padding: 14px 16px 14px 18px; border: 1px solid var(--border); border-radius: 12px;
  background: #fff; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.rec::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--blue); }
.rec.pri-高::before { background: var(--red); }
.rec.pri-中::before { background: var(--orange); }
.rec.pri-低::before { background: #8a93a6; }
.rec-head { display: flex; align-items: center; gap: 10px; }
.rec-head strong { font-size: 15px; color: var(--brand); }
.pri { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; color: #fff; background: var(--blue); }
.pri.高 { background: var(--red); } .pri.中 { background: var(--orange); } .pri.低 { background: #8a93a6; }
.rec .why { display: block; margin-top: 6px; font-size: 13px; color: #46506a; }
.rec div:not(.rec-head) { font-size: 13.5px; color: #2a3340; margin-top: 4px; }
.rec .rk { display: inline-block; margin: 6px 8px 0 0; padding: 3px 9px; font-size: 12px; font-weight: 600;
  color: #46506a; background: #f1f4f9; border: 1px solid var(--border); border-radius: 7px; }

/* 来源引用上标链接 */
.cite { color: var(--brand-2); font-weight: 700; text-decoration: none; border-bottom: 1px dotted var(--brand-2); padding: 0 1px; cursor: pointer; }
.cite:hover { color: var(--brand); }

/* 行内键值（细分增长/驱动/集中度/营销/合规等） */
.kv { margin: 8px 0; font-size: 13.5px; line-height: 1.7; color: #2a3340; }
.kv .k { display: inline-block; min-width: 104px; font-weight: 800; color: var(--brand); margin-right: 8px;
  padding: 2px 8px; background: #f1f4f9; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; vertical-align: top; }

/* 关键词 chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip { padding: 4px 12px; font-size: 12.5px; font-weight: 600; color: var(--brand); background: #eef3fb; border: 1px solid #d4e0f3; border-radius: 999px; }

/* 调研来源区 */
.sources { margin-top: 22px; }
.sources .sec { margin-bottom: 12px; }
.src-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.src-card { padding: 12px 14px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); transition: box-shadow .2s, transform .2s; }
.src-card:hover { box-shadow: 0 4px 16px rgba(21,49,91,.12); transform: translateY(-2px); }
.src-top { display: flex; align-items: flex-start; gap: 8px; }
.src-idx { flex: 0 0 auto; font-size: 11px; font-weight: 800; color: #fff; background: var(--brand-2); border-radius: 6px; padding: 2px 6px; margin-top: 2px; }
.src-title { font-size: 13.5px; font-weight: 700; color: var(--brand); text-decoration: none; line-height: 1.5; }
.src-title:hover { text-decoration: underline; }
.src-url { margin: 4px 0 6px 26px; font-size: 11px; color: #8a93a6; word-break: break-all; }
.src-snip { margin-left: 26px; font-size: 12.5px; color: #46506a; line-height: 1.6; padding: 6px 10px; background: #f7f9fc; border-radius: 8px; }
.src-q { margin: 4px 0 0 26px; font-size: 11px; color: #8a93a6; }
@media (max-width: 720px) { .src-list { grid-template-columns: 1fr; } }

/* 加载动画 */
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 70px 20px; color: var(--muted); }
.spinner { width: 42px; height: 42px; border: 4px solid #dde5f1; border-top-color: var(--brand-2); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .swot { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .layout, .topbar { padding-left: 14px; padding-right: 14px; }
  .brand h1 { font-size: 17px; }
}

/* ---------- 登录页（左右分栏 · 品牌商务风） ---------- */
.login-wrap { display: flex; min-height: 100vh; }
.login-aside {
  position: relative; flex: 1.15; overflow: hidden;
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(42,95,166,.55), transparent 60%),
    radial-gradient(700px 600px at 90% 100%, rgba(200,162,74,.18), transparent 60%),
    linear-gradient(150deg, #0f2748 0%, #15315b 45%, #1f4a86 100%);
  color: #fff; padding: 54px 56px; display: flex; flex-direction: column; justify-content: space-between;
}
.login-aside::after {
  content: "金"; position: absolute; right: -40px; bottom: -70px;
  font-size: 380px; font-weight: 900; line-height: 1; color: rgba(200,162,74,.07); pointer-events: none; user-select: none;
}
.brand-top { display: flex; align-items: center; gap: 14px; position: relative; z-index: 2; }
.mark {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--gold-2), var(--gold)); color: #15315b; font-size: 26px; font-weight: 900;
  box-shadow: 0 8px 22px rgba(200,162,74,.35);
}
.brand-top h1 { margin: 0; font-size: 22px; letter-spacing: 1px; font-weight: 800; }
.brand-top p { margin: 3px 0 0; font-size: 12.5px; color: rgba(255,255,255,.62); letter-spacing: 3px; }
.hero { position: relative; z-index: 2; max-width: 440px; }
.hero .eyebrow {
  display: inline-block; font-size: 12px; letter-spacing: 3px; color: var(--gold-2);
  border: 1px solid rgba(200,162,74,.45); padding: 5px 12px; border-radius: 999px; margin-bottom: 20px;
}
.hero h2 { margin: 0 0 16px; font-size: 34px; line-height: 1.35; font-weight: 800; letter-spacing: .5px; }
.hero h2 em { font-style: normal; color: var(--gold-2); }
.hero p { margin: 0; color: rgba(255,255,255,.72); font-size: 14.5px; line-height: 1.9; }
.feats { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 14px; margin-top: 34px; }
.feat { display: flex; align-items: center; gap: 12px; font-size: 14px; color: rgba(255,255,255,.85); }
.feat .ic {
  width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: rgba(200,162,74,.16); color: var(--gold-2); font-weight: 800;
}
.aside-foot { position: relative; z-index: 2; font-size: 12px; color: rgba(255,255,255,.5); }

.login-main { flex: 1; display: grid; place-items: center; padding: 32px; }
.login-card {
  width: min(400px, 100%); background: var(--card); border-radius: 20px;
  padding: 40px 38px 30px; box-shadow: 0 24px 70px rgba(21,49,91,.14); border: 1px solid #eef1f7;
}
.login-card h3 { margin: 0 0 4px; font-size: 23px; font-weight: 800; letter-spacing: .5px; }
.login-card .lead { margin: 0 0 26px; font-size: 13px; color: var(--muted); }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: #46506a; margin-bottom: 7px; }
.input {
  display: flex; align-items: center; gap: 10px; background: #f7f9fc; border: 1.5px solid var(--border);
  border-radius: 12px; padding: 0 13px; transition: .18s;
}
.input:focus-within { border-color: var(--gold); background: #fff; box-shadow: 0 0 0 4px rgba(200,162,74,.14); }
.input svg { flex: none; color: #9aa3b3; }
.input input { flex: 1; border: 0; outline: 0; background: transparent; padding: 12.5px 0; font-size: 14.5px; color: var(--text); font-family: inherit; }
.input input::placeholder { color: #aab2c0; }
.row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 22px; font-size: 12.5px; }
.remember { display: flex; align-items: center; gap: 7px; color: #5a6478; cursor: pointer; user-select: none; }
.remember input { accent-color: var(--gold); width: 15px; height: 15px; }
.forget { color: var(--brand-2); text-decoration: none; font-weight: 600; }
.forget:hover { text-decoration: underline; }
.btn {
  width: 100%; border: 0; cursor: pointer; border-radius: 12px; padding: 14px; font-size: 15.5px; font-weight: 800;
  letter-spacing: 4px; color: #15315b; font-family: inherit;
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  box-shadow: 0 10px 24px rgba(200,162,74,.32); transition: .18s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(200,162,74,.42); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.err { display: none; margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: #fdecea; color: var(--red); font-size: 13px; text-align: center; }
.err.show { display: block; }
.tiers { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--border); font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.8; }
.tiers b { color: #46506a; font-weight: 700; }
@media (max-width: 840px) {
  .login-aside { display: none; }
  .login-main { background: linear-gradient(150deg, #0f2748, #1f4a86); }
  .login-card { box-shadow: 0 18px 50px rgba(0,0,0,.3); }
}

/* ---------- 顶栏右侧 / 用户 ---------- */
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.user-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-name { font-size: 13px; color: #dce7f6; font-weight: 600; }
.role-pill { padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 800; color: #fff; white-space: nowrap; }
.role-superadmin { background: #7a1f1f; }
.role-admin { background: #1f5a7a; }
.role-director { background: #1f7a4a; }
.role-manager { background: #9a6a1f; }
.role-specialist { background: #5a5f6e; }
button.ghost.sm, .ghost.sm { padding: 6px 12px; font-size: 12.5px; }
.ghost.sm.danger { color: var(--red); border-color: #e3b4b0; }
.ghost.sm.danger:hover { background: #fbecea; }

/* ---------- 用户管理弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: rgba(15,30,55,.45); padding: 20px; }
.modal-card { width: min(760px, 96vw); max-height: 90vh; overflow: auto; background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff; }
.modal-head h3 { margin: 0; color: var(--brand); font-size: 16px; }
.modal-body { padding: 18px 20px 24px; }
.user-form { background: #fafbfe; border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 20px; }
.user-form h4 { margin: 0 0 12px; font-size: 14px; color: #3a4658; }
.user-form label { display: block; font-size: 12.5px; font-weight: 600; color: #3a4658; margin-bottom: 10px; }
.user-form input, .user-form select { width: 100%; margin-top: 5px; padding: 9px 11px; font-size: 14px; font-family: inherit;
  border: 1.5px solid var(--border); border-radius: 9px; background: #fff; color: var(--text); }
.user-form select { appearance: none; }
.uf-actions { display: flex; align-items: center; gap: 10px; }
.uf-msg { font-size: 12.5px; color: var(--green); font-weight: 700; }
.uf-ops button { margin: 0 2px; }
.modal-body h4 { margin: 0 0 10px; font-size: 14px; color: #3a4658; }

/* ===== 智能优化新增样式 ===== */
.stats-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: linear-gradient(120deg, #15315b, #1f4a86); color: #fff; padding: 14px 20px; border-radius: 14px; margin-bottom: 16px; box-shadow: 0 8px 24px rgba(21,49,91,.18); flex-wrap: wrap; grid-column: 1 / -1; }
.stat-welcome { display: flex; flex-direction: column; gap: 2px; }
.stat-hi { font-size: 16px; font-weight: 700; }
.stat-sub { font-size: 12px; opacity: .82; }
.stat-cards { display: flex; gap: 10px; }
.stat { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); border-radius: 12px; padding: 8px 16px; text-align: center; min-width: 86px; }
.stat-n { display: block; font-size: 22px; font-weight: 800; color: #f3d27a; line-height: 1.1; }
.stat-l { font-size: 11px; opacity: .85; }

/* 调研进度动画 */
.research-progress { padding: 30px 20px; text-align: center; }
.rp-head { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; color: var(--brand); font-weight: 600; }
.rp-pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--gold); animation: rp-pulse 1.6s infinite; }
@keyframes rp-pulse { 0% { box-shadow: 0 0 0 0 rgba(200,162,74,.6); } 70% { box-shadow: 0 0 0 12px rgba(200,162,74,0); } 100% { box-shadow: 0 0 0 0 rgba(200,162,74,0); } }
.rp-bar { height: 9px; border-radius: 6px; background: #eef1f7; overflow: hidden; margin: 18px 0 14px; }
.rp-bar i {
  display: block; height: 100%; width: 0; border-radius: 6px;
  background-image:
    linear-gradient(45deg, rgba(255,255,255,.28) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.28) 50%, rgba(255,255,255,.28) 75%, transparent 75%),
    linear-gradient(90deg, #c8a24a, #15315b);
  background-size: 22px 22px, 100% 100%;
  background-position: 0 0, 0 0;
  animation: rp-stripes .9s linear infinite;
  transition: width .6s ease;
}
.rp-bar i.done { animation: none; }
@keyframes rp-stripes { from { background-position: 0 0, 0 0; } to { background-position: 22px 0, 0 0; } }
.rp-tip { font-size: 12px; color: var(--muted); margin-top: 10px; }
.rp-steps { list-style: none; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; padding: 0; margin: 0; }
.rp-steps li { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: #f4f6fb; color: #9aa3b2; font-size: 13px; border: 1px solid var(--border); transition: .25s; }
.rp-steps li .dot { width: 9px; height: 9px; border-radius: 50%; background: #cbd2de; transition: .25s; }
.rp-steps li.active { background: #fff; color: var(--brand); border-color: var(--gold); font-weight: 600; box-shadow: 0 4px 12px rgba(200,162,74,.15); }
.rp-steps li.active .dot { background: var(--gold); }
.rp-steps li.done { color: #2f9e6b; }
.rp-steps li.done .dot { background: #2f9e6b; }

/* 智能洞察卡 */
.insight-card { background: linear-gradient(120deg, #fff, #f7f9fc); border: 1px solid var(--border); border-left: 4px solid var(--gold); border-radius: 14px; padding: 16px 18px; margin: 14px 0 18px; box-shadow: 0 6px 18px rgba(21,49,91,.06); }
.insight-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.insight-kicker { font-size: 12px; font-weight: 700; letter-spacing: 1px; color: #b8862f; background: #fbf2dd; padding: 3px 10px; border-radius: 999px; }
.insight-metrics { display: flex; gap: 14px; }
.insight-metrics span { font-size: 12px; color: #67708a; }
.insight-metrics b { font-size: 17px; color: var(--brand); margin-right: 3px; }
.insight-lead { margin: 12px 0 0; font-size: 14.5px; line-height: 1.75; color: #2b3650; }

/* 模块卡 */
.sec-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; margin: 14px 0; box-shadow: 0 4px 14px rgba(21,49,91,.05); }
.sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sec-no { flex: none; width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(145deg, #f3d27a, var(--gold)); color: #1c2c44; font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.sec-card .sec { margin: 0; }
.sec-card h4.sub-h { margin: 12px 0 6px; color: var(--brand); }

/* 来源卡片增强 */
.src-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: #fff; transition: .15s; }
.src-card:hover { border-color: var(--gold); box-shadow: 0 4px 14px rgba(200,162,74,.15); }
.src-top { display: flex; align-items: center; gap: 8px; }
.src-idx { flex: none; font-size: 11px; font-weight: 700; color: #fff; background: var(--brand); border-radius: 6px; padding: 2px 6px; }
.src-title { font-weight: 600; color: var(--brand); text-decoration: none; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-title:hover { text-decoration: underline; }
.src-cite { flex: none; font-size: 11px; color: #2f9e6b; background: #e7f6ee; border-radius: 999px; padding: 2px 8px; }
.src-meta { margin: 4px 0 2px; }
.src-domain { font-size: 11px; color: #9aa3b2; background: #f1f3f8; border-radius: 6px; padding: 1px 6px; }
.src-url { font-size: 11px; color: #9aa3b2; word-break: break-all; }
.src-snip { margin-top: 6px; font-size: 12.5px; color: #5b6478; line-height: 1.6; background: #f8f9fc; border-radius: 8px; padding: 8px 10px; }
.src-q { margin-top: 4px; font-size: 11px; color: #8a93a6; }
ul.dots { margin: 4px 0 0; padding-left: 18px; }
ul.dots li { margin: 3px 0; color: #3a4658; }
.muted { color: #9aa3b2; }
.placeholder { color: #9aa3b2; font-size: 14px; line-height: 1.8; padding: 40px 20px; text-align: center; border: 1.5px dashed var(--border); border-radius: 14px; background: #fafbfe; }

/* 智能引导空状态 */
.placeholder.guided { border-style: solid; border-color: #e3eaf5; background: linear-gradient(180deg, #fbfdff, #f5f9fe); padding: 34px 24px; }
.guided-emoji { font-size: 40px; line-height: 1; margin-bottom: 6px; }
.guided-title { margin: 6px 0 4px; font-size: 19px; color: var(--brand); font-weight: 800; }
.guided-desc { max-width: 580px; margin: 0 auto 18px; color: #5b6678; font-size: 13.5px; line-height: 1.75; }
.pipeline { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 5px 7px; max-width: 680px; margin: 0 auto 16px; }
.pipeline .pipe { padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--brand); background: #fff; border: 1px solid #d6e0f3; box-shadow: var(--shadow-sm); }
.pipeline i { width: 9px; height: 2px; background: #c9d6ea; border-radius: 2px; }
.guided-tips { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.guided-tips span { font-size: 12px; color: #6b7688; background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; }
@media (max-width: 560px) { .pipeline i { display: none; } }

/* 数据可信度指标 */
.cred { font-size: 12px; font-weight: 700; padding: 2px 11px; border-radius: 999px; }
.cred-hi { background: #e7f4ec; color: #1c7a44; }
.cred-mid { background: #eef3fb; color: #1f5a7a; }
.cred-lo { background: #fbf2dd; color: #8a6d1f; }

/* ============ 打印 / 导出 PDF（溯源齐全） ============ */
@media print {
  @page { size: A4; margin: 15mm 13mm; }
  html, body {
    background: #fff !important;
    color: #1a2233 !important;
    font-size: 12px;
  }
  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* 隐藏与报告无关的界面元素 */
  .login-wrap, .topbar, .stats-bar, .form-panel, .history,
  .user-box, .modal, .report-head, #userModal, .sec-no { display: none !important; }

  .layout { display: block !important; padding: 0 !important; margin: 0 !important; gap: 0 !important; }
  .report-panel {
    display: block !important; width: 100% !important;
    border: none !important; box-shadow: none !important;
    padding: 0 !important; background: #fff !important;
  }
  #report { font-size: 12px; color: #1a2233; }

  /* 品牌封皮（仅打印显示） */
  .print-cover { display: block !important; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 3px solid var(--brand); }
  .pc-band { display: flex; align-items: baseline; justify-content: space-between; }
  .pc-brand { font-size: 15px; font-weight: 700; color: var(--brand); letter-spacing: .5px; }
  .pc-brand span { margin: 0 4px; color: var(--gold); }
  .pc-tag { font-size: 9px; letter-spacing: 2px; color: var(--muted); }
  .pc-title { font-size: 23px; margin: 12px 0 12px; color: var(--brand); line-height: 1.3; }
  .pc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 24px; font-size: 11.5px; }
  .pc-meta div { display: flex; gap: 8px; }
  .pc-meta span { color: var(--muted); min-width: 60px; }
  .pc-meta b { font-weight: 600; color: #29324a; }
  .pc-desc { margin-top: 12px; font-size: 11px; color: #45506a; line-height: 1.7; border-left: 3px solid var(--gold); padding-left: 10px; }

  /* 章节与正文排版 */
  #report h3.sec { font-size: 15px; margin: 16px 0 8px; color: var(--brand); border-left: 4px solid var(--gold); padding-left: 8px; break-after: avoid; }
  #report h4.sub-h { font-size: 12.5px; margin: 10px 0 4px; color: #29324a; break-after: avoid; }
  #report .sec-card { margin-top: 16px; border-top: 2px solid var(--brand); padding-top: 8px; break-inside: avoid; }
  #report .src-note { color: #5b6478; }
  #report ul.points { margin: 4px 0 8px; }
  #report ul.points li { break-inside: avoid; }
  #report .mini { width: 100%; border-collapse: collapse; font-size: 11px; margin: 6px 0; break-inside: avoid; }
  #report .mini th, #report .mini td { border: 1px solid #cfd8e6; padding: 4px 6px; }
  #report .mini th { background: #eef2f8 !important; }
  #report .insight-card, #report .swot > div, #report .rec, #report .src-card {
    break-inside: avoid; border: 1px solid #d6deea; border-radius: 8px; padding: 8px 10px; margin: 8px 0;
  }
  #report .insight-card { background: #f6f8fc !important; border-left: 4px solid var(--brand); }
  #report .badge { border: 1px solid #c9d3e3; padding: 1px 7px; border-radius: 10px; font-size: 10.5px; background: #f1f4f9 !important; color: #46506a; }
  #report .badge.llm { background: #e7f4ec !important; color: #1c7a44; }
  #report .badge.demo { background: #efe9fb !important; color: #6b46c1; }
  #report .cite { color: var(--brand) !important; font-weight: 700; text-decoration: none; }
  #report .kv { break-inside: avoid; }
  #report .chips { break-inside: avoid; }

  /* 溯源来源清单：清晰呈现编号 / 域名 / 链接 / 引用计数 */
  #report .src-list { margin-top: 6px; }
  #report .src-card { padding: 8px 10px; }
  #report .src-idx { display: inline-block; background: var(--brand); color: #fff; border-radius: 6px; padding: 1px 6px; font-size: 10.5px; font-weight: 700; }
  #report .src-title { color: var(--brand) !important; font-weight: 600; }
  #report .src-cite { background: #e7f6ee !important; color: #2f9e6b; }
  #report .src-domain { background: #f1f3f8 !important; color: #50607a; }
  #report .src-url { color: #50607a !important; font-size: 10px; word-break: break-all; }
  #report .src-snip { background: #f8f9fc !important; color: #45506a; }
  #report .swot { gap: 8px; }
  #report .swot > div { background: #f6f8fc !important; }
  #report .swot .s { border-left: 3px solid #1c7a44; }
  #report .swot .w { border-left: 3px solid #c0392b; }
  #report .swot .o { border-left: 3px solid var(--gold); }
  #report .swot .t { border-left: 3px solid #2980b9; }
}

/* ============ 视图切换 Tab ============ */
.view-tabs {
  display: flex; gap: 6px; padding: 0 30px; margin-top: -1px;
  background: linear-gradient(110deg, var(--brand) 0%, #1f4a86 70%, #24579c 100%);
}
.vtab {
  appearance: none; border: 0; cursor: pointer;
  padding: 10px 22px; font-size: 14px; font-weight: 600;
  color: rgba(255, 255, 255, .72); background: transparent;
  border-radius: 10px 10px 0 0; transition: .18s;
}
.vtab:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.vtab.active { color: var(--brand); background: var(--bg); box-shadow: inset 0 3px 0 var(--gold); }

/* ============ 电商数据视图 ============ */
.commerce-view { grid-template-columns: 1fr; }
.commerce-view .panel { grid-column: 1 / -1; }
.cm-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cm-actions { display: flex; gap: 8px; }

.cm-form { display: grid; gap: 14px; margin: 14px 0 4px; }
.cm-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.cm-form input[type="text"], .cm-form select {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; color: var(--text); background: #fbfcfe; outline: none; width: 100%;
}
.cm-form input[type="text"]:focus, .cm-form select:focus { border-color: var(--brand-2); background: #fff; }
.cm-opts { display: grid; gap: 8px; }
.cm-opts > .label { font-size: 13px; font-weight: 700; color: var(--text); }
.cm-plats { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.cm-plats .chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--text); }
.tag-rev { font-style: normal; font-size: 10.5px; color: var(--green); background: #e7f6ee; border-radius: 5px; padding: 1px 5px; }
.cm-row { grid-auto-flow: column; grid-auto-columns: minmax(120px, 1fr); align-items: end; gap: 12px; }
.cm-row .primary { height: 40px; }
.cm-tip { margin: 0; font-size: 12.5px; color: var(--muted); background: #f8f9fc; border: 1px dashed var(--border); border-radius: 10px; padding: 10px 12px; }
.cm-tip b { color: var(--text); }

.cm-status { margin: 12px 0; padding: 11px 14px; border-radius: 10px; font-size: 13.5px; }
.cm-status.loading { background: #eef4ff; color: var(--brand-2); border: 1px solid #d6e3fb; display: flex; align-items: center; gap: 8px; }
.cm-status.ok { background: #e7f6ee; color: #1c7a44; border: 1px solid #c9ebd8; }
.cm-status.err { background: #fdecec; color: #b5362f; border: 1px solid #f6cfcd; }
.spin { width: 13px; height: 13px; border: 2px solid rgba(31, 74, 134, .25); border-top-color: var(--brand-2); border-radius: 50%; display: inline-block; animation: cmspin .8s linear infinite; }
@keyframes cmspin { to { transform: rotate(360deg); } }

.cm-result { margin-top: 14px; }
.cm-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.cm-kpi .kpi { background: linear-gradient(180deg, #fff, #f8fafd); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: grid; gap: 2px; box-shadow: var(--shadow-sm); }
.cm-kpi .kpi.wide { grid-column: 1 / -1; }
.cm-kpi .k-label { font-size: 12px; color: var(--muted); }
.cm-kpi .k-value { font-size: 22px; font-weight: 700; color: var(--brand); }
.cm-kpi .k-value.small { font-size: 14px; font-weight: 600; color: var(--text); }
.cm-kpi .k-value i { font-style: normal; font-size: 12px; color: var(--muted); margin-left: 3px; }

.cm-tabs { display: flex; gap: 6px; margin: 16px 0 10px; border-bottom: 1px solid var(--border); }
.cmtab { appearance: none; border: 0; background: transparent; cursor: pointer; padding: 8px 16px; font-size: 13.5px; font-weight: 600; color: var(--muted); border-radius: 8px 8px 0 0; }
.cmtab:hover { color: var(--brand-2); }
.cmtab.active { color: var(--brand); background: #f2f6fd; box-shadow: inset 0 -2px 0 var(--gold); }

.cm-pane { margin-bottom: 8px; }
.cm-tablewrap { overflow: auto; max-height: 560px; border: 1px solid var(--border); border-radius: 12px; }
.cm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cm-table th { position: sticky; top: 0; background: #f4f7fc; color: var(--brand); font-weight: 700; text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; z-index: 1; }
.cm-table td { padding: 9px 10px; border-bottom: 1px solid #f0f3f8; vertical-align: top; }
.cm-table tr:hover td { background: #fafbfe; }
.cm-table .t { max-width: 460px; color: var(--text); }
.cm-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cm-table .dim { color: var(--muted); }
.cm-table .plat { display: inline-block; font-size: 11.5px; background: #eef3fb; color: var(--brand-2); border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.cm-table a { color: var(--blue); text-decoration: none; }
.cm-table a:hover { text-decoration: underline; }
.empty-box { padding: 30px; text-align: center; color: var(--muted); background: #fafbfe; border: 1px dashed var(--border); border-radius: 12px; }

.rv { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.rv.pos { border-left: 3px solid var(--green); }
.rv.neg { border-left: 3px solid var(--red); }
.rv-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }
.rv-star { color: var(--gold); font-weight: 700; }
.rv-badge { font-size: 11px; background: #e7f6ee; color: var(--green); border-radius: 5px; padding: 1px 6px; }
.rv-meta { color: var(--muted); }
.rv-title { font-weight: 700; margin-top: 6px; color: var(--text); }
.rv-body { margin-top: 4px; color: #333c4d; font-size: 13.5px; white-space: pre-wrap; }
.rv-item { margin-top: 8px; font-size: 12px; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 6px; }

.ins-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.ins-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.ins-card.full { margin-top: 12px; }
.ins-card h4 { margin: 0 0 10px; font-size: 14px; color: var(--brand); }
.bar-row { display: grid; grid-template-columns: 44px 1fr 34px; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12.5px; }
.bar { background: #f0f3f8; border-radius: 6px; height: 12px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #e0c078); }
.bar-num { text-align: right; color: var(--muted); }
.rate-line { margin-top: 10px; font-size: 13px; color: var(--muted); }
.rate-line b { color: var(--brand); }
.words { display: flex; flex-wrap: wrap; gap: 6px; }
.word { background: #f2f6fd; color: var(--brand-2); border-radius: 6px; padding: 3px 8px; font-size: 12.5px; }
.word i { font-style: normal; color: var(--muted); margin-left: 4px; font-size: 11px; }
.words.neg .word { background: #fdecec; color: #b5362f; }
.quote { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: #fafbfe; }
.quote.neg { border-left: 3px solid var(--red); }
.quote.pos { border-left: 3px solid var(--green); }
.q-head { font-size: 12.5px; font-weight: 700; margin-bottom: 4px; }
.q-head .dim { font-weight: 400; color: var(--muted); }
.q-body { font-size: 13px; color: #333c4d; white-space: pre-wrap; }

@media (max-width: 860px) {
  .cm-row { grid-auto-flow: row; grid-auto-columns: auto; }
  .view-tabs { padding: 0 14px; }
}
