* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #F5F6F7;
  --card: #FFFFFF;
  --text: #1F2329;
  --muted: #86909C;
  --border: #E5E6EB;
  --brand: #07C160;
  --brand-dark: #06AD56;
  --brand-weak: #E8FFEF;
  --brand-text: #036B32;
  --warn: #D25F00;
  --warn-weak: #FFF3E8;
  --warn-border: #FFCF9E;
  --code-bg: #F7F8FA;
  --shadow: 0 1px 3px rgba(31, 35, 41, .06), 0 8px 24px rgba(31, 35, 41, .05);
}
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  line-height: 1.6;
}
a { color: inherit; }
.muted { color: var(--muted); }

/* ===== 布局 ===== */
.wrap-inner { max-width: 860px; margin: 0 auto; padding: 0 20px; }
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  margin-bottom: 20px;
}
.topbar .wrap-inner { display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; }
.logo-mark { width: 10px; height: 10px; border-radius: 3px; background: var(--brand); flex: 0 0 auto; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.link-muted { color: var(--muted); font-size: 13px; text-decoration: none; }
.link-muted:hover { color: var(--brand-text); }

/* ===== 控件 ===== */
.btn {
  background: var(--brand); color: #fff; border: none; border-radius: 8px;
  padding: 7px 14px; font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background .15s; text-decoration: none; display: inline-block;
}
.btn:hover { background: var(--brand-dark); }
.btn-block { width: 100%; padding: 10px; font-size: 15px; }
.btn-plain {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 14px; font-size: 13px; color: var(--muted); cursor: pointer;
}
.btn-plain:hover { border-color: var(--brand); color: var(--brand-text); }
.input {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; font-size: 14px; color: var(--text); background: var(--card);
  outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--brand); }

/* ===== 标签条 ===== */
.tagbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.chip {
  border: 1px solid var(--border); border-radius: 999px; background: var(--card);
  padding: 3px 14px; font-size: 13px; color: var(--muted); cursor: pointer;
  user-select: none; text-decoration: none; transition: all .15s;
  font-family: inherit; line-height: 1.6;
}
.chip:hover { border-color: var(--brand); color: var(--brand-text); }
.chip.active { background: var(--brand-weak); border-color: var(--brand); color: var(--brand-text); font-weight: 600; }
.chip.ghost { border-style: dashed; }

/* ===== 文章列表 ===== */
.rows { margin-top: 6px; }
.row { padding: 14px 2px; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: none; }
.rtitle { font-size: 15px; font-weight: 600; }
.rlink { text-decoration: none; }
.rlink:hover { color: var(--brand-text); }
.rmeta { display: flex; align-items: center; gap: 8px; margin-top: 5px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.rmeta .sep { color: var(--border); }
.mini {
  border: 1px solid var(--border); border-radius: 999px; padding: 0 8px;
  font-size: 11.5px; color: var(--muted); background: var(--card);
  font-family: inherit; line-height: 1.7; text-decoration: none;
}
.mini.warn { border-color: var(--warn-border); background: var(--warn-weak); color: var(--warn); cursor: pointer; }
.mini.link { cursor: pointer; }
.mini.link:hover { border-color: var(--brand); color: var(--brand-text); }
a.mini:hover { border-color: var(--brand); color: var(--brand-text); }
.empty { padding: 60px 0; text-align: center; color: var(--muted); font-size: 14px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px 0 8px; font-size: 13px; color: var(--muted); }
.pg-btn { text-decoration: none; color: var(--muted); }
.pg-btn:hover { color: var(--brand-text); }
.pg-btn.off { opacity: .4; }
.pager .cur { color: var(--text); font-weight: 600; }

/* ===== 阅读页 ===== */
.art-wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 40px; }
.art-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 28px clamp(18px, 4vw, 36px); box-shadow: var(--shadow);
}
.art-title { font-size: 22px; font-weight: 700; line-height: 1.4; }
.artmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
.artmeta .sep { color: var(--border); }
.artmeta a { color: var(--brand-text); text-decoration: none; border-bottom: 1px dashed currentColor; }
.tagline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 6px; }
.tagline-inner { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--brand-weak); color: var(--brand-text);
  border: 1px solid #B8EBCB; border-radius: 999px; padding: 2px 12px;
  font-size: 12.5px; font-weight: 500;
}
.tag .x {
  background: none; border: none; cursor: pointer; font-size: 13px;
  color: inherit; opacity: .55; padding: 0; line-height: 1;
}
.tag .x:hover { opacity: 1; }
.tag.add {
  background: var(--card); border: 1px dashed var(--border); color: var(--muted);
  cursor: pointer; font-family: inherit;
}
.tag.add:hover { border-color: var(--brand); color: var(--brand-text); }

/* ===== 正文（公众号排版保留） ===== */
.article-content {
  border-top: 1px solid var(--border); margin-top: 14px; padding-top: 20px;
  font-size: 15.5px; line-height: 1.85; color: var(--text);
  overflow-wrap: break-word;
}
.article-content p { margin: 1em 0; }
.article-content h1, .article-content h2, .article-content h3,
.article-content h4, .article-content h5, .article-content h6 { margin: 1.4em 0 .6em; line-height: 1.4; }
.article-content h1 { font-size: 20px; }
.article-content h2 { font-size: 18px; }
.article-content h3 { font-size: 16.5px; }
.article-content img { max-width: 100%; height: auto; border-radius: 6px; margin: 8px 0; }
.article-content a { color: var(--brand-text); }
.article-content blockquote {
  border-left: 3px solid var(--brand); background: var(--brand-weak);
  border-radius: 0 8px 8px 0; padding: 10px 16px; margin: 16px 0; font-size: 14px;
}
.article-content pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px 16px; overflow-x: auto; margin: 16px 0;
  font: 12.5px/1.7 Consolas, "JetBrains Mono", Menlo, monospace;
}
.article-content code { font-family: Consolas, "JetBrains Mono", Menlo, monospace; font-size: .9em; background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
.article-content pre code { background: none; padding: 0; }
.article-content table { border-collapse: collapse; margin: 16px 0; max-width: 100%; display: block; overflow-x: auto; }
.article-content td, .article-content th { border: 1px solid var(--border); padding: 6px 10px; font-size: 14px; }
.article-content ul, .article-content ol { padding-left: 1.6em; margin: 1em 0; }
.article-content hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.prevnext {
  display: flex; justify-content: space-between; gap: 12px;
  border-top: 1px solid var(--border); margin-top: 26px; padding-top: 16px;
  font-size: 13px; color: var(--muted);
}
.prevnext a { text-decoration: none; }
.prevnext a:hover { color: var(--brand-text); }

/* ===== 登录页 ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 34px 30px; width: 100%; max-width: 360px;
  display: flex; flex-direction: column; gap: 14px; text-align: center;
}
.login-logo { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 19px; font-weight: 700; }
.login-sub { color: var(--muted); font-size: 13px; margin-top: -8px; }
.login-error { background: var(--warn-weak); color: var(--warn); border: 1px solid var(--warn-border); border-radius: 8px; padding: 7px 10px; font-size: 13px; }

/* ===== 弹窗与提示 ===== */
.dlg { border: none; border-radius: 12px; box-shadow: var(--shadow); padding: 0; width: min(440px, calc(100vw - 40px)); }
.dlg::backdrop { background: rgba(0, 0, 0, .35); }
.dlg-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dlg-body h3 { font-size: 16px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; }
.tm-list { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow: auto; }
.tm-row { display: flex; gap: 8px; align-items: center; }
.tm-row .input { flex: 1; padding: 6px 10px; font-size: 13px; }
.tm-row .mini.warn { cursor: pointer; }
#toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(16px);
  background: rgba(31, 35, 41, .92); color: #fff; border-radius: 8px;
  padding: 9px 18px; font-size: 13.5px; opacity: 0; pointer-events: none;
  transition: all .2s; z-index: 99; max-width: calc(100vw - 40px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 560px) {
  .art-card { padding: 20px 16px; }
  .art-title { font-size: 19px; }
  .article-content { font-size: 15px; }
}
