: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;
}

.export-button {
  min-width: 92px;
  white-space: nowrap;
  text-align: center;
}

.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;
}

.view {
  min-width: 0;
}

.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;
  min-width: 0;
}

.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-card-list {
  display: grid;
  gap: 18px;
}

.upload-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(145deg, #fff, #fffaf5);
  box-shadow: 0 10px 26px rgba(79, 45, 28, 0.05);
}

.upload-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.upload-card-index {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--red);
  font-size: 13px;
  font-weight: 800;
}

.upload-card-name {
  display: inline-block;
  margin-left: 10px;
}

.upload-card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.upload-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.upload-card-grid .field-wide {
  grid-column: span 2;
}

.upload-card-grid .field-full {
  grid-column: 1 / -1;
}

.upload-card-grid textarea {
  min-height: 88px;
}

.upload-media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.upload-file-field {
  min-width: 0;
  padding: 14px;
  border: 1px dashed #dbc9bd;
  border-radius: 8px;
  background: #fff;
}

.upload-file-field .file-input {
  height: auto;
  padding: 8px;
}

.status-cell {
  min-width: 72px;
  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 .work-staff {
  color: #9f1723;
}

.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;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 98;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(35, 31, 32, 0.42);
}

.modal-card {
  width: min(720px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 24px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(44, 18, 14, 0.24);
}

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

.modal-head h3 {
  margin: 0 0 6px;
  font-size: 22px;
}

.modal-head p {
  margin: 0;
  color: var(--muted);
}

.icon-button {
  width: 36px;
  height: 36px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #7f726a;
  background: #fff;
  font-size: 24px;
  line-height: 32px;
}

.edit-grid {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 16px;
}

.edit-grid .full {
  grid-column: 1 / -1;
}

.edit-grid textarea {
  min-height: 120px;
}

.edit-media {
  padding: 18px;
  border: 1px solid rgba(177, 41, 52, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 247, 241, 0.96), rgba(241, 247, 255, 0.96));
}

.edit-media-head h4 {
  margin: 0 0 5px;
  color: #382b27;
  font-size: 16px;
}

.edit-media-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.edit-media-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.edit-file-field {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px dashed rgba(138, 94, 74, 0.32);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.edit-file-field > span {
  color: #4d3d37;
  font-weight: 800;
}

.edit-file-field input[type="file"] {
  width: 100%;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.edit-file-field small {
  color: var(--muted);
  line-height: 1.5;
}

.edit-upload-progress {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.edit-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: #5b4942;
  font-size: 13px;
}

.edit-progress-head strong {
  color: var(--red);
}

.edit-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eadfd8;
}

.edit-progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--blue));
  transition: width 160ms ease;
}

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

.search-input {
  width: 220px;
}

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

.stats-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 28px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #aa1523 0%, #d72636 48%, #1e63b6 100%);
  box-shadow: 0 18px 45px rgba(131, 23, 30, 0.18);
}

.stats-hero h3 {
  margin: 10px 0 8px;
  font-size: 30px;
}

.stats-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
}

.stats-eyebrow {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.stats-range {
  display: flex;
  flex: none;
  gap: 8px;
  padding: 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
}

.stats-range button {
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: transparent;
  font-weight: 900;
}

.stats-range button.active {
  color: var(--red-dark);
  background: #fff;
}

.leader-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.leader-card {
  padding: 20px;
  border-radius: 8px;
  border-top: 4px solid var(--red);
  background: #fff;
  box-shadow: var(--shadow);
}

.leader-card span,
.leader-card em {
  display: block;
  color: var(--muted);
  font-style: normal;
}

.leader-card strong {
  display: block;
  margin: 8px 0;
  color: var(--ink);
  font-size: 32px;
  line-height: 1;
}

.leader-card.people {
  border-top-color: var(--blue);
}

.leader-card.likes {
  border-top-color: var(--red);
}

.leader-card.clicks {
  border-top-color: #d9961f;
}

.leader-card.works {
  border-top-color: #2f855a;
}

.stats-layout {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 18px;
  margin-bottom: 18px;
}

.leader-panel {
  min-width: 0;
  padding: 22px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.panel-head.compact {
  margin-bottom: 14px;
}

.trend-chart {
  min-height: 190px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 12px;
  padding-top: 12px;
}

.trend-day {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.trend-bars {
  height: 132px;
  display: flex;
  align-items: flex-end;
  gap: 5px;
}

.bar {
  width: 10px;
  min-height: 6px;
  border-radius: 999px 999px 3px 3px;
}

.bar.views {
  background: var(--red);
}

.bar.clicks {
  background: #d9961f;
}

.bar.likes {
  background: var(--blue);
}

.group-compare {
  display: grid;
  gap: 12px;
}

.group-card-stat {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #fff, #fff8f2);
}

.group-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

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

.group-bars {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.group-bars label {
  display: flex;
  justify-content: space-between;
  color: #4d423d;
  font-size: 13px;
}

.group-bars i {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #f0e8e2;
}

.group-bars i span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--red);
}

.group-bars i.like span {
  background: var(--blue);
}

.group-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.stats-top-list {
  display: grid;
  gap: 10px;
}

.stats-top-row {
  display: grid;
  grid-template-columns: 42px 1fr 110px 110px;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.stats-top-row strong,
.stats-top-row em {
  display: block;
}

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

.stats-top-row em {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.top-rank {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #7f726a;
  background: #fff;
  font-weight: 900;
}

.top-rank.hot {
  color: #fff;
  background: linear-gradient(135deg, #d72535, #f0a02b);
  box-shadow: 0 8px 18px rgba(201, 31, 44, 0.2);
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: #fffaf5;
}

.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) {
  .upload-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .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;
  }

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

  .edit-media-grid {
    grid-template-columns: 1fr;
  }

  .stats-hero {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .stats-layout {
    grid-template-columns: 1fr;
  }

  .stats-top-row {
    grid-template-columns: 42px 1fr;
  }
}

@media (max-width: 760px) {
  .upload-card-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .upload-card-grid,
  .upload-media-grid {
    grid-template-columns: 1fr;
  }

  .upload-card-grid .field-wide {
    grid-column: auto;
  }

  .upload-card-actions {
    width: 100%;
    justify-content: space-between;
  }
}
