:root {
  --red: #c91f2c;
  --red-dark: #9f1723;
  --blue: #1e63b6;
  --ink: #231f20;
  --muted: #766d68;
  --line: #eadfd6;
  --paper: #fffaf5;
  --panel: #ffffff;
  --shadow: 0 14px 36px rgba(79, 45, 28, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #f6efe8;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    linear-gradient(135deg, rgba(201, 31, 44, 0.92), rgba(135, 16, 28, 0.82)),
    url("./assets/admin-bg.jpg") center/cover;
}

.login-card {
  width: 420px;
  padding: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(44, 18, 14, 0.24);
}

.brand-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--red);
  font-weight: 900;
  font-size: 24px;
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  font-size: 18px;
  flex: none;
}

.login-card h1 {
  margin: 22px 0 8px;
  font-size: 30px;
}

.login-card p,
.topbar p,
.panel-head p {
  margin: 0;
  color: var(--muted);
}

.login-form {
  margin-top: 28px;
  display: grid;
  gap: 18px;
}

label span {
  display: block;
  margin-bottom: 8px;
  color: #554b46;
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

textarea {
  height: 72px;
  padding-top: 10px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(201, 31, 44, 0.55);
  box-shadow: 0 0 0 3px rgba(201, 31, 44, 0.08);
}

.primary,
.ghost {
  height: 40px;
  border-radius: 6px;
  padding: 0 16px;
  border: 0;
  font-weight: 800;
}

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

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

.ghost {
  color: var(--red);
  background: #fff3f1;
  border: 1px solid rgba(201, 31, 44, 0.18);
}

.ghost.danger {
  width: 100%;
  color: #8f1722;
  background: #fff;
}

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

.sidebar {
  width: 260px;
  min-height: 100vh;
  padding: 24px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid var(--line);
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.side-brand strong,
.side-brand span {
  display: block;
}

.side-brand span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

nav {
  margin-top: 24px;
  display: grid;
  gap: 8px;
}

.nav-item {
  height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  text-align: left;
  color: #4d423d;
  background: transparent;
  font-weight: 800;
}

.nav-item.active {
  color: #fff;
  background: var(--red);
}

.sidebar .danger {
  margin-top: auto;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.topbar h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 14px;
}

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

.metric-card {
  padding: 20px;
}

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

.metric-card strong {
  display: block;
  margin-top: 8px;
  color: var(--red);
  font-size: 28px;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 18px;
  margin-top: 18px;
}

.panel {
  padding: 22px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

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

.check-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: #4d423d;
  font-weight: 700;
}

.check-line input {
  width: 16px;
  height: 16px;
}

.stat-list,
.rank-list,
.audit-list {
  display: grid;
  gap: 10px;
}

.stat-row,
.rank-row,
.audit-row {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr repeat(4, auto);
  gap: 14px;
}

.rank-row {
  display: grid;
  grid-template-columns: 36px 1fr repeat(3, 80px);
  gap: 12px;
  align-items: center;
}

.rank-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.upload-table {
  width: 1500px;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.upload-table th {
  color: var(--muted);
  font-size: 13px;
  text-align: left;
  padding: 0 8px;
}

.upload-table td {
  padding: 8px;
  background: var(--paper);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.upload-table td:first-child {
  border-left: 1px solid var(--line);
  border-radius: 8px 0 0 8px;
}

.upload-table td:last-child {
  border-right: 1px solid var(--line);
  border-radius: 0 8px 8px 0;
}

.upload-table input,
.upload-table select {
  min-width: 120px;
}

.upload-table .wide {
  min-width: 180px;
}

.upload-table textarea {
  width: 220px;
  height: 76px;
}

.upload-table .file-input {
  width: 180px;
  padding: 8px;
  height: auto;
}

.status-cell {
  width: 160px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.works-table {
  display: grid;
  gap: 12px;
}

.work-row {
  display: grid;
  grid-template-columns: 96px 1fr 78px 260px 210px;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.thumb {
  width: 96px;
  height: 54px;
  border-radius: 6px;
  object-fit: cover;
  background: #e8ddd3;
}

.work-title {
  min-width: 0;
}

.work-title strong,
.work-title span {
  display: block;
}

.work-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-title span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.badge.draft {
  background: #8d8178;
}

.work-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.work-metrics span {
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--red);
  background: #fff;
  font-size: 13px;
  font-weight: 800;
}

.work-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.work-actions button {
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: #4d423d;
  background: #fff;
}

.work-actions .danger {
  color: #a31522;
}

.search-input {
  width: 220px;
}

.audit-row {
  display: grid;
  grid-template-columns: 180px 120px 1fr 180px;
  gap: 12px;
  color: #4d423d;
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 26px;
  bottom: 26px;
  max-width: 420px;
  padding: 14px 18px;
  border-radius: 8px;
  color: #fff;
  background: rgba(35, 31, 32, 0.92);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
  z-index: 99;
}

@media (max-width: 1180px) {
  .metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .work-row {
    grid-template-columns: 96px 1fr;
  }

  .work-actions {
    justify-content: flex-start;
  }
}
