.audit-view {
  gap: 16px;
}

.nav-item[hidden] {
  display: none !important;
}

.audit-heading .page-actions {
  align-items: center;
}

.audit-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.audit-metric {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid #dce5f1;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(35, 61, 91, .06);
}

.audit-metric span,
.audit-metric small {
  display: block;
  color: #65758b;
  font-size: 12px;
}

.audit-metric strong {
  display: block;
  margin: 5px 0 3px;
  color: #132f51;
  font-size: 23px;
  line-height: 1.15;
}

.audit-metric.success strong { color: #13845b; }
.audit-metric.scope strong { font-size: 17px; line-height: 1.55; }

.audit-panel {
  overflow: hidden;
}

.audit-filters {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) repeat(2, minmax(140px, .9fr)) repeat(3, minmax(135px, .9fr));
  gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #e4eaf2;
  background: #f8fafc;
}

.audit-filter {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #55667b;
  font-size: 11px;
  font-weight: 700;
}

.audit-filter input,
.audit-filter select,
.audit-search input {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #cfd9e6;
  border-radius: 5px;
  background: #fff;
  color: #243b55;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
}

.audit-filter input:focus,
.audit-filter select:focus,
.audit-search input:focus {
  border-color: #2878d0;
  outline: 2px solid rgba(40, 120, 208, .12);
}

.audit-filter-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 10px;
  padding: 10px 16px 14px;
  border-bottom: 1px solid #dfe7f1;
  background: #f8fafc;
}

.audit-search {
  position: relative;
}

.audit-search input {
  padding-left: 34px;
}

.audit-search span {
  position: absolute;
  top: 9px;
  left: 11px;
  color: #718096;
}

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

.audit-filter-actions .button {
  min-width: 78px;
  height: 36px;
}

.audit-table-wrap {
  min-height: 360px;
  overflow: auto;
}

.audit-table {
  min-width: 1160px;
}

.audit-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f3f7fb;
  white-space: nowrap;
}

.audit-table td {
  height: 58px;
  vertical-align: middle;
}

.audit-table td small {
  display: block;
  margin-top: 3px;
  color: #7a889a;
  font-size: 11px;
}

.audit-time {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.audit-summary {
  max-width: 310px;
}

.audit-summary b,
.audit-entity {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-code {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border-radius: 4px;
  background: #eaf2fb;
  color: #245f9f;
  font-size: 11px;
  font-weight: 700;
}

.audit-result,
.audit-source {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.audit-result.success { background: #e7f6ef; color: #147451; }
.audit-result.failed { background: #fdeceb; color: #b43b35; }
.audit-result.denied { background: #fff1dc; color: #9a6115; }
.audit-source { background: #edf0f5; color: #536479; }
.audit-source.mobile { background: #e8f2ff; color: #2368ad; }

.audit-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 10px 16px;
  border-top: 1px solid #e1e8f0;
  background: #fff;
}

.audit-pagination-info {
  color: #68788c;
  font-size: 12px;
}

.audit-pagination-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.audit-pagination-actions button {
  width: 34px;
  height: 32px;
  border: 1px solid #d4deea;
  border-radius: 4px;
  background: #fff;
  color: #2a496b;
  cursor: pointer;
}

.audit-pagination-actions button:disabled {
  color: #a9b3c0;
  cursor: default;
  background: #f6f8fa;
}

.audit-pagination-actions span {
  min-width: 86px;
  text-align: center;
  color: #40546b;
  font-size: 12px;
}

.audit-detail-dialog {
  width: min(980px, calc(100vw - 32px));
  max-width: 980px;
}

.audit-detail-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 4px 0 14px;
  overflow: hidden;
  border: 1px solid #dfe7f0;
  border-radius: 6px;
  background: #dfe7f0;
}

.audit-detail-meta div {
  min-width: 0;
  padding: 10px 12px;
  background: #f9fbfd;
}

.audit-detail-meta span,
.audit-detail-meta small {
  display: block;
  overflow: hidden;
  color: #738197;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-detail-meta b {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: #243b55;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-change-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.audit-data-block {
  min-width: 0;
}

.audit-data-block h3 {
  margin: 0 0 7px;
  color: #314b68;
  font-size: 13px;
}

.audit-data-block pre {
  min-height: 180px;
  max-height: 340px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  border: 1px solid #d9e2ed;
  border-radius: 5px;
  background: #f6f8fb;
  color: #27415e;
  font: 12px/1.55 Consolas, "Microsoft YaHei", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.audit-context-block {
  margin-top: 12px;
}

.audit-context-block pre {
  min-height: 72px;
  max-height: 140px;
}

@media (max-width: 1180px) {
  .audit-filters { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .audit-detail-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body.audit-mode { min-width: 0; }
  body.audit-mode .sidebar { width: 64px; padding: 12px 8px; overflow-y: auto; }
  body.audit-mode .brand { justify-content: center; margin: 0 0 16px; }
  body.audit-mode .brand > span { display: none; }
  body.audit-mode .sidebar nav { gap: 3px; }
  body.audit-mode .nav-item { width: 48px; padding: 0; justify-content: center; gap: 0; font-size: 0; }
  body.audit-mode .nav-item span { font-size: 11px; }
  body.audit-mode .sidebar-footer { justify-content: center; padding: 10px 0 0; }
  body.audit-mode .sidebar-footer .operator { display: none; }
  body.audit-mode .workspace { width: calc(100vw - 64px); }
  body.audit-mode .topbar { height: 52px; padding: 0 12px; }
  body.audit-mode .topbar .business-date { display: none; }
  body.audit-mode .store-select select { min-width: 0; max-width: 190px; }
  body.audit-mode .audit-view { padding: 14px 12px 24px; }
  .audit-view { gap: 12px; }
  .audit-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit-metric { padding: 12px; }
  .audit-filters { grid-template-columns: 1fr 1fr; padding: 12px; }
  .audit-filter-row { grid-template-columns: 1fr; padding: 10px 12px 12px; }
  .audit-filter-actions { justify-content: flex-end; }
  .audit-table-wrap { min-height: 320px; }
  .audit-pagination { align-items: flex-start; flex-direction: column; }
  .audit-pagination-actions { align-self: flex-end; }
  .audit-change-grid { grid-template-columns: 1fr; }
  .audit-detail-meta { grid-template-columns: 1fr 1fr; }
  .audit-data-block pre { min-height: 130px; }
}

@media (max-width: 460px) {
  .audit-metrics,
  .audit-filters,
  .audit-detail-meta { grid-template-columns: 1fr; }
  .audit-filter-actions .button { flex: 1; }
}

@media (max-width: 760px) {
  body.audit-mode .workspace { margin-left: 64px; }
}
