:root {
  --gold: #b8860b;
  --gold-deep: #98690a;
  --gold-light: #d9b45c;
  --gold-soft: rgba(184, 134, 11, 0.08);
  --bg: #f8f5f0;
  --card: #ffffff;
  --text: #2c2c2c;
  --text-sub: #6e6559;
  --text-weak: #9c948a;
  --line: #ede6d9;
  --green: #2e7d32;
  --red: #c62828;
  --shadow: 0 8px 28px rgba(80, 60, 20, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

.hidden {
  display: none !important;
}

.serif {
  font-family: "Songti SC", "STSong", "Songti TC", "SimSun", serif;
}

/* 登录 */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 50% 18%, #fffaf0 0%, #f8f5f0 46%, #efe7da 100%);
}

.login-glow {
  position: absolute;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  border: 1px solid rgba(184, 134, 11, 0.12);
  box-shadow: 0 0 0 90px rgba(184, 134, 11, 0.03), 0 0 0 180px rgba(184, 134, 11, 0.02);
  top: 4%;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.login-card {
  position: relative;
  width: 360px;
  max-width: calc(100vw - 40px);
  padding: 40px 36px 30px;
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(80, 60, 20, 0.1);
  display: flex;
  flex-direction: column;
}

.login-brand {
  font-size: 34px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 8px;
  text-align: center;
}

.login-sub {
  margin-top: 6px;
  margin-bottom: 26px;
  font-size: 12px;
  color: var(--text-weak);
  letter-spacing: 4px;
  text-align: center;
}

.login-hint {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--text-weak);
  text-align: center;
}

.login-tech {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--text-weak);
  letter-spacing: 1px;
  text-align: center;
}

/* 布局 */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex: none;
  background: #fffdf9;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 26px 18px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  padding: 0 8px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  font-size: 26px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 6px;
}

.sidebar-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-weak);
  letter-spacing: 2px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 0;
  flex: 1;
}

.nav-item {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-sub);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.nav-item:hover {
  background: var(--gold-soft);
  color: var(--gold-deep);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(201, 154, 46, 0.16), rgba(184, 134, 11, 0.1));
  color: var(--gold-deep);
  font-weight: 600;
}

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-admin {
  font-size: 12px;
  color: var(--text-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-tech {
  margin: 12px 0 0;
  font-size: 11px;
  color: var(--text-weak);
  letter-spacing: 1px;
  text-align: center;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 30px 36px 60px;
}

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

.content-head h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 1px;
}

.view-desc {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-weak);
}

.updated {
  font-size: 12px;
  color: var(--text-weak);
}

/* 面板 */
.panel {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 20px;
}

.panel-title {
  margin: 0;
  font-size: 16px;
  letter-spacing: 1px;
}

.panel-text {
  margin: 10px 0 0;
  color: var(--text-sub);
  font-size: 13px;
}

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

.panel-hint {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--text-weak);
}

.sub-title {
  margin: 22px 0 12px;
  font-size: 14px;
  color: var(--text-sub);
}

/* 统计 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px 22px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-weak);
  letter-spacing: 1px;
}

.stat-value {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  font-weight: 600;
  color: var(--gold-deep);
}

/* 表单 */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field > span {
  font-size: 12px;
  color: var(--text-sub);
  letter-spacing: 0.5px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fffefb;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

textarea {
  resize: vertical;
  line-height: 1.7;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold-light);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0 18px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0 18px;
}

.upload-row {
  display: flex;
  gap: 10px;
}

.upload-row input {
  flex: 1;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-sub);
}

.check-row input {
  width: 16px;
  height: 16px;
  flex: none;
  margin: 0;
}

.thumb-preview img {
  margin-top: 10px;
  max-height: 90px;
  max-width: 220px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  display: none;
}

.thumb-preview img.show {
  display: block;
}

.font-preview {
  margin-top: 6px;
  padding: 18px 20px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px dashed var(--line);
}

.font-preview p {
  margin: 6px 0;
}

.preview-title {
  font-size: var(--preview-title, 40px);
  font-weight: 600;
}

.preview-body {
  font-size: var(--preview-body, 28px);
  line-height: var(--preview-line, 1.6);
}

.preview-sub {
  font-size: var(--preview-sub, 25px);
  color: var(--text-sub);
}

.preview-small {
  font-size: var(--preview-small, 20px);
  color: var(--text-weak);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 18px;
}

.form-error {
  color: var(--red);
  font-size: 12px;
  margin-right: auto;
  min-height: 18px;
}

/* 按钮 */
.btn-primary,
.btn-ghost {
  border: 0;
  border-radius: 10px;
  padding: 10px 22px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #c99a2e 0%, #b8860b 100%);
  color: #fff;
  box-shadow: 0 8px 20px rgba(184, 134, 11, 0.22);
}

.btn-ghost {
  background: transparent;
  color: var(--gold-deep);
  border: 1px solid rgba(184, 134, 11, 0.35);
}

.btn-sm {
  padding: 7px 16px;
}

.btn-primary:hover,
.btn-ghost:hover {
  opacity: 0.88;
}

.btn-primary:disabled,
.btn-ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-link {
  background: transparent;
  border: 0;
  color: var(--text-weak);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 2px;
  font-family: inherit;
}

.btn-link:hover {
  color: var(--gold-deep);
}

.btn-close {
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--text-weak);
  cursor: pointer;
  padding: 0 4px;
}

/* 表格 */
.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  font-weight: 500;
  color: var(--text-weak);
  font-size: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid #f4efe6;
  vertical-align: middle;
}

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

.data-table .op {
  text-align: right;
}

.data-table td.op {
  white-space: nowrap;
}

.table-thumb {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  display: block;
  cursor: zoom-in;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.table-thumb:hover {
  transform: scale(1.08);
  border-color: #b8860b;
  box-shadow: 0 4px 12px rgba(184, 134, 11, 0.3);
}

.table-thumb-empty {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-weak);
  font-size: 11px;
}

.cell-main {
  display: block;
  font-weight: 500;
}

.cell-sub {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-weak);
}

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12px;
  line-height: 1.7;
}

.tag-success {
  background: rgba(46, 125, 50, 0.1);
  color: var(--green);
}

.tag-fail {
  background: rgba(198, 40, 40, 0.08);
  color: var(--red);
}

.tag-muted {
  background: var(--gold-soft);
  color: var(--gold-deep);
}

.tag-off {
  background: #f1ede6;
  color: var(--text-weak);
}

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

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

.filter-row input,
.filter-row select {
  width: auto;
  min-width: 140px;
  padding: 7px 10px;
  font-size: 12px;
}

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

.pager button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-sub);
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 12px;
}

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

.summary {
  font-size: 12px;
  color: var(--text-weak);
}

/* 弹窗与抽屉 */
.modal-mask,
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(34, 28, 20, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 24px;
}

.modal {
  width: 560px;
  max-width: 100%;
  max-height: calc(100vh - 48px);
  background: var(--card);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(40, 30, 10, 0.22);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--line);
}

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

.modal-body {
  padding: 18px 22px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line);
}

.drawer-mask {
  justify-content: flex-end;
  align-items: stretch;
  padding: 0;
}

.drawer {
  width: 560px;
  max-width: 100%;
  height: 100%;
  background: var(--card);
  display: flex;
  flex-direction: column;
  box-shadow: -18px 0 50px rgba(40, 30, 10, 0.18);
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(30px);
    opacity: 0.4;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.drawer-body {
  padding: 18px 24px 40px;
  overflow-y: auto;
}

.detail-block {
  margin-bottom: 18px;
}

.detail-block h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-sub);
  letter-spacing: 1px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px 18px;
}

.detail-item {
  font-size: 13px;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.detail-item b {
  display: block;
  font-weight: 400;
  font-size: 11px;
  color: var(--text-weak);
}

.detail-image {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
}

/* 分类介绍富文本（description_html） */
.detail-rich {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-sub);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.detail-rich p {
  margin: 0 0 8px;
}

.detail-rich p:last-child {
  margin-bottom: 0;
}

.detail-rich img {
  max-width: 100%;
  border-radius: 8px;
}

.detail-rich ul,
.detail-rich ol {
  margin: 0 0 8px;
  padding-left: 18px;
}

.detail-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-sub);
}

.code-block {
  margin: 0;
  padding: 12px 14px;
  max-height: 320px;
  overflow: auto;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 42px;
  transform: translateX(-50%);
  background: rgba(44, 44, 44, 0.92);
  color: #fff;
  padding: 9px 20px;
  border-radius: 22px;
  font-size: 13px;
  z-index: 90;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

/* 图片大图预览 */
.image-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 120;
  padding: 40px;
}

.image-viewer.hidden {
  display: none;
}

.image-viewer img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.image-viewer-close {
  position: absolute;
  top: 18px;
  right: 24px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.image-viewer-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 860px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 16px;
  }
  .nav-list {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 12px 0 4px;
  }
  .content {
    padding: 20px 16px 50px;
  }
  .drawer {
    width: 100%;
  }
}
