.activity-initial-loading {
  cursor: progress;
}

.activity-initial-loading #activityView {
  opacity: 0;
}

.activity-initial-loading .main::before {
  content: "";
  position: fixed;
  inset: 0 0 0 268px;
  z-index: 80;
  background: var(--bg);
  pointer-events: all;
}

.activity-initial-loading .main::after {
  content: "";
  position: fixed;
  top: 50%;
  left: calc(268px + (100vw - 268px) / 2);
  width: 40px;
  height: 40px;
  z-index: 81;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(17, 24, 39, 0), rgba(17, 24, 39, .2), var(--dark));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  transform: translate3d(-50%, -50%, 0);
  animation: cdcc-loading-spin 1.05s linear infinite;
  pointer-events: none;
}

.sidebar-collapsed.activity-initial-loading .main::before {
  inset: 0;
}

.sidebar-collapsed.activity-initial-loading .main::after {
  left: 50%;
}

.activity-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.activity-module-tabs {
  margin: 24px 0 18px;
  scrollbar-width: thin;
}

.activity-module-tab {
  flex: 0 0 auto;
}

.activity-module-tab:focus-visible {
  outline: 3px solid rgba(21, 112, 239, .22);
  outline-offset: 2px;
}

.activity-danger-card .kpi-value {
  color: #b42318;
}

.activity-kpi-grid .kpi-meta {
  margin-top: 14px;
  color: #667085;
  font-size: .9rem;
  line-height: 1.4;
}

.activity-filter-card {
  margin-top: 24px;
}

.activity-table-card {
  margin-top: 0;
}

.activity-heading {
  align-items: center;
  gap: 20px;
}

.activity-filter-grid {
  grid-template-columns: repeat(6, minmax(150px, 1fr));
}

.activity-field {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: #344054;
  font-weight: 700;
}

.activity-field input,
.activity-field select {
  width: 100%;
  min-width: 0;
}

.activity-table-scroll {
  min-height: 220px;
  max-height: min(68vh, 900px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.activity-table-scroll > .activity-table {
  width: 100%;
  min-width: 1180px;
  /* Virtual rows must not resize columns. Product/device share the remaining width. */
  table-layout: fixed;
}

.activity-table .activity-col-time,
.activity-table .activity-col-module {
  width: 160px;
}

.activity-table .activity-col-actor,
.activity-table .activity-col-action {
  width: 170px;
}

.activity-table .activity-col-detail {
  width: 84px;
}

.activity-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
}

.activity-table td {
  vertical-align: top;
}

.activity-table tbody[hidden] {
  display: none;
}

.activity-table tbody tr:not(.virtual-spacer-row) {
  height: 84px;
}

.activity-table tbody tr:not(.virtual-spacer-row) td {
  height: 84px;
  overflow: hidden;
}

.activity-cell-clamp {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.activity-virtual-spacer {
  pointer-events: none;
}

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

.activity-actor {
  font-weight: 800;
  color: #101828;
}

.activity-path,
.activity-device,
.activity-entity {
  color: #667085;
  font-size: .88rem;
  overflow-wrap: anywhere;
}

.activity-product {
  overflow-wrap: anywhere;
  font-weight: 700;
  white-space: normal;
  line-height: 1.45;
}

.activity-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 220px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f2f4f7;
  color: #475467;
  font-size: .82rem;
  font-weight: 800;
  white-space: nowrap;
}

.activity-badge .activity-cell-clamp {
  min-width: 0;
}

.activity-badge.is-specific {
  width: auto;
  max-width: 100%;
  white-space: normal;
  line-height: 1.35;
  border-radius: 12px;
}

.activity-badge.is-create,
.activity-badge.is-login,
.activity-badge.is-login_success,
.activity-badge.is-restore {
  background: #ecfdf3;
  color: #027a48;
}

.activity-badge.is-delete,
.activity-badge.is-permanent_delete,
.activity-badge.is-login_failed {
  background: #fef3f2;
  color: #b42318;
}

.activity-badge.is-update,
.activity-badge.is-assign,
.activity-badge.is-account_update {
  background: #eff8ff;
  color: #175cd3;
}

.activity-badge.is-archive {
  background: #fff7ed;
  color: #c2410c;
}

.activity-badge.is-view {
  background: #f9f5ff;
  color: #6941c6;
}

.activity-badge.is-error,
.activity-friendly-empty.is-error {
  background: #fffaeb;
  color: #b54708;
}

.activity-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 24, 40, .56);
}

.activity-modal.hidden {
  display: none;
}

.activity-modal-panel {
  width: min(1180px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 28px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(16, 24, 40, .24);
}

.activity-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.activity-modal-head h2 {
  margin: 4px 0 0;
}

.activity-detail-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.activity-detail-meta div {
  padding: 12px 14px;
  border: 1px solid #eaecf0;
  border-radius: 12px;
  background: #f9fafb;
  overflow-wrap: anywhere;
}

.activity-friendly-section {
  margin-top: 24px;
  padding: 22px;
  border: 1px solid #dfe4ea;
  border-radius: 18px;
  background: #f8fafc;
}

.activity-friendly-heading h3 {
  margin: 0;
  color: #101828;
  font-size: 1.2rem;
}

.activity-friendly-heading p {
  margin: 6px 0 0;
  color: #667085;
}

.activity-friendly-changes {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.activity-change-card {
  overflow: hidden;
  border: 1px solid #d0d5dd;
  border-left: 5px solid #2e90fa;
  border-radius: 14px;
  background: #fff;
}

.activity-change-card.is-create {
  border-left-color: #12b76a;
}

.activity-change-card.is-delete {
  border-left-color: #f04438;
}

.activity-change-card > header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 17px;
  border-bottom: 1px solid #eaecf0;
}

.activity-change-card header strong,
.activity-change-card header small {
  display: block;
  overflow-wrap: anywhere;
}

.activity-change-card header strong {
  color: #101828;
}

.activity-change-card header small {
  margin-top: 3px;
  color: #667085;
  font-size: .85rem;
}

.activity-change-kind {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eff8ff;
  color: #175cd3;
  font-size: .8rem;
  font-weight: 800;
}

.activity-change-card.is-create .activity-change-kind {
  background: #ecfdf3;
  color: #027a48;
}

.activity-change-card.is-delete .activity-change-kind {
  background: #fef3f2;
  color: #b42318;
}

.activity-field-change-list {
  display: grid;
}

.activity-record-context {
  padding: 12px 17px;
  border-bottom: 1px solid #eaecf0;
  background: #f8fafc;
}

.activity-record-context dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px 20px;
  margin: 0;
}

.activity-record-context dt {
  color: #667085;
  font-size: .8rem;
}

.activity-record-context dd {
  margin: 3px 0 0;
  color: #344054;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.activity-record-context p {
  margin: 10px 0 0;
  color: #667085;
  font-size: .82rem;
}

.activity-modal-panel:has(.activity-cdcc-forecast-group) {
  width: min(1600px, 100%);
}

.activity-cdcc-forecast-group {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #e4e7ec;
  border-radius: 12px;
  background: #fff;
}

.activity-cdcc-forecast-group > header {
  padding: 14px 16px;
  border-bottom: 1px solid #eaecf0;
  color: #101828;
  overflow-wrap: anywhere;
}

.activity-cdcc-forecast-group > header small {
  display: block;
  margin-top: 4px;
  color: #667085;
}

.activity-cdcc-forecast-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.activity-cdcc-forecast-scroll:focus-visible {
  outline: 2px solid #84adff;
  outline-offset: -2px;
}

.activity-cdcc-forecast-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .88rem;
}

.activity-cdcc-forecast-table th,
.activity-cdcc-forecast-table td {
  min-width: 78px;
  padding: 12px;
  text-align: left;
  vertical-align: middle;
  border: 0;
  border-bottom: 1px solid #eef0f3;
  white-space: normal;
}

.activity-cdcc-forecast-table th {
  background: #f8fafc;
  color: #667085;
  font-size: .78rem;
  font-weight: 700;
}

.activity-cdcc-forecast-table tbody tr:last-child td {
  border-bottom: 0;
}

.activity-cdcc-forecast-table .activity-cdcc-location {
  min-width: 180px;
  max-width: 270px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.activity-cdcc-forecast-table .activity-cdcc-changed-months,
.activity-cdcc-forecast-table th:last-child {
  min-width: 230px;
  border-left: 1px solid #eef0f3;
  position: sticky;
  right: 0;
  z-index: 1;
  background: #fff;
}

.activity-cdcc-forecast-table th:last-child {
  background: #f8fafc;
}

.activity-cdcc-cell-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
}

.activity-cdcc-cell-change {
  flex: 1 0 205px;
  max-width: 290px;
}

.activity-cdcc-cell-change > strong {
  display: block;
  margin-bottom: 6px;
  color: #475467;
  font-size: .78rem;
}

.activity-cdcc-quantity-change {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.activity-cdcc-old,
.activity-cdcc-new {
  padding: 7px 9px;
  border-radius: 6px;
  background: #f2f4f7;
  overflow-wrap: anywhere;
}

.activity-cdcc-new {
  background: #ecfdf3;
  color: #027a48;
  font-weight: 700;
}

.activity-cdcc-quantity-change small {
  display: block;
  color: #667085;
  font-size: .68rem;
  margin-bottom: 3px;
}

.activity-cdcc-quantity-arrow {
  color: #98a2b3;
}

.activity-cdcc-forecast-note {
  margin: 0;
  padding: 10px 16px;
  border-top: 1px solid #eef0f3;
  color: #667085;
  font-size: .8rem;
}

.activity-field-change {
  display: grid;
  grid-template-columns: minmax(150px, .85fr) minmax(180px, 1fr) auto minmax(180px, 1fr);
  gap: 12px;
  align-items: stretch;
  padding: 14px 17px;
}

.activity-field-change + .activity-field-change {
  border-top: 1px solid #f0f2f5;
}

.activity-field-name {
  align-self: center;
  color: #344054;
  font-weight: 800;
}

.activity-old-value,
.activity-new-value {
  min-width: 0;
  padding: 11px 13px;
  border-radius: 10px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.activity-old-value {
  background: #f2f4f7;
  color: #475467;
}

.activity-new-value {
  background: #ecfdf3;
  color: #05603a;
  font-weight: 700;
}

.activity-old-value > span,
.activity-new-value > span {
  display: block;
  margin-bottom: 4px;
  color: #667085;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.activity-new-value small {
  display: block;
  margin-top: 6px;
  color: #067647;
  font-size: .78rem;
  font-weight: 700;
}

.activity-value-details {
  white-space: normal;
}

.activity-value-details > summary {
  list-style: none;
  cursor: pointer;
  border-radius: 4px;
}

.activity-value-details > summary::-webkit-details-marker {
  display: none;
}

.activity-value-details > summary:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.activity-value-preview,
.activity-value-full {
  white-space: pre-wrap;
}

.activity-value-toggle,
.activity-value-collapse {
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.activity-value-details:not([open]) .activity-value-collapse,
.activity-value-details[open] .activity-value-preview {
  display: none;
}

.activity-value-full {
  margin-top: 8px;
}

.activity-change-arrow {
  align-self: center;
  color: #98a2b3;
  font-size: 1.25rem;
  font-weight: 800;
}

.activity-change-message {
  padding: 16px 18px;
  color: #475467;
}

.activity-friendly-empty {
  display: grid;
  gap: 5px;
  padding: 18px;
  border: 1px solid #d0d5dd;
  border-radius: 14px;
  background: #fff;
  color: #475467;
}

.activity-friendly-empty strong {
  color: #101828;
}

.activity-technical-details {
  margin-top: 18px;
  border: 1px solid #eaecf0;
  border-radius: 14px;
  background: #fff;
}

.activity-technical-details > summary {
  padding: 15px 18px;
  color: #475467;
  cursor: pointer;
  font-weight: 800;
  user-select: none;
}

.activity-technical-details[open] {
  padding: 0 18px 18px;
}

.activity-technical-details[open] > summary {
  margin: 0 -18px 16px;
  border-bottom: 1px solid #eaecf0;
}

.activity-technical-meta {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
  padding: 13px 15px;
  border-radius: 10px;
  background: #f9fafb;
  color: #667085;
  font-size: .88rem;
  overflow-wrap: anywhere;
}

.activity-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.activity-detail-grid h3 {
  margin: 0 0 10px;
}

.activity-detail-grid pre {
  min-height: 220px;
  max-height: 480px;
  overflow: auto;
  margin: 0;
  padding: 18px;
  border-radius: 14px;
  background: #101828;
  color: #e4e7ec;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 1280px) {
  .activity-filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .activity-kpi-grid,
  .activity-filter-grid,
  .activity-detail-meta,
  .activity-detail-grid {
    grid-template-columns: 1fr;
  }

  .activity-modal {
    padding: 10px;
  }

  .activity-modal-panel {
    max-height: calc(100vh - 20px);
    padding: 20px;
  }

  .activity-friendly-section {
    padding: 14px;
  }

  .activity-field-change {
    grid-template-columns: 1fr;
  }

  .activity-change-arrow {
    justify-self: center;
    transform: rotate(90deg);
  }
}
