:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --sidebar: #182235;
  --sidebar-active: #243555;
  --danger: #dc2626;
  --success: #15803d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

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

input {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  outline: none;
}

select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
}

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

.btn.primary:hover,
button.primary:hover {
  background: var(--primary-dark);
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #172033, #253a5f);
}

.login-card {
  width: 420px;
  padding: 34px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .24);
}

.login-brand,
.brand,
.topbar,
.section-head {
  display: flex;
  align-items: center;
}

.login-brand {
  gap: 14px;
  margin-bottom: 26px;
}

.login-brand h1 {
  margin: 0;
  font-size: 23px;
}

.login-brand p,
.login-tip,
.section-head p,
.stat-desc,
.info-list span,
.muted,
small {
  color: var(--muted);
}

.login-card label {
  display: block;
  margin-bottom: 16px;
}

.login-card label span {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
}

.login-card .btn {
  width: 100%;
}

.login-tip {
  margin: 16px 0 0;
  text-align: center;
  font-size: 13px;
}

.admin-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 220px;
  flex: 0 0 220px;
  background: var(--sidebar);
  color: #d8dee9;
}

.brand {
  height: 62px;
  gap: 10px;
  padding: 0 18px;
  background: rgba(0, 0, 0, .18);
  font-weight: 700;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  text-align: center;
  line-height: 34px;
  font-weight: 700;
}

.nav {
  padding: 12px;
}

.nav a {
  display: block;
  padding: 12px 14px;
  border-radius: 7px;
  color: #d8dee9;
}

.nav a.active,
.nav a:hover {
  background: var(--sidebar-active);
  color: #fff;
}

.nav a.disabled {
  color: #778399;
  cursor: not-allowed;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 18px;
}

.topbar {
  justify-content: space-between;
  margin: -18px -18px 18px;
  padding: 0 22px;
  height: 62px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
}

.card {
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.section-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h2 {
  margin: 0;
  font-size: 18px;
}

.section-head p {
  margin: 6px 0 0;
}

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

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  margin-top: 8px;
  font-weight: 700;
}

.stat-desc {
  margin-top: 6px;
  font-size: 13px;
}

.info-list > div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.alert {
  margin-bottom: 16px;
  padding: 11px 14px;
  border-radius: 6px;
}

.alert.success {
  background: #dcfce7;
  color: var(--success);
}

.alert.error {
  background: #fee2e2;
  color: var(--danger);
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: #f9fafb;
}

td small {
  display: block;
  margin-top: 5px;
}

td input[readonly] {
  background: #f3f4f6;
  color: #9ca3af;
}

.code {
  padding: 14px;
  border-radius: 6px;
  background: #111827;
  color: #d1fae5;
  overflow-x: auto;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

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

.stack-field {
  display: block;
}

.stack-field span {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

.check-field {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-field input {
  width: auto;
  height: auto;
}

.muted-row {
  background: #f9fafb;
}

.filter-form {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(160px, 220px) auto auto 1fr;
  gap: 12px;
  align-items: end;
}

.filter-form label span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.empty-cell {
  padding: 28px 12px;
  color: var(--muted);
  text-align: center;
}

.points-plus {
  color: var(--success);
  font-weight: 700;
}

.points-minus {
  color: var(--danger);
  font-weight: 700;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
  color: var(--muted);
}

.preview-panel {
  margin-top: 18px;
}

.preview-box {
  width: 200px;
  height: 155px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f9fafb;
}

.preview-box img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.preview-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 900px) {
  .admin-shell {
    display: block;
  }

  .sidebar {
    width: 100%;
  }

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

  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .filter-form {
    grid-template-columns: 1fr;
  }
}
