/* ============================================================
   文库系统 · 全局设计系统
   品牌渐变：#0F2B5B (深蓝) → #1A73E8 (亮蓝) → #4FC3F7 (浅蓝)
   ============================================================ */

:root {
  /* 品牌色 */
  --brand-deep: #0f2b5b;
  --brand-mid: #1a73e8;
  --brand-light: #4fc3f7;
  --brand-gradient: linear-gradient(135deg, #0f2b5b 0%, #1a73e8 55%, #4fc3f7 100%);
  --brand-gradient-soft: linear-gradient(135deg, #1a73e8 0%, #4fc3f7 100%);

  /* 功能色 */
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --info: #0891b2;

  /* 中性色 */
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e3e9f2;
  --border-strong: #cfd9e8;

  --text: #14213d;
  --text-secondary: #55637a;
  --text-muted: #8a97ad;
  --text-invert: #ffffff;

  /* 尺寸 */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-full: 999px;

  --shadow-sm: 0 1px 3px rgba(15, 43, 91, 0.06);
  --shadow: 0 4px 14px rgba(15, 43, 91, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 43, 91, 0.14);

  --header-h: 64px;
  --container: 1200px;

  --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ 重置 ============ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body,
#root {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
  margin: 0;
  font-weight: 600;
  line-height: 1.35;
}

p { margin: 0; }

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition);
}

img { max-width: 100%; display: block; }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

ul { margin: 0; padding: 0; list-style: none; }

/* ============ 布局 ============ */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.app-main {
  flex: 1;
  padding: 28px 0 56px;
}

/* ============ 头部导航 ============ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--brand-gradient);
  box-shadow: var(--shadow);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(4px);
}

.nav {
  display: flex;
  gap: 4px;
}

.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-full);
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.header-spacer { flex: 1; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition);
  border: 1px solid transparent;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand-gradient-soft);
  color: #fff;
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.28);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(26, 115, 232, 0.36);
}

.btn-ghost-light {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.24);
}

.btn-ghost-light:hover {
  background: rgba(255, 255, 255, 0.26);
}

.btn-outline {
  background: var(--surface);
  color: var(--text-secondary);
  border-color: var(--border-strong);
}

.btn-outline:hover {
  border-color: var(--brand-mid);
  color: var(--brand-mid);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 12px 28px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

/* ============ 表单 ============ */
.field {
  margin-bottom: 18px;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.field-label .req {
  color: var(--danger);
  margin-left: 3px;
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  transition: all var(--transition);
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--brand-mid);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
  margin-bottom: 6px;
}

.field-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ============ 卡片 ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-pad {
  padding: 22px;
}

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

.section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  font-weight: 600;
  color: var(--brand-deep);
}

.section-title::before {
  content: '';
  width: 4px;
  height: 17px;
  border-radius: 2px;
  background: var(--brand-gradient-soft);
}

/* ============ 首页 Hero ============ */
.hero {
  position: relative;
  padding: 52px 0 60px;
  background: var(--brand-gradient);
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 22%, rgba(79, 195, 247, 0.35), transparent 42%),
    radial-gradient(circle at 88% 78%, rgba(26, 115, 232, 0.3), transparent 46%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  text-align: center;
}

.hero-title {
  font-size: 34px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.hero-sub {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.86);
  margin-bottom: 30px;
}

/* ============ 搜索框 ============ */
.searchbar {
  display: flex;
  max-width: 640px;
  margin: 0 auto;
  background: #fff;
  border-radius: var(--radius-full);
  padding: 5px;
  box-shadow: var(--shadow-lg);
}

.searchbar-input {
  flex: 1;
  padding: 12px 20px;
  border: none;
  background: transparent;
  font-size: 15px;
}

.searchbar-input:focus {
  outline: none;
}

.searchbar-input::placeholder {
  color: var(--text-muted);
}

.searchbar-btn {
  padding: 10px 30px;
  border-radius: var(--radius-full);
  background: var(--brand-gradient-soft);
  color: #fff;
  font-weight: 500;
  transition: all var(--transition);
}

.searchbar-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 14px rgba(26, 115, 232, 0.4);
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  margin-top: 20px;
}

.hero-tag {
  padding: 5px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  backdrop-filter: blur(4px);
  transition: all var(--transition);
}

.hero-tag:hover {
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
}

/* ============ 统计条 ============ */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: -34px;
  position: relative;
  z-index: 2;
  margin-bottom: 36px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: transform var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(26, 115, 232, 0.12), rgba(79, 195, 247, 0.2));
  color: var(--brand-mid);
  flex-shrink: 0;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand-deep);
  line-height: 1.2;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* ============ 分类网格 ============ */
.category-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 12px;
}

.category-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 18px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition);
}

.category-item:hover {
  transform: translateY(-3px);
  border-color: var(--brand-light);
  box-shadow: var(--shadow);
}

.category-item.active {
  border-color: var(--brand-mid);
  background: linear-gradient(135deg, rgba(26, 115, 232, 0.06), rgba(79, 195, 247, 0.12));
}

.category-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--brand-gradient-soft);
  color: #fff;
}

.category-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.category-count {
  font-size: 11px;
  color: var(--text-muted);
}

/* ============ 文档卡片 ============ */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.doc-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}

.doc-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-light);
}

.doc-thumb {
  position: relative;
  height: 132px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f0f5fc 0%, #e6f0fb 100%);
  border-bottom: 1px solid var(--border);
}

.doc-thumb-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow);
}

.doc-badge-preview {
  position: absolute;
  top: 9px;
  right: 9px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(22, 163, 74, 0.92);
  color: #fff;
  font-size: 11px;
}

.doc-badge-price {
  position: absolute;
  top: 9px;
  left: 9px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.94);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

.doc-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px;
}

.doc-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 7px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
  line-height: 1.45;
}

.doc-card:hover .doc-title {
  color: var(--brand-mid);
}

.doc-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 11px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 34px;
}

.doc-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 11px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-muted);
  margin-top: auto;
}

.doc-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============ 筛选条 ============ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.chip {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-size: 13px;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.chip:hover {
  border-color: var(--brand-mid);
  color: var(--brand-mid);
}

.chip.active {
  background: var(--brand-gradient-soft);
  border-color: transparent;
  color: #fff;
}

.result-count {
  font-size: 13px;
  color: var(--text-muted);
}

.result-count strong {
  color: var(--brand-mid);
  font-weight: 600;
}

/* ============ 分页 ============ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  margin-top: 32px;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 11px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  transition: all var(--transition);
}

.page-btn:hover:not(:disabled) {
  border-color: var(--brand-mid);
  color: var(--brand-mid);
}

.page-btn.active {
  background: var(--brand-gradient-soft);
  border-color: transparent;
  color: #fff;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============ 状态：加载 / 空 / 错误 ============ */
.state-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 72px 20px;
  text-align: center;
  color: var(--text-muted);
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--brand-mid);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.skeleton-card {
  height: 268px;
  border-radius: var(--radius-lg);
  background: linear-gradient(100deg, #eef2f8 30%, #f7f9fc 50%, #eef2f8 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: 180% 0; }
  100% { background-position: -40% 0; }
}

/* ============ 文档详情 ============ */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 22px;
  align-items: start;
}

.detail-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--brand-deep);
  margin-bottom: 14px;
  line-height: 1.4;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.detail-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-desc {
  padding: 18px 0;
  color: var(--text-secondary);
  line-height: 1.8;
}

.preview-frame {
  width: 100%;
  height: 620px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.preview-text {
  max-height: 620px;
  overflow: auto;
  padding: 20px;
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
  line-height: 1.75;
}

.preview-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  height: 380px;
  background: var(--surface-alt);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
  color: var(--text-muted);
}

.preview-fallback-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.action-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

/* 侧栏 */
.side-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
}

.side-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-deep);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 13px;
}

.info-row span:first-child {
  color: var(--text-muted);
  flex-shrink: 0;
}

.info-row span:last-child {
  color: var(--text);
  text-align: right;
  word-break: break-all;
}

/* ============ 上传页 ============ */
.upload-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 22px;
  align-items: start;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 46px 20px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-alt);
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
}

.dropzone:hover,
.dropzone.dragging {
  border-color: var(--brand-mid);
  background: linear-gradient(135deg, rgba(26, 115, 232, 0.04), rgba(79, 195, 247, 0.09));
}

.dropzone-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 20px;
  background: var(--brand-gradient-soft);
  color: #fff;
}

.dropzone-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.dropzone-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.file-selected {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.file-badge {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  font-size: 12px;
  color: var(--text-muted);
}

.progress-track {
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--border);
  overflow: hidden;
  margin-top: 14px;
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--brand-gradient-soft);
  transition: width 220ms ease;
}

/* ============ 认证页 ============ */
.auth-wrap {
  display: grid;
  place-items: center;
  min-height: calc(100vh - var(--header-h) - 110px);
  padding: 40px 20px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 34px 32px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand-deep);
  text-align: center;
  margin-bottom: 6px;
}

.auth-sub {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 26px;
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--brand-mid);
  font-weight: 500;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* ============ 提示条 ============ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

.alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
}

/* ============ 用户菜单 ============ */
.user-menu {
  position: relative;
}

.user-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  transition: all var(--transition);
}

.user-trigger:hover {
  background: rgba(255, 255, 255, 0.26);
}

.avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-light);
  color: var(--brand-deep);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 178px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 200;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  text-align: left;
  transition: all var(--transition);
}

.dropdown-item:hover {
  background: var(--surface-alt);
  color: var(--brand-mid);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 5px 0;
}

/* ============ 页脚 ============ */
.footer {
  background: var(--brand-deep);
  color: rgba(255, 255, 255, 0.72);
  padding: 26px 0;
  font-size: 13px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ============ 响应式 ============ */
@media (max-width: 1080px) {
  .doc-grid,
  .skeleton-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .category-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .detail-layout,
  .upload-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .doc-grid,
  .skeleton-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .category-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .nav {
    display: none;
  }
  .hero-title {
    font-size: 25px;
  }
  .hero {
    padding: 38px 0 46px;
  }
  .detail-title {
    font-size: 19px;
  }
  .preview-frame,
  .preview-text {
    height: 460px;
  }
}

@media (max-width: 520px) {
  .doc-grid,
  .skeleton-grid {
    grid-template-columns: 1fr;
  }
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .searchbar {
    flex-direction: column;
    border-radius: var(--radius-lg);
    padding: 8px;
  }
  .searchbar-btn {
    width: 100%;
    border-radius: var(--radius);
  }
}

/* ============ 后台管理布局 ============ */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--brand-gradient);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 28px;
  padding: 0 6px;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}

.admin-nav-link:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.admin-nav-link.active {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.admin-back {
  margin-top: auto;
  padding: 11px 14px;
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  transition: all var(--transition);
}

.admin-back:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.admin-topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-top-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--brand-deep);
}

.admin-top-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.admin-content {
  flex: 1;
  padding: 26px;
  max-width: 1100px;
  width: 100%;
}

.admin-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-size: 13px;
}

.admin-table th {
  text-align: left;
  padding: 12px 14px;
  background: var(--surface-alt);
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr:hover {
  background: var(--surface-alt);
}

/* ============ 状态徽章 ============ */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
}

.status-pending {
  background: #fef3c7;
  color: #b45309;
}

.status-published,
.status-admin {
  background: #dcfce7;
  color: #15803d;
}

.status-rejected,
.status-user {
  background: #fee2e2;
  color: #b91c1c;
}

.doc-status-float {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 2;
}

/* ============ 分类情况 ============ */
.cat-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text);
}

.cat-emoji {
  font-size: 15px;
  line-height: 1;
}

.cat-slug {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-alt);
  padding: 1px 6px;
  border-radius: 4px;
}

.head-actions {
  display: flex;
  align-items: center;
}

.admin-table tfoot .admin-total-row td {
  background: var(--surface-alt);
  font-weight: 700;
  color: var(--text);
  border-top: 2px solid var(--border);
}

.doc-title-sm {
  font-weight: 600;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}

.review-note {
  margin-top: 5px;
  font-size: 12px;
  color: var(--danger);
}

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 43, 91, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 500;
}

.modal {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

/* 后台响应式 */
@media (max-width: 900px) {
  .admin-sidebar { width: 64px; padding: 18px 10px; }
  .admin-brand span:last-child, .admin-nav-link span, .admin-back { display: none; }
  .admin-nav-link { justify-content: center; padding: 12px; }
  .admin-cards { grid-template-columns: repeat(2, 1fr); }
  .admin-content { padding: 18px; }
}
