.incidents-page {
  gap: clamp(18px, 3vw, 28px);
}

body:has(.incidents-page) {
  overflow-x: hidden;
}

.incidents-page,
.incidents-page * {
  min-width: 0;
  max-width: 100%;
}

.incidents-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(18px, 3vw, 34px);
  align-items: start;
}

.incidents-page .detail-hero {
  display: grid;
  align-content: start;
}

.incident-flow-board {
  position: relative;
  display: grid;
  gap: 14px;
  min-height: 430px;
  border-radius: 18px;
  padding: clamp(16px, 2vw, 22px);
  overflow: hidden;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.28);
}

.incident-flow-board::before {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  background: linear-gradient(120deg, transparent, rgba(19, 236, 128, 0.12), transparent);
  transform: translateX(-100%);
  animation: panel-scan 8s ease-in-out infinite;
}

.incident-flow-board .flow-board-header,
.incident-timeline,
.incident-record,
.postmortem-demo {
  position: relative;
  z-index: 1;
}

.incident-timeline {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(178px, 1fr));
  align-items: stretch;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.incident-step {
  min-width: 0;
  min-height: 172px;
  display: grid;
  align-content: start;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: rgba(10, 10, 12, 0.7);
  transition: border-color 260ms ease, background-color 260ms ease, transform 260ms ease;
}

.incident-step span,
.record-events span {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.incident-step span {
  width: fit-content;
  border: 1px solid rgba(19, 236, 128, 0.22);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--mint);
  background: rgba(19, 236, 128, 0.07);
}

.incident-step strong {
  display: block;
  color: var(--text);
  font-size: 19px;
  line-height: 1.1;
  overflow-wrap: break-word;
}

.incident-step small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: break-word;
}

.incident-flow-board[data-active-step="source"] [data-incident-step="source"],
.incident-flow-board[data-active-step="history"] [data-incident-step="history"],
.incident-flow-board[data-active-step="postmortem"] [data-incident-step="postmortem"] {
  border-color: rgba(19, 236, 128, 0.34);
  background: rgba(19, 236, 128, 0.06);
  transform: translateY(-2px);
}

.incident-record {
  display: grid;
  grid-template-columns: minmax(220px, 0.42fr) minmax(180px, 0.32fr) minmax(260px, 1fr);
  gap: 10px;
  align-items: stretch;
}

.record-summary,
.record-events,
.incident-record pre {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(10, 10, 12, 0.7);
}

.record-summary {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
}

.record-summary strong {
  display: block;
  color: var(--text);
  font-size: 22px;
  line-height: 1.1;
}

.record-summary small {
  display: block;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  text-transform: uppercase;
}

.record-events {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
}

.record-events span {
  display: block;
  border-left: 2px solid rgba(19, 236, 128, 0.5);
  padding: 2px 0 2px 8px;
  color: var(--muted-strong);
  line-height: 1.3;
}

.incident-record pre {
  margin: 0;
  padding: 14px;
  overflow: hidden;
  color: #e7e7e8;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.58;
  white-space: pre-wrap;
}

.postmortem-demo {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(14px, 2vw, 18px);
  background: rgba(10, 10, 12, 0.72);
}

.postmortem-demo-header,
.postmortem-demo-actions,
.postmortem-demo-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.postmortem-demo-header,
.postmortem-demo-toolbar {
  justify-content: space-between;
}

.postmortem-demo-header strong {
  color: var(--text);
  font-size: 18px;
  line-height: 1.2;
}

.postmortem-demo-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.postmortem-demo-actions span,
.postmortem-demo-toolbar > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.postmortem-demo-actions button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--mint);
  font: 700 13px/1 var(--font-sans);
  white-space: nowrap;
  box-shadow: 0 12px 24px rgba(19, 236, 128, 0.12);
}

.postmortem-demo-toolbar > span {
  color: var(--muted-strong);
  font-weight: 600;
}

.preview-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(68px, 1fr));
  gap: 2px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.05);
}

.preview-toggle span,
.preview-toggle strong {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  padding: 0 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.preview-toggle strong {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
}

.postmortem-preview {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: clamp(16px, 2.2vw, 22px);
  color: var(--silver-2);
  background: rgba(255, 255, 255, 0.03);
  font-size: 14px;
  line-height: 1.6;
}

.postmortem-preview h3,
.postmortem-preview h4 {
  margin: 0;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: 0;
}

.postmortem-preview h3 {
  font-size: 21px;
  font-weight: 700;
}

.postmortem-preview h4 {
  margin-top: 20px;
  margin-bottom: 8px;
  font-size: 17px;
  font-weight: 700;
}

.postmortem-preview p,
.postmortem-preview ul {
  margin: 8px 0 0;
}

.postmortem-preview ul {
  padding-left: 20px;
}

.postmortem-preview li {
  margin: 4px 0;
}

.postmortem-history-details {
  margin: 18px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
}

.postmortem-history-details summary {
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  line-height: 1.35;
}

.postmortem-history-details summary:focus-visible {
  outline: 2px solid rgba(19, 236, 128, 0.7);
  outline-offset: 4px;
}

.postmortem-history-details[open] .history-event-list {
  animation: history-open 520ms ease both;
}

.history-event-list {
  display: grid;
  gap: 13px;
  padding-top: 12px;
  overflow: hidden;
}

.history-event {
  display: grid;
  gap: 8px;
}

.history-event p {
  margin: 0;
  overflow-wrap: anywhere;
}

.history-event pre {
  margin: 0;
  max-width: 100%;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 12px;
  color: var(--silver-2);
  background: rgba(0, 0, 0, 0.28);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
}

.history-event code {
  font-family: inherit;
  white-space: pre;
}

@keyframes history-open {
  from {
    opacity: 0;
    transform: translateY(-8px);
    max-height: 0;
  }

  to {
    opacity: 1;
    transform: translateY(0);
    max-height: 620px;
  }
}

.incident-proof {
  display: grid;
  grid-template-columns: minmax(240px, 0.28fr) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 32px);
  align-items: start;
  padding: clamp(4px, 1vw, 8px) 0;
}

@media (max-width: 1180px) {
  .incidents-hero-grid,
  .incident-proof {
    grid-template-columns: 1fr;
  }

  .incident-flow-board {
    min-height: 0;
  }

  .incident-timeline {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .incident-record {
    grid-template-columns: 1fr 1fr;
  }

  .incident-record pre {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  body:has(.incidents-page) .page {
    width: 100vw;
    max-width: 100vw;
    padding-inline: 12px;
  }

  body:has(.incidents-page) .topbar {
    overflow: hidden;
  }

  body:has(.incidents-page) .topbar-actions {
    display: none;
  }

  .incident-flow-board,
  .incident-proof {
    border-radius: 20px;
  }

  .incidents-page .detail-hero h1,
  .incidents-page .detail-hero .lead {
    width: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .incidents-page,
  .incidents-hero-grid,
  .incident-flow-board,
  .incident-timeline,
  .incident-step,
  .incident-record,
  .record-summary,
  .record-events,
  .incident-record pre {
    width: min(100%, calc(100vw - 48px));
    max-width: calc(100vw - 48px);
  }

  .incident-step small,
  .record-events span,
  .incident-record pre,
  .postmortem-preview,
  .history-event pre {
    overflow-wrap: anywhere;
  }

  .incident-timeline,
  .incident-record {
    display: block;
  }

  .incident-step,
  .record-summary,
  .record-events,
  .incident-record pre {
    margin-top: 10px;
  }

  .incident-step:first-child,
  .record-summary:first-child {
    margin-top: 0;
  }

  .incident-step {
    min-height: 0;
  }

  .incident-record pre {
    max-height: 260px;
    overflow: auto;
  }

  .postmortem-demo-header,
  .postmortem-demo-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .postmortem-demo-actions {
    justify-content: flex-start;
  }

  .preview-toggle {
    width: 100%;
  }

  .postmortem-preview {
    padding: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .postmortem-history-details[open] .history-event-list {
    animation: none;
  }
}
