/* ─────────────────────────────────────────────────────────────
   audit.css — Audit-Log-Viewer
   ───────────────────────────────────────────────────────────── */

/* Vollbild-Overlay */
.audit-view {
  display: none;
  position: fixed;
  inset: 0;
  background: #f4f6f8;
  z-index: 1500;
  overflow-y: auto;
  flex-direction: column;
}
.audit-view.visible {
  display: flex;
}

/* Header */
.audit-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--theme-bg-dark, #0d2840) 0%, var(--theme-primary, #1565a8) 100%);
  color: white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.audit-header h2 {
  flex: 1;
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}
.audit-back, .audit-export {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 7px 14px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.audit-back:hover, .audit-export:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Stats-Cards */
.audit-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  padding: 20px 24px;
}
.audit-stat-loading {
  grid-column: 1 / -1;
  text-align: center;
  color: #6b7785;
  font-style: italic;
}
.audit-stat-card {
  background: white;
  border-radius: 8px;
  padding: 14px 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.audit-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7785;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.audit-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--theme-primary, #0d2840);
}
.audit-stat-ok    { color: #2e8540; }
.audit-stat-bad   { color: #c44b1c; }
.audit-stat-list-card .audit-stat-value { display: none; }
.audit-stat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12px;
}
.audit-stat-list li {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid #eef0f3;
}
.audit-stat-list li:last-child { border-bottom: none; }
.audit-stat-list code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  color: #4a5664;
}
.audit-stat-num {
  font-weight: 700;
  color: var(--theme-primary, #0d2840);
}

/* Filter-Bar */
.audit-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  padding: 0 24px 16px;
  align-items: end;
}
.audit-filter-wide { grid-column: span 2; }
.audit-filter label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #6b7785;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.audit-filter input,
.audit-filter select {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid #d8dee5;
  border-radius: 5px;
  font-size: 13px;
  background: white;
}
.audit-filter input:focus,
.audit-filter select:focus {
  outline: none;
  border-color: var(--theme-primary, #0d2840);
  box-shadow: 0 0 0 2px rgba(0, 53, 128, 0.12);
}
.audit-apply {
  background: var(--theme-primary, #0d2840);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 4px;
}
.audit-reset {
  background: white;
  color: #4a5664;
  border: 1px solid #d8dee5;
  padding: 7px 12px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* Tabelle */
.audit-table-wrap {
  background: white;
  margin: 0 24px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  overflow-x: auto;
}
.audit-loading, .audit-empty, .audit-error {
  padding: 50px 20px;
  text-align: center;
  color: #6b7785;
  font-style: italic;
  font-size: 13px;
}
.audit-error { color: #c44b1c; }

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.audit-table th {
  background: #f4f6f8;
  text-align: left;
  padding: 9px 12px;
  font-weight: 600;
  color: #4a5664;
  border-bottom: 2px solid #d8dee5;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  position: sticky;
  top: 0;
  z-index: 1;
}
.audit-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #eef0f3;
  vertical-align: top;
}
.audit-table tr:hover td { background: #fafbfc; }

.col-time     { white-space: nowrap; font-variant-numeric: tabular-nums; color: #6b7785; font-size: 11px; }
.col-action   { white-space: nowrap; }
.col-resource code { font-size: 10px; background: #f4f6f8; padding: 1px 5px; border-radius: 3px; }
.col-ip       { font-variant-numeric: tabular-nums; color: #6b7785; font-size: 11px; }
.col-details  { color: #4a5664; }

/* Action-Badges */
.action-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.act-info     { background: #d1ecf1; color: #0c5460; }
.act-success  { background: #d4edda; color: #155724; }
.act-warning  { background: #fff3cd; color: #856404; }
.act-danger   { background: #f8d7da; color: #721c24; }
.act-export   { background: #e2d5f0; color: #4a2868; }
.act-default  { background: #e9ecef; color: #4a5664; }

/* User-Cell */
.user-cell { display: flex; flex-direction: column; gap: 2px; }
.user-email { font-weight: 600; color: #1a2332; }
.user-role { font-size: 10px; color: #6b7785; text-transform: uppercase; letter-spacing: 0.3px; }
.user-system { color: #6b7785; }

/* Metadaten */
.meta-row { line-height: 1.5; }
.meta-key {
  color: #6b7785;
  font-size: 11px;
  font-weight: 600;
}
.meta-val {
  color: #1a2332;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
}

/* Pagination */
.audit-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px 32px;
  gap: 16px;
}
.audit-pagination button {
  background: white;
  color: var(--theme-primary, #0d2840);
  border: 1px solid #d8dee5;
  padding: 7px 14px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.audit-pagination button:hover {
  border-color: var(--theme-primary, #0d2840);
  background: #f0f7ff;
}
.audit-page-info {
  font-size: 12px;
  color: #6b7785;
  font-weight: 500;
}

@media (max-width: 700px) {
  .audit-filters { grid-template-columns: 1fr 1fr; padding: 0 12px 12px; }
  .audit-filter-wide { grid-column: span 2; }
  .audit-table-wrap { margin: 0 12px; font-size: 11px; }
  .col-details { display: none; }
  .col-resource { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
}
