/* ===== 香港鹰力 商业分析驾驶舱 · 样式 ===== */
:root {
  --bg: #f4f6fb;
  --bg-g1: #eef1ff;
  --bg-g2: #f7f0ff;
  --surface: rgba(255,255,255,0.72);
  --surface-solid: #ffffff;
  --text: #161a2b;
  --text-dim: #5c6379;
  --accent: #6d5efc;
  --accent2: #11c4d6;
  --accent3: #f5519b;
  --border: rgba(20,24,50,0.08);
  --glass: rgba(255,255,255,0.6);
  --shadow: 0 12px 36px rgba(30,35,80,0.10);
  --radius: 18px;
}
[data-theme="dark"] {
  --bg: #070912;
  --bg-g1: #0d1226;
  --bg-g2: #160d28;
  --surface: rgba(255,255,255,0.045);
  --surface-solid: #11141f;
  --text: #e9ebf5;
  --text-dim: #949ab4;
  --accent: #8b7dff;
  --accent2: #2fe0f0;
  --accent3: #ff7ec0;
  --border: rgba(255,255,255,0.09);
  --glass: rgba(255,255,255,0.04);
  --shadow: 0 14px 44px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background .5s ease, color .35s ease;
  background-image:
    radial-gradient(1200px 600px at 12% -8%, var(--bg-g1), transparent 60%),
    radial-gradient(1000px 500px at 100% 0%, var(--bg-g2), transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* 顶部栏 */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  font-size: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  box-shadow: 0 6px 18px rgba(109,94,252,.35);
}
.brand-title { font-weight: 750; font-size: 17px; letter-spacing: .3px; }
.brand-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.range-pill {
  font-size: 12.5px; color: var(--text-dim);
  padding: 7px 13px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
}
.gran-toggle { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.gran-toggle button {
  border: 0; background: transparent; color: var(--text-dim);
  padding: 7px 16px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600;
  transition: all .25s ease;
}
.gran-toggle button.active { background: linear-gradient(135deg, var(--accent), var(--accent3)); color: #fff; box-shadow: 0 4px 14px rgba(109,94,252,.35); }
.period-select {
  appearance: none; -webkit-appearance: none;
  font-size: 13px; font-weight: 600; color: var(--text);
  padding: 9px 34px 9px 14px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a90ad' stroke-width='3'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 13px center;
  transition: border-color .25s, box-shadow .25s;
  max-width: 170px;
}
.period-select:hover { border-color: var(--accent); }
.period-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139,125,255,.18); }
.theme-btn {
  width: 42px; height: 42px; border-radius: 13px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 19px; display: grid; place-items: center;
  transition: transform .25s cubic-bezier(.16,1,.3,1), background .3s;
}
.theme-btn:hover { transform: translateY(-2px) rotate(-8deg); }

/* 导航 */
.nav {
  position: sticky; top: 71px; z-index: 40;
  display: flex; gap: 6px; padding: 12px 26px; flex-wrap: wrap;
  background: var(--glass); backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.nav-item {
  text-decoration: none; color: var(--text-dim); font-size: 14px; font-weight: 600;
  padding: 8px 16px; border-radius: 11px; transition: all .25s ease; position: relative;
}
.nav-item:hover { color: var(--text); background: var(--surface); }
.nav-item.active { color: var(--accent); background: var(--surface); }

.container { max-width: 1180px; margin: 0 auto; padding: 26px 26px 60px; }

.notice {
  border-radius: var(--radius); padding: 14px 18px; margin-bottom: 22px;
  font-size: 12.8px; color: var(--text-dim); line-height: 1.7;
  border-left: 3px solid var(--accent3);
}
.notice b { color: var(--text); }

.section { margin-bottom: 46px; scroll-margin-top: 140px; }
/* 页面切换模式：每个分区是一个独立页面，仅当前页可见 */
.section.page { display: none; }
.section.page.page-active { display: block; animation: pageIn .42s cubic-bezier(.16,1,.3,1) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(14px) scale(.994); } to { opacity: 1; transform: none; } }
.nav-item { cursor: pointer; }
.section-head { margin-bottom: 18px; }
.section-head h2 { font-size: 22px; font-weight: 750; letter-spacing: .3px; }
.section-head h2::before {
  content: ""; display: inline-block; width: 5px; height: 20px; border-radius: 3px; margin-right: 10px;
  background: linear-gradient(var(--accent), var(--accent3)); vertical-align: -3px;
}
.section-desc { font-size: 13px; color: var(--text-dim); margin-top: 6px; margin-left: 15px; }
.section-desc strong { color: var(--accent); font-weight: 700; }
.cur-period {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; margin-left: 15px;
  font-size: 12.5px; font-weight: 600; color: var(--text);
  padding: 7px 14px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(139,125,255,.16), rgba(47,224,240,.12));
  border: 1px solid var(--border);
}
.cur-period::before { content: "📍"; font-size: 13px; }

.glass {
  background: var(--surface);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  border: 1px solid var(--border);
}
.card { border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.chart-card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 10px; }
.card-head h3 { font-size: 15.5px; font-weight: 700; }
.badge-static {
  font-size: 11px; font-weight: 700; color: var(--text-dim);
  padding: 3px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); white-space: nowrap;
}
.chart { width: 100%; height: 340px; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.kpi {
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
  position: relative; overflow: hidden; transition: transform .35s cubic-bezier(.16,1,.3,1), box-shadow .35s;
}
.kpi::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent), transparent 70%); opacity: .16;
}
.kpi:hover { transform: translateY(-5px); box-shadow: 0 20px 44px rgba(0,0,0,.16); }
.kpi-label { font-size: 12.5px; color: var(--text-dim); font-weight: 600; }
.kpi-value { font-size: 27px; font-weight: 800; margin-top: 8px; letter-spacing: -.5px;
  background: linear-gradient(120deg, var(--text), var(--accent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.kpi-sub { font-size: 11.5px; color: var(--text-dim); margin-top: 6px; }
.kpi-sub.up { color: #1bbf72; } .kpi-sub.down { color: #f0556b; }

/* metric toggle */
.metric-toggle { display: flex; flex-wrap: wrap; gap: 6px; }
.metric-toggle button {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim);
  padding: 5px 12px; border-radius: 9px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all .2s;
}
.metric-toggle button.active { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent3)); border-color: transparent; }

/* tabs */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tabs button {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim);
  padding: 9px 20px; border-radius: 12px; font-size: 14px; font-weight: 650; cursor: pointer; transition: all .25s;
}
.tabs button.active { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; box-shadow: 0 6px 18px rgba(109,94,252,.3); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } .chart { height: 300px; } }

/* timeline */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--accent), var(--accent3)); border-radius: 2px; }
.tl-item { position: relative; padding: 12px 16px; margin-bottom: 14px; border-radius: 14px; box-shadow: var(--shadow); }
.tl-item::before { content: ""; position: absolute; left: -23px; top: 18px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--surface); }
.tl-date { font-size: 12px; color: var(--accent); font-weight: 700; }
.tl-model { font-size: 13px; font-weight: 700; margin: 4px 0; }
.tl-note { font-size: 13.5px; color: var(--text-dim); line-height: 1.6; }

/* AI 面板 */
.ai-card { padding: 22px; }
.ai-config { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 650; color: var(--text-dim); }
.field input, .field select {
  padding: 10px 13px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface-solid); color: var(--text); font-size: 13.5px; outline: none; transition: border .2s;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field-actions { grid-column: 1 / -1; flex-direction: row; gap: 12px; align-items: center; }
.btn-primary {
  border: 0; padding: 11px 24px; border-radius: 12px; font-size: 14px; font-weight: 700; cursor: pointer; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent3)); box-shadow: 0 8px 22px rgba(109,94,252,.35);
  transition: transform .25s cubic-bezier(.16,1,.3,1);
}
.btn-primary:hover { transform: translateY(-2px) scale(1.02); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-ghost {
  border: 1px solid var(--border); background: transparent; color: var(--text-dim);
  padding: 11px 20px; border-radius: 12px; font-size: 13.5px; font-weight: 650; cursor: pointer; transition: all .2s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.ai-status { font-size: 13px; color: var(--text-dim); margin: 16px 0 8px; min-height: 18px; }
.ai-status.err { color: #f0556b; } .ai-status.ok { color: #1bbf72; }
.ai-output {
  margin-top: 12px; padding: 18px 20px; border-radius: 14px; line-height: 1.85; font-size: 14px;
  background: var(--surface-solid); border: 1px solid var(--border); white-space: pre-wrap; color: var(--text);
  max-height: 520px; overflow-y: auto; display: none;
}
.ai-output.show { display: block; }
.ai-output h4 { margin: 14px 0 6px; font-size: 15px; color: var(--accent); }
.ai-output b { color: var(--accent3); }

.footer { text-align: center; font-size: 12px; color: var(--text-dim); padding: 30px 0 10px; }

/* 磁吸动画基类 */
.magnetic { transition: transform .25s cubic-bezier(.16,1,.3,1); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.kpi, .card { animation: fadeUp .6s ease both; }

/* ===== AI 洞察引擎 ===== */
.ai-engine-title { font-size: 14px; font-weight: 700; color: var(--accent); margin-bottom: 14px; letter-spacing: .3px; }
.insight-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.insight {
  display: flex; gap: 13px; padding: 15px 17px; border-radius: 15px; cursor: pointer;
  background: var(--surface-solid); border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: transform .22s cubic-bezier(.16,1,.3,1), box-shadow .22s, border-color .22s;
}
.insight:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(0,0,0,.16); border-color: var(--accent); }
.ins-icon { font-size: 22px; line-height: 1.3; flex: 0 0 auto; }
.ins-body { min-width: 0; }
.ins-title { font-size: 13.5px; font-weight: 750; margin-bottom: 5px; }
.ins-text { font-size: 12.8px; line-height: 1.65; color: var(--text-dim); }
.ins-text b { color: var(--text); font-weight: 750; }
.insight.ok { border-left: 3px solid #1bbf72; }
.insight.warn { border-left: 3px solid #f5a623; }
.insight.info { border-left: 3px solid var(--accent); }
.ai-optional { margin-top: 20px; border-top: 1px dashed var(--border); padding-top: 16px; }
.ai-llm-panel { margin-top: 14px; }

/* ===== 商品排行表 ===== */
.card-sub { font-size: 12px; color: var(--text-dim); font-weight: 500; margin: 4px 0 0; }
.table-wrap { width: 100%; overflow-x: auto; }
.rank-tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
.rank-tbl th, .rank-tbl td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.rank-tbl th { color: var(--text-dim); font-weight: 650; font-size: 12px; background: var(--surface); position: sticky; top: 0; }
.rank-tbl td.rk { color: var(--text-dim); font-weight: 700; text-align: center; }
.rank-tbl td.pname { text-align: left; font-weight: 650; color: var(--text); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.rank-tbl td.spark { text-align: center; }
.rank-tbl tbody tr { transition: background .18s; }
.rank-tbl tbody tr.clickable { cursor: pointer; }
.rank-tbl tbody tr.clickable:hover { background: var(--surface); }

/* ===== 单品详情 ===== */
#productDetail .prod-title { font-size: 19px; font-weight: 800; letter-spacing: .3px; margin-bottom: 16px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
#productDetail .prod-sub { font-size: 12.5px; color: var(--text-dim); font-weight: 500; }
.back-btn { margin-bottom: 16px; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } .rank-tbl { font-size: 12px; } }

/* ===== 设置页 ===== */
.settings-card { padding: 24px; }
.settings-card .card-sub { margin-bottom: 18px; max-width: 720px; line-height: 1.6; }
.dropzone {
  display: block; cursor: pointer; border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--surface); transition: all .25s ease; padding: 34px 20px; text-align: center;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: linear-gradient(135deg, rgba(139,125,255,.10), rgba(47,224,240,.08)); transform: translateY(-2px); }
.dz-inner { pointer-events: none; }
.dz-icon { font-size: 38px; margin-bottom: 10px; }
.dz-text { font-size: 15px; font-weight: 650; color: var(--text); }
.dz-text b { color: var(--accent); }
.dz-hint { font-size: 12.5px; color: var(--text-dim); margin-top: 8px; }
.settings-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 20px; }
.ds-status { font-size: 13px; color: var(--text-dim); margin-top: 16px; min-height: 18px; }
.ds-status.ok { color: #1bbf72; }
.ds-status.err { color: #f0556b; }
.ds-summary { margin-top: 14px; padding: 16px 18px; border-radius: 14px; box-shadow: var(--shadow); }
.ds-sum-title { font-size: 14px; font-weight: 700; color: var(--accent); margin-bottom: 12px; }
.ds-sum-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.ds-sum-grid div { display: flex; flex-direction: column; gap: 4px; }
.ds-sum-grid span { font-size: 11.5px; color: var(--text-dim); }
.ds-sum-grid b { font-size: 20px; font-weight: 800; background: linear-gradient(120deg, var(--text), var(--accent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.ds-sum-range { font-size: 12.5px; color: var(--text-dim); margin-top: 12px; }
#btnBackMain { text-decoration: none; display: inline-flex; align-items: center; }

