:root {
  --bg: #f5f4ef;
  --panel: #fffdfa;
  --ink: #161513;
  --muted: #716c63;
  --line: rgba(22, 21, 19, 0.12);
  --accent: #526b8a;
  --danger: #b23b3b;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  margin: 0;
}

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

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

.sidebar {
  background: #171814;
  bottom: 0;
  color: rgba(255, 253, 250, 0.74);
  display: grid;
  grid-template-rows: auto 1fr auto;
  left: 0;
  padding: 24px 18px;
  position: fixed;
  top: 0;
  width: 232px;
}

.admin-brand {
  color: #fffdfa;
  display: block;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 28px;
}

.sidebar nav {
  align-content: start;
  display: grid;
  gap: 8px;
  grid-auto-rows: max-content;
}

.sidebar nav a,
.sidebar-foot a {
  border-radius: var(--radius);
  color: rgba(255, 253, 250, 0.76);
  min-height: 38px;
  padding: 9px 12px;
}

.sidebar nav a:hover,
.sidebar-foot a:hover {
  background: rgba(255, 253, 250, 0.08);
  color: #fffdfa;
}

.sidebar-foot {
  align-content: start;
  border-top: 1px solid rgba(255, 253, 250, 0.12);
  display: grid;
  gap: 6px;
  padding-top: 16px;
}

.sidebar-foot span {
  color: #fffdfa;
  font-weight: 650;
  padding: 0 12px 8px;
}

.admin-main {
  margin-left: 232px;
  min-height: 100vh;
  padding: 32px;
}

.page-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-head span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: 28px;
  margin-bottom: 0;
}

h2 {
  font-size: 17px;
}

.panel,
.stat-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 48px rgba(28, 24, 18, 0.06);
}

.panel {
  margin-bottom: 20px;
  overflow: hidden;
  padding: 20px;
}

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

.muted-panel code {
  background: rgba(82, 107, 138, 0.08);
  border-radius: 5px;
  color: var(--ink);
  padding: 2px 5px;
}

.stat-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 20px;
}

.stat-grid article {
  display: grid;
  gap: 6px;
  padding: 20px;
}

.stat-grid strong {
  font-size: 30px;
}

.stat-grid span,
.empty,
.toolbar input::placeholder {
  color: var(--muted);
}

.two-col {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

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

.actions form {
  margin: 0;
}

.primary,
.secondary,
.toolbar button,
.danger,
.login-box button {
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  font-weight: 650;
  justify-content: center;
  min-height: 38px;
  padding: 9px 14px;
}

.primary,
.toolbar button,
.login-box button {
  background: var(--accent);
  color: #fff;
}

.secondary {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}

.danger {
  background: rgba(178, 59, 59, 0.08);
  color: var(--danger);
}

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

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.toolbar input {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  flex: 1;
  min-height: 40px;
  padding: 0 12px;
}

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

.edit-form label {
  display: grid;
  gap: 7px;
}

.edit-form label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.edit-form input,
.edit-form select,
.edit-form textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 40px;
  padding: 9px 11px;
  width: 100%;
}

.edit-form textarea {
  resize: vertical;
}

.wide,
.check,
.form-actions {
  grid-column: 1 / -1;
}

.check {
  align-items: center;
  display: flex !important;
  gap: 10px !important;
}

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

.form-actions {
  display: flex;
  gap: 10px;
}

.preview {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  height: 72px;
  object-fit: cover;
  width: 112px;
}

.alert {
  background: rgba(178, 59, 59, 0.08);
  border: 1px solid rgba(178, 59, 59, 0.18);
  border-radius: var(--radius);
  color: var(--danger);
  margin-bottom: 14px;
  padding: 12px 14px;
}

.login-shell {
  align-items: center;
  background:
    linear-gradient(180deg, rgba(255, 253, 250, 0.7), rgba(245, 244, 239, 0.96)),
    var(--bg);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 22px;
}

.login-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(32, 28, 20, 0.11);
  display: grid;
  gap: 14px;
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

.login-box > span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.login-box h1 {
  margin: 0;
}

.login-box p {
  color: var(--muted);
  line-height: 1.7;
}

.login-box label {
  display: grid;
  gap: 8px;
}

.login-box input {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 42px;
  padding: 0 12px;
}

@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .admin-main {
    margin-left: 0;
    padding: 20px;
  }

  .stat-grid,
  .two-col,
  .edit-form {
    grid-template-columns: 1fr;
  }
}
