/* Security incidents — dedicated triage view */

.incidents-workspace {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

/* ── Live verification banner ─────────────────────────────── */

.incidents-verify-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.04));
  color: var(--shell-text-secondary);
}

.incidents-verify-banner[hidden] {
  display: none !important;
}

.incidents-verify-banner-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.55);
  animation: incident-verify-pulse 1.4s infinite;
  flex-shrink: 0;
}

@keyframes incident-verify-pulse {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.incidents-verify-banner-copy {
  display: grid;
  gap: 2px;
}

.incidents-verify-banner-copy strong {
  color: var(--shell-text);
  font-size: 0.84rem;
}

.incidents-verify-banner-copy span {
  font-size: 0.76rem;
  line-height: 1.45;
}

/* ── Status strip ─────────────────────────────────────────── */

.incidents-status-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 12px;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-sm);
  background: var(--shell-panel);
  font-size: 0.76rem;
  color: var(--shell-text-secondary);
  line-height: 1.4;
}

.incidents-status-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.incidents-status-strip.is-clear .incidents-status-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.incidents-status-strip.is-empty .incidents-status-dot {
  background: var(--shell-muted);
  box-shadow: none;
}

.incidents-status-text {
  font-weight: 600;
  color: var(--shell-text);
}

.incidents-status-meta {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--shell-muted);
  white-space: nowrap;
}

/* ── Toolbar ──────────────────────────────────────────────── */

.incidents-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-md);
  background: var(--shell-elevated);
}

.incidents-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 200px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-sm);
  background: var(--shell-panel);
}

.incidents-search-wrap svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--shell-muted);
}

.incidents-search-wrap input {
  flex: 1;
  min-width: 0;
  padding: 8px 0;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--shell-text);
  outline: none;
}

.incidents-queue-chips,
.incidents-risk-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--shell-panel);
  border: 1px solid var(--shell-border);
}

.incidents-queue-chip,
.incidents-risk-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--shell-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
}

.incidents-queue-chip:hover,
.incidents-risk-chip:hover {
  color: var(--shell-text-secondary);
}

.incidents-queue-chip.is-active,
.incidents-risk-chip.is-active {
  color: var(--shell-text);
  background: var(--shell-elevated);
  box-shadow: var(--shadow-xs);
}

.incidents-queue-chip[data-status="open"].is-active { color: var(--danger); }
.incidents-queue-chip[data-status="acknowledged"].is-active { color: var(--warn); }
.incidents-queue-chip[data-status="verifying"].is-active { color: var(--accent); }
.incidents-queue-chip[data-status="closed"].is-active { color: var(--success); }
.incidents-risk-chip[data-risk-filter="high"].is-active { color: var(--danger); }
.incidents-risk-chip[data-risk-filter="medium"].is-active { color: var(--warn); }

.incidents-queue-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  color: inherit;
  background: rgba(15, 23, 42, 0.06);
}

.incidents-toolbar-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

/* ── Layout ───────────────────────────────────────────────── */

.incidents-layout {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 0;
}

.incidents-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: calc(var(--header-height) + 12px);
}

.incidents-card {
  padding: 14px 16px;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-md);
  background: var(--shell-panel);
}

.incidents-card h3 {
  margin: 0 0 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--shell-muted);
}

.incidents-breakdown {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.incidents-breakdown li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--shell-elevated);
  font-size: 0.76rem;
}

.incidents-breakdown-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--shell-text-secondary);
  font-weight: 500;
  min-width: 0;
}

.incidents-breakdown-label span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.incidents-breakdown-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.incidents-breakdown-dot.is-danger { background: var(--danger); }
.incidents-breakdown-dot.is-warn { background: var(--warn); }
.incidents-breakdown-dot.is-success { background: var(--success); }
.incidents-breakdown-dot.is-muted { background: var(--shell-muted); }
.incidents-breakdown-dot.is-accent { background: var(--shell-accent); }

.incidents-breakdown-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--shell-text);
  flex-shrink: 0;
}

.incidents-tips {
  margin: 0;
  padding-left: 16px;
  font-size: 0.72rem;
  color: var(--shell-muted);
  line-height: 1.5;
}

.incidents-tips li + li {
  margin-top: 8px;
}

.incidents-tips a {
  color: var(--shell-accent);
  text-decoration: none;
  font-weight: 600;
}

.incidents-tips a:hover {
  text-decoration: underline;
}

/* ── Incident list ────────────────────────────────────────── */

.incidents-main {
  min-width: 0;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-md);
  background: var(--shell-panel);
  overflow: hidden;
}

.incidents-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--shell-border);
  background: var(--shell-elevated);
}

.incidents-list-head h3 {
  margin: 0 0 3px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--shell-text);
}

.incidents-list-lead {
  margin: 0;
  font-size: 0.72rem;
  color: var(--shell-muted);
  line-height: 1.4;
  max-width: 48ch;
}

.incidents-count-label {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
}

.incidents-list {
  display: flex;
  flex-direction: column;
}

.incidents-loading,
.incidents-empty,
.incidents-error {
  padding: 48px 24px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--shell-muted);
  line-height: 1.5;
}

.incidents-error {
  color: var(--danger);
}

.incidents-empty-cta {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Incident row ─────────────────────────────────────────── */

.incident-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--shell-border);
  transition: background 0.1s;
}

.incident-row:last-child {
  border-bottom: none;
}

.incident-row:hover {
  background: var(--shell-elevated);
}

.incident-row.is-high {
  background: linear-gradient(90deg, var(--danger-soft) 0%, transparent 50%);
}

.incident-row.is-medium {
  background: linear-gradient(90deg, var(--warn-soft) 0%, transparent 45%);
}

.incident-risk {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--shell-border);
  background: var(--shell-elevated);
}

.incident-row.is-high .incident-risk {
  border-color: var(--danger-border);
  background: var(--danger-soft);
}

.incident-row.is-medium .incident-risk {
  border-color: var(--warn-border);
  background: var(--warn-soft);
}

.incident-risk-value {
  font-size: 0.9rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--shell-text);
  line-height: 1;
}

.incident-row.is-high .incident-risk-value { color: var(--danger); }
.incident-row.is-medium .incident-risk-value { color: var(--warn); }

.incident-risk-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--shell-muted);
  margin-top: 2px;
}

.incident-row-body {
  min-width: 0;
}

.incident-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.incident-threat {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--shell-text);
}

.incident-row-time {
  font-size: 0.68rem;
  color: var(--shell-muted);
}

.incident-status-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: capitalize;
  border: 1px solid transparent;
}

.incident-status-pill.status-open {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-border);
}

.incident-status-pill.status-acknowledged {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: var(--warn-border);
}

.incident-status-pill.status-verifying {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-border, rgba(59, 130, 246, 0.25));
}

.incident-status-pill.status-closed,
.incident-status-pill.status-resolved {
  color: var(--success);
  background: var(--success-soft);
  border-color: var(--success-border);
}

.incident-verify-hint {
  margin-top: 8px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  line-height: 1.45;
  border: 1px solid var(--shell-border);
  background: var(--shell-elevated);
  color: var(--shell-text-secondary);
}

.incident-verify-hint.is-running {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(59, 130, 246, 0.2);
}

.incident-verify-hint.is-pass {
  color: var(--success);
  background: var(--success-soft);
  border-color: var(--success-border);
}

.incident-verify-hint.is-fail {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-border);
}

.incident-verify-tasks {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
  font-size: 0.82rem;
}

.incident-verify-tasks .is-pass {
  color: var(--success);
}

.incident-verify-tasks .is-fail {
  color: var(--danger);
}

.incident-field {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--shell-text-secondary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.incident-context {
  font-size: 0.7rem;
  color: var(--shell-muted);
  font-family: var(--font-mono);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.incident-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.incident-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--shell-text-secondary);
  background: var(--shell-elevated);
  border: 1px solid var(--shell-border);
}

.incident-chip.is-action-block {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-border);
}

.incident-chip.is-action-monitor {
  color: var(--shell-accent);
  background: var(--shell-active);
  border-color: var(--accent-muted);
}

.incident-row-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  flex-shrink: 0;
  min-width: 130px;
}

.incident-row-actions .sr-select {
  font-size: 0.72rem;
  padding: 6px 8px;
}

.incident-row-actions .btn {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Hide unrelated panels on incidents view */
body[data-monitor-view="incidents"] #live-banner,
body[data-monitor-view="incidents"] #attention-panel {
  display: none !important;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 1100px) {
  .incidents-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .incidents-toolbar-actions {
    margin-left: 0;
    justify-content: flex-end;
  }
}

@media (max-width: 960px) {
  .incidents-layout {
    grid-template-columns: 1fr;
  }

  .incidents-sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .incidents-triage-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .incidents-sidebar {
    grid-template-columns: 1fr;
  }

  .incident-row {
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .incident-risk {
    width: 44px;
    height: 44px;
  }

  .incident-risk-value {
    font-size: 0.78rem;
  }

  .incident-row-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    min-width: 0;
    padding-left: 56px;
  }

  .incident-row-actions .btn {
    width: auto;
  }

  .incidents-status-meta {
    margin-left: 0;
    width: 100%;
  }
}
