:root {
  --bg-deep: #020203;
  --bg-base: #050506;
  --bg-elevated: #0a0a0c;
  --bg-surface: rgba(255, 255, 255, 0.04);
  --bg-hover: rgba(255, 255, 255, 0.07);

  --text: #EDEDEF;
  --text-2: #8A8F98;
  --text-3: rgba(255, 255, 255, 0.28);
  --text-4: rgba(255, 255, 255, 0.14);

  --border: rgba(255, 255, 255, 0.06);
  --border-hi: rgba(255, 255, 255, 0.10);

  --accent: #5E6AD2;
  --accent-hi: #6872D9;
  --accent-glow: rgba(94, 106, 210, 0.25);

  --bob: #0f62fe;
  --bob-bg: rgba(15, 98, 254, 0.10);
  --bob-border: rgba(15, 98, 254, 0.22);

  --critical: #ff4444;
  --critical-bg: rgba(255, 68, 68, 0.08);
  --critical-border: rgba(255, 68, 68, 0.22);
  --critical-glow: rgba(255, 68, 68, 0.28);

  --high: #ff8c00;
  --high-bg: rgba(255, 140, 0, 0.08);
  --high-border: rgba(255, 140, 0, 0.22);

  --medium: #e8b84b;
  --medium-bg: rgba(232, 184, 75, 0.08);
  --medium-border: rgba(232, 184, 75, 0.20);

  --low: #3dd68c;
  --low-bg: rgba(61, 214, 140, 0.08);
  --low-border: rgba(61, 214, 140, 0.20);
  --low-glow: rgba(61, 214, 140, 0.20);

  --changed: #44aaff;
  --changed-bg: rgba(68, 170, 255, 0.08);
  --changed-border: rgba(68, 170, 255, 0.22);

  --safe: #2c3340;

  --mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Geist', Inter, -apple-system, Arial, sans-serif;

  --shadow-card: rgba(255, 255, 255, 0.06) 0 0 0 1px, rgba(0, 0, 0, 0.4) 0 4px 24px;
  --shadow-card-hover: rgba(255, 255, 255, 0.10) 0 0 0 1px, rgba(0, 0, 0, 0.5) 0 8px 40px, rgba(94, 106, 210, 0.07) 0 0 60px;
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0
}

html,
body {
  height: 100%;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar {
  width: 3px;
  height: 3px
}

::-webkit-scrollbar-track {
  background: transparent
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.10);
  border-radius: 2px
}

/* Ambient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 130% 80% at 50% -5%, #0d0d1a 0%, #050506 55%, #020203 100%),
    linear-gradient(rgba(255, 255, 255, 0.016) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.016) 1px, transparent 1px) 0 0 / 64px 64px;
}

/* Single ambient glow layer — replaces the four removed DOM divs */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 860px 680px at 50% -280px, rgba(94, 106, 210, 0.13) 0%, transparent 70%),
    radial-gradient(ellipse 580px 480px at -120px 100%, rgba(110, 70, 190, 0.08) 0%, transparent 70%),
    radial-gradient(ellipse 480px 380px at 100% -80px, rgba(68, 170, 255, 0.05) 0%, transparent 70%);
}

/* App shell */
#app {
  display: grid;
  grid-template-rows: 52px 1fr;
  height: 100vh;
  position: relative;
  z-index: 1
}

/* Header */
#header {
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 14px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  background: rgba(5, 5, 6, 0.78);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
}

.logo {
  font-family: var(--sans);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.03em;
  color: var(--text);
  flex-shrink: 0;
  user-select: none;
  cursor: pointer;
}

.logo span {
  color: var(--critical)
}

.pr-title {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0
}

/* New analysis ghost-link button */
.new-analysis-btn {
  background: none;
  border: none;
  color: var(--text-3);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.01em;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.new-analysis-btn:hover {
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.05);
}

#bob-metrics {
  display: none;
  align-items: center;
  gap: 6px
}

.bob-metric-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 8px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

#risk-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: rgba(255, 255, 255, 0.07) 0 0 0 1px;
  min-width: 72px;
  flex-shrink: 0;
  transition: box-shadow 0.4s var(--ease-expo);
}

#risk-score .score-label {
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-3);
}

#risk-score-value {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  transition: color 0.4s var(--ease-expo);
}

#risk-score.score-neutral #risk-score-value {
  color: var(--text-2)
}

#risk-score.score-low #risk-score-value {
  color: var(--low)
}

#risk-score.score-moderate #risk-score-value {
  color: var(--medium)
}

#risk-score.score-high #risk-score-value {
  color: var(--high)
}

#risk-score.score-critical #risk-score-value {
  color: var(--critical)
}

#risk-score.score-critical {
  box-shadow: rgba(255, 255, 255, 0.07) 0 0 0 1px, 0 0 20px var(--critical-glow)
}

#risk-badge {
  display: none;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 4px;
  align-items: center;
  flex-shrink: 0;
}

#risk-badge.CRITICAL {
  background: var(--critical-bg);
  color: var(--critical);
  border: 1px solid var(--critical-border);
  display: flex;
  box-shadow: 0 0 12px var(--critical-glow)
}

#risk-badge.HIGH {
  background: var(--high-bg);
  color: var(--high);
  border: 1px solid var(--high-border);
  display: flex
}

#risk-badge.MEDIUM {
  background: var(--medium-bg);
  color: var(--medium);
  border: 1px solid var(--medium-border);
  display: flex
}

#risk-badge.LOW {
  background: var(--low-bg);
  color: var(--low);
  border: 1px solid var(--low-border);
  display: flex
}

.bob-badge-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  margin-left: 2px;
}

.bob-powered {
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3)
}

#demo-btn {
  background: var(--critical);
  color: #fff;
  border: none;
  padding: 7px 18px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  box-shadow:
    rgba(255, 68, 68, 0.5) 0 0 0 1px,
    rgba(255, 68, 68, 0.25) 0 4px 16px,
    inset rgba(255, 255, 255, 0.15) 0 1px 0;
  transition: box-shadow 0.2s var(--ease-expo), transform 0.15s;
}

#demo-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, transparent 50%);
  pointer-events: none
}

#demo-btn:hover {
  box-shadow: rgba(255, 68, 68, 0.6) 0 0 0 1px, rgba(255, 68, 68, 0.40) 0 6px 24px, inset rgba(255, 255, 255, 0.18) 0 1px 0
}

#demo-btn:active {
  transform: scale(0.97)
}

#demo-btn:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none
}

/* Main layout */
#main {
  display: grid;
  grid-template-columns: 272px 1fr 296px;
  overflow: hidden;
  position: relative;
  z-index: 1
}

/* Panels */
.panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
  position: relative
}

.panel:last-child {
  border-right: none
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.015);
}

.panel-title {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* Section label — not a tab, not interactive */
.panel-label {
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-4);
  user-select: none;
}

.panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden
}

.btn-sm {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-2);
  border: none;
  box-shadow: rgba(255, 255, 255, 0.08) 0 0 0 1px;
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 11px;
  border-radius: 5px;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.15s, box-shadow 0.15s, color 0.15s;
}

.btn-sm:hover {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: rgba(255, 255, 255, 0.13) 0 0 0 1px;
  color: var(--text)
}

/* Diff viewer */
#diff-container {
  padding: 8px 0
}

.diff-placeholder {
  padding: 24px 16px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.8
}

.diff-placeholder strong {
  color: var(--text-2);
  font-weight: 500
}

.diff-file-header {
  padding: 5px 14px;
  font-size: 11px;
  color: var(--changed);
  background: var(--changed-bg);
  border-top: 1px solid var(--changed-border);
  border-bottom: 1px solid var(--changed-border);
  margin: 4px 0;
  letter-spacing: 0.01em;
}

.diff-line {
  display: flex;
  align-items: stretch;
  font-size: 11.5px;
  line-height: 1.65;
  cursor: default;
  transition: background 0.1s
}

.diff-line:hover {
  background: rgba(255, 255, 255, 0.025)
}

.diff-gutter {
  width: 4px;
  flex-shrink: 0
}

.diff-line.added .diff-gutter {
  background: rgba(61, 214, 140, 0.55)
}

.diff-line.removed .diff-gutter {
  background: rgba(255, 68, 68, 0.55)
}

.diff-sign {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  color: var(--text-4);
  user-select: none;
  font-size: 11px
}

.diff-line.added .diff-sign {
  color: var(--low)
}

.diff-line.removed .diff-sign {
  color: var(--critical)
}

.diff-content {
  flex: 1;
  padding: 0 10px 0 3px;
  font-family: var(--mono);
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(255, 255, 255, 0.35);
}

.diff-line.added .diff-content {
  color: #6ddba8;
  background: rgba(61, 214, 140, 0.03)
}

.diff-line.removed .diff-content {
  color: #ff8080;
  background: rgba(255, 68, 68, 0.03)
}

.diff-line.blast-entry {
  position: relative
}

.diff-line.blast-entry::after {
  content: '⚡ blast entry';
  font-size: 9px;
  color: var(--critical);
  background: var(--critical-bg);
  border: 1px solid var(--critical-border);
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: 8px;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

/* Graph panel */
#graph-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 120px),
    rgba(0, 0, 0, 0.16);
}

#graph-canvas {
  flex: 1;
  min-height: 400px;
  overflow: hidden;
  position: relative;
  background:
    linear-gradient(115deg, rgba(68, 170, 255, 0.035), transparent 42%, rgba(255, 68, 68, 0.026)),
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px) 0 0 / 48px 48px;
  opacity: 0.9;
  transition: opacity 0.45s var(--ease-expo), filter 0.45s var(--ease-expo);
}

#graph-panel.report-ready #graph-canvas {
  opacity: 1;
  filter: saturate(1.08);
}

#graph-idle {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  transition: opacity 0.28s var(--ease-expo), transform 0.28s var(--ease-expo);
}

#graph-idle.is-hidden {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}

.idle-icon {
  font-size: 28px;
  color: var(--text-4);
  line-height: 1
}

.idle-text {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  line-height: 2;
  letter-spacing: 0.01em
}

#idle-demo-btn {
  padding: 7px 18px;
  font-size: 11px;
  margin-top: 4px
}

#risk-summary {
  display: none;
  align-items: center;
  gap: 10px
}

.risk-count {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  letter-spacing: 0.02em
}

.risk-count .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0
}

.risk-count.critical {
  color: var(--critical)
}

.risk-count.critical .dot {
  background: var(--critical);
  box-shadow: 0 0 6px var(--critical-glow)
}

.risk-count.high {
  color: var(--high)
}

.risk-count.high .dot {
  background: var(--high)
}

.risk-count.medium {
  color: var(--medium)
}

.risk-count.medium .dot {
  background: var(--medium)
}

.risk-count.low {
  color: var(--low)
}

.risk-count.low .dot {
  background: var(--low)
}

/* Stream log */
#stream-log {
  position: absolute;
  bottom: 14px;
  left: 14px;
  right: 14px;
  background: rgba(5, 5, 6, 0.90);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-2);
  max-height: 130px;
  overflow-y: auto;
  display: none;
  line-height: 1.7;
  box-shadow: rgba(0, 0, 0, 0.55) 0 8px 32px, rgba(94, 106, 210, 0.06) 0 0 40px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.24s var(--ease-expo), transform 0.24s var(--ease-expo);
}

#stream-log.visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.stream-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px
}

.stream-label {
  color: #5E6AD2;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.02em
}

#stream-metrics {
  color: var(--text-4);
  font-size: 9px
}

#stream-content {
  opacity: 0.72;
  font-size: 10.5px
}

.stream-step {
  margin-top: 3px;
  padding-left: 8px;
  border-left: 2px solid var(--accent);
}

/* Recommendation bar */
#recommendation-bar {
  padding: 0 14px 14px;
  display: none;
  position: relative;
  z-index: 2;
  animation: reportRise 0.38s var(--ease-expo) both;
}

#merge-verdict {
  display: none;
  padding: 10px 14px;
  border-radius: 7px;
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.6;
  border: 1px solid;
  transition: box-shadow 0.28s var(--ease-expo), border-color 0.28s var(--ease-expo);
}

#merge-verdict.block {
  background: var(--critical-bg);
  border-color: var(--critical-border);
  color: var(--critical);
  box-shadow: 0 0 20px var(--critical-glow)
}

#merge-verdict.safe {
  background: var(--low-bg);
  border-color: var(--low-border);
  color: var(--low);
  box-shadow: 0 0 16px var(--low-glow)
}

#suggested-actions {
  margin-top: 8px
}

#suggested-actions .action-title {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}

#suggested-actions .action-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-2);
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
  transition: color 0.15s;
}

#suggested-actions .action-item:last-child {
  border-bottom: none
}

#suggested-actions .action-item:hover {
  color: var(--text)
}

#suggested-actions .action-item input {
  appearance: none;
  width: 13px;
  height: 13px;
  min-width: 13px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 3px;
  margin-top: 2px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.15s, border-color 0.15s;
}

#suggested-actions .action-item input:checked {
  background: var(--accent);
  border-color: var(--accent)
}

/* D3 graph nodes */
.node circle {
  cursor: pointer;
  transition: filter 0.22s var(--ease-expo), opacity 0.22s var(--ease-expo), stroke-width 0.22s var(--ease-expo)
}

.node circle:hover {
  filter: brightness(1.25) saturate(1.2)
}

.node.dimmed circle {
  opacity: 0.18
}

.node.dimmed text {
  opacity: 0.14
}

.node text {
  font-family: var(--mono);
  font-size: 9.5px;
  pointer-events: none;
  text-anchor: middle
}

.node.highlighted circle {
  filter: brightness(1.18) saturate(1.12) drop-shadow(0 0 6px rgba(68, 170, 255, 0.42))
}

.link {
  stroke-opacity: 0.35;
  fill: none;
  transition: stroke-opacity 0.24s var(--ease-expo), stroke-width 0.24s var(--ease-expo)
}

.link.dimmed {
  stroke-opacity: 0.08
}

.link.highlighted {
  stroke-opacity: 0.78;
  stroke-width: 2.25px
}

/* Right panel — chain cards */
#detail-empty {
  padding: 28px 16px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-3);
  line-height: 2;
  text-align: center;
}

#no-chains-state {
  display: none;
  padding: 28px 16px;
  text-align: center
}

.no-chains-icon {
  font-size: 26px;
  margin-bottom: 10px;
  color: var(--low);
  filter: drop-shadow(0 0 8px var(--low-glow))
}

.no-chains-title {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--low);
  margin-bottom: 6px
}

.no-chains-copy {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.8
}

.chain-card {
  margin: 8px 10px 0;
  padding: 13px 14px;
  border-radius: 8px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: var(--shadow-card);
  border-left: 2px solid transparent;
  transition: background 0.2s var(--ease-expo), box-shadow 0.2s var(--ease-expo), transform 0.2s var(--ease-expo);
  animation: slideIn 0.32s var(--ease-expo) both;
}

.chain-card:nth-child(2) {
  animation-delay: 45ms;
}

.chain-card:nth-child(3) {
  animation-delay: 90ms;
}

.chain-card:nth-child(4) {
  animation-delay: 135ms;
}

.chain-card:last-child {
  margin-bottom: 10px
}

.chain-card:hover {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px)
}

.chain-card.active {
  background: rgba(68, 170, 255, 0.05);
  border-left-color: var(--changed);
  box-shadow: rgba(68, 170, 255, 0.20) 0 0 0 1px, rgba(0, 0, 0, 0.4) 0 4px 20px;
  transform: translateY(-1px)
}

.chain-card.risk-CRITICAL.active {
  border-left-color: var(--critical);
}

.chain-card.risk-HIGH.active {
  border-left-color: var(--high);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(10px)
  }

  to {
    opacity: 1;
    transform: translateX(0)
  }
}

@keyframes reportRise {
  from {
    opacity: 0;
    transform: translateY(10px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

.chain-risk-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  margin-bottom: 6px;
}

.risk-CRITICAL .chain-risk-badge {
  background: var(--critical-bg);
  color: var(--critical);
  border: 1px solid var(--critical-border);
  box-shadow: 0 0 8px var(--critical-glow)
}

.risk-HIGH .chain-risk-badge {
  background: var(--high-bg);
  color: var(--high);
  border: 1px solid var(--high-border)
}

.risk-MEDIUM .chain-risk-badge {
  background: var(--medium-bg);
  color: var(--medium);
  border: 1px solid var(--medium-border)
}

.risk-LOW .chain-risk-badge {
  background: var(--low-bg);
  color: var(--low);
  border: 1px solid var(--low-border)
}

.chain-confidence {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 3px;
  margin-bottom: 6px;
  margin-left: 4px;
}

.confidence-HIGH {
  background: var(--low-bg);
  color: var(--low);
  border: 1px solid var(--low-border)
}

.confidence-MEDIUM {
  background: var(--medium-bg);
  color: var(--medium);
  border: 1px solid var(--medium-border)
}

.confidence-LOW {
  background: var(--high-bg);
  color: var(--high);
  border: 1px solid var(--high-border);
  font-style: italic
}

.chain-path {
  font-family: var(--mono);
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.36);
  margin-bottom: 7px;
  line-height: 1.6
}

.chain-path .arrow {
  color: rgba(255, 255, 255, 0.16);
  margin: 0 4px
}

.chain-path .node {
  color: var(--text-2)
}

.chain-path .node.changed {
  color: var(--changed);
  display: inline-block;
  border-left: 2px solid var(--changed);
  padding-left: 4px;
}

.chain-impact {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 8px
}

.chain-no-tests {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--critical);
  background: var(--critical-bg);
  border: 1px solid var(--critical-border);
  border-radius: 4px;
  padding: 4px 8px;
  margin-bottom: 6px;
}

.chain-has-tests {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--low);
  margin-bottom: 6px;
}

.chain-explanation {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-3);
  line-height: 1.7;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 6px;
}

/* Modal */
.inline-warning {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--high);
  padding: 5px 8px;
  margin-top: 4px;
  border-radius: 4px;
  background: var(--high-bg);
  border: 1px solid var(--high-border);
}

#custom-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  background: rgba(2, 2, 3, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.custom-modal-body {
  background: rgba(10, 10, 12, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  padding: 22px;
  width: 560px;
  max-width: 95vw;
  box-shadow: rgba(0, 0, 0, 0.6) 0 24px 64px, rgba(94, 106, 210, 0.06) 0 0 60px;
}

.custom-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px
}

.custom-modal-title {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text)
}

#diff-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: rgba(255, 255, 255, 0.08) 0 0 0 1px;
  border: none;
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  outline: none;
  padding: 12px 14px;
  resize: vertical;
  transition: box-shadow 0.2s var(--ease-expo);
}

#diff-input:focus {
  box-shadow: rgba(94, 106, 210, 0.5) 0 0 0 1px, rgba(94, 106, 210, 0.12) 0 0 16px
}

#diff-input::placeholder {
  color: var(--text-3)
}

.custom-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px
}

#analyze-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 6px 18px;
  cursor: pointer;
  box-shadow: rgba(94, 106, 210, 0.5) 0 0 0 1px, rgba(94, 106, 210, 0.25) 0 4px 12px, inset rgba(255, 255, 255, 0.15) 0 1px 0;
  transition: box-shadow 0.2s var(--ease-expo), transform 0.15s;
}

#analyze-btn:hover {
  box-shadow: rgba(94, 106, 210, 0.6) 0 0 0 1px, rgba(94, 106, 210, 0.35) 0 6px 20px, inset rgba(255, 255, 255, 0.18) 0 1px 0
}

#analyze-btn:active {
  transform: scale(0.97)
}

/* Utilities */
.loading-pulse {
  animation: loadPulse 1.4s ease-in-out infinite;
  color: var(--accent)
}

@keyframes loadPulse {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: 0.35
  }
}

button:focus-visible {
  outline: 2px solid rgba(94, 106, 210, 0.7);
  outline-offset: 2px
}

@media(max-width:980px) {

  html,
  body {
    overflow: auto
  }

  #app {
    height: auto;
    min-height: 100vh
  }

  #header {
    flex-wrap: wrap;
    height: auto;
    min-height: 52px;
    padding: 8px 14px
  }

  #main {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(280px, 36vh) minmax(340px, 48vh) minmax(280px, 38vh)
  }

  .panel {
    border-right: none;
    border-bottom: 1px solid var(--border)
  }
}

@media(prefers-reduced-motion:reduce) {
  .chain-card {
    animation: none;
    transition: background 0.1s
  }

  * {
    transition-duration: 0.01ms !important
  }
}

/* -- GitHub URL input -- */
#pr-url-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s;
}

#pr-url-input:focus {
  border-color: var(--accent);
}

#pr-url-input::placeholder {
  color: var(--text-3);
}

/* GitHub URL panel container */
#github-url-panel {
  padding: 14px;
}

/* -- Analyze PR (primary bob-blue action) -- */
#analyze-github-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: var(--bob);
  color: #fff;
  border: none;
  padding: 8px 14px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 6px;
  cursor: pointer;
  box-shadow:
    rgba(15, 98, 254, 0.5) 0 0 0 1px,
    inset rgba(255, 255, 255, 0.15) 0 1px 0;
  transition: background 0.15s var(--ease-expo), box-shadow 0.15s var(--ease-expo), transform 0.1s;
}

#analyze-github-btn:hover {
  background: #0050d0;
  box-shadow:
    rgba(15, 98, 254, 0.6) 0 0 0 1px,
    rgba(15, 98, 254, 0.25) 0 4px 16px,
    inset rgba(255, 255, 255, 0.18) 0 1px 0;
}

#analyze-github-btn:active {
  transform: scale(0.98);
}

#analyze-github-btn:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none;
}

/* -- Input mode toggle -- */
.mode-toggle {
  color: var(--text-3);
}

.mode-toggle.active {
  color: var(--text);
  background: transparent;
  border-color: transparent;
  border-bottom: 2px solid var(--accent);
}

/* -- Share bar -- */
#share-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-3);
  animation: reportRise 0.34s var(--ease-expo) both;
}

.share-btn {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
}

.share-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* -- Context stats -- */
.context-stats {
  padding: 6px 14px 4px;
  font-size: 10.5px;
  line-height: 1.6;
}

.ctx-summary {
  display: block;
  color: var(--text-2);
  font-family: var(--mono);
}

.ctx-summary strong {
  color: var(--text);
}

.ctx-warning {
  display: block;
  margin-top: 2px;
  color: #c68a00;
  font-family: var(--mono);
  font-size: 10px;
}

/* -- IBM Bob badge (always visible, never hidden) -- */
.bob-badge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--bob);
  border: 1px solid var(--bob);
  border-radius: 4px;
  padding: 2px 8px;
  box-shadow: 0 0 10px rgba(15, 98, 254, 0.25);
  transition: background 0.25s, color 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.bob-badge.bob-badge--fallback {
  color: #1a0800;
  background: var(--medium);
  border-color: var(--medium);
  box-shadow: none;
}

/* ── Risk Cost Estimator panel ──────────────────────────────────────── */
#cost-panel {
  margin: 8px 16px 0;
  padding: 14px 16px 10px;
  border: 1px solid var(--critical-border);
  border-radius: 8px;
  background: var(--critical-bg);
  animation: reportRise 0.42s var(--ease-expo) both;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 -10px 34px rgba(255, 68, 68, 0.08);
}

.cost-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}

.cost-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  text-align: center;
}

.cost-label {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 4px;
}

.cost-value {
  font-size: 22px;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--critical);
}

.cost-basis {
  font-size: 10px;
  color: var(--text-3);
  line-height: 1.5;
  font-style: italic;
}

/* ── AST verification badges (chain card) ───────────────────────────── */
.badge-verified,
.badge-inferred,
.badge-unverifiable {
  display: inline-block;
  font-size: 9px;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 6px;
}

.badge-verified {
  background: rgba(61, 214, 140, 0.12);
  color: var(--low);
  border: 1px solid rgba(61, 214, 140, 0.28);
}

.badge-inferred {
  background: var(--high-bg);
  color: var(--high);
  border: 1px solid rgba(255, 140, 0, 0.28);
}

.badge-unverifiable {
  background: var(--bg-surface);
  color: var(--text-3);
  border: 1px solid var(--border);
}

/* ── Graph edge verification classes ────────────────────────────────── */
line.verification-verified {
  stroke-dasharray: none;
  opacity: 0.85;
}

line.verification-inferred {
  stroke-dasharray: 5 3;
  opacity: 0.65;
}

line.verification-unverifiable {
  stroke-dasharray: 2 4;
  opacity: 0.45;
}
