/* ── Audit / Activity Log Timeline ── */
.audit-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.audit-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  position: relative;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  transition: background var(--tr);
}

.audit-item:last-child { border-bottom: none; }

.audit-item:hover { background: var(--bg-soft); border-radius: 10px; padding-left: 8px; padding-right: 8px; margin: 0 -8px; }

.audit-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 19px;
  top: 44px;
  bottom: -12px;
  width: 2px;
  background: var(--border);
  z-index: 0;
  opacity: 0.5;
}

.audit-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: var(--bg-soft);
  border: 1.5px solid var(--border);
  position: relative;
  z-index: 1;
  box-shadow: 0 1px 4px rgba(var(--ws-black-rgb), .06);
}

.audit-item.cat-add .audit-icon    { background: var(--ws-success-pastel); border-color: var(--ws-success-light); }
.audit-item.cat-edit .audit-icon   { background: var(--ws-warning-pastel); border-color: var(--ws-warning); }
.audit-item.cat-delete .audit-icon { background: var(--ws-danger-pastel);  border-color: var(--ws-danger-light); }
.audit-item.cat-system .audit-icon { background: var(--ws-info-pastel);    border-color: var(--ws-info); }

.audit-body { flex: 1; min-width: 0; padding-top: 1px; }

.audit-action {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--dark);
  line-height: 1.4;
}

.audit-name {
  color: var(--teal);
  font-weight: 600;
}

.audit-meta {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.audit-meta::before { content: none; }

/* ── Filter chips ── */
.audit-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.audit-chip {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  transition: all var(--tr);
  line-height: 1;
}

.audit-chip:hover {
  color: var(--dark);
  border-color: var(--teal);
  background: var(--bg-soft);
}

.audit-chip.active {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--ws-white);
  box-shadow: 0 2px 8px rgba(var(--ws-accent-rgb), .25);
}

/* ── Empty state ── */
.audit-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 24px;
  color: var(--muted);
}

.audit-empty-icon {
  font-size: 40px;
  opacity: 0.4;
}

.audit-empty-text {
  font-size: 14px;
  font-weight: 500;
}

.audit-empty-sub {
  font-size: 12px;
  opacity: 0.7;
  text-align: center;
}

/* ── Undo / Redo fixed toolbar ── */
#undo-toolbar {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: var(--z-nav);
  display: flex;
  gap: 4px;
}

#undo-toolbar button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--dark);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  box-shadow: 0 1px 4px rgba(var(--ws-black-rgb), .07);
}

#undo-toolbar button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  box-shadow: none;
}

#undo-toolbar button:not(:disabled):hover {
  background: var(--teal);
  color: var(--ws-white);
  border-color: var(--teal);
}

/* ── Dark mode ── */
[data-theme=dark] .audit-item.cat-add .audit-icon    { background: rgba(6,78,59,.5);   border-color: #065f46; }
[data-theme=dark] .audit-item.cat-edit .audit-icon   { background: rgba(120,53,15,.5); border-color: #92400e; }
[data-theme=dark] .audit-item.cat-delete .audit-icon { background: rgba(127,29,29,.5); border-color: #991b1b; }
[data-theme=dark] .audit-item.cat-system .audit-icon { background: rgba(30,27,75,.5);  border-color: #312e81; }

@media (max-width: 600px) {
  .audit-item:not(:last-child)::after { left: 17px; top: 42px; }
  .audit-icon { width: 34px; height: 34px; font-size: 14px; }
  .audit-action { font-size: 13px; }
  .audit-item:hover { padding-left: 4px; padding-right: 4px; margin: 0 -4px; }
}
