:root {
  --bg: #f6f4ee;
  --panel: #fffefb;
  --panel-soft: #faf8f1;
  --ink: #1e2620;
  --muted: #6f7268;
  --line: #e5e0d2;
  --line-strong: #cec7b3;
  --charcoal: #14201a;
  --teal: #24523f;
  --teal-soft: #e4ede6;
  --gold: #a5822f;
  --gold-soft: #f2e9d3;
  --gold-line: rgba(165, 130, 47, 0.38);
  --green: #22714f;
  --amber: #a86405;
  --red: #b42318;
  --blue: #2563a8;
  --violet: #6952a8;
  --shadow: none;
  --radius: 6px;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: var(--charcoal);
  color: #f5f4ec;
  border-right: 1px solid var(--gold-line);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 4px 20px;
  border-bottom: 1px solid var(--gold-line);
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #c8a44b, #a5822f);
  color: #14201a;
  border-radius: var(--radius);
  font-weight: 800;
  font-family: var(--font-serif);
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-serif);
  letter-spacing: 0.02em;
}

.brand-subtitle {
  color: rgba(245, 244, 236, 0.6);
  font-size: 12px;
  margin-top: 2px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: rgba(245, 244, 236, 0.72);
  text-align: left;
  padding: 9px 10px;
  transition: background 0.18s ease, color 0.18s ease;
}

.nav-item span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.nav-item.active {
  background: rgba(200, 164, 75, 0.12);
  border-color: transparent;
  box-shadow: inset 3px 0 0 var(--gold);
  color: #ffffff;
}

.nav-item:hover .nav-index,
.nav-item.active .nav-index {
  color: #c8a44b;
}

.nav-index {
  color: rgba(245, 244, 236, 0.45);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  transition: color 0.18s ease;
}

.sidebar-note {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--gold-line);
  border-radius: var(--radius);
  color: rgba(245, 244, 236, 0.75);
  display: grid;
  gap: 8px;
  font-size: 12px;
}

.sidebar-note strong {
  color: #ffffff;
}

.site-links {
  display: flex;
  gap: 8px;
}

.site-links a {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  color: rgba(245, 244, 236, 0.85);
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.site-links a:hover {
  background: rgba(200, 164, 75, 0.14);
  border-color: #c8a44b;
  color: #ffffff;
}

.workspace {
  min-width: 0;
  padding: 32px 40px 44px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

h1 {
  margin: 0;
  font-size: 27px;
  line-height: 1.22;
  letter-spacing: 0.01em;
  font-family: var(--font-serif);
  font-weight: 700;
}

h2,
h3 {
  margin: 0;
  letter-spacing: 0.01em;
  font-family: var(--font-serif);
}

h2 {
  font-size: 17px;
  font-weight: 700;
}

h3 {
  font-size: 15px;
  font-weight: 700;
}

p {
  margin: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.control {
  display: grid;
  gap: 5px;
  min-width: 150px;
  color: var(--muted);
  font-size: 12px;
}

select,
input[type="text"] {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0 12px;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric-strip:empty {
  display: none;
  margin: 0;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 2px solid var(--gold-line);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
  min-height: 96px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.metric-value {
  margin-top: 10px;
  font-size: 27px;
  line-height: 1;
  font-weight: 700;
  font-family: var(--font-serif);
  font-variant-numeric: tabular-nums;
}

.metric-foot {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.page-root {
  display: grid;
  gap: 20px;
}

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.section-title {
  display: grid;
  gap: 4px;
}

.section-title p {
  color: var(--muted);
  font-size: 12px;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 680;
  white-space: nowrap;
}

.button.primary {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
}

.button.ghost {
  background: transparent;
}

.button:focus-visible,
.nav-item:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(36, 82, 63, 0.28);
  outline-offset: 2px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-width: 100%;
  min-width: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

/* 策略页观点输入表：固定列宽，观点切换时位置/宽度不抖动 */
#strategy-market-table {
  table-layout: fixed;
}

#strategy-market-table thead th:nth-child(1),
#strategy-market-table tbody td:nth-child(1) {
  width: 170px;
}

#strategy-market-table thead th:nth-child(2),
#strategy-market-table tbody td:nth-child(2) {
  width: 120px;
}

#strategy-market-table thead th:nth-child(3),
#strategy-market-table tbody td:nth-child(3) {
  width: 220px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 740;
  background: var(--panel-soft);
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr.clickable:hover {
  background: #f5f2e7;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
}

.pill.teal {
  color: var(--teal);
  background: var(--teal-soft);
}

.pill.green {
  color: var(--green);
  background: #e0f1e7;
}

.pill.amber {
  color: var(--amber);
  background: #faebd1;
}

.pill.red {
  color: var(--red);
  background: #fbe1dd;
}

.pill.blue {
  color: var(--blue);
  background: #e0ebfa;
}

.pill.violet {
  color: var(--violet);
  background: #e9e3f6;
}

.note {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

.note strong {
  color: var(--ink);
}

.bar-list {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 140px) minmax(0, 1fr) 56px;
  align-items: center;
  gap: 10px;
}

.bar-label {
  color: var(--muted);
  white-space: nowrap;
}

.track {
  height: 10px;
  border-radius: 999px;
  background: #ebe7da;
  overflow: hidden;
}

.fill {
  height: 100%;
  width: var(--value);
  background: var(--teal);
}

.fill.green {
  background: var(--green);
}

.fill.amber {
  background: var(--amber);
}

.fill.blue {
  background: var(--blue);
}

.delta {
  font-variant-numeric: tabular-nums;
  font-weight: 760;
}

.delta.positive {
  color: var(--green);
}

.delta.negative {
  color: var(--red);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.mini-kpi {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--panel-soft);
  min-width: 0;
  min-height: 86px;
}

.mini-kpi span {
  color: var(--muted);
  font-size: 12px;
}

.mini-kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  line-height: 1;
  font-family: var(--font-serif);
  font-variant-numeric: tabular-nums;
}

.split-list {
  display: grid;
  gap: 10px;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--panel);
  display: grid;
  gap: 8px;
  min-width: 0;
}

.list-item.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(165, 130, 47, 0.14);
}

.item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.item-title {
  font-weight: 780;
}

.item-meta {
  color: var(--muted);
  font-size: 12px;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  gap: 10px;
}

.asset-tile {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  min-width: 0;
  min-height: 112px;
}

.asset-tile strong {
  display: block;
  font-size: 20px;
  margin: 10px 0 8px;
  font-family: var(--font-serif);
  font-variant-numeric: tabular-nums;
}

.asset-tile span {
  color: var(--muted);
  font-size: 12px;
}

.risk-band {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
}

.risk-step {
  height: 8px;
  border-radius: 999px;
  background: #e0dccd;
}

.risk-step.on {
  background: var(--teal);
}

.script-box {
  border-left: 3px solid var(--gold);
  background: var(--gold-soft);
  padding: 12px 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: #4a4230;
}

.warning-box {
  border-left-color: var(--amber);
  background: #fff8eb;
}

.danger-box {
  border-left-color: var(--red);
  background: #fff0ee;
}

.audit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.empty-state {
  min-height: 160px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

/* ---- 客户标签带 ---- */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 720;
  cursor: help;
  border: 1px solid transparent;
}

.tag.green { color: var(--green); background: #e0f1e7; border-color: #c4e3d1; }
.tag.amber { color: var(--amber); background: #faebd1; border-color: #f0dcb2; }
.tag.red { color: var(--red); background: #fbe1dd; border-color: #f3c8c2; }
.tag.blue { color: var(--blue); background: #e0ebfa; border-color: #c8dbf2; }
.tag.teal { color: var(--teal); background: var(--teal-soft); border-color: #bce4dd; }
.tag.violet { color: var(--violet); background: #e9e3f6; border-color: #d7cdee; }

/* ---- 流程步骤条 ---- */
.stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
  white-space: nowrap;
}

.step-dot {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e0dccd;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.step.done {
  color: var(--teal);
  border-color: #cdd9cf;
  background: #eef2ec;
}

.step.done .step-dot {
  background: var(--teal);
  color: #ffffff;
}

.step.current {
  color: #ffffff;
  background: var(--teal);
  border-color: var(--teal);
}

.step.current .step-dot {
  background: #ffffff;
  color: var(--teal);
}

.step-line {
  flex: 0 0 14px;
  height: 2px;
  background: var(--line-strong);
}

/* ---- 可解释轨迹 ---- */
.trace-list {
  display: grid;
  gap: 8px;
}

.trace-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.trace-step.caution { border-left-color: var(--amber); }
.trace-step.blocked { border-left-color: var(--red); }

.trace-index {
  flex: 0 0 auto;
  min-width: 34px;
  text-align: center;
  padding: 1px 6px;
  border-radius: 999px;
  background: #ebe7da;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.trace-meta {
  display: block;
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.trace-list.small .trace-step {
  padding: 6px 9px;
  font-size: 12px;
}

.trace-details summary {
  list-style: none;
  cursor: pointer;
}

.trace-details summary::-webkit-details-marker {
  display: none;
}

.trace-details[open] summary .pill {
  outline: 2px solid rgba(165, 130, 47, 0.35);
}

.trace-details .trace-list {
  margin-top: 8px;
  min-width: 320px;
}

tr.row-active {
  background: #f5f2e7;
}

/* ---- 06 · 产品解读 Copilot ---- */
.chat-grid {
  display: grid;
  grid-template-columns: minmax(230px, 0.62fr) minmax(0, 1.5fr) minmax(240px, 0.68fr);
  gap: 16px;
  align-items: start;
}

.chat-side {
  position: sticky;
  top: 12px;
}

.chat-chips {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-chip {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 8px 11px;
  text-align: left;
  font-size: 13px;
  line-height: 1.35;
}

.chat-chip:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.chat-flow {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 560px;
  min-height: 320px;
  overflow-y: auto;
  padding: 4px 6px 4px 2px;
}

.chat-bubble {
  max-width: 92%;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.55;
}

.chat-bubble p {
  margin: 0 0 8px;
}

.chat-bubble p:last-child {
  margin-bottom: 0;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--teal);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.chat-bubble.bot {
  align-self: flex-start;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.chat-bubble.bot.pending {
  color: var(--muted);
  font-style: italic;
}

.chat-meta {
  color: var(--muted);
  font-size: 12px;
}

.chat-trace {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line-strong);
}

.chat-list {
  margin: 6px 0;
  padding-left: 18px;
}

.chat-list li {
  margin-bottom: 4px;
}

.chat-input-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.chat-input-row input {
  flex: 1;
  min-height: 40px;
}

.chat-toolbar {
  display: flex;
  gap: 8px;
  margin: 8px 0 10px;
}

.chat-table {
  min-width: 0;
  font-size: 12.5px;
}

/* 归因瀑布 */
.wf-list {
  display: grid;
  gap: 6px;
  margin: 8px 0;
}

.wf-row {
  display: grid;
  grid-template-columns: minmax(76px, 96px) minmax(0, 1fr) 72px;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  padding: 4px 6px;
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  color: var(--ink);
}

button.wf-row:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
  cursor: pointer;
}

.wf-label {
  color: var(--muted);
  white-space: nowrap;
}

.wf-track {
  height: 10px;
  border-radius: 999px;
  background: #ebe7da;
  overflow: hidden;
  display: block;
}

.wf-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.wf-fill.pos {
  background: var(--green);
}

.wf-fill.neg {
  background: var(--red);
}

.wf-value {
  text-align: right;
  font-size: 12px;
}

.wf-total {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  font-weight: 760;
}

@media (max-width: 1120px) {
  .chat-grid {
    grid-template-columns: 1fr;
  }

  .chat-side {
    position: static;
  }
}

@media (max-width: 1120px) {
  .metric-strip,
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-2,
  .audit-grid {
    grid-template-columns: 1fr;
  }

  .asset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-note {
    display: none;
  }

  .workspace {
    padding: 18px 14px 28px;
  }

  .topbar {
    display: grid;
  }

  .top-actions {
    justify-content: stretch;
  }

  .control {
    min-width: 0;
    flex: 1 1 180px;
  }

  .metric-strip,
  .kpi-grid,
  .grid-3,
  .asset-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }
}

@media (max-width: 520px) {
  .nav-list {
    grid-template-columns: 1fr;
  }
}

/* ---------- Tableau 风格可视化 ---------- */
.viz-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.viz-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--charcoal);
  letter-spacing: 0.01em;
  font-family: var(--font-serif);
}

.viz-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

.viz-filter {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.viz-ctl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.viz-ctl select {
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.viz-canvas {
  width: 100%;
}

.viz-embed-wrap {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.viz-embed {
  width: 100%;
  min-height: 1200px;
  border: 0;
  display: block;
}

.viz-embed-note {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

.viz-svg {
  width: 100%;
  height: auto;
  display: block;
}

.viz-foot {
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  padding-top: 8px;
}

/* 热力矩阵 */
.heat-grid {
  display: grid;
  gap: 4px;
}

.heat-corner {
  background: transparent;
}

.heat-col,
.heat-rowhead {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.heat-rowhead {
  justify-content: flex-end;
  padding-right: 6px;
}

.heat-cell {
  height: 54px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  cursor: default;
  transition: transform 0.1s ease;
}

.heat-cell:hover {
  transform: scale(1.04);
  outline: 2px solid rgba(38, 49, 44, 0.35);
}

/* 漏斗 */
.funnel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fn-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 12px;
}

.fn-label {
  font-size: 13px;
  color: var(--charcoal);
  font-weight: 600;
  text-align: right;
}

.fn-track {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--panel-soft);
  border-radius: 6px;
  height: 34px;
}

.fn-bar {
  height: 34px;
  border-radius: 6px;
  transition: width 0.35s ease;
  min-width: 4px;
}

.fn-bar:hover {
  filter: brightness(1.08);
}

.fn-val {
  position: absolute;
  right: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--charcoal);
}

.viz-stat {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.viz-stat div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.viz-stat span {
  font-size: 11px;
  color: var(--muted);
}

.viz-stat strong {
  font-size: 16px;
  color: var(--charcoal);
}

/* 图例 */
.viz-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
}

.lg {
  display: inline-block;
  width: 16px;
  height: 12px;
  border-radius: 3px;
}

.lg-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.lg-line {
  display: inline-block;
  width: 16px;
  height: 3px;
  border-radius: 2px;
}

/* SVG 轴 */
.viz-grid {
  stroke: var(--line);
  stroke-width: 1;
}

.viz-axis {
  font-size: 10px;
  fill: var(--muted);
}

.viz-axis-title {
  font-size: 11px;
  fill: var(--charcoal);
  font-weight: 600;
}

.viz-threshold {
  stroke: var(--red);
  stroke-width: 1.2;
  stroke-dasharray: 5 4;
}

/* 提示 */
.viz-tip {
  position: fixed;
  z-index: 9999;
  display: none;
  max-width: 240px;
  background: rgba(38, 49, 44, 0.95);
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 10px;
  border-radius: 6px;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.viz-tip b {
  color: #7fe3d3;
}

@media (max-width: 520px) {
  .viz-embed {
    min-height: 560px;
  }
}

/* ---------- 进场动画（与 docs/index.html 一致） ---------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  animation: rise 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.reveal.d1 { animation-delay: 0.1s; }
.reveal.d2 { animation-delay: 0.26s; }
.reveal.d3 { animation-delay: 0.42s; }
.reveal.d4 { animation-delay: 0.58s; }
.reveal.d5 { animation-delay: 0.72s; }

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
