.history-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.history-button span {
  font-size: 1rem;
  line-height: 1;
}

.audit-log-modal {
  width: min(680px, calc(100% - 2rem));
  max-height: min(820px, calc(100dvh - 2rem));
  padding: 0;
  overflow: hidden;
}

.audit-log-shell {
  display: flex;
  max-height: min(820px, calc(100dvh - 2rem));
  flex-direction: column;
}

.audit-log-heading {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid #d6e0ee;
}

.audit-log-heading h2 {
  max-width: 520px;
}

.audit-log-heading p:last-child {
  margin: 0.35rem 0 0;
  color: #64748b;
  font-size: 0.9rem;
}

.audit-log-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.5rem;
  background: #f8fafc;
  border-bottom: 1px solid #d6e0ee;
  color: #64748b;
  font-size: 0.82rem;
}

.audit-log-summary strong {
  color: #14213d;
}

.audit-log-list {
  overflow-y: auto;
  padding: 1.15rem 1.5rem 1.5rem;
}

.audit-entry {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 0.75rem;
}

.audit-entry:not(:last-child) {
  padding-bottom: 1rem;
}

.audit-entry:not(:last-child)::before {
  position: absolute;
  top: 16px;
  bottom: 0;
  left: 7px;
  width: 2px;
  background: #dbe5f2;
  content: "";
}

.audit-entry-marker {
  z-index: 1;
  width: 16px;
  height: 16px;
  margin-top: 0.9rem;
  border: 4px solid #dbeafe;
  border-radius: 50%;
  background: #2563eb;
  box-sizing: border-box;
}

.audit-deleted .audit-entry-marker { border-color: #fee2e2; background: #dc2626; }
.audit-created .audit-entry-marker { border-color: #d1fae5; background: #059669; }
.audit-payment .audit-entry-marker { border-color: #fef3c7; background: #d97706; }
.audit-checkin .audit-entry-marker { border-color: #ede9fe; background: #7c3aed; }

.audit-entry-content {
  min-width: 0;
  padding: 0.85rem 1rem;
  border: 1px solid #dbe3ee;
  border-radius: 14px;
  background: #fff;
}

.audit-entry-heading,
.audit-entry-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.audit-action {
  color: #2563eb;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.audit-entry-heading time {
  color: #64748b;
  font-size: 0.75rem;
  white-space: nowrap;
}

.audit-entry-content > strong {
  display: block;
  margin-top: 0.35rem;
  color: #14213d;
}

.audit-entry-content p {
  margin: 0.25rem 0 0.65rem;
  color: #475569;
  font-size: 0.86rem;
}

.audit-entry-meta {
  padding-top: 0.65rem;
  border-top: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 0.75rem;
}

.audit-entry-meta span:last-child {
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 700;
}

.audit-empty {
  display: grid;
  justify-items: center;
  padding: 3rem 1rem;
  color: #64748b;
  text-align: center;
}

.audit-empty > span {
  margin-bottom: 0.65rem;
  color: #2563eb;
  font-size: 2rem;
}

.audit-empty strong { color: #14213d; }
.audit-empty p { max-width: 330px; margin: 0.35rem 0 0; font-size: 0.86rem; }

@media (max-width: 800px) {
  .event-actions .history-button { grid-column: 1 / -1; }

  .audit-log-modal {
    width: calc(100% - 1rem);
    max-height: calc(100dvh - 1rem);
  }

  .audit-log-shell { max-height: calc(100dvh - 1rem); }
  .audit-log-heading { padding: 1.15rem 1rem 0.85rem; }
  .audit-log-heading h2 { font-size: 1.25rem; }
  .audit-log-summary { padding: 0.7rem 1rem; }
  .audit-log-list { padding: 0.9rem 0.85rem 1rem; }
  .audit-entry { grid-template-columns: 18px minmax(0, 1fr); gap: 0.45rem; }
  .audit-entry:not(:last-child)::before { left: 6px; }
  .audit-entry-marker { width: 14px; height: 14px; }
  .audit-entry-content { padding: 0.75rem; }
  .audit-entry-heading { align-items: flex-start; flex-direction: column; gap: 0.2rem; }
  .audit-entry-heading time { white-space: normal; }
  .audit-entry-meta { align-items: flex-start; flex-direction: column; gap: 0.45rem; }
}
