:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1f2329;
  --muted: #8a919c;
  --line: #e5e7eb;
  --line-strong: #d0d4da;
  --primary: #e5486f;
  --primary-soft: #fdebf0;
  --hover: #f7f8fa;
  --danger: #d93026;
  --s0: #9aa1ab; --s1: #d48806; --s2: #2f9e44; --s3: #b0b5bd;
  --nav-bg: #1f2430; --nav-text: #c3c8d2;
  --radius: 6px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a; --panel: #1d2024; --text: #e6e8eb; --muted: #8b929c; --line: #2c3036;
    --line-strong: #3a3f46; --primary: #ff6b8e; --primary-soft: #3a2029; --hover: #24282d;
    --nav-bg: #111316;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--danger); min-height: 1.2em; margin: 8px 0 0; }

input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 6px 8px; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
textarea { width: 100%; resize: vertical; }

.btn {
  border: 1px solid var(--line-strong); background: var(--panel); border-radius: var(--radius);
  padding: 6px 14px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.block { width: 100%; padding: 9px; }
.link { background: none; border: none; color: var(--primary); cursor: pointer; padding: 0; text-decoration: none; }

/* 登录 */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 28px; display: flex; flex-direction: column; gap: 12px;
}
.login-card h1 { margin: 0; font-size: 22px; }
.login-card p { margin: 0 0 8px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; }

/* 布局：左侧菜单 + 右侧内容 */
.admin { display: grid; grid-template-columns: 220px 1fr; height: 100vh; }
.nav { background: var(--nav-bg); color: var(--nav-text); display: flex; flex-direction: column; overflow-y: auto; }
.nav-brand { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid rgba(255,255,255,.06); }
.nav-brand .logo { width: 32px; height: 32px; border-radius: 8px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.nav-brand b { display: block; color: #fff; font-size: 15px; }
.nav-brand span { font-size: 11px; opacity: .6; }
.menu { padding: 8px 0 16px; }
.menu-group { font-size: 12px; opacity: .5; padding: 14px 20px 6px; }
.menu a { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: inherit; text-decoration: none; border-left: 3px solid transparent; }
.menu a svg { width: 18px; height: 18px; fill: currentColor; opacity: .8; flex: none; }
.menu a:hover { background: rgba(255,255,255,.05); color: #fff; }
.menu a.active { background: rgba(255,255,255,.08); color: #fff; border-left-color: var(--primary); }
.nav-mask { display: none; }

.frame { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar { height: 52px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.crumb { font-weight: 600; font-size: 15px; }
.crumb .muted { font-weight: normal; }
.burger { display: none; font-size: 18px; padding: 4px 10px; }
.content { flex: 1; overflow: auto; padding: 16px; }
.page { display: flex; flex-direction: column; gap: 12px; min-height: 100%; }

/* 仪表盘 / 面板 */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; text-decoration: none; color: inherit; }
a.card:hover { border-color: var(--primary); }
.card b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; margin-top: 4px; }
.card span { font-size: 12px; color: var(--muted); }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.panel.narrow { max-width: 420px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 600; border-bottom: 1px solid var(--line); }
.panel-head .link { font-weight: normal; font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.stack .field:not(.grow):not(.range) { width: 100%; }
.progress { padding: 10px 14px; display: flex; flex-direction: column; gap: 10px; }
.progress a { color: inherit; text-decoration: none; display: grid; grid-template-columns: 56px 1fr 64px; align-items: center; gap: 8px; font-size: 13px; }
.progress .bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: var(--primary); }
.progress .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

/* 接口文档 */
.panel.doc { max-width: 900px; }
.doc-body { padding: 4px 18px 18px; line-height: 1.7; }
.doc-body h3 { font-size: 15px; margin: 20px 0 6px; }
.doc-body code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.doc-body pre { background: var(--bg); padding: 10px 12px; border-radius: 6px; overflow-x: auto; font-size: 12.5px; line-height: 1.5; margin: 6px 0; }

/* 筛选区顶部的快捷筛选 */
.chips-row { display: flex; gap: 10px; align-items: flex-start; }
.chips-label { font-size: 12px; color: var(--muted); padding-top: 5px; width: 28px; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 14px; padding: 3px 10px; cursor: pointer; font-size: 13px; }
.chip:hover { border-color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.active .count { color: rgba(255,255,255,.8); }
.chip .count { font-size: 11px; color: var(--muted); margin-left: 4px; font-variant-numeric: tabular-nums; }

/* 筛选 */
.filters { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.row.between { justify-content: space-between; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label { font-size: 12px; color: var(--muted); }
.field.grow { flex: 1 1 260px; }
.field select, .field input { width: 100%; }
.field:not(.grow):not(.range) { width: 120px; }
.field.range { width: 150px; }
.pair { display: flex; gap: 4px; }
.input-group { display: flex; }
.input-group select { width: 100px; flex: none; border-radius: var(--radius) 0 0 var(--radius); border-right: none; }
.input-group input { flex: 1; border-radius: 0 var(--radius) var(--radius) 0; }
.checks { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.check, .inline { display: flex; align-items: center; gap: 6px; }
.btns { display: flex; gap: 8px; }

/* 工具栏 */
.toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.batch { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.batch.disabled select, .batch.disabled button { opacity: .5; pointer-events: none; }
.small-btn { padding: 4px 10px; }

/* 表格 */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: auto; flex: 1 1 auto; min-height: 200px; }
table.grid { border-collapse: collapse; width: 100%; white-space: nowrap; }
.grid th, .grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.grid thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; font-weight: 600; font-size: 13px; box-shadow: inset 0 -1px var(--line-strong); }
.grid tbody tr:hover { background: var(--hover); }
.grid tbody tr.selected { background: var(--primary-soft); }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid .cb { width: 32px; }
.grid th.sortable { cursor: pointer; user-select: none; }
.grid th.sortable:hover { color: var(--primary); }
.grid th.sorted::after { content: " ↓"; color: var(--primary); }
.grid th.sorted.asc::after { content: " ↑"; }
.grid td.kw { font-weight: 500; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.grid td.kw .other { font-size: 11px; color: var(--muted); margin-left: 4px; }
.grid.compact th, .grid.compact td { padding: 7px 14px; }
.grid td a { color: var(--primary); text-decoration: none; }
.grid td.title { font-weight: 500; }
.grid td.title .other { font-size: 11px; color: var(--muted); margin-left: 4px; }
.st-lt-0 { color: var(--s0); } .st-lt-1 { color: var(--s1); } .st-lt-2 { color: #1971c2; } .st-lt-3 { color: var(--s2); } .st-lt-4 { color: var(--s3); text-decoration: line-through; }
.grid .empty { text-align: center; color: var(--muted); padding: 40px; }
.nil { color: var(--line-strong); }

.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; border: 1px solid currentColor; }
.st-ln-0 { color: var(--s2); } .st-ln-1 { color: var(--s3); text-decoration: line-through; } .st-ln-2 { color: var(--danger); }
.grid td a.full { color: var(--muted); }
.grid td.clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.grid td.ops > * + * { margin-left: 12px; }
.table-wrap.flat { border: none; border-radius: 0; min-height: 0; }
.btn.primary-outline { border-color: var(--primary); color: var(--primary); }
.btn.danger, .link.danger { color: var(--danger); }
.st-0 { color: var(--s0); } .st-1 { color: var(--s1); } .st-2 { color: var(--s2); } .st-3 { color: var(--s3); text-decoration: line-through; }
.tag { display: inline-block; background: var(--bg); border-radius: 4px; padding: 1px 6px; font-size: 12px; margin-right: 4px; }
.comp-高 { color: var(--danger); } .comp-中 { color: var(--s1); } .comp-低 { color: var(--s2); }

.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.pager button { min-width: 34px; }
.pager button.current { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager input { width: 64px; }

/* 弹窗 */
.dialog { border: 1px solid var(--line); border-radius: 10px; padding: 20px; width: min(480px, calc(100vw - 32px)); background: var(--panel); color: var(--text); }
.dialog.wide { width: min(760px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(0,0,0,.35); }
.dialog h2 { margin: 0 0 14px; font-size: 18px; word-break: break-all; }
.dialog form { display: flex; flex-direction: column; gap: 12px; }
.dialog form > .field:not(.grow) { width: 100%; }
.dialog-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.spacer { flex: 1; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.detail-grid div { background: var(--bg); border-radius: var(--radius); padding: 6px 8px; }
.detail-grid span { display: block; font-size: 12px; color: var(--muted); }

.dialog.xwide { width: min(1000px, calc(100vw - 32px)); }
.dialog h3.sub { margin: 6px 0 -4px; font-size: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.pub-cfg { display: flex; flex-direction: column; gap: 10px; }
textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; }
.tabs { display: flex; gap: 4px; align-items: center; border-bottom: 1px solid var(--line); margin-bottom: -6px; }
.tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 6px 12px; cursor: pointer; color: var(--muted); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.article-preview { border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 18px; max-height: 60vh; overflow: auto; line-height: 1.8; }
.article-preview h2 { font-size: 18px; margin: 20px 0 8px; }
.article-preview h3 { font-size: 15px; margin: 16px 0 6px; }
.article-preview table { border-collapse: collapse; margin: 8px 0; }
.article-preview th, .article-preview td { border: 1px solid var(--line); padding: 4px 10px; }
.article-preview blockquote { margin: 8px 0; padding: 2px 12px; border-left: 3px solid var(--line-strong); color: var(--muted); }
.article-preview a { color: var(--primary); }
.art-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: -8px; }
.art-warn { background: var(--primary-soft); color: var(--danger); border-radius: var(--radius); padding: 8px 12px; font-size: 13px; }
.st-art-0 { color: var(--s1); } .st-art-1 { color: #1971c2; } .st-art-2 { color: var(--s2); } .st-art-3 { color: var(--danger); } .st-art-4 { color: var(--s3); text-decoration: line-through; }
.risk { color: var(--danger); font-size: 12px; margin-left: 4px; }
/* AI 选词：1 适合 / 2 存疑 / 3 不相关 / 4 高危 */
.st-ai-1 { color: var(--s2); } .st-ai-2 { color: var(--s1); } .st-ai-3 { color: var(--s3); text-decoration: line-through; } .st-ai-4 { color: var(--danger); }
.screen-test td { vertical-align: top; }
.jev-scores { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; }
.jev-scores .bad { color: var(--danger); font-weight: 600; }
.ok-1 { color: var(--s2); } .ok-0 { color: var(--danger); }
.grid td.msg { max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.token { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1f2329; color: #fff; padding: 8px 16px; border-radius: 6px; z-index: 100; }

@media (max-width: 860px) {
  .admin { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  .nav { position: fixed; inset: 0 auto 0 0; width: 240px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .admin.nav-open .nav { transform: none; }
  .admin.nav-open .nav-mask { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; }
  .burger { display: inline-block; }
  .frame { height: auto; min-height: 100vh; }
  .topbar { position: sticky; top: 0; z-index: 10; }
  .content { padding: 12px 16px; overflow: visible; }
  .field:not(.grow):not(.range), .field.range { width: calc(50% - 5px); }
  .chips-row { flex-direction: column; gap: 4px; }
  .chips-label { padding-top: 0; }
  .table-wrap { max-height: 70vh; }
}

/* 城市分站 / 会员 */
.city-picks { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.city-picks .prov { display: flex; gap: 10px; align-items: flex-start; }
.city-picks .prov > b { width: 48px; flex: none; font-size: 12px; color: var(--muted); font-weight: normal; padding-top: 2px; }
.city-picks .prov > div { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.city-picks label { display: flex; align-items: center; gap: 4px; }
.city-picks label.done { color: var(--muted); }
.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.photos .ph { position: relative; width: 96px; height: 96px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.photos .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos .ph .cover { position: absolute; left: 0; top: 0; background: var(--primary); color: #fff; font-size: 11px; padding: 1px 6px; border-bottom-right-radius: var(--radius); }
.photos .ph .acts { position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; background: rgba(0,0,0,.55); }
.photos .ph .acts button { border: 0; background: none; color: #fff; font-size: 12px; padding: 2px 6px; cursor: pointer; }
.photos .add { width: 96px; height: 96px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: none; color: var(--muted); font-size: 13px; cursor: pointer; }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 8px; background: var(--bg); }
.avatar.empty { display: inline-block; }
.member-cell { display: flex; align-items: center; }
.star { color: var(--s1); margin-left: 4px; }
