:root {
  --brand: #4B3FE3;
  --brand-weak: #EEF0FF;
  --bg: #F2F3F7;
  --card: #FFFFFF;
  --text: #1D1D1F;
  --muted: #86868B;
  --line: #E8E8EE;
  --danger: #E8463A;
  --ok: #1DC981;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,.94);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { font-size: 17px; font-weight: 700; color: var(--brand); letter-spacing: .2px; text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.topbar nav a { text-decoration: none; color: var(--text); }
.topbar nav a:active { color: var(--brand); }

.container { max-width: 720px; margin: 0 auto; padding: 16px 16px 56px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 10px; padding: 10px 18px;
  font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: opacity .15s; font-family: inherit;
}
.btn:active { opacity: .75; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px; margin-bottom: 14px;
}
.hint { font-size: 13px; color: var(--muted); }

input[type=text], input[type=password], input[type=search] {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 14px; font-size: 16px; background: #fff; outline: none; font-family: inherit;
}
input[type=number] {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; font-size: 14px; background: #fff; outline: none; font-family: inherit;
}
input:focus { border-color: var(--brand); }

.error-msg {
  background: #FDECEA; color: var(--danger); font-size: 13px;
  border-radius: 8px; padding: 8px 12px; margin-bottom: 12px;
}

.toast {
  position: fixed; left: 50%; bottom: 64px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(29,29,31,.92); color: #fff;
  padding: 10px 20px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 登录 / 设置密码 */
.auth-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 360px; padding: 32px 24px; text-align: center; }
.auth-logo {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px;
  background: var(--brand); color: #fff; font-size: 26px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card .hint { margin-bottom: 20px; }
.auth-card input { margin-bottom: 12px; }

/* 列表 */
.search-box { margin-bottom: 10px; }
.article-card { display: block; text-decoration: none; transition: border-color .15s; }
.article-card:active { border-color: var(--brand); }
.article-card h2 {
  font-size: 16.5px; font-weight: 600; line-height: 1.5; margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.article-card .meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.article-card .meta b { color: var(--text); font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; border-style: dashed; }
.empty a { color: var(--brand); text-decoration: none; font-weight: 600; }

/* 详情 */
.title-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.title-row h1 { font-size: 19px; line-height: 1.5; flex: 1; }
.stat-line { font-size: 13px; color: var(--muted); margin: 0 2px 14px; }
.stat-line b { color: var(--brand); font-size: 16px; font-weight: 700; }
.action-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.section-label { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.body-text p { text-indent: 2em; margin-bottom: 14px; line-height: 1.95; font-size: 16px; }
.body-text img.inline-img {
  display: block; width: 100%; margin: 12px 0 16px;
  border-radius: 10px; border: 1px solid var(--line);
  cursor: zoom-in; -webkit-touch-callout: default;
}

/* 上传 */
.dropzone {
  border: 2px dashed #C4C8EC; border-radius: 14px; padding: 40px 16px;
  text-align: center; color: var(--muted); cursor: pointer; background: #fff;
  transition: border-color .15s, background .15s;
}
.dropzone.over { border-color: var(--brand); background: var(--brand-weak); color: var(--brand); }
.dropzone .dz-icon { font-size: 34px; margin-bottom: 8px; }
.dropzone p { font-size: 14px; }
.file-list { margin-top: 14px; }
.file-item {
  display: flex; justify-content: space-between; gap: 10px; font-size: 14px;
  padding: 10px 12px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 8px;
}
.file-item .del { color: var(--danger); cursor: pointer; flex: none; }
.result-item {
  display: flex; justify-content: space-between; gap: 10px; font-size: 14px;
  padding: 10px 12px; border-radius: 10px; margin-bottom: 8px; border: 1px solid var(--line);
  background: #fff; word-break: break-all;
}
.result-item.ok { border-color: rgba(29,201,129,.4); }
.result-item.fail { border-color: rgba(232,70,58,.4); }
.result-item.dup { border-color: rgba(230,180,80,.55); background: #FFFBF0; }
.result-item .msg { color: var(--muted); flex: none; }

/* 列表 Tab 与已发布卡片 */
.tabs { display: flex; gap: 8px; margin: 4px 0 14px; }
.tab {
  flex: 1; text-align: center; padding: 9px 0; border-radius: 10px;
  background: #fff; border: 1px solid var(--line);
  text-decoration: none; font-size: 14px; font-weight: 600; color: var(--text);
}
.tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.tab .cnt { margin-left: 5px; font-size: 12px; opacity: .8; }
.ac-link { text-decoration: none; color: inherit; display: block; }
.ac-link h2 {
  font-size: 16.5px; font-weight: 600; line-height: 1.5; margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.meta-right { display: flex; align-items: center; gap: 12px; }
.meta-right form { display: inline; }
.link-btn {
  border: none; background: none; color: var(--brand); font-size: 13px;
  cursor: pointer; padding: 0; font-family: inherit;
}
.badge-done {
  display: inline-block; font-size: 12px; color: var(--ok);
  background: rgba(29,201,129,.12); border-radius: 999px;
  padding: 3px 10px; margin-bottom: 10px;
}

@media (min-width: 640px) {
  .dropzone { padding: 56px 16px; }
}

/* ===== 管理后台 ===== */
.page-title { font-size: 22px; margin-bottom: 14px; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; }
.form-row input, .form-row select { flex: 1; min-width: 140px; }
.select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 15px; background: #fff; outline: none; font-family: inherit;
}
.search-box { display: flex; gap: 8px; margin-bottom: 10px; }
.search-box select { width: auto; flex: none; }
.my-progress { font-size: 14px; color: var(--muted); margin: 0 2px 12px; }
.my-progress b { color: var(--brand); font-size: 16px; }

.table-wrap { overflow-x: auto; padding: 0; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; vertical-align: middle;
}
.admin-table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table .t-title {
  white-space: normal; min-width: 200px; max-width: 420px;
  overflow: hidden; text-overflow: ellipsis;
}
.admin-table .op-cell { white-space: normal; }
.row-off td { opacity: .5; }
.danger-link { color: var(--danger); }
.chk-label { display: flex; align-items: center; gap: 4px; font-size: 14px; }

.bulk-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line);
}
.bulk-bar select { width: auto; flex: none; padding: 6px 10px; font-size: 14px; }

.stat-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
.stat-card { padding: 14px 8px; text-align: center; }
.stat-card b { display: block; font-size: 20px; color: var(--brand); }
.stat-card span { font-size: 12px; color: var(--muted); }
.prog {
  position: relative; background: var(--bg); border-radius: 999px; height: 18px; overflow: hidden;
}
.prog-bar { background: var(--ok); height: 100%; border-radius: 999px; min-width: 2px; transition: width .4s; }
.prog span {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text); font-weight: 600;
}
.chip {
  display: inline-block; font-size: 12px; border-radius: 999px; padding: 2px 9px;
  background: var(--brand-weak); color: var(--brand); font-weight: 600;
}
.chip-muted { background: #F2F3F7; color: var(--muted); }
.chip-done { background: rgba(29,201,129,.12); color: var(--ok); }
.domain-now { font-size: 18px; margin-bottom: 6px; }
.domain-now b { color: var(--brand); word-break: break-all; }
.soft-hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
#adminTabs .tab { border: none; background: #fff; cursor: pointer; font-family: inherit; }

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