:root {
  color-scheme: light;
  --bg: #eef3f1;
  --panel: #ffffff;
  --ink: #22383a;
  --muted: #72837e;
  --line: #dde6e2;
  --red: #c51f2d;
  --red-dark: #9d1822;
  --gold: #a98245;
  --green: #3f7d63;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

h1,
h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
}

/* 登录页 */

.login-page {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 15% 12%, rgba(197, 31, 45, 0.1), transparent 40%),
    radial-gradient(circle at 85% 88%, rgba(169, 130, 69, 0.16), transparent 42%),
    var(--bg);
}

.login-shell {
  width: min(420px, calc(100% - 32px));
  padding: 48px 0;
}

.login-card {
  padding: 40px 36px;
  border: 1px solid rgba(161, 184, 176, 0.3);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(40, 66, 60, 0.12);
}

.login-card h1 {
  font-family: "Songti SC", "SimSun", serif;
  font-size: 27px;
  line-height: 1.35;
}

.login-subtitle {
  margin: 10px 0 28px;
  color: var(--muted);
  font-size: 14px;
}

.login-form {
  display: grid;
  gap: 4px;
}

.form-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(197, 31, 45, 0.28);
  border-radius: 9px;
  background: rgba(197, 31, 45, 0.07);
  color: var(--red-dark);
  font-size: 13px;
}

/* 框架 */

.admin-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 26px 20px;
  background: #1e3335;
  color: #e9f1ee;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(160deg, #d04350, #a5161f);
  color: #ffffff;
  font-family: "Songti SC", "SimSun", serif;
  font-size: 20px;
  font-weight: 700;
}

.brand-text {
  display: grid;
  line-height: 1.35;
}

.brand-text strong {
  font-size: 15px;
}

.brand-text small {
  color: #9db3ae;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  padding: 11px 14px;
  border-radius: 9px;
  color: #c6d6d2;
  font-size: 14px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.13);
  color: #ffffff;
  font-weight: 600;
}

.logout-button {
  margin-top: auto;
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 9px;
  background: transparent;
  color: #c6d6d2;
  cursor: pointer;
  font-size: 14px;
}

.logout-button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.main-column {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(8px);
}

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

.topbar-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  font-size: 13px;
  white-space: nowrap;
}

.user-chip .role {
  color: var(--gold);
  font-size: 12px;
}

.text-button {
  padding: 2px 0 2px 10px;
  border: 0;
  border-left: 1px solid var(--line);
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.text-button:hover {
  color: var(--red);
}

.content {
  display: grid;
  gap: 20px;
  width: min(920px, 100%);
  padding: 28px 34px 56px;
}

.content-split {
  grid-template-columns: minmax(270px, 340px) minmax(0, 1fr);
  align-items: start;
  width: min(1160px, 100%);
}

/* 面板与表单 */

.panel {
  padding: 24px;
  border: 1px solid rgba(161, 184, 176, 0.3);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(46, 70, 64, 0.05);
}

.panel-title {
  margin-bottom: 20px;
  font-size: 15px;
  font-weight: 700;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.field span {
  color: #42524f;
  font-size: 13px;
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfdfc;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: #93b7ad;
  box-shadow: 0 0 0 3px rgba(147, 183, 173, 0.18);
}

input[type="file"] {
  height: auto;
  padding: 9px 12px;
}

.preview {
  display: grid;
  min-height: 260px;
  overflow: hidden;
  place-items: center;
  border: 1px dashed #c9d8d3;
  border-radius: 12px;
  background: #f5f8f7;
}

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

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 24px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.switch-row span {
  font-size: 14px;
  font-weight: 600;
}

.switch-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--red);
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.button {
  min-height: 42px;
  padding: 0 20px;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.button.primary {
  background: var(--red);
  color: #ffffff;
}

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

.button.secondary {
  border: 1px solid #c6d3cf;
  background: #ffffff;
  color: #42524f;
}

.button.secondary:hover {
  background: #f4f8f6;
}

.button.block {
  width: 100%;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* 管理员列表 */

.user-list {
  display: grid;
  gap: 14px;
}

.user-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fcfefd;
}

.user-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.user-name {
  font-size: 15px;
  font-weight: 700;
}

.user-username {
  margin-left: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.tag {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.tag.superadmin {
  background: rgba(169, 130, 69, 0.14);
  color: #8a682f;
}

.tag.admin {
  background: rgba(63, 125, 99, 0.13);
  color: #33664f;
}

.tag.disabled {
  background: rgba(197, 31, 45, 0.12);
  color: var(--red-dark);
}

.user-card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.user-card-grid .field {
  margin-bottom: 0;
}

.user-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.user-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

/* 提示 */

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  max-width: min(360px, calc(100% - 32px));
  padding: 13px 18px;
  border-radius: 10px;
  background: #24413f;
  color: #ffffff;
  box-shadow: 0 16px 36px rgba(20, 40, 38, 0.28);
  font-size: 14px;
}

.toast.error {
  background: var(--red-dark);
}

.modal {
  width: min(420px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  color: var(--ink);
}

.modal::backdrop {
  background: rgba(16, 32, 34, 0.5);
}

.modal-form {
  padding: 26px 24px 22px;
}

.modal-form h2 {
  margin-bottom: 22px;
  font-size: 17px;
}

@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
  }

  .brand-text {
    display: none;
  }

  .nav {
    display: flex;
    flex: 1;
    overflow-x: auto;
  }

  .logout-button {
    margin: 0;
    white-space: nowrap;
  }

  .content-split {
    grid-template-columns: 1fr;
  }

  .user-card-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    padding: 20px 18px;
  }

  .topbar-subtitle {
    display: none;
  }

  .content {
    padding: 20px 18px 48px;
  }

  .panel {
    padding: 18px;
  }

  .actions {
    flex-direction: column-reverse;
  }

  .button {
    width: 100%;
  }
}
