.insight-panel-shell {
  flex: none;
  display: flex;
  width: clamp(300px, 28vw, 420px);
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow: hidden;
  transition:
    width 360ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.insight-panel-shell.collapsed {
  width: 0;
  opacity: 0;
}

.insight-panel {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(189, 201, 214, 0.74);
  border-radius: 4px;
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(148, 163, 184, 0.16);
  opacity: 1;
  transform: translateX(0) scale(1);
  transform-origin: right center;
  transition:
    opacity 260ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 320ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.insight-panel-shell.collapsed .insight-panel {
  opacity: 0;
  transform: translateX(28px) scale(0.985);
  pointer-events: none;
}

.el-fade-in-linear-enter-active,
.el-fade-in-linear-leave-active {
  transition: opacity 200ms linear;
}

.el-fade-in-linear-enter-from,
.el-fade-in-linear-leave-to {
  opacity: 0;
}

.el-fade-in-linear-enter-to,
.el-fade-in-linear-leave-from {
  opacity: 1;
}

.insight-head {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
}

.insight-head h3 {
  margin: 6px 0 0;
  color: #0f172a;
  font-size: var(--wb-fs-insight-title, 17px);
  font-weight: 850;
}

.insight-head p {
  margin: 6px 0 0;
  color: #64748b;
  font-size: var(--wb-fs-insight-body, 12px);
  line-height: 1.55;
}

.insight-body {
  min-height: 0;
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 14px;
  overflow-y: auto;
}

.intent-pill,
.flow-status-chip,
.status-pill {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 4px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
}

.confidence-card,
.insight-card,
.review-side-card,
.review-flow-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #ffffff;
}

.confidence-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  background: #f8fbff;
}

.confidence-card span,
.card-head p,
.note-block p,
.review-side-head p,
.review-side-risk-summary,
.flow-step-detail,
.flow-step-card time {
  margin: 0;
  color: #64748b;
  font-size: var(--wb-fs-insight-body, 12px);
  line-height: 1.55;
}

.confidence-card strong,
.card-head h4,
.note-block strong,
.review-side-head strong,
.flow-step-card strong,
.review-side-metric-copy strong,
.review-side-category-copy strong {
  color: #0f172a;
  font-weight: 850;
}

.card-head,
.review-side-head,
.flow-step-card header,
.review-document-switch-head,
.review-flow-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-head h4 {
  margin: 0;
  font-size: var(--wb-fs-insight-h4, 14px);
}

.review-document-switch-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.review-side-head-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
  text-align: left;
}

.review-side-head-copy strong {
  line-height: 1.35;
}

.review-side-head-copy p {
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}

.note-block {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 4px;
  background: #f8fbff;
}

.capability-chip-row,
.citation-stack,
.knowledge-question-list,
.review-flow-list,
.review-side-risk-list,
.review-document-warning-list {
  display: grid;
  gap: 8px;
}

.risk-chip,
.review-document-meta-chip,
.review-side-confidence {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 4px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
}

.citation-card,
.knowledge-question-btn,
.review-side-metric-card,
.review-side-category-card,
.review-side-risk-item,
.flow-step-card,
.review-document-preview-card {
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #ffffff;
}

.knowledge-question-btn,
.review-side-metric-card,
.review-side-category-card,
.review-side-risk-item {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 10px;
  color: #334155;
  font: inherit;
  text-align: left;
}

.knowledge-question-btn {
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
}

.knowledge-question-index {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 11px;
  font-weight: 850;
}

.review-side-grid,
.review-side-category-grid,
.review-document-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.review-side-metric-card {
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: start;
}

.review-side-metric-icon,
.review-side-risk-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: #eff6ff;
  color: var(--theme-primary, #3a7ca5);
}

.review-side-metric-copy,
.review-side-category-copy,
.review-side-risk-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.review-side-metric-copy small,
.review-side-edit-hint,
.review-side-category-copy p {
  margin: 0;
  color: #64748b;
  font-size: 11px;
  line-height: 1.45;
}

.review-side-category-card.active {
  border-color: rgba(var(--theme-primary-rgb, 58, 124, 165), 0.55);
  background: var(--theme-primary-soft, #eaf4fa);
}

.review-insight-tools,
.review-document-nav,
.review-document-meta-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.review-document-nav {
  flex: 0 0 auto;
  align-items: center;
  flex-wrap: nowrap;
  padding: 4px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #ffffff;
  white-space: nowrap;
}

.review-document-nav span {
  min-width: 38px;
  color: #334155;
  font-size: 11px;
  font-weight: 850;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.review-insight-switch-icon-btn,
.flow-icon-btn,
.review-document-nav-btn,
.review-side-save-pill {
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  color: #334155;
}

.review-insight-switch-icon-btn,
.flow-icon-btn,
.review-document-nav-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
}

.review-insight-switch-icon-btn.active,
.review-side-save-pill {
  border-color: var(--theme-primary, #3a7ca5);
  background: var(--theme-primary, #3a7ca5);
  color: #ffffff;
}

.review-flow-list {
  position: relative;
  gap: 0;
  padding: 2px 0 0;
}

.flow-step-item {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 10px;
}

.flow-step-item:last-child {
  padding-bottom: 0;
}

.flow-step-rail {
  position: relative;
  display: flex;
  justify-content: center;
}

.flow-step-rail::after {
  content: "";
  position: absolute;
  top: 28px;
  bottom: -10px;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #e2e8f0;
  opacity: 0;
  transform-origin: top;
  transition: opacity 0.18s ease, transform 0.32s ease, background 0.18s ease;
  transform: translateX(-50%) scaleY(0);
}

.flow-step-item:not(:last-child) .flow-step-rail::after {
  opacity: 1;
  transform: translateX(-50%) scaleY(1);
}

.flow-step-rail span {
  position: relative;
  z-index: 1;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid #dbe4ee;
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.flow-step-card {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 10px 11px;
  border-radius: 4px;
  background: #f8fafc;
  box-shadow: none;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.flow-step-item.completed .flow-step-rail::after {
  background: #1e293b;
}

.flow-step-item.completed .flow-step-rail span {
  border-color: #0f172a;
  background: #0f172a;
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.08);
}

.flow-step-item.completed .flow-step-card {
  border-color: #1e293b;
  background: #1e293b;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.14);
}

.flow-step-item.completed .flow-step-card strong {
  color: #ffffff;
}

.flow-step-item.completed .flow-step-detail,
.flow-step-item.completed .flow-step-card time {
  color: #cbd5e1;
}

.flow-step-item.running .flow-step-rail span {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.12);
}

.flow-step-item.running .flow-step-card {
  border-color: rgba(37, 99, 235, 0.38);
  background: #eff6ff;
}

.flow-step-item.failed .flow-step-rail span {
  border-color: #dc2626;
  background: #dc2626;
  color: #ffffff;
}

.flow-step-item.failed .flow-step-card {
  border-color: rgba(220, 38, 38, 0.34);
  background: #fef2f2;
}

.flow-empty-state,
.review-side-empty,
.review-document-preview-placeholder {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 4px;
  background: #f8fbff;
  color: #64748b;
  text-align: center;
}

.review-inline-input,
.review-document-edit-field input,
.review-document-edit-field textarea {
  width: 100%;
  min-height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  color: #0f172a;
  font: inherit;
}

.review-document-edit-field {
  display: grid;
  gap: 6px;
}

.review-document-edit-field span {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.review-document-scroll {
  display: grid;
  gap: 10px;
}

.review-document-preview-card {
  min-height: 140px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #f8fbff;
}

.review-document-preview-card img {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
}

.review-side-save-pill {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 1440px) {
  .insight-panel-shell:not(.collapsed) {
    width: 100%;
    max-height: min(34dvh, 360px);
  }
}

.review-insight-title-copy {
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-insight-title-copy .title-icon {
  font-size: 20px;
  color: var(--theme-primary, #3a7ca5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
