/* Frame 2 — Issue Detail + Live Knowledge Neighborhood
 * -------------------------------------------------------------------------
 * 4-tile metric strip, knowledge-neighborhood graph container, and the
 * what-if cascade preview panel. Paired with
 * web/static/js/knowledge_neighborhood.js + the /issues/<id>/cascade-preview
 * endpoint in routes_issues.py.
 */

/* ---- Page-header issue-id chip ---- */
.issue-id-chip {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface-inset);
  font-size: 11px;
  color: var(--text-secondary);
  vertical-align: baseline;
}

/* ==========================================================================
 * Title row (Frame 2 — bundle parity)
 * Mirrors design-references/.../Frame2_Graph.jsx:103 where the <h2> title
 * sits on the same baseline as a severity-word Pill and the mono issue ID.
 * ========================================================================== */

.issue-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.issue-title-row .issue-title-h {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

/* Severity-word pill — carries the tier name (critical/high/medium/low).
 * Distinct from the numeric Score trust-chip in the subtitle: this is the
 * scannable signal; the score is the drill-through provenance. Bundle
 * pill contract: 2px radius, 1px border, accent-soft fill keyed to tier. */
.pill.pill-severity {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 2px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: lowercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.pill.pill-severity.severity-critical {
  background: var(--severity-critical-soft, #FEE2E2);
  color: var(--severity-critical, #B91C1C);
  border-color: var(--severity-critical-soft, #FEE2E2);
}
.pill.pill-severity.severity-high {
  background: var(--severity-high-soft, #FFE4E6);
  color: var(--severity-high, #DC2626);
  border-color: var(--severity-high-soft, #FFE4E6);
}
.pill.pill-severity.severity-medium {
  background: var(--severity-medium-soft, #FEF3C7);
  color: var(--severity-medium, #D97706);
  border-color: var(--severity-medium-soft, #FEF3C7);
}
.pill.pill-severity.severity-low {
  background: var(--surface-inset, #EEF1F5);
  color: var(--text-muted, #64748B);
  border-color: var(--border, #E5E9EE);
}
.pill.pill-severity::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ==========================================================================
 * 4-tile metric strip
 * ========================================================================== */

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

.frame2-tile {
  background: var(--paper, #fff);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.frame2-tile-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.frame2-tile-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 500;
  color: var(--ink, var(--text));
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.frame2-tile-foot {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================================================
 * Shared section chrome
 * ========================================================================== */

.frame2-section-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.frame2-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

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

/* ==========================================================================
 * Knowledge neighborhood graph
 * ========================================================================== */

.frame2-neighborhood {
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--paper);
  margin-bottom: 16px;
}

.frame2-neighborhood-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-inset);
  gap: 16px;
  flex-wrap: wrap;
}

.frame2-neighborhood-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: var(--text-secondary);
}

.frame2-neighborhood-legend .legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1px solid var(--border);
  background: var(--surface, #fff);
  margin-right: 6px;
  vertical-align: middle;
}

.legend-dot-issue  { background: var(--accent-tint, #EBF1FF); border-color: var(--primary, #1F5EFF); }
.legend-dot-asset  { background: var(--surface, #fff); border-color: var(--border-strong, #CBD5E1); }
.legend-dot-expert { background: var(--surface, #fff); border-color: var(--border-strong, #CBD5E1); }
.legend-dot-entry  { background: var(--surface, #fff); border-color: var(--border-strong, #CBD5E1); border-style: dashed; }

.frame2-graph {
  height: 260px;
  background: var(--surface, #fff);
  position: relative;
}

.frame2-graph-empty {
  padding: 24px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

/* ==========================================================================
 * What-if cascade preview
 * ========================================================================== */

.frame2-cascade {
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--paper);
  margin-bottom: 16px;
}

.frame2-cascade-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-inset);
  gap: 16px;
  flex-wrap: wrap;
}

.frame2-cascade-body {
  padding: 16px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
}

.frame2-cascade-scope {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.frame2-cascade-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.frame2-cascade-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--paper);
  font-size: 13px;
  font-family: var(--font-sans);
  color: var(--ink);
}

.frame2-cascade-preview {
  min-height: 128px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.frame2-cascade-placeholder {
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-style: italic;
  font-size: 12px;
}

.frame2-cascade-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.frame2-cascade-row:last-child { border-bottom: 0; }

.frame2-cascade-row .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.frame2-cascade-row .value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.frame2-cascade-row .value.is-danger {
  color: var(--danger, #dc2626);
}

.frame2-cascade-ribbon {
  margin-top: 10px;
  font-size: 10.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.frame2-cascade-ribbon .mono { color: var(--ink); }

.frame2-cascade-affected-list {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--text-secondary);
}

@media (max-width: 900px) {
  .frame2-metric-strip { grid-template-columns: repeat(2, 1fr); }
  .frame2-cascade-body { grid-template-columns: 1fr; }
}

/* ==========================================================================
 * Pass-3 bundle right-panel aside (Frame2_Graph.jsx aside.panel)
 * Mirrors bundle shell-body gridTemplateColumns: '1fr 360px'.
 * Rendered by default — no interaction gate.
 * ========================================================================== */
.frame2-neighborhood-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
}
.frame2-neighborhood-grid .frame2-neighborhood { margin-bottom: 0; }
.frame2-panel {
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
}
.frame2-panel-section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.frame2-panel-section:last-child { border-bottom: 0; }
.frame2-panel-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
/* Small inline caption that hangs off a section label — used by the
 * experts-in-scope panel to show when the rows were derived from an
 * asset-class graph edge rather than a direct issue_experts link. */
.frame2-panel-label-caption {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--text-muted);
  margin-left: 6px;
  padding: 1px 5px;
  border: 1px dashed var(--border);
  border-radius: 2px;
  background: var(--surface-inset, #EEF1F5);
}
.frame2-panel-kv { display: flex; flex-direction: column; gap: 4px; }
.frame2-panel-kv-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.frame2-panel-kv-k { color: var(--text-muted); }
.frame2-panel-kv-v { color: var(--ink); }
.frame2-panel-list { list-style: none; margin: 0; padding: 0; }
.frame2-panel-list-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.frame2-panel-list-row:last-child { border-bottom: 0; }
.frame2-panel-list-primary { color: var(--ink); }
.frame2-panel-list-secondary { color: var(--text-muted); font-size: 11px; }
.frame2-panel-more { margin-top: 6px; font-size: 11px; color: var(--text-muted); }
.frame2-panel-empty { font-size: 12px; color: var(--text-muted); font-style: italic; }
@media (max-width: 900px) {
  .frame2-neighborhood-grid { grid-template-columns: 1fr; }
}
