/* AI tool result cards (unified doc v10.19 §6.14, guide §7.18).
 * One component for all seven kinds, drawn inside the AI answer only
 * (page and drawer share .fxm-ai-ui). Surfaces reuse the answer's data-card
 * tokens (fxm-ai-evidence.css): 18px card, purple-tinted lift, white tiles,
 * the site type scale. Tones match the KPI tiles: POSITIVE green, WARNING
 * amber, NEGATIVE red, NEUTRAL grey, UNKNOWN grey dashed. Colour never
 * carries meaning alone: verdicts have an icon and a spoken tone label,
 * bars and lines sit next to their text. */
.fxm-ai-ui .fxm-ai-tool-card {
  --tool-line: var(--ai-card-line, rgb(47 38 88 / 7%));
  --tool-ink: var(--ai-ink, #2f2658);
  --tool-muted: #8a8f9c;
  --tool-soft: var(--ai-data-soft, #f7f6fd);
  --tool-accent: var(--color-primary, #4f34d9);
  --tool-pos: #0f7a5a; --tool-pos-soft: #ecf8f3; --tool-pos-line: rgb(15 122 90 / 22%);
  --tool-warn: #b45309; --tool-warn-soft: #fff7e8; --tool-warn-line: rgb(180 83 9 / 22%);
  --tool-neg: #be123c; --tool-neg-soft: #fff1f3; --tool-neg-line: rgb(190 18 60 / 20%);
  --tool-neu: #5f6575; --tool-neu-soft: #f4f5f8; --tool-neu-line: #e3e5eb;
  --tool-unk: #7b8194; --tool-unk-line: #cfd3de;
  container-type: inline-size;
  overflow: hidden;
  min-width: 0;
  border: 1px solid var(--tool-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--ai-card-shadow, 0 10px 28px -16px rgb(79 52 217 / 20%));
  color: var(--tool-ink);
  font-family: var(--font-body);
}

/* Tone → one colour triple; every part below reads --tone-*. */
.fxm-ai-ui .fxm-ai-tool-card .fxm-ai-tool-tone--positive { --tone: var(--tool-pos); --tone-soft: var(--tool-pos-soft); --tone-line: var(--tool-pos-line); }
.fxm-ai-ui .fxm-ai-tool-card .fxm-ai-tool-tone--warning { --tone: var(--tool-warn); --tone-soft: var(--tool-warn-soft); --tone-line: var(--tool-warn-line); }
.fxm-ai-ui .fxm-ai-tool-card .fxm-ai-tool-tone--negative { --tone: var(--tool-neg); --tone-soft: var(--tool-neg-soft); --tone-line: var(--tool-neg-line); }
.fxm-ai-ui .fxm-ai-tool-card :is(.fxm-ai-tool-tone--neutral, .fxm-ai-tool-tone--unknown) { --tone: var(--tool-neu); --tone-soft: var(--tool-neu-soft); --tone-line: var(--tool-neu-line); }
.fxm-ai-ui .fxm-ai-tool-card .fxm-ai-tool-tone--unknown { --tone: var(--tool-unk); --tone-line: var(--tool-unk-line); }

/* Title row: same head as the table / chart cards. */
.fxm-ai-ui .fxm-ai-tool-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--ai-data-line, #eceef3);
  background: linear-gradient(120deg, #fff 0%, #fbfbfd 55%, #f6f6fa 100%);
}
.fxm-ai-ui .fxm-ai-tool-icon {
  display: inline-flex;
  flex: 0 0 30px;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--tool-soft);
  color: var(--tool-accent);
}
.fxm-ai-ui .fxm-ai-tool-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--color-on-surface, #272e42);
  font: 600 14px/1.5 var(--font-headline);
  overflow-wrap: anywhere;
}

.fxm-ai-ui .fxm-ai-tool-body { display: flex; flex-direction: column; gap: 14px; padding: 16px 18px 18px; }
.fxm-ai-ui .fxm-ai-tool-body p { margin: 0; }

/* Verdict banner: the conclusion first, tinted by tone with its icon. */
.fxm-ai-ui .fxm-ai-tool-verdict {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--tone-line);
  border-radius: 14px;
  background: var(--tone-soft);
}
.fxm-ai-ui .fxm-ai-tool-verdict.fxm-ai-tool-tone--unknown { border-style: dashed; background: #fff; }
.fxm-ai-ui .fxm-ai-tool-verdict-icon { display: inline-flex; flex-shrink: 0; margin-top: 1px; color: var(--tone); }
.fxm-ai-ui .fxm-ai-tool-verdict-copy { min-width: 0; }
.fxm-ai-ui .fxm-ai-tool-verdict-title { color: var(--tone); font: 600 15px/1.5 var(--font-headline); overflow-wrap: anywhere; }
.fxm-ai-ui .fxm-ai-tool-verdict-text { margin-top: 3px !important; color: #4b5163; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }

/* Subject row: what was checked (masked address, symbol, licence, broker). */
.fxm-ai-ui .fxm-ai-tool-subject { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; }
.fxm-ai-ui .fxm-ai-tool-subject-icon { display: inline-flex; color: var(--tool-muted); }
.fxm-ai-ui .fxm-ai-tool-subject-copy { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.fxm-ai-ui .fxm-ai-tool-subject-label { color: var(--tool-muted); font-size: 12px; }
.fxm-ai-ui .fxm-ai-tool-subject-value { color: var(--tool-ink); font: 600 14px/1.5 var(--font-body); font-variant-numeric: tabular-nums; letter-spacing: .01em; overflow-wrap: anywhere; }
.fxm-ai-ui .fxm-ai-tool-entity {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 32px;
  box-sizing: border-box;
  padding: 3px 10px 3px 4px;
  border: 1px solid var(--ai-tile-line, rgb(79 52 217 / 9%));
  border-radius: 999px;
  background: #fff;
  color: var(--tool-ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.fxm-ai-ui .fxm-ai-tool-entity:not(.has-logo) { padding-left: 12px; }
.fxm-ai-ui a.fxm-ai-tool-entity { transition: border-color .15s ease, color .15s ease; }
.fxm-ai-ui a.fxm-ai-tool-entity:hover { border-color: rgb(79 52 217 / 30%); color: var(--tool-accent); }
.fxm-ai-ui a.fxm-ai-tool-entity svg { flex-shrink: 0; color: var(--tool-muted); }
.fxm-ai-ui .fxm-ai-tool-entity-logo { display: inline-flex; overflow: hidden; width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%; background: var(--tool-soft); }
.fxm-ai-ui .fxm-ai-tool-entity-logo img { width: 100%; height: 100%; object-fit: contain; }
.fxm-ai-ui .fxm-ai-tool-entity-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* Hero: one big figure (METRIC) or a tinted status word (STATUS). */
.fxm-ai-ui .fxm-ai-tool-hero { display: flex; flex-direction: column; gap: 2px; }
.fxm-ai-ui .fxm-ai-tool-hero-label { color: var(--tool-muted); font-size: 12px; line-height: 1.5; }
.fxm-ai-ui .fxm-ai-tool-hero-value { color: var(--tone, var(--tool-ink)); font: 700 30px/1.2 var(--font-headline); letter-spacing: -.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.fxm-ai-ui .fxm-ai-tool-hero:not([class*="fxm-ai-tool-tone--"]) .fxm-ai-tool-hero-value { color: var(--tool-ink); }
.fxm-ai-ui .fxm-ai-tool-hero--status .fxm-ai-tool-hero-value { font-size: 22px; }
.fxm-ai-ui .fxm-ai-tool-hero-unit { margin-left: 4px; color: var(--tool-muted); font: 500 13px/1 var(--font-body); letter-spacing: 0; }
.fxm-ai-ui .fxm-ai-tool-hero-hint { color: var(--tool-muted); font-size: 12px; line-height: 1.6; }

/* Shared label row for scale / meters / distribution / trend. */
.fxm-ai-ui .fxm-ai-tool-row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; color: #5f6575; font-size: 12px; line-height: 1.5; }
.fxm-ai-ui .fxm-ai-tool-row-head > span { min-width: 0; overflow-wrap: anywhere; }
.fxm-ai-ui .fxm-ai-tool-row-head em { color: var(--tool-muted); font-style: normal; }
.fxm-ai-ui .fxm-ai-tool-row-head strong { flex-shrink: 0; color: var(--tone, var(--tool-ink)); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Scale: segmented levels low → high, the current one lit. */
.fxm-ai-ui .fxm-ai-tool-scale-levels { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.fxm-ai-ui .fxm-ai-tool-scale-level { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fxm-ai-ui .fxm-ai-tool-scale-bar { display: block; height: 6px; border-radius: 999px; background: #eceef3; }
.fxm-ai-ui .fxm-ai-tool-scale-level.is-current .fxm-ai-tool-scale-bar { background: var(--tone); }
.fxm-ai-ui .fxm-ai-tool-scale-text { color: var(--tool-muted); font-size: 11px; line-height: 1.4; text-align: center; overflow-wrap: anywhere; }
.fxm-ai-ui .fxm-ai-tool-scale-level.is-current .fxm-ai-tool-scale-text { color: var(--tone); font-weight: 600; }

/* Meters: value / max, filled bar keeps its tone when over max. */
.fxm-ai-ui .fxm-ai-tool-meters { display: flex; flex-direction: column; gap: 12px; }
.fxm-ai-ui .fxm-ai-tool-meter-track { display: block; overflow: hidden; height: 8px; border-radius: 999px; background: #eceef3; }
.fxm-ai-ui .fxm-ai-tool-meter-fill { display: block; height: 100%; border-radius: inherit; background: var(--tone); transition: width .4s ease; }
.fxm-ai-ui .fxm-ai-tool-meter.fxm-ai-tool-tone--neutral .fxm-ai-tool-meter-fill { background: var(--tool-accent); }
.fxm-ai-ui .fxm-ai-tool-meter-hint { margin-top: 4px !important; color: var(--tool-muted); font-size: 11px; line-height: 1.5; }

/* Distribution: stacked bar + legend with the raw counts. */
.fxm-ai-ui .fxm-ai-tool-dist-bar { display: flex; overflow: hidden; gap: 2px; height: 10px; border-radius: 999px; background: #eceef3; }
.fxm-ai-ui .fxm-ai-tool-dist-seg { display: block; min-width: 3px; height: 100%; background: var(--tone); }
.fxm-ai-ui .fxm-ai-tool-dist-seg.fxm-ai-tool-tone--neutral { background: #b8bccb; }
.fxm-ai-ui .fxm-ai-tool-dist-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 0; padding: 0; list-style: none; color: #5f6575; font-size: 12px; }
.fxm-ai-ui .fxm-ai-tool-dist-legend li { display: inline-flex; align-items: center; gap: 6px; }
.fxm-ai-ui .fxm-ai-tool-dist-legend strong { color: var(--tool-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.fxm-ai-ui .fxm-ai-tool-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); }
.fxm-ai-ui .fxm-ai-tool-dist-legend .fxm-ai-tool-tone--neutral .fxm-ai-tool-dot { background: #b8bccb; }

/* Trend: axis-free sparkline; gaps are real gaps. */
.fxm-ai-ui .fxm-ai-tool-trend-svg { display: block; width: 100%; height: 56px; overflow: visible; }
.fxm-ai-ui .fxm-ai-tool-trend-line { fill: none; stroke: var(--tool-accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.fxm-ai-ui .fxm-ai-tool-trend-area { fill: rgb(79 52 217 / 8%); stroke: none; }
.fxm-ai-ui .fxm-ai-tool-trend-axis { display: flex; justify-content: space-between; margin-top: 4px; color: var(--tool-muted); font-size: 11px; font-variant-numeric: tabular-nums; }

/* Fields: white tiles, two columns, three from 720px of card width. */
.fxm-ai-ui .fxm-ai-tool-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
@container (min-width: 720px) {
  .fxm-ai-ui .fxm-ai-tool-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.fxm-ai-ui .fxm-ai-tool-field {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--ai-tile-line, rgb(79 52 217 / 9%));
  border-radius: 12px;
  background: #fff;
}
.fxm-ai-ui .fxm-ai-tool-field dt { display: flex; align-items: center; gap: 5px; margin: 0 0 3px; color: var(--tool-muted); font-size: 12px; line-height: 1.5; }
.fxm-ai-ui .fxm-ai-tool-field dt > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.fxm-ai-ui .fxm-ai-tool-field-icon { display: inline-flex; flex-shrink: 0; color: #a4a8b5; }
.fxm-ai-ui .fxm-ai-tool-field dd { margin: 0; }
.fxm-ai-ui .fxm-ai-tool-field-value { display: block; color: var(--tool-ink); font: 600 15px/1.4 var(--font-body); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.fxm-ai-ui .fxm-ai-tool-field.has-tone .fxm-ai-tool-field-value { color: var(--tone); }
.fxm-ai-ui .fxm-ai-tool-field-unit { margin-left: 3px; color: var(--tool-muted); font-size: 12px; font-weight: 400; }
.fxm-ai-ui .fxm-ai-tool-field-hint { display: block; margin-top: 2px; color: var(--tool-muted); font-size: 11px; line-height: 1.5; }

/* "查看详细信息" and collapsed sections: the same quiet disclosure. */
.fxm-ai-ui .fxm-ai-tool-more > summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  color: var(--tool-accent);
  font-size: 13px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.fxm-ai-ui .fxm-ai-tool-more > summary::-webkit-details-marker { display: none; }
.fxm-ai-ui .fxm-ai-tool-more > summary svg { transition: transform .2s ease; }
.fxm-ai-ui .fxm-ai-tool-more[open] > summary svg { transform: rotate(180deg); }
.fxm-ai-ui .fxm-ai-tool-more > summary:focus-visible { border-radius: 6px; outline: 2px solid var(--tool-accent); outline-offset: 2px; }
.fxm-ai-ui .fxm-ai-tool-more[open] > :not(summary) { margin-top: 8px; }

/* Tags: small pills in their tone. */
.fxm-ai-ui .fxm-ai-tool-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.fxm-ai-ui .fxm-ai-tool-tag { padding: 3px 10px; border: 1px solid var(--tone-line); border-radius: 999px; background: var(--tone-soft); color: var(--tone); font-size: 12px; font-weight: 500; line-height: 1.5; }

/* Sections: bullets, numbered steps or a list with a meta line. */
.fxm-ai-ui .fxm-ai-tool-section-title { margin: 0 0 8px; color: var(--tool-ink); font: 600 13px/1.5 var(--font-headline); }
.fxm-ai-ui .fxm-ai-tool-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; counter-reset: tool-step; }
.fxm-ai-ui .fxm-ai-tool-list > li { position: relative; min-width: 0; color: #4b5163; font-size: 13px; line-height: 1.7; }
.fxm-ai-ui .fxm-ai-tool-list--bullets > li { padding-left: 16px; }
.fxm-ai-ui .fxm-ai-tool-list--bullets > li::before { position: absolute; top: .72em; left: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--tone, var(--tool-accent)); content: ""; opacity: .75; }
.fxm-ai-ui .fxm-ai-tool-list--steps > li { padding-left: 30px; counter-increment: tool-step; }
.fxm-ai-ui .fxm-ai-tool-list--steps > li::before { position: absolute; top: 2px; left: 0; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--tool-soft); color: var(--tool-accent); font-size: 11px; font-weight: 700; line-height: 1; content: counter(tool-step); }
.fxm-ai-ui .fxm-ai-tool-list--list > li { padding: 9px 12px; border: 1px solid var(--ai-tile-line, rgb(79 52 217 / 9%)); border-radius: 12px; background: #fff; }
.fxm-ai-ui .fxm-ai-tool-list--list > li.has-tone { border-left: 3px solid var(--tone); }
.fxm-ai-ui .fxm-ai-tool-list--list > li:has(> .fxm-ai-tool-list-link) { padding: 0; }
.fxm-ai-ui .fxm-ai-tool-list-link { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.fxm-ai-ui .fxm-ai-tool-list--list .fxm-ai-tool-list-link { padding: 9px 12px; border-radius: 12px; }
.fxm-ai-ui .fxm-ai-tool-list-link > svg { flex-shrink: 0; margin-left: auto; color: var(--tool-muted); }
.fxm-ai-ui .fxm-ai-tool-list-link:hover .fxm-ai-tool-list-text { color: var(--tool-accent); }
.fxm-ai-ui .fxm-ai-tool-list-link:focus-visible { outline: 2px solid var(--tool-accent); outline-offset: 1px; }
.fxm-ai-ui .fxm-ai-tool-list > li > .fxm-ai-tool-list-icon, .fxm-ai-ui .fxm-ai-tool-list-link > .fxm-ai-tool-list-icon { display: inline-flex; flex-shrink: 0; color: var(--tool-muted); }
.fxm-ai-ui .fxm-ai-tool-list--list > li:not(:has(> a)) { display: flex; gap: 8px; }
.fxm-ai-ui .fxm-ai-tool-list-copy { display: flex; flex-direction: column; min-width: 0; }
.fxm-ai-ui .fxm-ai-tool-list-text { overflow-wrap: anywhere; }
.fxm-ai-ui .fxm-ai-tool-list--list .fxm-ai-tool-list-text { color: var(--tool-ink); font-weight: 500; }
.fxm-ai-ui .fxm-ai-tool-list-meta { color: var(--tool-muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }

/* Actions: one filled primary, one outlined; 40px targets. */
.fxm-ai-ui .fxm-ai-tool-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fxm-ai-ui .fxm-ai-tool-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  box-sizing: border-box;
  padding: 8px 16px;
  border: 1px solid rgb(79 52 217 / 22%);
  border-radius: 999px;
  background: #fff;
  color: var(--tool-accent);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.fxm-ai-ui .fxm-ai-tool-action:hover { border-color: rgb(79 52 217 / 40%); background: var(--tool-soft); }
.fxm-ai-ui .fxm-ai-tool-action--primary { border-color: var(--tool-accent); background: var(--tool-accent); color: #fff; }
.fxm-ai-ui .fxm-ai-tool-action--primary:hover { border-color: #432bc0; background: #432bc0; color: #fff; }
.fxm-ai-ui .fxm-ai-tool-action:focus-visible { outline: 2px solid var(--tool-accent); outline-offset: 2px; }

/* Notes and data time: small print at the bottom. */
.fxm-ai-ui .fxm-ai-tool-foot { display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px dashed #e6e8ee; }
.fxm-ai-ui .fxm-ai-tool-note { color: var(--tool-muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.fxm-ai-ui .fxm-ai-tool-asof { display: inline-flex; align-items: center; gap: 4px; color: #a4a8b5; font-size: 11px; line-height: 1.5; font-variant-numeric: tabular-nums; }

.fxm-ai-ui .fxm-ai-tool-sr { position: absolute; overflow: hidden; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; clip: rect(0 0 0 0); white-space: nowrap; }

/* Pending card announced in status.detail.expect. */
.fxm-ai-ui .fxm-ai-skeleton-block--card { height: 168px; border-radius: 18px; }

/* Narrow bubbles (drawer on phones). */
@container (max-width: 420px) {
  .fxm-ai-ui .fxm-ai-tool-head { padding: 12px 14px; }
  .fxm-ai-ui .fxm-ai-tool-body { gap: 12px; padding: 14px; }
  .fxm-ai-ui .fxm-ai-tool-hero-value { font-size: 26px; }
  .fxm-ai-ui .fxm-ai-tool-actions { flex-direction: column; }
  .fxm-ai-ui .fxm-ai-tool-action { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .fxm-ai-ui .fxm-ai-tool-meter-fill, .fxm-ai-ui .fxm-ai-tool-more > summary svg, .fxm-ai-ui .fxm-ai-tool-action, .fxm-ai-ui a.fxm-ai-tool-entity { transition: none; }
}
