:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #d8e0ea;
  --text: #142033;
  --muted: #66758a;
  --accent: #1267c4;
  --accent-strong: #0f559f;
  --green-bg: #e7f4ec;
  --green-text: #17613a;
  --red-bg: #fff0eb;
  --red-text: #b42318;
  --amber-bg: #fff7df;
  --amber-text: #8a5a00;
  --shadow: 0 14px 32px rgba(21, 35, 55, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
  font-size: 14px;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: #17324d;
  color: #fff;
  font-weight: 800;
}

.login-panel h1,
.page-title h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.login-panel label,
.form-row label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.login-panel input,
.search-form select,
.search-form input,
.form-row input,
.form-row textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
}

.form-row textarea {
  min-height: 74px;
  padding: 10px 12px;
  resize: vertical;
}

.api-field.is-configured {
  display: none;
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 700;
  white-space: nowrap;
}

.primary-button {
  border: 0;
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button,
.ghost-button,
.icon-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.danger-button {
  border: 0;
  background: #c2410c;
  color: #fff;
}

.danger-button:hover {
  background: #9a3412;
}

.compact-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 62px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.topbar-brand {
  font-weight: 800;
}

.topbar nav {
  display: flex;
  gap: 6px;
  flex: 1;
}

.topbar nav a {
  padding: 8px 11px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 700;
}

.topbar nav a.active,
.topbar nav a:hover {
  background: #e9f2ff;
  color: var(--accent);
}

.session-box {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.page-shell {
  width: min(1240px, calc(100vw - 40px));
  margin: 28px auto 56px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.page-title p {
  margin: 8px 0 0;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.muted-text {
  color: var(--muted);
}

.form-error {
  margin: 0;
  color: var(--red-text);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 44px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 12px 14px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.content-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 17px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 9px;
}

.metric-card strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.content-panel {
  padding: 18px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-title h2 {
  margin: 0;
  font-size: 17px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  gap: 18px;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(38px, 1fr));
  align-items: end;
  gap: 12px;
  height: 220px;
}

.bar-item {
  display: grid;
  grid-template-rows: 22px 1fr 22px;
  gap: 7px;
  height: 100%;
  text-align: center;
}

.bar-value,
.bar-label {
  color: var(--muted);
  font-size: 12px;
}

.bar-track {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: #edf1f5;
}

.bar-fill {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 2px;
  background: var(--accent);
}

.status-grid,
.detail-grid,
.stats-grid {
  display: grid;
  gap: 12px;
}

.status-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.status-item,
.detail-grid div,
.stats-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.status-item dt,
.detail-grid dt,
.stats-grid dt {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
}

.status-item dd,
.detail-grid dd,
.stats-grid dd {
  margin: 0;
  word-break: break-word;
}

.search-form {
  display: flex;
  gap: 10px;
  width: min(580px, 100%);
}

.review-search-form {
  width: min(720px, 100%);
}

.review-search-form select {
  width: 128px;
  flex: 0 0 128px;
}

.table-panel {
  padding: 0;
  overflow: hidden;
}

.table-summary,
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  color: var(--muted);
}

.table-summary {
  border-bottom: 1px solid var(--line);
}

.table-footer {
  border-top: 1px solid var(--line);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

tbody tr:hover {
  background: #fbfdff;
}

.strong-text {
  font-weight: 800;
}

.row-link {
  color: var(--accent);
  font-weight: 800;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--green-bg);
  color: var(--green-text);
  font-size: 12px;
  font-weight: 800;
}

.status-pill.banned {
  background: var(--red-bg);
  color: var(--red-text);
}

.status-pill.warn {
  background: var(--amber-bg);
  color: var(--amber-text);
}

.empty-panel,
.empty-cell {
  color: var(--muted);
  text-align: center;
}

.empty-panel {
  padding: 48px 18px;
}

.empty-cell {
  height: 120px;
}

.profile-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.profile-card {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.avatar-preview {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  overflow: hidden;
  border-radius: 8px;
  background: #dfeaf5;
  color: #17324d;
  font-size: 34px;
  font-weight: 800;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message-list {
  display: grid;
  gap: 12px;
}

.message-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.message-card p {
  margin: 0;
  white-space: normal;
}

.message-card span {
  color: var(--muted);
  font-size: 12px;
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.evidence-card {
  display: grid;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.evidence-card img,
.evidence-card span {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  object-fit: cover;
}

.evidence-card small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.profile-card h2 {
  margin: 0;
  font-size: 19px;
}

.profile-card p {
  margin: 0;
  color: var(--muted);
  word-break: break-word;
}

.detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-grid .wide {
  grid-column: 1 / -1;
}

.ops-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ops-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.ops-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 22, 34, 0.38);
}

.modal-panel {
  width: min(460px, 100%);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 20px;
}

.modal-panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

@media (max-width: 900px) {
  .topbar {
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 18px;
  }

  .topbar nav {
    order: 3;
    width: 100%;
  }

  .page-heading,
  .table-summary,
  .table-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .page-actions,
  .search-form {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .dashboard-grid,
  .status-grid,
  .profile-layout,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .bar-chart {
    gap: 7px;
  }
}
