/* 极简主题 CSS —— 前后台共用 */
:root {
  --fg: #1f2328;
  --muted: #6b7280;
  --bg: #fafafa;
  --card: #ffffff;
  --border: #e5e7eb;
  --link: #0969da;
  --link-hover: #0550ae;
  --max: 720px;
  --code-bg: #f3f4f6;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--fg);
  background: var(--bg);
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
.muted { color: var(--muted); }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* 头尾 */
.site-header { border-bottom: 1px solid var(--border); background: var(--card); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.site-title { font-weight: 700; font-size: 17px; color: var(--fg); }
.site-nav a { margin-left: 18px; color: var(--muted); font-size: 14px; }
.site-nav a:hover { color: var(--fg); text-decoration: none; }
.site-main { padding: 32px 20px 64px; min-height: 60vh; }
.site-footer { border-top: 1px solid var(--border); padding: 20px 0; color: var(--muted); font-size: 13px; }
.site-footer .wrap { display: flex; gap: 8px; }

/* 文章卡片列表 */
.post-list { display: flex; flex-direction: column; gap: 28px; }
.post-card { padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.post-card:last-child { border-bottom: none; }
.post-card-title { font-size: 20px; margin: 0 0 6px; font-weight: 600; }
.post-meta { font-size: 13px; color: var(--muted); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.post-meta .cat { background: var(--code-bg); padding: 1px 8px; border-radius: 10px; color: var(--muted); }
.post-excerpt { margin: 10px 0 6px; color: #374151; }
.post-excerpt p { margin: 6px 0; }
.read-more { font-size: 14px; }
.badge { display: inline-block; font-size: 11px; color: #b91c1c; border: 1px solid #fecaca; background: #fef2f2; border-radius: 4px; padding: 0 6px; vertical-align: middle; }

/* 文章详情 */
.post-title { font-size: 26px; margin: 0 0 8px; }
.post-desc { color: var(--muted); font-style: italic; margin: 4px 0 18px; }
.post-content h1, .post-content h2, .post-content h3 { line-height: 1.35; margin: 1.6em 0 0.6em; }
.post-content h2 { font-size: 21px; }
.post-content h3 { font-size: 18px; }
.post-content p { margin: 14px 0; }
.post-content ul, .post-content ol { padding-left: 1.6em; }
.post-content img { max-width: 100%; }
.post-content blockquote {
  margin: 14px 0; padding: 6px 14px; color: var(--muted);
  border-left: 3px solid var(--border); background: var(--code-bg);
}
.post-content pre {
  background: var(--code-bg); padding: 12px 14px; border-radius: 6px;
  overflow-x: auto; font-size: 13.5px; line-height: 1.5;
}
.post-content code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.post-content :not(pre) > code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }
.post-content table { border-collapse: collapse; margin: 14px 0; }
.post-content th, .post-content td { border: 1px solid var(--border); padding: 6px 10px; }
.tag { color: var(--muted); }
.views { margin-left: auto; }

/* 分页 */
.pagination { display: flex; gap: 16px; justify-content: center; align-items: center; margin-top: 40px; font-size: 14px; }
.pagedot { color: var(--muted); }

/* 归档 */
.page-title { font-size: 24px; margin: 0 0 20px; }
.archive-year { font-size: 18px; margin: 24px 0 6px; color: var(--muted); }
.archive-list, .tax-list { list-style: none; padding: 0; }
.archive-list li, .tax-list li { padding: 5px 0; display: flex; gap: 12px; }
.archive-list time, .tax-list time { color: var(--muted); font-size: 13px; width: 90px; flex-shrink: 0; }

/* 分类/标签云 */
.tax-cloud { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.tax-cloud li a { display: inline-block; padding: 4px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; font-size: 14px; color: var(--fg); }
.tax-cloud li a:hover { background: var(--code-bg); text-decoration: none; }

/* 404 */
.notfound { text-align: center; padding: 60px 0; }

/* 评论 */
.comments { margin-top: 48px; border-top: 1px solid var(--border); padding-top: 24px; }
.comments h3 { font-size: 18px; margin: 0 0 16px; }
.comment-list { list-style: none; padding: 0; }
.comment-list li { padding: 10px 0; border-bottom: 1px dashed var(--border); }
.comment-author { font-size: 14px; font-weight: 600; }
.comment-author small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.comment-body { margin-top: 4px; color: #374151; white-space: pre-wrap; }
.comment-form { margin-top: 24px; display: flex; flex-direction: column; gap: 10px; max-width: 100%; }
.comment-form .row { display: flex; gap: 10px; }
.comment-form input, .comment-form textarea { flex: 1; }
.comment-form textarea { min-height: 90px; resize: vertical; }

/* 表单通用 */
input[type=text], input[type=email], input[type=password], input[type=datetime-local], select, textarea {
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
  font: inherit; background: var(--card); color: var(--fg); width: 100%; }
textarea { width: 100%; }
button, .btn {
  display: inline-block; cursor: pointer; border: 1px solid var(--border);
  background: var(--card); color: var(--fg); padding: 7px 14px; border-radius: 6px;
  font: inherit; line-height: 1.4; }
button:hover, .btn:hover { background: var(--code-bg); text-decoration: none; }
button[type=submit]:not(.muted) { background: var(--link); color: #fff; border-color: var(--link); }
button[type=submit]:not(.muted):hover { background: var(--link-hover); border-color: var(--link-hover); }
.error { color: #b91c1c; }

/* ===== 后台 ===== */
/* 后台页面加宽到 960，表格/编辑器更舒展 */
body.admin .wrap { max-width: 960px; }
.admin h1 { font-size: 22px; margin: 0 0 18px; font-weight: 600; }

/* 卡片容器 */
.admin-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px 22px; margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}

/* 工具栏 */
.admin-bar {
  display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; align-items: center;
}
.admin-bar .spacer { flex: 1; }
.admin-bar .btn { font-size: 13px; padding: 6px 12px; }
.admin-bar .btn-primary { background: var(--link); color: #fff; border-color: var(--link); }
.admin-bar .btn-primary:hover { background: var(--link-hover); }
.admin-bar .count {
  font-size: 12px; color: var(--muted); background: var(--code-bg);
  padding: 2px 8px; border-radius: 10px;
}
.admin-bar .count.has { color: #b91c1c; background: #fef2f2; }

/* 过滤切换 */
.tabs { display: inline-flex; gap: 2px; background: var(--code-bg); padding: 3px; border-radius: 8px; }
.tabs a { padding: 5px 12px; border-radius: 6px; font-size: 13px; color: var(--muted); }
.tabs a.active { background: var(--card); color: var(--fg); box-shadow: 0 1px 2px rgba(0,0,0,.06); font-weight: 500; }

/* 表格 */
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td {
  border-bottom: 1px solid var(--border); padding: 11px 10px; text-align: left; vertical-align: middle;
}
.admin-table thead th {
  color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase;
  letter-spacing: .04em; border-bottom: 1px solid var(--border); padding-top: 6px; padding-bottom: 8px;
}
.admin-table tbody tr:hover { background: #f9fafb; }
.admin-table td .ttitle { font-weight: 500; color: var(--fg); }
.admin-table td .ttitle:hover { color: var(--link); }
.admin-table td time, .admin-table td .m { color: var(--muted); font-size: 13px; }
.admin-table .c-body { max-width: 280px; word-break: break-word; color: #374151; font-size: 13px; line-height: 1.5; }
.admin-table td.actions { white-space: nowrap; text-align: right; }

/* 表格内操作链接 */
.a-link { color: var(--link); font-size: 13px; margin-left: 10px; }
.a-link:first-child { margin-left: 0; }
.a-link.danger { color: #b91c1c; }
.a-link.danger:hover { color: #991b1b; }
form.inline { display: inline; }
.admin-table form.inline button,
form.inline button {
  border: none !important; background: none !important; padding: 0 !important;
  font: inherit; cursor: pointer; color: #b91c1c !important; font-size: 13px !important;
  margin-left: 10px; line-height: 1.4; display: inline; box-shadow: none !important;
}
form.inline button:hover { color: #991b1b !important; text-decoration: underline; }

/* 状态徽章 */
.st { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; line-height: 1.6; }
.st-published { color: #15803d; background: #f0fdf4; border: 1px solid #bbf7d0; }
.st-draft { color: #b45309; background: #fffbeb; border: 1px solid #fde68a; }
.st-pending { color: #b45309; background: #fffbeb; border: 1px solid #fde68a; }
.st-approved { color: #15803d; background: #f0fdf4; border: 1px solid #bbf7d0; }
.st-spam { color: #991b1b; background: #fef2f2; border: 1px solid #fecaca; }

/* 编辑器 */
.admin-edit form { display: flex; flex-direction: column; gap: 16px; }
.admin-edit label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.admin-edit label > span { font-weight: 500; }
.admin-edit input[type=text], .admin-edit input[type=email],
.admin-edit input[type=password], .admin-edit input[type=datetime-local],
.admin-edit select, .admin-edit textarea {
  border: 1px solid var(--border); border-radius: 7px; padding: 9px 11px;
  font: inherit; background: var(--card); color: var(--fg); width: 100%; transition: border-color .15s;
}
.admin-edit input:focus, .admin-edit select:focus, .admin-edit textarea:focus {
  outline: none; border-color: var(--link); box-shadow: 0 0 0 3px rgba(9,105,218,.12);
}
.admin-edit textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; line-height: 1.6; min-height: 360px; }
.admin-edit .row { display: flex; gap: 14px; }
.admin-edit .row > label { flex: 1; }
.admin-edit .settings-row {
  display: flex; gap: 28px; align-items: center; flex-wrap: wrap;
}
.admin-edit .checkbox-label {
  display: inline-flex; flex-direction: row; align-items: center; gap: 7px;
  color: var(--fg); font-size: 14px; cursor: pointer; margin: 0;
}
.admin-edit .checkbox-label input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; margin: 0; }
.admin-edit .field-inline { display: inline-flex; align-items: center; gap: 10px; }
.admin-edit .field-inline .field-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.admin-edit .field-inline select { width: auto; min-width: 120px; padding: 8px 11px; }
.admin-edit code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.admin-edit .form-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.admin-edit .form-actions button { padding: 9px 20px; font-size: 14px; }
.admin-edit .hint { font-size: 12px; color: var(--muted); }

/* 登录页 */
.admin.login .wrap { max-width: 380px; }
.admin-login { margin-top: 48px; }
.admin-login h1 { text-align: center; font-size: 20px; margin-bottom: 24px; }
.admin-login .admin-card { padding: 28px 26px; }
.admin-login form { display: flex; flex-direction: column; gap: 14px; }
.admin-login label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.admin-login input { border: 1px solid var(--border); border-radius: 7px; padding: 10px 12px; font: inherit; }
.admin-login input:focus { outline: none; border-color: var(--link); box-shadow: 0 0 0 3px rgba(9,105,218,.12); }
.admin-login button { padding: 10px; font-size: 15px; }
.admin-login .alert { color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 7px; padding: 9px 12px; font-size: 13px; margin-bottom: 4px; }

@media (max-width: 560px) {
  .site-nav a { margin-left: 10px; }
  .comment-form .row, .admin-edit .row { flex-direction: column; }
  body.admin .wrap { max-width: 100%; }
  .admin-table .hide-sm { display: none; }
}