/* 对话流、发现、反问、表格、预览统计条、心愿单。从 A2_styles.css 拆出来, 页面按顺序加载。 */

/* 对话流 */

#stream { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; gap: 15px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
#stream > * { animation: rise 0.28s cubic-bezier(0.22, 0.85, 0.3, 1) both; }

.msg-user {
  align-self: flex-end;
  max-width: 76%;
  padding: 10px 15px;
  border-radius: 15px 15px 5px 15px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  white-space: pre-wrap;
  box-shadow: var(--shadow-sm);
}

.msg-agent { color: var(--text-primary); padding: 0 2px; }
.msg-agent strong { font-weight: 640; }

.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 13px; font-weight: 620; display: flex; align-items: center; gap: 8px; }
.card-meta { font-size: 11.5px; font-weight: 400; color: var(--text-muted); }
.card-tools { display: flex; gap: 5px; flex: 0 0 auto; }

.chip {
  font: inherit;
  font-size: 11.5px;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/**
 vega-embed 会把宿主元素改成 inline-block, 宽度直接塌成内容宽(实测 52px, 图就空了)。
 所以给它独立的内层 div 当宿主, 并强制块级满宽。
 */
/* 分面图(小倍数、季节分解)宽度是固定的, 窄屏上让它自己横向滚, 别把整页顶宽 */
.chart-box { padding: 14px 15px 18px; overflow-x: auto; }
.chart-host { width: 100%; display: block; }
.vega-embed { width: 100%; display: block !important; }
.vega-embed summary { opacity: 0.3; }

/* 发现 */

.finding {
  display: flex;
  gap: 12px;
  padding: 13px 15px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.finding::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(var(--accent), var(--accent-2));
}
.finding-no {
  flex: 0 0 20px;
  height: 20px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.finding-text { flex: 1; min-width: 0; }
.finding-evidence {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--mono);
  margin-top: 6px;
  padding: 7px 10px;
  background: var(--wash);
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* 反问 */

.question {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.question::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--warm);
}
.question-label {
  font-size: 11px;
  font-weight: 650;
  color: var(--warm);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.followup { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; padding: 0 2px; }
.followup-hint { font-size: 12px; color: var(--text-muted); }
.followup .chip:disabled { opacity: 0.45; cursor: default; }

.question-options { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.question-options .chip { border-color: var(--border-strong); }

/* 表格 */

.table-wrap { overflow: auto; max-height: 340px; }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th, td {
  text-align: left;
  padding: 7px 14px;
  border-bottom: 1px solid var(--grid);
  white-space: nowrap;
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-weight: 620;
  font-size: 11.5px;
  letter-spacing: 0.02em;
}
th .th-type {
  display: block;
  font-weight: 400;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0;
}
td { color: var(--text-secondary); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
/** 表头跟着它那一列走, 否则数值列的标题在左、数在右, 看着像没对齐 */
th.num { text-align: right; }
tbody tr:nth-child(even) { background: var(--wash); }
tbody tr:hover { background: var(--accent-soft); }
tbody tr:last-child td { border-bottom: 0; }

.sql {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 10px 15px;
  border-top: 1px solid var(--border);
  background: var(--wash);
  white-space: pre-wrap;
  word-break: break-word;
}

/* 数据预览的统计条 */

.stat-row {
  display: flex;
  gap: 26px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
  background: var(--wash);
}
.stat { display: flex; flex-direction: column; }
.stat-val {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-key { font-size: 11px; color: var(--text-muted); }

/** 一句话能答的问题只给数字, 那就把数字放大到能一眼看见 */
.stat-row.big { gap: 34px; padding: 20px 18px; background: none; border-bottom: 0; }
.stat-row.big .stat-val { font-size: 30px; letter-spacing: -0.03em; line-height: 1.2; }
.stat-row.big .stat-key { font-size: 12.5px; color: var(--text-secondary); }
.stat-unit { font-size: 15px; font-weight: 500; color: var(--text-muted); margin-left: 3px; }

/* 心愿单 */
.wish {
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
  border-radius: var(--r);
  background: var(--surface-2);
  box-shadow: var(--shadow-sm);
}
.wish-label {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: var(--accent-2);
  margin-bottom: 3px;
}
.wish-why { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.turn-sep{border-top:1px dashed var(--border-strong);margin:22px 0 14px}
