/* Change history and audit log.
   Owned by the change-history workstream. Every colour is a custom property
   from app.css so light and dark mode both work; nothing here is hard-coded.
   All new class names are prefixed `sn-` so they cannot collide with the
   shared design system or another workstream's stylesheet. */

/* ---------- shared bits ---------- */

.sn-pill-neutral {
  background: var(--surface-2);
  color: var(--muted);
  border-color: var(--line-strong);
}

/* Critical means "reachable from the internet". It is the one severity that
   fills rather than tints, so it cannot be mistaken for a warning. --bg is
   light in light mode and dark in dark mode, so it stays readable on --danger. */
.sn-pill-critical {
  background: var(--danger);
  color: var(--bg);
  border-color: var(--danger);
}

.sn-loading { padding: 6px 0 2px; }
.sn-error { display: grid; gap: 8px; justify-items: start; }
.sn-arrow { color: var(--muted); }

.sn-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- picker and timeline ---------- */

.sn-picker-field { max-width: 340px; margin-bottom: 14px; }

.sn-timeline {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.sn-timeline-head,
.sn-timeline-row {
  display: grid;
  grid-template-columns: 52px 52px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.sn-timeline-head {
  padding: 8px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.sn-timeline-head .eyebrow { text-align: center; }
.sn-timeline-head .eyebrow:last-child { text-align: left; }

.sn-timeline-row { padding: 9px 12px; border-bottom: 1px solid var(--line); }
.sn-timeline-row:last-child { border-bottom: 0; }
.sn-timeline-row:hover { background: var(--surface-2); }

.sn-radio {
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 6px 0;
}
.sn-radio input { accent-color: var(--accent); margin: 0; cursor: pointer; }

.sn-snapshot { display: grid; gap: 1px; min-width: 0; }
.sn-snapshot strong { font-size: 13px; font-weight: 600; }
.sn-snapshot .muted { font-size: 11px; }
.sn-snapshot-facts {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- diff results ---------- */

.sn-compared { margin-bottom: 14px; display: flex; gap: 6px; flex-wrap: wrap; }

/* Two identical snapshots are a result, not an empty state. */
.sn-verdict {
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid var(--ok);
  margin-bottom: 16px;
}

.sn-summary { margin-bottom: 18px; }

.sn-section { margin-bottom: 20px; }
.sn-section:last-child { margin-bottom: 0; }

.sn-group-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 9px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.sn-group-head h3 { text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.sn-count {
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.sn-group-head .muted { margin-left: auto; font-size: 11px; }

/* ---------- highlights ---------- */

.sn-critical-banner {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid var(--danger);
  border-left-width: 4px;
  margin-bottom: 10px;
}

.sn-highlights { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

.sn-highlight {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}
.sn-highlight > .pill { margin-top: 2px; }

.sn-highlight-critical {
  border-color: var(--danger);
  border-left-width: 4px;
  background: var(--danger-soft);
}

.sn-highlight-body { display: grid; gap: 2px; min-width: 0; }
.sn-highlight-summary { font-size: 13px; overflow-wrap: anywhere; }
.sn-highlight-meta { font-size: 11px; color: var(--muted); }
.sn-highlight-critical .sn-highlight-summary { font-weight: 600; color: var(--danger); }
.sn-highlight-critical .sn-highlight-meta { color: var(--danger); }

/* ---------- resource groups ---------- */

.sn-resources { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.sn-resource {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  background: var(--surface-2);
  display: grid;
  gap: 7px;
}

.sn-resource-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.sn-resource-main {
  display: grid;
  gap: 1px;
  min-width: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
}
button.sn-resource-main { cursor: pointer; }
button.sn-resource-main:hover .sn-resource-name { color: var(--accent); text-decoration: underline; }
button.sn-resource-main:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.sn-resource-name { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.sn-resource-meta { font-size: 11px; color: var(--muted); }

.sn-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- field and tag changes ---------- */

.sn-changes {
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.sn-change {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
}
.sn-change-field {
  min-width: 150px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}
.sn-change-critical .sn-change-field,
.sn-change-critical .sn-value-to { color: var(--danger); font-weight: 700; }

.sn-value {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow-wrap: anywhere;
}
.sn-value-to { border-color: var(--line-strong); color: var(--ink); }

.sn-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.sn-chip {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.sn-chip-added { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.sn-chip-removed { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }

.sn-relationships { display: grid; gap: 4px; margin-top: 16px; }

/* ---------- audit log ---------- */

.sn-audit { margin-bottom: 10px; }
.sn-audit-foot { display: grid; gap: 8px; justify-items: start; }

/* ---------- narrow screens ---------- */

@media (max-width: 720px) {
  .sn-summary { grid-template-columns: repeat(2, 1fr); }
  .sn-highlight { grid-template-columns: auto minmax(0, 1fr); }
  .sn-highlight .btn { grid-column: 2; justify-self: start; }
  .sn-change-field { min-width: 0; flex-basis: 100%; }
}
