/* Admin audit log — read-only history of every AuditEvent in the
 * audience-marketing module. Per EVENT_SYSTEM_BRIEFING.md §5.
 *
 * Pulls neutral tokens only (no domain tints): the audit page is a
 * cross-cutting admin surface, not a domain page. */

.audit-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  font-family: -apple-system, BlinkMacSystemFont, Inter, "Segoe UI", system-ui, sans-serif;
  color: #1c1917;
}

.audit-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 24px;
}

.audit-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.audit-subtitle {
  font-size: 12.5px;
  color: #57534e;
  margin-top: 4px;
}

.audit-tools {
  display: flex;
  gap: 8px;
}

.audit-btn {
  font-size: 12.5px;
  padding: 5px 10px;
  background: #ffffff;
  border: 1px solid #e7e5e4;
  border-radius: 4px;
  color: #1c1917;
  text-decoration: none;
  cursor: pointer;
  display: inline-block;
}

.audit-btn:hover {
  background: #f5f5f4;
  border-color: #d6d3d1;
}

.audit-btn-muted {
  color: #57534e;
}

/* Table — real <table> structure so the viewport controller can
 * append <tr> rows from the JSON batch endpoint into <tbody>.
 * Sticky <thead> stays pinned to the top of the scroll viewport. */
.audit-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #ffffff;
  font-size: 13px;
}

.audit-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5f5f4;
  border-bottom: 1px solid #e7e5e4;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #57534e;
  text-align: left;
}

.audit-table thead th.audit-col-status { text-align: right; }

.audit-col-time     { width: 160px; }
.audit-col-actor    { width: 200px; }
.audit-col-record   { width: 280px; }
.audit-col-status   { width: 90px; text-align: right; }

.audit-row {
  font-size: 13px;
  color: #1c1917;
  cursor: pointer;
}

.audit-row td {
  padding: 10px 16px;
  border-bottom: 1px solid #e7e5e4;
  vertical-align: middle;
  font-size: 12.5px;
}

.audit-row td.audit-col-time {
  color: #57534e;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.audit-row td.audit-col-actor {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.audit-row td.audit-col-record {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}

.audit-row:hover,
.audit-row-expanded { background: #f5f5f4; }
.audit-row-undone   { opacity: 0.55; }
.audit-row-undone .audit-col-operation { text-decoration: line-through; text-decoration-color: #a8a29e; }

.audit-detail-row td {
  padding: 0;
  background: #ffffff;
  border-bottom: 1px solid #d6d3d1;
}

.audit-empty {
  background: #ffffff;
  border: 1px solid #e7e5e4;
  border-radius: 6px;
  text-align: center;
  color: #a8a29e;
  font-style: italic;
  padding: 32px;
}

.audit-record-type {
  color: #57534e;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-right: 6px;
  font-weight: 500;
}

/* The viewport (bounded scrollable area) on the admin audit page —
 * shared chrome with the AM index pages. The cp-viewport-*
 * primitives live in campaigns.css and are imported by the page;
 * we don't redefine them here. */

.audit-description {
  color: #1c1917;
  line-height: 1.4;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-description .label {
  color: #57534e;
}

.audit-description .value {
  color: #1c1917;
  font-weight: 500;
}

.audit-description .old {
  color: #57534e;
  text-decoration: line-through;
  text-decoration-color: #a8a29e;
}

.audit-description .arrow {
  color: #a8a29e;
  margin: 0 2px;
}

.audit-description .ref {
  color: #a8a29e;
  font-size: 11px;
}

.audit-status {
  font-size: 11px;
  text-align: right;
}

.audit-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 8px;
  background: #f5f5f4;
  color: #57534e;
  font-weight: 500;
  font-size: 11px;
  text-transform: lowercase;
}

.audit-badge-reversal {
  background: #eef2ff;
  color: #4338ca;
}

.audit-badge-reversed {
  background: #f5f5f4;
  color: #57534e;
}

/* Inline detail drawer */
.audit-detail {
  background: #ffffff;
  border-top: 1px solid #d6d3d1;
  border-bottom: 1px solid #d6d3d1;
  padding: 16px 16px 16px 32px;
}

.audit-detail-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #57534e;
  font-weight: 600;
  margin-bottom: 12px;
}

.audit-detail-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 16px;
  font-size: 12.5px;
  margin: 0;
}

.audit-detail-grid dt {
  color: #57534e;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.audit-detail-grid dd {
  margin: 0;
  color: #1c1917;
  overflow-wrap: break-word;
}

.audit-detail-grid dd pre {
  margin: 0;
  padding: 8px 10px;
  background: #f5f5f4;
  border-radius: 4px;
  font-size: 11.5px;
  font-family: ui-monospace, Menlo, monospace;
  color: #1c1917;
  overflow-x: auto;
  line-height: 1.5;
}

.audit-detail-grid dd code {
  background: #f5f5f4;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-family: ui-monospace, Menlo, monospace;
}

.audit-link {
  color: #2563eb;
  text-decoration: none;
}

.audit-link:hover {
  text-decoration: underline;
}

.audit-single-row .audit-row {
  cursor: default;
}
