:root {
  --bg: #eef2f6;
  --sider: #243041;
  --sider-2: #1b2533;
  --card: #ffffff;
  --line: #e5ebf2;
  --text: #1f2a37;
  --muted: #6b7a8d;
  --primary: #3d6f97;
  --primary-hover: #335d7e;
  --danger: #c45b4d;
  --ok: #2f8f6b;
  --shadow: 0 10px 30px rgba(24, 39, 56, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.hidden { display: none !important; }

/* 登录 */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(700px 320px at 15% 10%, rgba(61, 111, 151, 0.18), transparent 60%),
    linear-gradient(160deg, #1b2533, #2f3a48 55%, #3d5168);
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.login-brand {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.login-sub,
.login-tip {
  color: var(--muted);
  margin: 8px 0 20px;
}

.login-tip { margin-top: 14px; font-size: 13px; }

/* 布局 */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sider {
  background: linear-gradient(180deg, var(--sider), var(--sider-2));
  color: #fff;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
}

.sider-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 10px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 16px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #3d6f97;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.brand-name { font-size: 18px; font-weight: 700; }
.brand-sub { font-size: 12px; color: rgba(255,255,255,0.55); margin-top: 2px; }

.menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.menu-item {
  border: none;
  text-align: left;
  background: transparent;
  color: rgba(255,255,255,0.78);
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
}

.menu-item:hover,
.menu-item.active {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.logout { margin-top: auto; }

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 18px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.top-title { font-size: 20px; font-weight: 700; }
.top-desc { color: var(--muted); font-size: 13px; margin-top: 4px; }

.badge {
  background: #e8eef5;
  color: var(--primary);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.content {
  padding: 24px 28px 40px;
}

.panel { display: none; }
.panel.active { display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}

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

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

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

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

.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
}

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

.stat-value {
  margin-top: 10px;
  font-size: 24px;
  font-weight: 700;
}

.stat-value.small { font-size: 16px; word-break: break-all; }

.field-label {
  display: block;
  margin: 12px 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.field {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
  background: #fff;
}

.field:focus {
  border-color: #8fb0cb;
  box-shadow: 0 0 0 3px rgba(61, 111, 151, 0.12);
}

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

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
}

.btn.block { width: 100%; margin-top: 8px; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost {
  background: transparent;
  color: #d7e3ef;
  border: 1px solid rgba(255,255,255,0.22);
}
.workspace .btn.ghost {
  color: var(--primary);
  border-color: #c5d6e6;
  background: #f5f9fc;
}
.btn.danger {
  background: rgba(196, 91, 77, 0.1);
  color: var(--danger);
  border: 1px solid rgba(196, 91, 77, 0.25);
}
.file-btn { display: inline-block; }

.actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.actions.wrap { flex-wrap: wrap; }

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0 4px;
  color: var(--text);
  font-size: 14px;
}
.field-row em {
  font-style: normal;
  color: var(--primary);
  font-weight: 600;
}
.field-row input[type='range'] {
  width: 100%;
  max-width: 360px;
  accent-color: var(--primary);
}

.qiniu-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.cover-box {
  min-height: 240px;
  border-radius: 12px;
  background: #f3f6f9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cover-img {
  max-width: 220px;
  max-height: 300px;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.16);
}

.cover-empty { color: var(--muted); }

.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.page-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  position: relative;
  transition: box-shadow 0.15s ease, opacity 0.15s ease;
}

.page-card.dragging {
  opacity: 0.55;
  box-shadow: 0 8px 24px rgba(36, 48, 65, 0.18);
}

.page-card.drag-over {
  box-shadow: 0 0 0 2px var(--primary);
}

.page-card .drag-handle {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 2;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(36, 48, 65, 0.72);
  color: #fff;
  font-size: 14px;
  letter-spacing: -2px;
  cursor: grab;
  user-select: none;
}

.page-card .drag-handle:active {
  cursor: grabbing;
}

.page-card img {
  width: 100%;
  height: 260px;
  object-fit: contain;
  display: block;
  background: #edf1f5;
}

.page-card .badge-num {
  position: absolute;
  left: 8px;
  top: 8px;
  background: rgba(36, 48, 65, 0.75);
  color: #fff;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
}

.page-card .page-field {
  width: calc(100% - 16px);
  margin: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.page-card .remove {
  width: calc(100% - 16px);
  margin: 0 8px 10px;
  border: none;
  background: rgba(196, 91, 77, 0.1);
  color: var(--danger);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
}

.pdf-status {
  margin: 8px 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f3f7fb;
  color: var(--text);
  font-size: 14px;
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 14px;
  color: var(--muted);
}

.bgm-preview {
  width: min(420px, 100%);
  margin-top: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: rgba(27, 37, 51, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  z-index: 99;
  font-size: 14px;
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sider { min-height: auto; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .menu { flex-direction: row; flex-wrap: wrap; }
  .logout { margin-top: 12px; }
}
