:root {
  --bg: #0a0e14;
  --panel: #121821;
  --panel-2: #171f2a;
  --panel-3: #1d2632;
  --line: #26303d;
  --text: #d8dee8;
  --muted: #7f8a99;
  --accent: #f0b90b;
  --magenta: #ff4d9d;
  --red: #ef232a;
  --green: #14b143;
  --blue: #4a9eff;
  --purple: #b07bff;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(240,185,11,.06), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(255,77,157,.05), transparent 55%),
    var(--bg);
  color: var(--text);
  font: 13px/1.7 "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  overflow-x: hidden;
}
a { color: var(--blue); }
.muted { color: var(--muted); font-size: 12px; }
.spacer { flex: 1; }

/* ---------------- 顶栏 ---------------- */
.ai-top {
  position: sticky; top: 0; z-index: 20;
  height: 52px; display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  background: rgba(14,19,26,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.ai-top .back {
  color: var(--muted); text-decoration: none; font-size: 12px;
  padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px;
}
.ai-top .back:hover { color: var(--accent); border-color: rgba(240,185,11,.45); }
.ai-top .logo { color: var(--accent); font-size: 17px; }
.ai-top .title { font-weight: 700; letter-spacing: .4px; }
.ai-top .tag {
  font-size: 11px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px;
}
.user-area { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.user-area a { color: var(--muted); text-decoration: none; }
.user-area a:hover { color: var(--accent); }
.icon-btn {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 8px; width: 32px; height: 30px; cursor: pointer; font-size: 15px;
}
.icon-btn:hover { color: var(--accent); border-color: rgba(240,185,11,.4); }

/* ---------------- 布局 ---------------- */
.ai-shell {
  display: grid; grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px; max-width: 1500px; margin: 0 auto; padding: 18px;
}
.ai-side {
  position: sticky; top: 70px; align-self: start;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px;
  max-height: calc(100vh - 90px); overflow: auto;
}
.side-title {
  font-weight: 700; font-size: 13px; letter-spacing: .5px;
  padding-bottom: 10px; margin-bottom: 6px; border-bottom: 1px solid var(--line);
}
.field-label {
  display: block; color: var(--muted); font-size: 11px;
  margin: 12px 0 5px; letter-spacing: .3px;
}
.field, .prompt {
  width: 100%; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font: inherit; outline: none;
}
.field:focus, .prompt:focus { border-color: rgba(240,185,11,.55); }
.prompt { resize: vertical; min-height: 92px; line-height: 1.6; }
.run-btn {
  width: 100%; margin-top: 14px; padding: 11px 12px;
  border: 0; border-radius: 9px; cursor: pointer;
  background: linear-gradient(135deg, #f0b90b, #ff8a3d);
  color: #16120a; font-weight: 800; font-size: 13px; letter-spacing: .5px;
}
.run-btn:hover { filter: brightness(1.06); }
.run-btn:disabled { opacity: .55; cursor: wait; }
.hint { margin-top: 10px; min-height: 18px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.hint.err { color: var(--red); }
.hint.ok { color: var(--green); }

/* ---------------- 配置面板 ---------------- */
.cfg-panel {
  margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line);
}
.cfg-title { font-weight: 700; font-size: 12px; margin-bottom: 4px; }
.cfg-actions { display: flex; gap: 6px; margin-top: 12px; }
.ghost {
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
  border-radius: 7px; padding: 6px 10px; cursor: pointer; font: inherit; font-size: 11px;
}
.ghost:hover { color: var(--text); border-color: #3a4656; }
.ghost.primary { color: var(--accent); border-color: rgba(240,185,11,.45); }
.ghost.danger:hover { color: var(--red); border-color: rgba(239,35,42,.45); }

/* ---------------- 报告区 ---------------- */
.ai-main { min-width: 0; }
.report-toolbar {
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); font-size: 12px; padding: 0 2px 10px;
}
.report {
  background: linear-gradient(180deg, #121923, #0f151d);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 34px 38px 44px; min-height: 70vh;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.empty {
  min-height: 58vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; color: var(--muted);
}
.empty-mark {
  width: 64px; height: 64px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 30px; margin-bottom: 14px;
  background: rgba(240,185,11,.07); border: 1px solid rgba(240,185,11,.25);
}
.empty h2 { color: var(--text); font-size: 20px; margin: 0 0 8px; }
.empty p { margin: 4px 0; }

/* 报告头 */
.rep-head { border-bottom: 1px solid var(--line); padding-bottom: 20px; margin-bottom: 24px; }
.rep-kicker {
  color: var(--magenta); font-size: 11px; letter-spacing: 2px; font-weight: 700;
}
.rep-head h1 {
  margin: 8px 0 10px; font-size: 30px; line-height: 1.25; letter-spacing: .5px;
}
.rep-head h1 span { color: var(--accent); font-size: 20px; font-weight: 600; margin-left: 8px; }
.rep-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; }
.rep-chip {
  border: 1px solid var(--line); background: var(--panel-2);
  border-radius: 999px; padding: 2px 9px;
}
.rep-chip.hot { color: var(--magenta); border-color: rgba(255,77,157,.35); }

/* 13 板块 */
.zy-section {
  padding: 22px 0 6px; border-top: 1px solid rgba(38,48,61,.7);
  break-inside: avoid;
}
.zy-section:first-of-type { border-top: 0; padding-top: 4px; }
.zy-section h2 {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; margin: 0 0 12px; line-height: 1.35;
}
.zy-section h2 .sec-no {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,77,157,.12); color: var(--magenta);
  border: 1px solid rgba(255,77,157,.3); font-size: 14px; font-weight: 700;
}
.zy-section h3 { font-size: 14px; margin: 14px 0 6px; color: #e9eef6; }
.zy-section.summary {
  margin: 0 -12px 8px; padding: 20px 12px 22px;
  background: linear-gradient(120deg, rgba(255,77,157,.10), rgba(240,185,11,.04) 55%, transparent);
  border-left: 3px solid var(--magenta); border-radius: 0 10px 10px 0;
  border-top: 0;
}
.zy-section.strategy { border-left: 3px solid var(--accent); padding-left: 14px; }
.zy-section.risk { border-left: 3px solid var(--red); padding-left: 14px; }
.zy-section.fundamental { border-left: 3px solid var(--blue); padding-left: 14px; }
.zy-section.technical { border-left: 3px solid var(--purple); padding-left: 14px; }
.zy-section p { margin: 7px 0; color: #cbd4e0; }
.zy-section ul, .zy-section ol { margin: 6px 0 10px; padding-left: 22px; }
.zy-section li { margin: 3px 0; color: #cbd4e0; }
.zy-section strong { color: var(--accent); font-weight: 700; }
.zy-section code {
  background: var(--panel-3); color: #ffd66b; border-radius: 4px; padding: 1px 5px; font-size: 12px;
}
.zy-section blockquote {
  margin: 10px 0; padding: 10px 14px;
  border-left: 3px solid var(--blue); background: rgba(74,158,255,.07);
  border-radius: 0 8px 8px 0; color: #c7d4e6;
}
.zy-section a { color: var(--blue); }

.zy-section table {
  width: 100%; border-collapse: collapse; margin: 10px 0 14px;
  font-size: 12px; font-variant-numeric: tabular-nums;
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.zy-section th {
  background: var(--panel-2); color: var(--muted); font-weight: 600;
  text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.zy-section td {
  padding: 7px 9px; border-bottom: 1px solid rgba(38,48,61,.55); color: #cbd4e0;
}
.zy-section tr:last-child td { border-bottom: 0; }
.zy-section tbody tr:nth-child(even) { background: rgba(255,255,255,.012); }

.rep-foot {
  margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 11px; display: flex; justify-content: space-between; gap: 12px;
}

/* 错误 / 登录 / 加载 */
.gate, .error-box {
  padding: 26px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--muted); text-align: center;
}
.gate h2, .error-box h2 { color: var(--text); margin: 0 0 8px; font-size: 18px; }
.gate a {
  display: inline-block; margin: 8px 5px 0; padding: 7px 14px;
  border-radius: 8px; background: var(--accent); color: #16120a; text-decoration: none; font-weight: 700;
}
.gate a.ghost-link { background: transparent; color: var(--text); border: 1px solid var(--line); }
.loading { display: flex; align-items: center; gap: 12px; color: var(--muted); padding: 18px 0; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(240,185,11,.2); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 报告模板（对齐左右AI成品样式） ---------------- */
.rep-hero {
  margin: -34px -38px 22px; padding: 30px 24px 24px;
  text-align: center; position: relative; overflow: hidden;
  background:
    radial-gradient(circle at 18% 20%, rgba(255,0,127,.20), transparent 62%),
    radial-gradient(circle at 82% 78%, rgba(0,229,255,.12), transparent 62%),
    linear-gradient(135deg, #1a0033, #0d0033 45%, #1a0033);
  border-bottom: 2px solid #ff007f;
  border-radius: 14px 14px 0 0;
}
.rep-hero h1 {
  margin: 0; color: #ff4fa3; font-size: 30px; line-height: 1.25;
  letter-spacing: .5px; text-shadow: 0 0 22px rgba(255,0,127,.45);
}
.rep-hero h1 span { color: #ffd24a; font-size: 19px; margin-left: 8px; font-weight: 600; }
.rep-hero .sub { color: #8b949e; font-size: 12px; margin-top: 7px; }
.rep-hero .chips { margin-top: 13px; }
.chip {
  display: inline-block; background: rgba(13,17,23,.8);
  border: 1px solid #30363d; border-radius: 20px;
  padding: 4px 12px; margin: 3px; font-size: 11px; color: #9aa6b5;
}
.chip b { color: #e6edf3; }
.chip-signal { background: rgba(255,68,68,.10); border-color: rgba(255,68,68,.45); color: #ff8f8f; }
.chip-signal b { color: #ff6b6b; }

.panel {
  background: #12161d; border: 1px solid #262c36; border-radius: 10px;
  margin-bottom: 16px; overflow: hidden; box-shadow: 0 2px 14px rgba(0,0,0,.35);
}
.panel.summary { border-color: rgba(255,0,127,.45); }
.panel.strategy { border-left: 3px solid #ffd24a; }
.panel.risk { border-left: 3px solid #ff5b5b; }
.panel.fundamental { border-left: 3px solid #00a8ff; }
.panel.technical { border-left: 3px solid #9b6bff; }
.panel-title {
  background: linear-gradient(90deg, rgba(255,0,127,.16), transparent 70%);
  padding: 12px 18px; font-size: 16px; font-weight: 800;
  color: #ff4fa3; border-bottom: 1px solid #262c36;
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
}
.panel-title .no {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; background: #ff007f; color: #0a0a0f;
  border-radius: 6px; font-size: 13px; font-weight: 900; flex: 0 0 auto;
}
.panel-title .role {
  color: #8b949e; font-size: 11px; font-weight: 400; margin-left: 2px;
}
.panel-body { padding: 16px 18px 18px; }
.panel-body h3 {
  font-size: 13px; color: #e6edf3; margin: 14px 0 7px;
  padding-left: 8px; border-left: 3px solid #ff007f;
}
.panel-body p { margin: 7px 0; color: #cbd4e0; }
.panel-body ul, .panel-body ol { margin: 6px 0 10px; padding-left: 22px; }
.panel-body li { margin: 3px 0; color: #cbd4e0; }
.panel-body strong { color: #ffd24a; font-weight: 800; }
.panel-body code { background: #1d2632; color: #ffd66b; border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.panel-body a { color: #5ce1ff; }
.panel-body blockquote.blk { margin: 10px 0; }
.panel-body table {
  width: 100%; border-collapse: collapse; font-size: 12px; margin: 10px 0 14px;
  border: 1px solid #262c36; border-radius: 8px; overflow: hidden;
}
.panel-body th {
  background: #0d1117; color: #8b949e; padding: 8px 10px;
  text-align: left; border-bottom: 2px solid #262c36; white-space: nowrap;
}
.panel-body td {
  padding: 7px 10px; border-bottom: 1px solid rgba(38,44,54,.65);
  font-variant-numeric: tabular-nums; color: #cbd4e0;
}
.panel-body tr:last-child td { border-bottom: 0; }
.panel-body tbody tr:hover { background: rgba(255,0,127,.05); }

.concl {
  background: linear-gradient(90deg, rgba(255,0,127,.16), rgba(255,0,127,.02));
  border-left: 4px solid #ff007f; border-radius: 6px;
  padding: 14px 16px; margin: 10px 0; color: #e6edf3;
}
.concl strong { color: #ff8fbe; }
.blk {
  border-radius: 8px; padding: 12px 14px; margin: 10px 0;
  border-left: 4px solid #00e5ff; background: rgba(0,229,255,.05);
  color: #cbd4e0;
}
.blk-info { border-color: #00e5ff; background: rgba(0,229,255,.05); }
.rep-body > p { color: #cbd4e0; }
.footer {
  text-align: center; padding: 22px 10px 4px; color: #8b949e;
  font-size: 11px; border-top: 1px solid #262c36; margin-top: 14px;
}
.report-chart {
  width: 100%; margin: 14px 0 4px; background: #0d1117;
  border: 1px solid #262c36; border-radius: 8px; overflow: hidden;
}
.chart-empty {
  margin: 14px 0 4px; padding: 22px 16px; border: 1px dashed #30363d;
  border-radius: 8px; background: rgba(13,17,23,.55);
  color: #78828f; font-size: 12px; text-align: center;
}
.chart-img { width: 100%; display: block; border-radius: 8px; }

/* ---------------- 响应式 / 打印 ---------------- */
@media (max-width: 980px) {
  .ai-shell { grid-template-columns: 1fr; padding: 12px; }
  .ai-side { position: static; max-height: none; }
  .report { padding: 22px 18px 30px; }
  .rep-hero { margin: -22px -18px 18px; padding: 24px 14px 20px; }
  .rep-hero h1 { font-size: 23px; }
  .panel-title { font-size: 14px; padding: 10px 13px; }
  .panel-body { padding: 13px 13px 15px; }
  .ai-top .tag { display: none; }
  .rep-head h1 { font-size: 23px; }
}
@media print {
  :root { --bg: #fff; --panel: #fff; --panel-2: #fff; --panel-3: #f2f4f7; --line: #d8dee8; --text: #111; --muted: #555; }
  body { background: #fff !important; color: #111; }
  .ai-top, .ai-side, .report-toolbar { display: none !important; }
  .ai-shell { display: block; padding: 0; }
  .report { border: 0; box-shadow: none; padding: 0; background: #fff; }
  .zy-section, .zy-section table, .rep-head,
  .panel, .panel table, .rep-hero { break-inside: avoid; }
  .zy-section.summary { background: #faf3f7 !important; }
  .zy-section strong { color: #9a5b00; }
  .rep-hero { background: #f7f2fa !important; border-bottom-color: #b0005a; border-radius: 0; }
  .rep-hero h1 { color: #b0005a; text-shadow: none; }
  .panel { box-shadow: none; }
  .panel-title { color: #b0005a; background: #faf3f7 !important; }
  .panel-title .no { background: #b0005a; color: #fff; }
  .panel-body strong, .concl strong { color: #9a5b00; }
}

/* ---------------- AI 页面视图切换 / 分析报告 / 历史 ---------------- */
[hidden] { display: none !important; }
.view-tabs {
  display: inline-flex; gap: 2px; padding: 2px; margin-left: 4px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
}
.view-tab {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  border-radius: 6px; padding: 4px 9px; font: inherit; font-size: 11px;
}
.view-tab:hover { color: var(--text); }
.view-tab.active { background: rgba(240,185,11,.12); color: var(--accent); font-weight: 700; }

.std-shell {
  display: grid; grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px; max-width: 1500px; margin: 0 auto; padding: 14px 18px;
  min-height: calc(100vh - 80px);
}
.std-side {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; min-height: 0; display: flex; flex-direction: column;
  max-height: calc(100vh - 90px); overflow: auto;
}
.std-side-title {
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 12px; padding: 14px 0 8px; margin-top: 6px;
  border-top: 1px solid var(--line);
}
.std-side-title .icon-btn { width: 26px; height: 24px; font-size: 12px; border-radius: 6px; }
.std-list { display: flex; flex-direction: column; gap: 5px; }
.std-item {
  display: block; width: 100%; text-align: left; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  color: var(--text); cursor: pointer; font: inherit;
}
.std-item:hover { border-color: #3b4658; background: var(--panel-3); }
.std-item.active { border-color: rgba(240,185,11,.55); background: rgba(240,185,11,.07); }
.std-item b { display: block; font-size: 12px; font-weight: 700; }
.std-item span { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
.std-main {
  min-width: 0; min-height: 0; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--panel-2);
}
.std-toolbar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 9px;
  padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel);
  font-size: 12px; min-height: 44px;
}
.std-toolbar b { color: var(--accent); }
.std-frame { flex: 1; width: 100%; min-height: calc(100vh - 140px); border: 0; background: #0a0a0f; }

@media (max-width: 980px) {
  .std-shell { grid-template-columns: 1fr; padding: 12px; }
  .std-side { max-height: none; }
  .std-frame { min-height: 70vh; }
  .view-tabs { margin-left: 0; }
  .ai-top .tag { display: none; }
}

.repro-opt {
  display: flex; align-items: flex-start; gap: 6px; margin: 8px 2px 4px;
  color: var(--muted); font-size: 11px; line-height: 1.45; cursor: pointer;
}
.repro-opt input { margin-top: 2px; accent-color: var(--accent); }
.exact-wrap { padding: 0; margin: -34px -38px; min-height: 80vh; }
.exact-frame { width: 100%; height: calc(100vh - 120px); min-height: 70vh; border: 0; display: block; background: #0a0a0f; }
@media (max-width: 980px) {
  .exact-wrap { margin: -18px; }
  .exact-frame { height: 78vh; }
}

.sklh-data {
  margin-top: 16px; padding-top: 12px; border-top: 1px dashed #30363d;
}
.sklh-data h3 {
  margin: 0 0 8px; color: var(--accent); font-size: 13px;
}
.sklh-data table { margin-top: 6px; }
.sklh-data td:first-child { white-space: nowrap; }
.sklh-data p { margin: 7px 0 0; font-size: 12px; color: #aeb8c6; line-height: 1.7; }
.sklh-data p b { color: #e6edf3; }

.field-hint { margin: 4px 1px 8px; color: var(--muted); font-size: 11px; line-height: 1.5; }

#btn-sync.ok { color: var(--down); border-color: rgba(20,177,67,.45); opacity: 1; }
#btn-sync:disabled { opacity: .65; cursor: default; }

.skill-cases { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 12px; }
.skill-case {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  border-radius: 6px; padding: 3px 7px; font-size: 10px; cursor: pointer;
}
.skill-case:hover { color: var(--accent); border-color: rgba(240,185,11,.45); }
