:root {
  --ink: #16181d;
  --muted: #6b7280;
  --line: #e6e8eb;
  --soft: #f6f7f9;
  --brand: #1a5fd0;
  --brand-soft: #eef3fd;
  --danger: #c0392b;
  --ok: #157347;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #fff;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.6;
}

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

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.2px;
}

.brand span { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 8px; }

/* ---------- 卡片与表单 ---------- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin: 22px 0;
  background: #fff;
}

.card h2 {
  font-size: 15px;
  margin: 0 0 16px;
  font-weight: 600;
}

.field { margin-bottom: 14px; }

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

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}

input[type="file"] { padding: 8px; }

input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 14px;
}

.btn {
  display: inline-block;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
}

.btn:hover { background: var(--soft); }

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn-primary:hover { background: #1550b3; }

.btn-sm { padding: 5px 10px; font-size: 13px; }

.btn-danger { color: var(--danger); border-color: #f0d5d1; }
.btn-danger:hover { background: #fdf3f2; }

.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

/* ---------- 提示条 ---------- */
.notice {
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  margin: 18px 0;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  word-break: break-all;
}

.notice.ok { background: #f1f8f4; border-color: #cfe8d9; color: var(--ok); }
.notice.warn { background: #fdf8ec; border-color: #f0e2bd; color: #8a6d1a; }
.notice.err { background: #fdf3f2; border-color: #f0d5d1; color: var(--danger); }

/* ---------- 列表 ---------- */
.list-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 30px 0 10px;
}

.list-head h2 { font-size: 15px; margin: 0; font-weight: 600; }
.list-head span { font-size: 13px; color: var(--muted); }

.item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.item-main { min-width: 220px; flex: 1; }

.item-title {
  font-weight: 500;
  font-size: 14px;
  margin: 0 0 4px;
}

.item-meta {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0;
  word-break: break-all;
}

.item-meta .dot { margin: 0 6px; opacity: 0.5; }

.tag {
  display: inline-block;
  font-size: 12px;
  padding: 1px 7px;
  border-radius: 20px;
  margin-left: 6px;
  vertical-align: 1px;
}

.tag.live { background: #f1f8f4; color: var(--ok); }
.tag.dead { background: var(--soft); color: var(--muted); }

.item-actions { display: flex; gap: 8px; flex-shrink: 0; }

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 40px 0;
}

/* ---------- 登录页 ---------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--soft);
  padding: 20px;
}

.login-box {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 24px;
}

.login-box h1 {
  font-size: 17px;
  margin: 0 0 6px;
  font-weight: 600;
}

.login-box p.sub {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 20px;
}

/* ---------- 阅读页 ---------- */
.reader { background: #eceef1; }

.reader-head {
  background: #fff;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.reader-head .rbrand {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.5px;
  margin: 0 0 6px;
}

.reader-head h1 {
  font-size: 17px;
  line-height: 1.4;
  margin: 0;
  font-weight: 600;
  word-break: break-word;
}

.reader-head .rmeta {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 0;
}

.pages {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 12px 30px;
}

.page {
  margin: 0 0 10px;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.page img {
  display: block;
  width: 100%;
  height: auto;
}

.doc-html {
  background: #fff;
  border-radius: 6px;
  padding: 24px 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  font-size: 15px;
  line-height: 1.85;
  overflow-wrap: break-word;
}

.doc-html img { max-width: 100%; height: auto; }
.doc-html h1, .doc-html h2, .doc-html h3 { line-height: 1.4; }
.doc-html table { border-collapse: collapse; width: 100%; font-size: 13px; }
.doc-html td, .doc-html th { border: 1px solid var(--line); padding: 6px 8px; }
.doc-html p { margin: 0 0 12px; }

.reader-foot {
  text-align: center;
  padding: 6px 20px 34px;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- 失效页 ---------- */
.state-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #fff;
}

.state-box {
  text-align: center;
  max-width: 320px;
}

.state-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 1.5px solid #d9c48a;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b08d2e;
  font-size: 24px;
  font-weight: 400;
}

.state-box h1 { font-size: 17px; margin: 0 0 10px; font-weight: 600; }
.state-box p { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.7; }

/* ---------- 浮层 ---------- */
.modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal[hidden] { display: none; }

.modal-mask {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(20, 22, 28, 0.46);
}

.modal-box {
  position: relative;
  width: 100%;
  max-width: 340px;
  background: #fff;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 500;
}

.modal-x {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
}

.modal-x:hover { color: var(--ink); }

.qr-wrap {
  text-align: center;
  padding: 6px 0 12px;
}

.qr-img {
  width: 240px;
  height: 240px;
  max-width: 100%;
  display: block;
  margin: 0 auto;
  border-radius: 6px;
}

.modal-tip {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.65;
  margin: 0 0 10px;
}

.modal-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
}

@media (max-width: 560px) {
  .row2 { grid-template-columns: 1fr; }
  .item { align-items: flex-start; }
  .item-actions { width: 100%; }
  .item-actions .btn { flex: 1; }
  .wrap { padding: 0 16px; }
}
