/* screens/audit-log.css — audit-log screen styles (Stage 9 retrofit owner: this file).
 * ------------------------------------------------------------------
 * Phase 7 PR7.6 — Audit log viewer (spec §3.7), reskinned onto the
 * Stage 9 brand tokens. The page is a page-head, a `.toolbar--card`
 * filter bar, and a `.table-card` list of expandable audit rows with a
 * cursor-pager footer. Desktop is capped at 1200px (matches the spec's
 * "desktop max-width 1200px" requirement).
 * ------------------------------------------------------------------ */

.audit-log-page {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* --- filter bar -----------------------------------------------------
 * `.toolbar.toolbar--card` supplies the card chrome; the scoped rules
 * below stack the three filter rows vertically. */

.audit-log-filters {
  flex-direction: column;
  align-items: stretch;
  gap: var(--brand-size-sm);
}

.audit-log-filters__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--brand-size-sm);
  align-items: flex-end;
}

.audit-log-filters__chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--brand-size-xxs);
  align-items: center;
}

.audit-log-filters__chip-group-label {
  font-size: var(--brand-font-size-sm);
  color: var(--brand-color-text-tertiary);
  font-weight: var(--brand-font-weight-strong);
  margin-right: var(--brand-size-xxs);
}

.audit-log-filters__field {
  display: flex;
  flex-direction: column;
  gap: var(--brand-size-xxs);
  font-size: var(--brand-font-size-sm);
  color: var(--brand-color-text-tertiary);
  font-weight: var(--brand-font-weight-strong);
  min-width: 0;
}

.audit-log-filters__field input {
  min-width: 160px;
}

.audit-log-filters__field--date input {
  min-width: 140px;
}

.audit-log-filters__date-range {
  display: flex;
  flex-wrap: wrap;
  gap: var(--brand-size-xs);
  align-items: flex-end;
}

.audit-log-filters__actor-preset {
  align-self: flex-end;
}

@media (max-width: 600px) {
  .audit-log-filters__row {
    flex-direction: column;
    align-items: stretch;
  }

  .audit-log-filters__field {
    width: 100%;
  }

  .audit-log-filters__field input {
    width: 100%;
    min-width: 0;
  }
}

/* --- list ------------------------------------------------------------ */

.audit-log-list {
  display: flex;
  flex-direction: column;
}

/* Expandable rows read as one divided list inside the table card —
 * border separators instead of cards-in-card. */
.audit-log-row {
  border-bottom: var(--brand-line-width) solid var(--brand-color-border-secondary);
  transition: background var(--brand-motion-duration-fast) var(--brand-motion-ease-out);
}

.audit-log-row:last-child {
  border-bottom: 0;
}

.audit-log-row:hover {
  background: var(--brand-color-fill-quaternary);
}

.audit-log-row__header {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.audit-log-row__header:focus-visible {
  outline: calc(2 * var(--brand-line-width)) solid var(--brand-primary-palette-2);
  outline-offset: calc(-2 * var(--brand-line-width));
}

.audit-log-row__summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--brand-size-xs);
  align-items: center;
  padding: var(--brand-size-sm) var(--brand-size-md);
  font-size: var(--brand-font-size);
}

.audit-log-row__icon {
  font-size: var(--brand-font-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--brand-control-height-sm);
  height: var(--brand-control-height-sm);
  background: var(--brand-color-fill-tertiary);
  border-radius: var(--brand-border-radius-sm);
  flex-shrink: 0;
}

.audit-log-row__event {
  font-family: var(--brand-font-family-code);
  font-size: var(--brand-font-size-sm);
  color: var(--brand-color-text);
  font-weight: var(--brand-font-weight-strong);
}

.audit-log-row__actor {
  color: var(--brand-color-text-secondary);
  font-size: var(--brand-font-size-sm);
}

.audit-log-row__time {
  color: var(--brand-color-text-tertiary);
  font-size: var(--brand-font-size-sm);
  margin-left: auto;
}

.audit-log-row__sep {
  color: var(--brand-color-text-quaternary);
  font-size: var(--brand-font-size-sm);
}

.audit-log-row__detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--brand-size-sm);
  padding: var(--brand-size-sm) var(--brand-size-md) var(--brand-size-md);
  border-top: var(--brand-line-width) solid var(--brand-color-border-secondary);
  background: var(--brand-color-fill-quaternary);
}

@media (min-width: 700px) {
  .audit-log-row__detail {
    grid-template-columns: 1fr 1fr;
  }
}

.audit-log-row__detail-block {
  display: flex;
  flex-direction: column;
  gap: var(--brand-size-xxs);
  min-width: 0;
}

.audit-log-row__detail-label {
  margin: 0;
  font-size: var(--brand-font-size-sm);
  font-weight: var(--brand-font-weight-strong);
  color: var(--brand-color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em; /* tracking — documented raw value */
}

.audit-log-row__pre {
  margin: 0;
  background: var(--brand-color-fill-tertiary);
  border-radius: var(--brand-border-radius-sm);
  padding: var(--brand-size-xs) var(--brand-size-sm);
  font-family: var(--brand-font-family-code);
  font-size: var(--brand-font-size-sm);
  color: var(--brand-color-text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow: auto;
}

.audit-log-row__muted {
  margin: 0;
  color: var(--brand-color-text-tertiary);
  font-style: italic;
  font-size: var(--brand-font-size-sm);
}
