.system-item span.error {
  color: #be123c;
  font-weight: 850;
}

.admin-community-list {
  display: grid;
  gap: 1rem;
}

.admin-community-post {
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.admin-community-heading,
.admin-comment-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.admin-community-heading h3,
.admin-community-heading p,
.admin-comment-item p {
  margin: 0;
}

.admin-community-heading p,
.admin-comment-item span,
.admin-empty-comments {
  color: var(--muted);
}

.admin-community-content {
  margin: .9rem 0;
  white-space: pre-wrap;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.admin-comments-toggle {
  width: 100%;
  margin: 0 0 .7rem;
  padding: .65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.admin-community-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  margin-top: 1.2rem;
}

.admin-community-pager button {
  min-width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.admin-community-pager button.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(90deg,#568ce8,#2ec7d3);
}

.admin-community-pager button:disabled { opacity: .45; cursor: default; }

.admin-user-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  margin-top: 1.2rem;
  flex-wrap: nowrap;
  min-height: 40px;
}

.admin-user-pager button {
  min-width: 40px;
  height: 40px;
  padding: 0 .75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.admin-user-pager button.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #5b8def, #31c7d4);
}

.admin-user-pager button:disabled { opacity: .45; cursor: default; }
.admin-user-pager span { color: var(--muted); font-weight: 800; }

/* Fixed column tracks keep headers aligned with every data page. */
.user-account-table { table-layout: fixed; min-width: 980px; }
.user-account-table .user-col { width: 16%; }
.user-account-table .account-col { width: 22%; }
.user-account-table .role-col { width: 12%; }
.user-account-table .status-col { width: 10%; }
.user-account-table .school-col { width: 24%; }
.user-account-table .actions-col { width: 16%; }
.user-account-table th,
.user-account-table td { padding-left: 1rem; padding-right: 1rem; }
.admin-user-pager > span { display: inline-grid; place-items: center; min-width: 40px; height: 40px; }

.audit-table-wrap { overflow: visible; }
.audit-table { width: 100%; table-layout: fixed; min-width: 0; }
.audit-table .audit-time-col { width: 15%; }
.audit-table .audit-actor-col { width: 10%; }
.audit-table .audit-action-col { width: 15%; }
.audit-table .audit-target-col { width: 13%; }
.audit-table .audit-detail-col { width: 27%; }
.audit-table .audit-request-col { width: 20%; }
.audit-table th,
.audit-table td { white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
.audit-table code { white-space: normal; overflow-wrap: anywhere; word-break: break-all; font-size: .78rem; }

.status-pill.approved {
  background: #ecfdf5;
  color: #047857;
}

.admin-comment-list {
  display: grid;
  gap: .65rem;
}

.admin-comment-item {
  padding: .8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.admin-comment-item span {
  display: inline-block;
  margin-left: .6rem;
  font-size: .85rem;
}

.admin-comment-item p {
  margin-top: .4rem;
  white-space: pre-wrap;
}

@media (max-width: 720px) {
  .admin-community-heading,
  .admin-comment-item {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Admin overview: six quick-glance queues with restrained, semantic colors. */
.admin-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: .85rem;
}

.admin-stat {
  position: relative;
  display: flex;
  align-items: center;
  gap: .8rem;
  min-height: 108px;
  overflow: hidden;
  padding: 1rem 1.05rem;
  margin-bottom: 0;
  border: 1px solid transparent;
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(40, 86, 122, .08);
}

.admin-stat::after {
  content: "";
  position: absolute;
  width: 6rem;
  height: 6rem;
  right: -2.3rem;
  top: -2.3rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, .42);
  pointer-events: none;
}

.admin-stat-icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  flex: 0 0 2.6rem;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 13px;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 950;
  box-shadow: 0 8px 16px rgba(44, 91, 130, .16);
}

.admin-stat-copy { position: relative; z-index: 1; min-width: 0; }
.admin-stat-copy p { margin: 0; color: #46637b; font-size: .86rem; font-weight: 850; }
.admin-stat-copy h3 { margin: .25rem 0 0 !important; color: #153b5b; font-size: 1.65rem !important; line-height: 1.1; }
.admin-stat-copy small { display: block; margin-top: .28rem; color: #66839a; font-size: .72rem; white-space: nowrap; }

.admin-stat--accounts { background: linear-gradient(140deg, #f5f9ff, #e8f2ff); border-color: #cfe1f5; }
.admin-stat--accounts .admin-stat-icon { background: linear-gradient(135deg, #578ee9, #4eacd7); }
.admin-stat--students { background: linear-gradient(140deg, #f2fbff, #e5f8f8); border-color: #c8e9ed; }
.admin-stat--students .admin-stat-icon { background: linear-gradient(135deg, #26a9c6, #35c4bd); }
.admin-stat--teachers { background: linear-gradient(140deg, #f3fcf7, #e6f8ed); border-color: #cae9d7; }
.admin-stat--teachers .admin-stat-icon { background: linear-gradient(135deg, #39ae83, #55c98e); }
.admin-stat--identity { background: linear-gradient(140deg, #fffaf0, #fff3d8); border-color: #f0dfba; }
.admin-stat--identity .admin-stat-icon { background: linear-gradient(135deg, #e4a53d, #f2bf63); }
.admin-stat--feedback { background: linear-gradient(140deg, #f8f5ff, #f0eaff); border-color: #ddd1f3; }
.admin-stat--feedback .admin-stat-icon { background: linear-gradient(135deg, #8a70d4, #aa84e3); }
.admin-stat--anomaly { background: linear-gradient(140deg, #fff5f3, #ffe9e6); border-color: #f1caca; }
.admin-stat--anomaly .admin-stat-icon { background: linear-gradient(135deg, #e35e70, #ef8a56); }

.admin-anomaly-card {
  grid-column: 1 / -1;
  padding: 1.2rem 1.25rem;
  background: linear-gradient(120deg, #fffaf6, #fff4ed 54%, #fff8ec);
  border-color: #f3d9bb;
}

.admin-anomaly-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.admin-anomaly-heading > div { display: flex; align-items: baseline; gap: .65rem; }
.admin-anomaly-heading span { color: #a14d24; font-weight: 900; }
.admin-anomaly-heading strong { color: #c65d2d; font-size: 1.6rem; }
.admin-anomaly-heading small { color: #9b735b; }
.admin-anomaly-breakdown { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .65rem; margin-top: .85rem; }
.admin-anomaly-item { display: flex; align-items: center; gap: .6rem; min-width: 0; padding: .72rem .8rem; border: 1px solid rgba(216, 164, 121, .35); border-radius: 11px; background: rgba(255, 255, 255, .78); color: #785d4d; text-align: left; cursor: default; }
.admin-anomaly-breakdown b { display: grid; place-items: center; flex: 0 0 1.8rem; height: 1.8rem; border-radius: 8px; background: #fff0e2; color: #c65d2d; }
.admin-anomaly-breakdown span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; font-weight: 850; }

.violation-record.auto-flagged { border-color: #f0c7b9; background: linear-gradient(135deg, #fffaf7, #fff1ed); }
.violation-record.auto-flagged b { color: #b4533b; }

.admin-page .operations-priority { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1240px) {
  .admin-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-page .operations-priority { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-anomaly-breakdown { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-anomaly-heading { align-items: flex-start; flex-direction: column; gap: .25rem; }
}

@media (max-width: 500px) {
  .admin-stats, .admin-anomaly-breakdown, .admin-page .operations-priority { grid-template-columns: 1fr; }
  .admin-stat-copy small { white-space: normal; }
}
