.azjm-stats {
  border: 1px dotted #660000;
  margin: 28px 0 18px;
  padding: 16px;
  background: #fff;
}

.azjm-stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px dotted #660000;
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.azjm-stats-header h3 {
  margin: 0 0 4px;
  color: #660000;
}

.azjm-stats-header p {
  margin: 0;
  color: #4d3d3d;
  font-size: 0.92em;
}

.azjm-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.azjm-stat-card {
  display: block;
  min-height: 94px;
  padding: 14px 10px;
  border: 1px solid #d9baba;
  background: #fffafa;
  color: #660000 !important;
  text-align: center;
  text-decoration: none !important;
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.azjm-stat-card:hover,
.azjm-stat-card:focus {
  background: #660000 !important;
  border-color: #660000;
  color: #eecccc !important;
  transform: translateY(-2px);
  text-decoration: none !important;
}

.azjm-stat-number {
  display: block;
  font-size: 2em;
  font-weight: bold;
  line-height: 1.1;
}

.azjm-stat-label {
  display: block;
  margin-top: 7px;
  font-size: 0.88em;
  text-transform: uppercase;
}

.azjm-stats-toggle {
  border: 1px solid #660000;
  background: #660000;
  color: #eecccc;
  cursor: pointer;
  font-weight: bold;
  padding: 7px 12px;
}

.azjm-stats-toggle:hover,
.azjm-stats-toggle:focus {
  background: #4d0000;
}

.azjm-stats-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dotted #660000;
}

.azjm-stats-details[hidden] {
  display: none;
}

.azjm-stats-details a {
  border: 1px solid #d9baba;
  padding: 7px 10px;
  color: #660000 !important;
  background: #fff;
  text-decoration: none !important;
}

.azjm-stats-details a:hover,
.azjm-stats-details a:focus {
  color: #eecccc !important;
  background: #660000 !important;
}

.azjm-live-stats {
  margin-top: 16px;
  border-top: 1px dotted #660000;
  padding-top: 14px;
}

.azjm-live-stats h4 {
  margin: 0 0 10px;
  color: #660000;
}

.azjm-live-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.azjm-live-grid div {
  border: 1px solid #d9baba;
  background: #fff;
  padding: 10px 8px;
  text-align: center;
  transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.azjm-live-grid div:hover {
  background: #660000;
  color: #eecccc;
  transform: translateY(-2px);
}

.azjm-live-number {
  display: block;
  color: #660000;
  font-size: 1.45em;
  font-weight: bold;
  line-height: 1.1;
}

.azjm-live-grid div:hover .azjm-live-number {
  color: #eecccc;
}

.azjm-live-grid span:last-child {
  display: block;
  margin-top: 5px;
  font-size: 0.82em;
  text-transform: uppercase;
}

.azjm-live-note {
  color: #4d3d3d;
  font-size: 0.86em;
  margin: 10px 0 0;
}

.azjm-toc-tools {
  border: 1px dotted #660000;
  margin: 10px 0 18px;
  padding: 10px;
  background: #fffafa;
}

.azjm-toc-tools label {
  color: #660000;
  display: block;
  font-weight: bold;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.azjm-toc-tools input {
  border: 1px solid #d9baba;
  color: #111;
  font-family: "Times New Roman", Times, Georgia, serif;
  padding: 7px 8px;
  width: 100%;
}

.azjm-toc-tools input:focus {
  border-color: #660000;
  outline: 2px solid #eecccc;
}

.azjm-global-search {
  margin-top: 0;
}

.azjm-search-status {
  color: #4d3d3d;
  font-size: 0.86em;
  margin-top: 8px;
}

.azjm-search-results {
  border-top: 1px dotted #660000;
  margin-top: 10px;
  max-height: 360px;
  overflow: auto;
  padding-top: 10px;
}

.azjm-search-results[hidden] {
  display: none;
}

.azjm-search-result {
  border: 1px solid #d9baba;
  background: #fff;
  margin-bottom: 8px;
  padding: 10px;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.azjm-search-result:hover,
.azjm-search-result:focus-within {
  background: #fffafa;
  border-color: #660000;
  transform: translateY(-1px);
}

.azjm-search-result strong {
  display: block;
  color: #660000;
  margin-bottom: 4px;
}

.azjm-search-result span {
  display: block;
  color: #111;
  margin-bottom: 4px;
}

.azjm-search-result small {
  color: #4d3d3d;
  display: block;
  margin-bottom: 7px;
}

.azjm-search-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.azjm-search-actions a {
  border: 1px solid #d9baba;
  color: #660000 !important;
  padding: 5px 8px;
  text-decoration: none !important;
}

.azjm-search-actions a:hover,
.azjm-search-actions a:focus {
  background: #660000 !important;
  color: #eecccc !important;
}

.azjm-back-top {
  background: #660000;
  border: 1px solid #660000;
  bottom: 18px;
  color: #eecccc;
  cursor: pointer;
  font-family: "Times New Roman", Times, Georgia, serif;
  font-weight: bold;
  opacity: 0;
  padding: 9px 12px;
  pointer-events: none;
  position: fixed;
  right: 18px;
  transition: opacity 160ms ease, transform 160ms ease, background-color 160ms ease;
  z-index: 10;
}

.azjm-back-top:hover,
.azjm-back-top:focus {
  background: #4d0000;
}

.azjm-back-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-2px);
}

@media (max-width: 820px) {
  .azjm-stat-grid,
  .azjm-live-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .azjm-stats-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .azjm-stat-grid,
  .azjm-live-grid {
    grid-template-columns: 1fr;
  }
}
