/* Audit (#/audit). Scope every rule under .page-audit. Shared components live in styles/app.css. */

.page-audit .au-tools { padding: 0 0 12px; }
.page-audit .au-tools .toolbar { margin-bottom: 0; }
.page-audit .au-status { color: var(--dim); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.page-audit .au-list { display: grid; min-width: 0; }
.page-audit .au-list > .empty { margin: 0 16px 16px; }

/* The events table runs edge to edge inside the card. */
.page-audit .au-table { border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.page-audit .au-table > .table td { vertical-align: top; }

/* Row toggle: the time cell is the expand button. */
.page-audit .au-toggle {
  display: inline-flex; align-items: flex-start; gap: 6px; padding: 2px 4px 2px 0; margin: -2px 0;
  border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; border-radius: var(--radius-sm);
}
.page-audit .au-toggle > .icon { width: 14px; height: 14px; margin-top: 2px; color: var(--dim); flex: none; }
.page-audit .au-toggle:hover .au-time time { color: var(--accent); text-decoration: underline; }
.page-audit .au-toggle:focus-visible { outline: var(--focus); outline-offset: 2px; }
.page-audit .au-time { display: grid; white-space: nowrap; font-variant-numeric: tabular-nums; }
.page-audit .au-row-open td { background: var(--panel-2); }
.page-audit .au-row-open td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

.page-audit .au-actor { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.page-audit .au-actor .icon { width: 14px; height: 14px; color: var(--dim); }
.page-audit .au-actor-admin { color: var(--info); font-weight: 600; }
.page-audit .au-actor-admin .icon { color: var(--info); }

.page-audit .au-action { display: grid; gap: 3px; justify-items: start; }
.page-audit .au-action-label { font-weight: 600; }
.page-audit .au-action-code { color: var(--dim); font-size: 11.5px; }

.page-audit .au-target { color: var(--ink); text-decoration: none; }
.page-audit a.au-target:hover { color: var(--accent); text-decoration: underline; }
.page-audit a.au-target { font-weight: 500; }

.page-audit .au-hidden { display: inline-flex; align-items: center; gap: 4px; color: var(--dim); font-style: italic; }
.page-audit .au-hidden .icon { width: 13px; height: 13px; }

/* Expanded panel. */
.page-audit .au-detail > td { padding: 0; background: var(--panel-2); border-bottom: 1px solid var(--line-strong); }
.page-audit .au-panel {
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr); gap: 18px;
  padding: 14px 16px 16px 34px;
}
.page-audit .au-panel-main { display: grid; gap: 8px; align-content: start; min-width: 0; }
.page-audit .au-panel-title { font-size: var(--fs-xs); font-weight: 600; color: var(--dim); text-transform: uppercase; letter-spacing: 0.03em; }
.page-audit .au-panel-side { display: grid; gap: 10px; align-content: start; min-width: 0; }
.page-audit .au-panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-audit .au-kv-val { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.page-audit .au-diff .table th { position: static; }
.page-audit .au-changed td:last-child { background: var(--accent-bg); }
.page-audit .au-list-val { display: inline-flex; flex-wrap: wrap; gap: 4px 8px; }

/* Pager. */
.page-audit .au-pager { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0 16px; border-top: 1px solid var(--line); }
.page-audit .au-end { display: flex; align-items: center; gap: 6px; padding: 12px 0 16px; color: var(--dim); font-size: var(--fs-xs); border-top: 1px solid var(--line); }
.page-audit .au-end .icon { width: 13px; height: 13px; }

@media (max-width: 1100px) {
  .page-audit .au-panel { grid-template-columns: minmax(0, 1fr); padding-left: 16px; }
}

@media (max-width: 640px) {
  .page-audit .au-tools { padding: 0 12px 12px; }
  .page-audit .au-table { border-top: 0; padding: 0 12px 12px; }
  .page-audit .au-row-open td { background: transparent; }
  .page-audit .au-row-open td:first-child { box-shadow: none; }
  .page-audit .au-row-open { border-color: var(--accent); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .page-audit .au-detail { padding: 0; margin-top: -9px; border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; border-color: var(--accent); }
  .page-audit .au-detail > td { display: block; padding: 0; border: 0; background: transparent; }
  .page-audit .au-detail > td::before { content: none; }
  .page-audit .au-panel { padding: 10px 12px 12px; }
  .page-audit .au-diff .table tr { background: var(--panel); }
  .page-audit .au-pager, .page-audit .au-end { padding: 12px; }
}

/* Rows: a token actor is its name with "integrator token shk_..." beneath, wrapping. */
.page-audit .au-actor-token { white-space: normal; align-items: flex-start; }
.page-audit .au-actor-token .icon { margin-top: 3px; flex: none; }
.page-audit .au-actor-text { display: grid; gap: 2px; min-width: 0; }
.page-audit .au-actor-text .cell-sub { font-size: 11px; overflow-wrap: anywhere; }
.page-audit .au-window { padding: 0 16px 8px; margin: 0; }
.page-audit .au-progress { padding: 12px 16px 0; margin: 0; }
.page-audit .au-statusbox { padding: 0 16px 12px; }
.page-audit .au-statusbox:empty { display: none; }
.page-audit .au-statusbox .au-window { padding: 0; }

/* Long action codes and refusal reasons ("refused: credential_expiry_after_minter") wrap inside
   their cell instead of pushing the page sideways at phone width (400px check). */
.page-audit .au-action { min-width: 0; max-width: 100%; }
.page-audit .au-action > * { min-width: 0; max-width: 100%; }
.page-audit .au-action-code { overflow-wrap: anywhere; }
.page-audit .au-action .pills { display: flex; max-width: 100%; }
.page-audit .au-action .pill { white-space: normal; overflow-wrap: anywhere; max-width: 100%; align-items: flex-start; }
.page-audit .au-action .pill .icon { flex: none; margin-top: 3px; }
