/* Audit Log page — scoped styles; uses existing CRM theme tokens. */
.audit-log-page {
  min-width: 0;
}
.audit-page-head {
  align-items: flex-start;
  margin-bottom: 22px;
}
.audit-page-head .set-head__title {
  font-size: 26px;
  line-height: 1.25;
  font-weight: 700;
}
.audit-page-head .set-head__sub {
  margin: 5px 0 0;
  color: var(--text-muted, #667085);
  font-size: 14px;
}
.audit-topbar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin: 22px 0 14px;
  min-width: 0;
  flex-wrap: nowrap;
}
.audit-view-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  gap: 0;
  border-bottom: 1px solid var(--border-strong, #d0d5dd);
}
.audit-view-tab {
  margin-bottom: -1px;
  padding: 12px 22px;
  border: 1px solid var(--border-strong, #d0d5dd);
  border-left-width: 0;
  background: var(--surface-2, #f9fafb);
  color: var(--text-muted, #667085);
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.audit-view-tab:first-child {
  border-left-width: 1px;
  border-top-left-radius: var(--radius-sm, 8px);
}
.audit-view-tab:last-child {
  border-top-right-radius: var(--radius-sm, 8px);
}
.audit-view-tab:hover {
  background: var(--surface-hover, #f2f4f7);
  color: var(--text, #101828);
}
.audit-view-tab.is-active {
  background: var(--bg, #fff);
  color: var(--text, #101828);
  border-bottom-color: var(--bg, #fff);
  font-weight: 600;
}
.audit-view-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.audit-icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-strong, #d0d5dd);
  border-radius: var(--radius-sm);
  background: var(--surface, #fff);
  display: grid;
  place-items: center;
  color: var(--text-muted, #667085);
  cursor: pointer;
}
.audit-icon-btn svg,
.audit-pill-btn svg,
.audit-filter-trigger svg,
.audit-searchbox svg,
.audit-export-btn svg,
.audit-menu svg,
.audit-date-input-wrap svg,
.audit-modal header svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.audit-icon-btn.is-muted {
  background: var(--surface-2, #f9fafb);
  color: var(--text-subtle, #98a2b3);
  border-color: var(--border, #e4e7ec);
}
.audit-pill-btn,
.audit-export-btn {
  height: 38px;
  border: 1px solid var(--border-strong, #c7cbd1);
  border-radius: var(--radius-sm);
  background: var(--surface, #fff);
  color: var(--text, #344054);
  padding: 0 16px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.audit-filter-line {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.55vw, 26px);
  flex-wrap: wrap;
  position: relative;
  z-index: 5;
  margin-bottom: 22px;
  min-height: 42px;
}
.audit-filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  white-space: nowrap;
}
.audit-filter-label {
  font-size: 13px;
  color: var(--text-muted, #475467);
}
.audit-filter-trigger {
  border: 0;
  background: transparent;
  padding: 6px 2px;
  color: var(--text, #101828);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.audit-filter-trigger strong {
  font-weight: 600;
}
.audit-filter-trigger svg {
  width: 11px;
  height: 11px;
}
.audit-export-btn {
  margin-left: auto;
  height: 36px;
}
.audit-popover-wrap {
  position: relative;
}
.audit-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 190px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #d0d5dd);
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.14);
  padding: 7px;
  z-index: 30;
}
.audit-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--text, #344054);
  font-size: 14px;
  border-radius: 7px;
  cursor: pointer;
}
.audit-menu button:hover,
.audit-assisted-option:hover,
.audit-date-options button:hover {
  background: var(--surface-hover, #f2f4f7);
}
.audit-menu-divider {
  height: 1px;
  background: var(--border, #e4e7ec);
  margin: 5px -7px;
}
.audit-filter-panel {
  position: absolute;
  left: -10px;
  top: calc(100% + 14px);
  width: 350px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #d0d5dd);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.16);
  z-index: 40;
  overflow: hidden;
  white-space: normal;
}
.audit-filter-panel:before {
  content: '';
  position: absolute;
  top: -8px;
  left: 24px;
  width: 14px;
  height: 14px;
  background: var(--surface, #fff);
  border-left: 1px solid var(--border, #d0d5dd);
  border-top: 1px solid var(--border, #d0d5dd);
  transform: rotate(45deg);
}
.audit-searchbox {
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 12px 12px 8px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface, #fff);
  box-shadow: none;
  outline: none;
  position: relative;
  z-index: 1;
}
.audit-searchbox:focus-within {
  box-shadow: none;
}
.audit-searchbox input {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  min-width: 0;
  width: 100%;
  font-size: 14px;
  color: var(--text, #101828);
  padding: 0 !important;
}
.audit-searchbox svg {
  flex-shrink: 0;
  color: var(--text-subtle, #98a2b3);
}
.audit-check-list {
  max-height: 215px;
  overflow: auto;
  padding: 0 8px 8px;
  scrollbar-width: thin;
}
.audit-check-option {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 39px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text, #475467);
  font-size: 14px;
  cursor: pointer;
}
.audit-check-option:hover,
.audit-check-option:nth-child(even) {
  background: var(--surface-2, #f9fafb);
}
.audit-check-option input {
  appearance: none;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border: 1.5px solid var(--border-strong, #98a2b3);
  border-radius: 6px;
  background: var(--surface, #fff);
  margin: 0;
  position: relative;
  cursor: pointer;
}
.audit-check-option input:checked {
  background: var(--brand, #2456e6);
  border-color: var(--brand, #2456e6);
}
.audit-check-option input:checked:after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.audit-panel-footer {
  border-top: 1px solid var(--border, #e4e7ec);
  padding: 12px 20px;
  background: var(--surface, #fff);
}
.audit-panel-footer button {
  border: 0;
  background: transparent;
  color: var(--text-muted, #667085);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.audit-upgrade-note {
  border-top: 1px solid var(--border, #e4e7ec);
  margin: 0;
  padding: 13px 18px 16px;
  color: var(--text-muted, #667085);
  font-size: 13px;
  line-height: 1.55;
}
.audit-upgrade-note svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  vertical-align: -2px;
  margin-right: 7px;
}
.audit-upgrade-note a {
  color: var(--brand-ink, #2456e6);
  font-weight: 600;
  text-decoration: none;
}
.audit-narrow-panel {
  width: 282px;
}
.audit-user-panel {
  width: 248px;
}
.audit-user-parent {
  font-weight: 600;
}
.audit-user-child {
  min-height: 57px;
}
.audit-user-child span {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.audit-user-child small {
  font-size: 12px;
  color: var(--text-muted, #667085);
}
.audit-assisted-panel {
  width: 258px;
}
.audit-assisted-list {
  max-height: 260px;
  overflow: auto;
  padding: 0 0 7px;
}
.audit-assisted-list button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 18px;
  color: var(--text, #344054);
  font-size: 14px;
  cursor: pointer;
}
.audit-assisted-heading {
  font-weight: 700;
}
.audit-assisted-heading span {
  font-size: 11px;
  color: #fff;
  background: var(--success);
  border-radius: 10px;
  padding: 3px 8px;
  margin-left: 7px;
}
.audit-assisted-option {
  padding-left: 36px !important;
}
.audit-assisted-section {
  display: block;
  padding: 12px 18px 4px;
  font-size: 13px;
  color: var(--text, #344054);
}
.audit-date-panel {
  width: 258px;
}
.audit-date-options {
  max-height: 285px;
  overflow: auto;
  padding: 0 0 8px;
}
.audit-date-options button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  padding: 10px 18px;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--text, #344054);
  font-size: 14px;
  cursor: pointer;
}
.audit-date-options button small {
  font-size: 12px;
  color: var(--text-muted, #667085);
}
.audit-date-options button.is-selected {
  background: var(--surface-hover, #f2f4f7);
}
.audit-custom-dates {
  position: absolute;
  top: calc(100% + 13px);
  left: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #d0d5dd);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.14);
  z-index: 45;
}
.audit-custom-dates label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text, #344054);
}
.audit-date-input-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border-strong, #98a2b3);
  border-radius: 8px;
  padding: 5px 7px;
}
.audit-date-input-wrap svg {
  width: 15px;
  height: 15px;
  color: var(--text-muted, #667085);
}
.audit-date-input-wrap input {
  border: 0;
  background: transparent;
  width: 130px;
  color: var(--text, #344054);
  font-size: 12px;
}
.audit-custom-dates > button {
  border: 0;
  border-radius: 7px;
  background: var(--brand, #2456e6);
  color: #fff;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
}
.audit-table-wrap {
  width: 100%;
  overflow-x: auto;
  position: relative;
  z-index: 1;
}
.audit-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
  color: var(--text, #344054);
  font-size: 14px;
}
.audit-table thead th {
  text-align: left;
  font-weight: 500;
  color: var(--text-muted, #667085);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-strong, #98a2b3);
  white-space: nowrap;
}
.audit-table tbody td {
  height: 72px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, #d0d5dd);
  vertical-align: middle;
  white-space: nowrap;
}
.audit-table tbody tr:hover {
  background: var(--surface-2, #f9fafb);
}
.audit-table tbody tr[hidden] {
  display: none;
}
.audit-info {
  font-size: 12px;
  color: var(--text-subtle, #98a2b3);
  margin-left: 3px;
}
.audit-sort {
  font-size: 17px;
  margin-left: 5px;
  color: var(--text-muted, #667085);
}
.audit-user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 190px;
}
.audit-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  background: var(--surface-3, #eaecf0);
  color: var(--text-muted, #475467);
  font-size: 14px;
}
.audit-user-cell > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.audit-user-cell strong {
  color: #176b68;
  font-weight: 600;
  font-size: 14px;
}
.audit-user-cell small {
  font-size: 13px;
  color: var(--text-muted, #667085);
  max-width: 175px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.audit-source {
  font-variant-numeric: tabular-nums;
}
.audit-no-events {
  min-height: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 25px;
}
.audit-no-events[hidden] {
  display: none;
}
.audit-no-events svg {
  width: 220px;
  height: 190px;
  margin-bottom: 6px;
}
.audit-no-events h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text, #344054);
  margin: 0 0 14px;
}
.audit-no-events p {
  font-size: 14px;
  color: var(--text-muted, #667085);
  margin: 0;
}
.audit-view-picker-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.06);
  z-index: 100;
}
.audit-view-picker {
  position: fixed;
  z-index: 101;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  width: min(845px, calc(100vw - 36px));
  height: 480px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #d0d5dd);
  border-radius: 18px;
  box-shadow: 0 12px 35px rgba(16, 24, 40, 0.18);
  padding: 10px;
  display: flex;
  flex-direction: column;
}
.audit-view-picker[hidden],
.audit-view-picker-backdrop[hidden],
.audit-modal-backdrop[hidden] {
  display: none;
}
.audit-view-picker-search {
  margin: 10px 0 14px;
  flex-shrink: 0;
}
.audit-view-picker-columns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  flex: 1;
  min-height: 0;
}
.audit-view-picker-columns > div {
  padding: 8px 20px;
  border-right: 1px solid var(--border-strong, #98a2b3);
  overflow: auto;
}
.audit-view-picker-columns > div:last-child {
  border-right: 0;
}
.audit-view-picker-columns strong {
  display: block;
  font-size: 14px;
  color: var(--text, #344054);
  margin-bottom: 12px;
}
.audit-view-picker-columns button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text, #344054);
  font-size: 14px;
  cursor: pointer;
}
.audit-view-picker-columns button:hover {
  background: var(--brand-soft, #edf2ff);
}
.audit-view-picker-footer {
  border-top: 1px solid var(--border-strong, #98a2b3);
  margin: 0 -10px -10px;
  padding: 16px 22px;
}
.audit-view-picker-footer button {
  border: 0;
  background: transparent;
  color: var(--brand-ink, #176b68);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.audit-saved-view-item {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
}
.audit-saved-view-item small {
  color: var(--text-subtle, #98a2b3);
  font-size: 11px;
}
.audit-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
}
.audit-modal {
  width: min(450px, 100%);
  background: var(--surface, #fff);
  border: 1px solid var(--border, #d0d5dd);
  border-radius: 17px;
  box-shadow: 0 20px 60px rgba(16, 24, 40, 0.22);
  overflow: hidden;
}
.audit-modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border, #e4e7ec);
}
.audit-modal header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  color: var(--text, #101828);
}
.audit-modal header button {
  border: 0;
  background: transparent;
  color: var(--text-muted, #667085);
  padding: 4px;
  cursor: pointer;
}
.audit-modal header svg {
  width: 19px;
  height: 19px;
}
.audit-modal form {
  padding: 20px;
}
.audit-modal-field {
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #344054);
}
.audit-modal-field input {
  height: 42px;
  border: 1px solid var(--border-strong, #98a2b3);
  border-radius: 7px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text, #101828);
  background: var(--surface, #fff);
}
.audit-modal fieldset {
  border: 0;
  padding: 22px 0 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.audit-modal legend {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #344054);
  margin-bottom: 0px;
}
.audit-modal fieldset label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: var(--text, #344054);
}
.audit-modal input[type='radio'] {
  width: 19px;
  height: 19px;
  accent-color: var(--brand, #2456e6);
  margin: 0;
}
.audit-modal form footer {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}
.audit-confirm-btn,
.audit-cancel-btn {
  min-width: 106px;
  height: 40px;
  border-radius: var(--radius-sm);
  padding: 0 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.audit-confirm-btn {
  border: 1px solid var(--brand, #2456e6);
  background: var(--brand, #2456e6);
  color: #fff;
}
.audit-confirm-btn:disabled {
  border-color: var(--surface-3, #eaecf0);
  background: var(--surface-3, #eaecf0);
  color: var(--text-subtle, #98a2b3);
  cursor: not-allowed;
}
.audit-cancel-btn {
  border: 1px solid var(--border-strong, #98a2b3);
  background: var(--surface, #fff);
  color: var(--text, #344054);
}
@media (max-width: 1100px) {
  .audit-filter-line {
    gap: 8px 15px;
  }
  .audit-export-btn {
    margin-left: 0;
  }
}
@media (max-width: 700px) {
  .audit-page-head .set-head__title {
    font-size: 22px;
  }
  .audit-view-tab {
    padding: 0 10px;
    font-size: 12px;
  }
  .audit-filter-line {
    align-items: flex-start;
  }
  .audit-filter-item {
    flex-wrap: wrap;
  }
  .audit-filter-panel {
    left: 0;
    max-width: min(350px, calc(100vw - 36px));
  }
  .audit-custom-dates {
    position: relative;
    top: auto;
    left: auto;
    flex-wrap: wrap;
  }
  .audit-view-picker {
    top: 5%;
    height: 90vh;
  }
  .audit-view-picker-columns {
    grid-template-columns: 1fr;
    overflow: auto;
  }
  .audit-view-picker-columns > div {
    border-right: 0;
    border-bottom: 1px solid var(--border, #e4e7ec);
    min-height: 130px;
  }
  .audit-modal form {
    padding: 22px;
  }
  .audit-table {
    min-width: 850px;
  }
}

/* Responsive refinements and shared CRM date-range picker treatment */
.audit-log-page {
  min-width: 0;
  width: 100%;
}
.audit-page-head {
  margin-bottom: 22px;
}
.audit-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-wrap: nowrap;
}
.audit-view-tabs {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}
.audit-view-tab {
  min-width: 0;
  white-space: nowrap;
}
.audit-view-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.audit-filter-line {
  display: flex;
  align-items: center;
  gap: 12px 22px;
  flex-wrap: wrap;
  position: relative;
  z-index: 12;
  margin: 16px 0 26px;
  min-width: 0;
}
.audit-filter-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.audit-filter-label {
  white-space: nowrap;
}
.audit-filter-trigger {
  white-space: nowrap;
}
.audit-filter-panel {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  z-index: 130;
  max-width: calc(100vw - 24px);
  max-height: min(430px, calc(100vh - 32px));
  overflow: hidden;
}
.audit-filter-panel[hidden],
.audit-custom-dates[hidden],
.audit-calendar[hidden] {
  display: none !important;
}
.audit-date-panel {
  width: 258px;
}
.audit-date-options {
  max-height: 300px;
}
.audit-custom-dates {
  position: fixed;
  z-index: 140;
  top: 180px;
  left: 24px;
  width: min(460px, calc(100vw - 24px));
  display: block;
  padding: 10px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #d0d5dd);
  border-radius: 13px;
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.16);
  box-sizing: border-box;
}
.audit-custom-date-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.audit-custom-date-inputs > label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
  color: var(--text, #344054);
  font-size: 13px;
  white-space: nowrap;
}
.audit-date-input-wrap {
  height: 34px;
  min-width: 0;
  flex: 1;
  gap: 6px;
  padding: 0 8px;
  border-radius: 7px;
}
.audit-date-input-wrap input {
  width: 100%;
  min-width: 0;
  height: 100%;
  font-family: inherit;
  font-size: 12px;
  outline: 0;
}
.audit-date-input-wrap:focus-within {
  border-color: var(--brand-ink, var(--brand, #2456e6));
  box-shadow: 0 0 0 1px var(--brand-ink, var(--brand, #2456e6));
}
.audit-custom-date-inputs > button {
  height: 34px;
  flex: 0 0 auto;
  padding: 0 15px;
  border: 0;
  border-radius: 7px;
  background: var(--brand-ink, var(--brand, #2456e6));
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.audit-calendar {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  height: 310px;
  margin-top: 9px;
  overflow: hidden;
  border: 1px solid var(--border, #e4e7ec);
  border-radius: 9px;
  background: var(--surface, #fff);
}
.audit-calendar-presets {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: auto;
  padding: 5px 0;
  border-right: 1px solid var(--border, #e4e7ec);
}
.audit-calendar-presets button {
  width: 100%;
  padding: 8px 11px;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--text, #101828);
  font-size: 12px;
  cursor: pointer;
}
.audit-calendar-presets button:hover,
.audit-calendar-presets button.is-active {
  background: var(--surface-hover, #f2f4f7);
  color: var(--brand-ink, var(--brand, #2456e6));
  font-weight: 700;
}
.audit-calendar-main {
  min-width: 0;
  padding: 10px 8px;
  overflow: auto;
}
.audit-calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  margin-bottom: 8px;
  color: var(--text, #101828);
  font-size: 13px;
  font-weight: 700;
}
.audit-calendar-head button {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text, #101828);
  cursor: pointer;
}
.audit-calendar-head button:hover {
  background: var(--surface-hover, #f2f4f7);
}
.audit-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  text-align: center;
}
.audit-calendar-grid span {
  padding: 4px 0;
  color: var(--text-muted, #475467);
  font-size: 11px;
  font-weight: 700;
}
.audit-calendar-grid button {
  position: relative;
  height: 28px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text, #101828);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.audit-calendar-grid button:hover {
  background: var(--brand-soft, #edf2ff);
}
.audit-calendar-grid button.is-out {
  color: var(--text-subtle, #98a2b3);
  font-weight: 500;
}
.audit-calendar-grid button.is-range {
  background: var(--brand-soft, #edf2ff);
  border-radius: 0;
}
.audit-calendar-grid button.is-selected {
  background: var(--brand-ink, var(--brand, #2456e6));
  color: #fff;
}
.audit-calendar-grid button.is-today:not(.is-selected) {
  color: var(--brand-ink, var(--brand, #2456e6));
}
.audit-calendar-clear {
  width: 100%;
  margin-top: 8px;
  padding: 6px;
  border: 1px solid var(--border-strong, #d0d5dd);
  border-radius: 7px;
  background: var(--surface, #fff);
  color: var(--text, #344054);
  font-size: 12px;
  cursor: pointer;
}
.audit-table-wrap {
  z-index: 1;
  max-width: 100%;
}
.audit-table {
  table-layout: auto;
}
.audit-view-picker {
  max-width: calc(100vw - 24px);
}
@media (max-width: 1100px) {
  .audit-filter-line {
    gap: 12px 16px;
  }
}
@media (max-width: 760px) {
  .audit-log-page {
    padding-left: 0px;
    padding-right: 0px;
  }
  .audit-page-head {
    margin-bottom: 16px;
  }
  .audit-page-head .set-head__title {
    font-size: 22px;
  }
  .audit-page-head .set-head__sub {
    font-size: 13px;
    line-height: 1.45;
  }
  .audit-topbar {
    gap: 10px;
  }
  .audit-view-tabs {
    display: flex;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    border-bottom: 1px solid var(--border, #e4e7ec);
  }
  .audit-view-tab {
    flex: 0 0 auto;
    min-width: 145px;
    height: 42px;
    padding: 0 14px;
  }
  .audit-view-actions {
    width: 100%;
    justify-content: flex-end;
    gap: 7px;
  }
  .audit-filter-line {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 10px;
    margin: 14px 0 20px;
  }
  .audit-filter-item {
    min-width: 0;
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
  }
  .audit-filter-label {
    font-size: 12px;
  }
  .audit-filter-trigger {
    max-width: 100%;
    padding: 4px 2px;
    font-size: 12px;
  }
  .audit-filter-trigger strong {
    max-width: 95px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .audit-filter-panel {
    position: fixed;
    top: auto;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    max-height: min(65vh, 430px);
    margin: 0;
  }
  .audit-date-filter {
    grid-column: 1/-1;
  }
  .audit-date-panel {
    width: auto;
  }
  .audit-export-btn {
    grid-column: 1/-1;
    justify-self: end;
  }
  .audit-custom-dates {
    width: calc(100vw - 24px);
    left: 12px !important;
    right: 12px !important;
    padding: 9px;
  }
  .audit-custom-date-inputs {
    flex-wrap: wrap;
  }
  .audit-custom-date-inputs > label {
    flex: 1 1 calc(50% - 8px);
    font-size: 12px;
  }
  .audit-custom-date-inputs > button {
    margin-left: auto;
  }
  .audit-calendar {
    grid-template-columns: 105px minmax(0, 1fr);
    height: 295px;
  }
  .audit-calendar-presets button {
    padding: 8px 7px;
    font-size: 11px;
  }
  .audit-calendar-main {
    padding: 8px 5px;
  }
  .audit-calendar-grid button {
    height: 25px;
  }
  .audit-table {
    min-width: 900px;
  }
  .audit-view-picker {
    top: 3vh;
    height: 94vh;
    width: calc(100vw - 20px);
    padding: 8px;
    border-radius: 13px;
  }
  .audit-view-picker-columns {
    grid-template-columns: 1fr;
    overflow: auto;
  }
  .audit-view-picker-columns > div {
    min-height: 115px;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border, #e4e7ec);
  }
  .audit-view-picker-footer {
    padding: 12px 14px;
  }
  .audit-modal {
    max-width: calc(100vw - 28px);
  }
  .audit-modal header {
    padding: 17px 20px;
  }
  .audit-modal form {
    padding: 20px;
  }
}
@media (max-width: 420px) {
  .audit-filter-line {
    grid-template-columns: 1fr 1fr;
  }
  .audit-filter-label {
    font-size: 15px;
  }
  .audit-filter-trigger {
    font-size: 11px;
  }
  .audit-custom-date-inputs > label {
    flex-basis: 100%;
  }
  .audit-custom-date-inputs > button {
    width: 100%;
  }
  .audit-calendar {
    grid-template-columns: 94px minmax(0, 1fr);
  }
}

/* Audit Log: use the same tab component as settings-profile.php */
.audit-view-tabbar {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}
.audit-view-tabbar .os-tabs {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: stretch;
  gap: 0;
}
.audit-view-tabbar .os-tab {
  flex: 1 1 0;
  min-width: 0;
  justify-content: flex-start;
  text-align: left;
  white-space: nowrap;
}
.audit-view-tabbar .os-tab[aria-selected='true'] {
  color: var(--text);
}
.audit-topbar {
  align-items: center;
}
.audit-view-actions {
  flex: 0 0 auto;
}

/* Standard CRM table component surface, header, row rhythm and borders */
.audit-table-card.crm-table-card {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius, 12px);
  background: var(--surface);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(16, 24, 40, 0.06));
}
.audit-table-wrap.crm-table-wrap {
  min-width: 0;
  width: 100%;
  padding: 0;
}
.audit-table.crm-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}
.audit-table.crm-table thead th {
  height: 44px;
  padding: 12px 16px;
  background: var(--surface-2);
  color: var(--text-subtle);
  border: 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  white-space: nowrap;
  text-transform: none;
}
.audit-table.crm-table tbody tr {
  background: var(--surface);
  transition: background 0.15s ease;
}
.audit-table.crm-table tbody tr:hover {
  background: var(--surface-hover);
}
.audit-table.crm-table tbody td {
  height: 67px;
  padding: 13px 16px;
  border: 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  vertical-align: middle;
  white-space: nowrap;
}
.audit-table.crm-table tbody tr:last-child td {
  border-bottom: 0;
}
.audit-table.crm-table th:first-child,
.audit-table.crm-table td:first-child {
  padding-left: 20px;
}
.audit-table.crm-table th:last-child,
.audit-table.crm-table td:last-child {
  padding-right: 20px;
}
.audit-table.crm-table .audit-user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
}
.audit-table.crm-table .audit-user-cell > span:last-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.audit-table.crm-table .audit-user-cell strong {
  color: var(--brand-ink, var(--brand));
  font-size: 14px;
  font-weight: 700;
}
.audit-table.crm-table .audit-user-cell small {
  display: block;
  max-width: 190px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
}
.audit-table.crm-table .audit-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
}
.audit-table.crm-table .audit-source {
  font-variant-numeric: tabular-nums;
}
.audit-no-events {
  min-height: 390px;
  padding: 40px 20px;
  background: var(--surface);
}
.audit-no-events h2 {
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}
.audit-no-events p {
  color: var(--text-muted);
  font-size: 14px;
}

/* Wide audit records stay in their own scroll area on tablets and phones. */
@media (max-width: 991.98px) {
  .audit-table-card.crm-table-card {
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius, 12px);
    background: var(--surface);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(16, 24, 40, 0.06));
  }
  .audit-table-wrap.crm-table-wrap {
    min-width: 1040px;
    width: 1040px;
  }
  .audit-table.crm-table {
    display: table;
    min-width: 1040px;
    width: 100%;
  }
  .audit-table.crm-table thead {
    display: table-header-group;
  }
  .audit-table.crm-table tbody {
    display: table-row-group;
  }
  .audit-table.crm-table tbody tr {
    display: table-row;
    padding: 0;
    border: 0;
    border-radius: 0;
  }
  .audit-table.crm-table tbody td {
    display: table-cell;
    position: static !important;
    padding: 13px 16px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--border) !important;
    background: transparent !important;
    white-space: nowrap;
    text-align: left !important;
  }
  .audit-table.crm-table tbody td:before {
    display: none !important;
  }
  .audit-table.crm-table tbody tr:last-child td {
    border-bottom: 0 !important;
  }
}
@media (max-width: 760px) {
  .audit-topbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
  }
  .audit-view-tabbar {
    width: 100%;
    flex-basis: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
  }
  .audit-view-tabbar .os-tabs {
    width: max-content;
    min-width: 100%;
  }
  .audit-view-tabbar .os-tab {
    flex: 0 0 auto;
    min-width: 130px;
  }
  .audit-view-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .audit-table-wrap.crm-table-wrap {
    min-width: 1040px;
    width: 1040px;
  }
}
@media (max-width: 420px) {
  .audit-view-actions {
    gap: 6px;
  }
  .audit-icon-btn {
    width: 34px;
    height: 34px;
  }
  .audit-pill-btn {
    height: 34px;
    padding: 0 12px;
  }
}

.audit-log-page {
  width: 100%;
  min-width: 0;
}
.audit-log-page .audit-icon-btn,
.audit-log-page .audit-pill-btn,
.audit-log-page .audit-export-btn,
.audit-log-page .audit-filter-trigger,
.audit-log-page .audit-confirm-btn,
.audit-log-page .audit-cancel-btn {
  font-family: inherit;
}
.audit-scope-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: -8px 0 18px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 13px;
}
.audit-scope-chip button {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}
.audit-scope-chip svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.audit-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 12px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}
.audit-pager button {
  font: inherit;
  font-size: 14px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text);
}
.audit-pager__step {
  padding: 6px 10px;
}
.audit-pager__step:disabled {
  color: var(--text-muted);
  cursor: default;
}
.audit-pager__num {
  min-width: 30px;
  padding: 5px 8px;
}
.audit-pager__num[aria-current='page'] {
  font-weight: 600;
  border-color: var(--border-strong);
}
.audit-pager button:hover:not(:disabled) {
  background: var(--surface-hover);
}
.audit-pager__size {
  position: relative;
  margin-left: 16px;
}
.audit-pager__size > button {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
}
.audit-pager__size > button svg {
  width: 12px;
  height: 12px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}
.audit-pager__size ul {
  position: absolute;
  bottom: calc(100% + 4px);
  right: 0;
  z-index: 20;
  min-width: 140px;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md, 0 6px 18px rgba(0, 0, 0, 0.18));
}
.audit-pager__size li button {
  width: 100%;
  padding: 6px 10px;
  text-align: left;
}
.audit-pager__size li button[aria-selected='true'] {
  font-weight: 600;
}

/* Boxed tabs from settings.css (.set-tabs--boxed), scoped so deals.css cannot override them. */
.audit-log-page .audit-topbar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: nowrap;
}
.audit-log-page .audit-view-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  height: auto;
  margin: 0;
  padding: 0;
  gap: 0;
  overflow: visible;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border-strong, #d0d5dd);
  border-radius: 0;
}
.audit-log-page .audit-view-actions {
  display: flex;
  flex: 0 0 auto;
  align-self: center;
  align-items: center;
  gap: 10px;
  margin-left: 0;
  padding-bottom: 2px;
}
.audit-log-page .audit-view-tab {
  display: block !important;
  box-sizing: border-box;
  min-width: 0 !important;
  height: auto !important;
  margin: 0 0 -1px !important;
  padding: 12px 16px !important;
  border: 1px solid var(--border-strong, #d0d5dd) !important;
  border-left-width: 0 !important;
  border-radius: 0;
  background: var(--surface-2, #f9fafb) !important;
  color: var(--text-muted, #667085) !important;
  font-size: 14.5px !important;
  font-weight: 500 !important;
  line-height: 1.25;
  text-align: left !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: none !important;
  cursor: pointer;
}
.audit-log-page .audit-view-tab:first-child {
  border-left-width: 1px !important;
  border-top-left-radius: var(--radius-sm, 8px) !important;
}
.audit-log-page .audit-view-tab:last-child {
  border-top-right-radius: var(--radius-sm, 8px) !important;
}
.audit-log-page .audit-view-tab:hover {
  background: var(--surface-hover, #f2f4f7) !important;
  color: var(--text, #101828) !important;
}
.audit-log-page .audit-view-tab.is-active {
  background: var(--bg, #fff) !important;
  color: var(--text, #101828) !important;
  font-weight: 600 !important;
  border-bottom-color: var(--bg, #fff) !important;
  box-shadow: none !important;
}
.audit-log-page .audit-row--detail .audit-change-link {
  display: block;
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand, #ff7a59);
  font: inherit;
  font-size: 12.5px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}
.audit-log-page .audit-detail__meta {
  margin: 0 0 14px;
  color: var(--text-muted, #667085);
  font-size: 13px;
}
.audit-log-page .audit-detail ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.audit-log-page .audit-detail li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 0;
  border-top: 1px solid var(--border, #eaecf0);
}
.audit-log-page .audit-detail li strong {
  font-size: 14px;
}
.audit-log-page .audit-detail li span {
  color: var(--text, #101828);
  font-size: 13px;
  overflow-wrap: anywhere;
}
@media (max-width: 560px) {
  .audit-log-page .audit-topbar {
    flex-wrap: wrap;
  }
  .audit-log-page .audit-view-tabs {
    flex-basis: 100%;
    width: 100%;
  }
  .audit-log-page .audit-view-actions {
    margin-left: auto;
  }
}
