.insight-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.insight-metric {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  padding: 17px 20px;
  background: #fff;
  border: 1px solid #e3e8ef;
  border-radius: 12px;
}
.insight-metric-label { color: #53647a; font-size: 12px; font-weight: 600; }
.insight-metric-value { color: #1d3554; font-size: 27px; font-variant-numeric: tabular-nums; line-height: 1.2; overflow-wrap: anywhere; }
.insight-metric-note { color: #778397; font-size: 11px; line-height: 1.5; }
.insight-record {
  margin-bottom: 10px;
  background: #fff;
  border: 1px solid #e3e8ef;
  border-radius: 12px;
  overflow: hidden;
}
.insight-record > summary {
  position: relative;
  display: block;
  padding: 17px 42px 17px 20px;
  cursor: pointer;
  list-style: none;
}
.insight-record > summary::-webkit-details-marker { display: none; }
.insight-record > summary::after {
  content: '';
  position: absolute;
  right: 21px;
  top: 25px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid #78879a;
  border-bottom: 1.5px solid #78879a;
  transform: rotate(45deg);
  transition: transform .15s ease;
}
.insight-record[open] > summary::after { transform: rotate(225deg); }
.insight-record[open] > summary { background: #f8faff; border-bottom: 1px solid #e8edf4; }
.insight-record > summary:hover { background: #f8faff; }
.insight-record-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; min-width: 0; }
.insight-record-title { color: #1b2d45; font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
.insight-purpose { color: #586981; font-size: 12px; font-weight: 400; overflow-wrap: anywhere; }
.insight-badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 5px; font-size: 11px; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.insight-badge-success { background: #edf6f2; color: #35775b; }
.insight-badge-danger { background: #fff0ef; color: #b84c46; }
.insight-badge-warning { background: #fff5e4; color: #9c6b22; }
.insight-badge-active { background: #edf3fe; color: #3f6db4; }
.insight-badge-neutral { background: #f0f2f5; color: #68778b; }
.insight-record-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 16px; margin-top: 9px; color: #748196; font-size: 12px; font-variant-numeric: tabular-nums; }
.insight-chip { display: inline-flex; padding: 3px 7px; border-radius: 5px; background: #f2f5f9; color: #596d86; font-size: 11px; white-space: nowrap; }
.insight-record-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; color: #8a95a5; font-size: 10px; line-height: 1.5; min-width: 0; }
.insight-record-meta > span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insight-record-meta code { font-family: Consolas, monospace; font-size: 10px; }
.insight-record-note { display: block; margin-top: 8px; color: #9b6754; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.insight-record-body { min-width: 0; }
.insight-detail { padding: 18px 20px; color: #43556d; font-size: 13px; min-width: 0; }
.insight-section { margin: 7px 0; border: 1px solid #e5eaf1; border-radius: 8px; background: #fff; overflow: hidden; }
.insight-section > summary { display: list-item; padding: 11px 13px; cursor: pointer; color: #51647e; font-size: 12px; font-weight: 600; line-height: 1.6; }
.insight-section > summary::marker { color: #91a1b6; font-size: 10px; }
.insight-section[open] > summary { background: #f7f9fc; border-bottom: 1px solid #e8edf4; }
.insight-section-note { margin-left: 14px; color: #8794a7; font-size: 11px; font-weight: 400; }
.insight-section-body { padding: 12px 14px; max-height: 560px; overflow: auto; }
.insight-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 23px 0 13px; }
.insight-section-heading h3 { margin: 0; color: #283e5b; font-size: 13px; font-weight: 650; }
.insight-section-heading > span { color: #8895a7; font-size: 11px; }
.insight-timeline { padding: 0; margin: 0; list-style: none; }
.insight-stage { position: relative; margin: 0; padding: 0 0 14px 39px; min-width: 0; }
.insight-stage:not(:last-child)::before { content: ''; position: absolute; left: 13px; top: 28px; bottom: 0; border-left: 1px solid #e0e7f1; }
.insight-stage-number { position: absolute; left: 0; top: 8px; display: flex; align-items: center; justify-content: center; width: 27px; height: 27px; border: 1px solid #dce5f1; border-radius: 50%; background: #f6f9fe; color: #5878a5; font-size: 11px; font-variant-numeric: tabular-nums; }
.insight-stage-details { padding: 0; background: #fcfdff; border: 1px solid #e5eaf1; border-radius: 9px; overflow: hidden; }
.insight-stage-details > summary { display: block; position: relative; padding: 12px 30px 12px 14px; list-style: none; cursor: pointer; }
.insight-stage-details > summary::-webkit-details-marker { display: none; }
.insight-stage-details > summary::after { content: '+'; position: absolute; right: 13px; top: 12px; color: #92a2b8; font-size: 15px; }
.insight-stage-details[open] > summary::after { content: '−'; }
.insight-stage-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.insight-stage-name { color: #344f72; font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.insight-stage-duration { margin-left: auto; color: #8895a7; font-size: 11px; font-variant-numeric: tabular-nums; }
.insight-stage-reason { display: block; margin-top: 6px; color: #9b6d58; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.insight-stage-body { padding: 0 11px 9px; border-top: 1px solid #e8edf4; }
.insight-value { margin: 0; padding: 0; max-height: 440px; overflow: auto; background: transparent; color: #43556d; font-family: Consolas, 'Microsoft YaHei', monospace; font-size: 12px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.insight-fields { margin: 0; }
.insight-field { display: grid; grid-template-columns: minmax(105px, 25%) minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid #edf0f5; }
.insight-field:last-child { border-bottom: 0; }
.insight-field > dt { color: #8390a3; font-size: 11px; line-height: 1.75; overflow-wrap: anywhere; }
.insight-field > dd { margin: 0; min-width: 0; }
.insight-value-list { margin: 0; padding-left: 22px; }
.insight-value-list > li { padding: 4px 0; color: #9aa6b6; }
.insight-empty-value { color: #95a0b0; font-size: 12px; }
.insight-empty { margin: 0; padding: 12px 0; color: #8b97a8; font-size: 12px; line-height: 1.7; }
.insight-notice { margin: 10px 0; padding: 11px 13px; background: #f5f8fd; border: 1px solid #e4ebf6; border-radius: 8px; color: #6880a1; font-size: 12px; line-height: 1.6; }
.insight-table-scroll { overflow: auto; }
.insight-diff { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; }
.insight-diff th, .insight-diff td { padding: 9px 10px; border-bottom: 1px solid #e8edf4; vertical-align: top; }
.insight-diff thead { background: #f7f9fc; color: #72839c; }
.insight-diff th { font-weight: 500; overflow-wrap: anywhere; }
.insight-diff tbody th { width: 20%; color: #6581a7; }
.insight-diff td { width: 40%; min-width: 120px; }
.insight-model-calls { display: grid; gap: 8px; }
.insight-model-call { border: 1px solid #e3e9f2; border-radius: 8px; overflow: hidden; }
.insight-model-call > summary { display: list-item; padding: 12px 14px; color: #5a7192; font-size: 12px; cursor: pointer; }
.insight-model-call > summary::marker { color: #93a5bd; }
.insight-model-call[open] > summary { background: #f8faff; border-bottom: 1px solid #e8edf4; }
.insight-call-title { display: inline-flex; flex-wrap: wrap; gap: 9px; color: #344f72; font-weight: 600; }
.insight-call-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 12px; margin-top: 9px; color: #8997ab; font-size: 11px; }
.insight-call-body > .insight-empty { padding: 13px 16px; }
.insight-message { padding: 10px 0 13px; border-bottom: 1px solid #edf0f5; }
.insight-message:first-child { padding-top: 0; }
.insight-message:last-child { padding-bottom: 0; border-bottom: 0; }
.insight-message-label { margin-bottom: 9px; color: #6988b1; font-size: 11px; font-weight: 600; }
.insight-paused { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 10px 0; padding: 16px 18px; background: #fffdfa; border: 1px solid #efdfc3; border-radius: 10px; }
.insight-paused-content { min-width: 0; }
.insight-paused-count { color: #91784e; font-size: 11px; }
.insight-paused-error { margin: 8px 0 0; color: #a16c43; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.insight-paused > .insight-paused-content > .insight-record-meta { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insight-paused-actions { display: flex; flex-wrap: wrap; gap: 8px; flex-shrink: 0; }
.insight-action { padding: 7px 11px; border: 1px solid #d8e0ed; border-radius: 7px; background: #fff; color: #5c7392; font-size: 12px; cursor: pointer; }
.insight-action-primary { border-color: #517cac; background: #517cac; color: #fff; }
.insight-action:hover { filter: brightness(.96); }
.insight-action:disabled { opacity: .55; cursor: wait; }
.insight-record summary:focus-visible, .insight-action:focus-visible { outline: 2px solid #7ea7df; outline-offset: 3px; }

@media (max-width: 800px) {
  .insight-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .insight-metric { padding: 14px 16px; }
  .insight-metric-value { font-size: 24px; }
  .insight-paused { align-items: flex-start; }
}
@media (max-width: 520px) {
  .insight-record > summary { padding: 15px 32px 15px 14px; }
  .insight-record > summary::after { right: 15px; }
  .insight-record-title { font-size: 14px; }
  .insight-record-facts { gap: 7px 10px; font-size: 11px; }
  .insight-detail { padding: 14px 12px; }
  .insight-stage { padding-left: 31px; }
  .insight-stage-number { width: 23px; height: 23px; top: 10px; }
  .insight-stage:not(:last-child)::before { left: 11px; }
  .insight-stage-duration { margin-left: 0; }
  .insight-stage-body { padding-left: 7px; padding-right: 7px; }
  .insight-section-body { padding: 10px; }
  .insight-field { grid-template-columns: 1fr; gap: 2px; }
  .insight-field .insight-fields { padding-left: 10px; border-left: 1px solid #e5eaf1; }
  .insight-paused { flex-direction: column; gap: 12px; padding: 14px; }
  .insight-paused-actions { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .insight-record > summary::after { transition: none; }
}
.insight-result { border:1px solid #cce5e2; background:#f0faf8; border-radius:10px; padding:16px 20px; margin-bottom:16px; }
.insight-result h3 { margin:0 0 10px; font-size:16px; }
.insight-result p { margin:6px 0; line-height:1.65; overflow-wrap:anywhere; }
.insight-result small { color:#64748b; }
.insight-chat { display:grid; gap:12px; max-height:620px; overflow:auto; }
.insight-chat-message { border:1px solid #e2e8f0; background:#fff; border-radius:10px; padding:14px; min-width:0; }
.insight-chat-message header { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.insight-chat-message time { color:#64748b; font-size:12px; margin-left:auto; }
.insight-chat-image { display:block; min-width:120px; min-height:70px; max-width:260px; max-height:240px; object-fit:contain; cursor:zoom-in; margin:8px 0; }
.insight-image-viewer { width:90vw; height:88vh; max-width:96vw; max-height:96vh; border:0; border-radius:12px; padding:48px 12px 12px; background:#161b22; }
.insight-image-viewer::backdrop { background:rgba(0,0,0,.72); }
.insight-image-viewer.maximized { width:96vw; height:96vh; }
.insight-image-viewer > img { width:100%; height:100%; object-fit:contain; }
.insight-image-tools { position:absolute; top:8px; right:12px; display:flex; gap:8px; }
.insight-image-tools button { border:1px solid #64748b; border-radius:6px; color:white; background:#334155; padding:6px 12px; cursor:pointer; }
