/* ============================================================
   后台：与公开博客同一套克制留白气质
   暖纸底 + 墨色 + 青绿 brand；去卡片、去重线、收敛圆角。
   写作页保留「白纸浮起」感，但圆角/阴影收敛。
   ============================================================ */
:root {
  --bg: oklch(0.965 0.020 95);
  --card: #ffffff;
  --text: oklch(0.27 0.022 75);
  --ink-soft: oklch(0.45 0.020 75);
  --muted: oklch(0.55 0.015 75);
  --line: oklch(0.90 0.018 90);
  --brand: oklch(0.45 0.075 256);
  --brand-soft: oklch(0.94 0.030 256);
  --danger: oklch(0.52 0.05 250);
  --shadow: 0 1px 2px rgba(20,30,28,.04), 0 14px 40px rgba(20,30,28,.06);
  --shadow-sm: 0 1px 2px rgba(20,30,28,.04), 0 6px 18px rgba(20,30,28,.04);
  --serif: "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  --sans: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); line-height: 1.75; font-size: 16px; display: flex; flex-direction: column; min-height: 100vh; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* 顶栏：不画线，靠留白分隔 */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; max-width: 1200px; width: 100%; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 700; font-size: 21px; letter-spacing: .5px; cursor: pointer; color: var(--text); }
.brand .logo { width: 30px; height: 30px; color: var(--brand); display: inline-flex; }
.brand .logo svg { width: 100%; height: 100%; }
.topbar .links a { margin-left: 18px; color: var(--ink-soft); font-size: 14px; }
.topbar .links a:hover { color: var(--brand); text-decoration: none; }

/* 布局 */
.admin-shell { max-width: 1200px; width: 100%; margin: 0 auto; padding: 30px 24px 120px; flex: 1; }
.view-head { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.view-head h2 { font-family: var(--serif); font-size: 26px; margin: 0; }

/* 草稿/已发布列表：去卡片，纯文字行 + 极淡分隔线 */
.art-list { display: flex; flex-direction: column; }
.art-item { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 14px; padding: 18px 0; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .15s; }
.art-item:first-child { padding-top: 4px; }
.art-item:last-child { border-bottom: none; }
.art-item:hover { background: transparent; }
.art-item:hover .t { color: var(--brand); }
.art-item .t { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16.5px; transition: color .15s; }
.art-item .d { color: var(--muted); font-size: 12.5px; }
.status-pill { font-size: 11px; padding: 3px 11px; border-radius: 999px; white-space: nowrap; }
.status-draft { background: oklch(0.95 0.005 90); color: var(--muted); }
.status-published { background: var(--brand-soft); color: var(--brand); }

/* 写作页：页面底色压深一档，让「白纸」浮起来 */
body.writing { --bg: oklch(0.952 0.008 95); background: var(--bg); }

/* 写作页 */
.write-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 6px; background: color-mix(in oklch, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.save-status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; }
.save-status .dot { width: 7px; height: 7px; border-radius: 50%; background: oklch(0.55 0.10 256); display: inline-block; transition: background .2s; }
.save-status.dirty .dot { background: oklch(0.74 0.14 70); }
/* 一张白纸：正文文字列保持 700px（844 − 左右各 56 内边距 − 编辑器左右各 16 = 700） */
.write-area { max-width: 844px; margin: 26px auto 80px; padding: 50px 56px 44px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); }

/* 标题 / 简介 / 正文 三块输入区，同款细边框，视觉成一组 */
.write-area .write-title, .write-area .write-summary {
  display: block; width: 100%; background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
  transition: border-color .15s;
}
.write-area .write-title { font-family: var(--serif); font-size: 30px; font-weight: 700; line-height: 1.32; color: var(--text); letter-spacing: .5px; padding: 14px 16px; margin-bottom: 14px; }
.write-area .write-summary { color: var(--ink-soft); font-size: 16px; line-height: 1.7; resize: none; padding: 12px 16px; margin-bottom: 18px; }
.write-area .write-title::placeholder, .write-area .write-summary::placeholder { color: var(--muted); }
.write-area .write-title:focus, .write-area .write-summary:focus { outline: none; border-color: var(--brand); }
.write-count { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

/* 分段控件：草稿 / 已发布 */
.seg { display: inline-flex; gap: 4px; background: oklch(0.94 0.006 90); border-radius: 10px; padding: 4px; }
.seg-btn { border: none; background: transparent; padding: 9px 18px; border-radius: 8px; font-size: 14px; cursor: pointer; color: var(--ink-soft); font-family: var(--sans); transition: .15s; }
.seg-btn.active { background: #fff; color: var(--brand); font-weight: 600; box-shadow: var(--shadow-sm); }
.seg-btn span { color: var(--muted); font-size: 12px; margin-left: 2px; }

/* 列表项操作 */
.art-item .acts { display: flex; gap: 8px; }
.art-item .acts .btn { padding: 6px 12px; font-size: 13px; }

/* 底部元信息面板：标签 / 访问路径 / 发布日期——竖排 */
.meta-box { background: oklch(0.965 0.006 95); border: none; border-radius: 12px; padding: 22px 24px; margin-top: 40px; display: grid; grid-template-columns: 1fr; gap: 20px; }
.meta-field { min-width: 0; }
.meta-label { display: block; font-size: 12px; letter-spacing: 1.5px; color: var(--muted); font-weight: 600; margin-bottom: 7px; }
.slug-field { display: flex; align-items: center; gap: 4px; padding: 0 8px 0 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; transition: border-color .15s; }
.slug-field:focus-within { border-color: var(--brand); }
.slug-field .slug-prefix { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.slug-field input { border: none; padding: 12px 0; flex: 1; background: transparent; font-size: 15px; min-width: 0; }
.slug-field input:focus { outline: none; }
.slug-regen { border: none; background: transparent; cursor: pointer; color: var(--muted); font-size: 15px; padding: 6px; border-radius: 8px; }
.slug-regen:hover { color: var(--brand); background: var(--brand-soft); }

/* Quill 编辑器：工具栏与正文同处一个有边框的盒子内（与标题/简介成一组） */
.editor-box { border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; transition: border-color .15s; }
.editor-box:focus-within { border-color: var(--brand); }
.ql-toolbar.ql-snow { border: none; border-bottom: 1px solid var(--line); padding: 8px 12px; background: oklch(0.985 0.004 95); }
.ql-container.ql-snow { border: none; font-family: var(--sans); font-size: 17px; }
.ql-editor { min-height: clamp(400px, 58vh, 900px); padding: 20px 16px; }
.editor-foot { text-align: right; padding-top: 12px; }

/* 查看态（已发布文章默认进入）：只读，无工具栏、不显示保存状态 */
body.viewing .ql-toolbar.ql-snow { display: none; }
body.viewing .save-status { display: none; }
body.viewing .editor-box .ql-editor { cursor: default; }
body.viewing .write-area input, body.viewing .write-area textarea { background: oklch(0.985 0.004 95); color: var(--ink-soft); }
body.viewing .write-area .write-title { color: var(--text); }
body.viewing .slug-field { background: oklch(0.985 0.004 95); }
body.viewing .slug-regen { display: none; }
body.viewing .slug-field input { color: var(--ink-soft); }

/* 专注模式：隐藏顶栏 */
body.immersive .topbar { display: none; }

/* 正文排版——与博客阅读页 .article-body 一致（所见即所得） */
.ql-editor { font-size: 17px; line-height: 1.95; color: oklch(0.32 0.01 80); }
.ql-editor > *:first-child { margin-top: 0; }
.ql-editor p { margin: 1.1em 0; }
.ql-editor h1, .ql-editor h2, .ql-editor h3, .ql-editor h4 { font-family: var(--serif); line-height: 1.4; margin: 1.6em 0 .6em; }
.ql-editor h1 { font-size: 30px; }
.ql-editor h2 { font-size: 25px; }
.ql-editor h3 { font-size: 20px; }
.ql-editor h4 { font-size: 18px; }
.ql-editor ul, .ql-editor ol { margin: 1.1em 0; padding-left: 1.6em; }
.ql-editor li { margin: .4em 0; }
.ql-editor blockquote { margin: 1.6em 0; padding: 4px 0 4px 18px; border-left: 2px solid var(--line); color: var(--ink-soft); font-style: italic; }
.ql-editor pre, .ql-editor .ql-code-block-container { background: oklch(0.22 0.01 80); color: oklch(0.96 0 0); padding: 16px; border-radius: 8px; overflow: auto; font-size: 14px; }
.ql-editor code { background: oklch(0.95 0.005 90); padding: 2px 6px; border-radius: 5px; font-size: .9em; }
.ql-editor pre code, .ql-editor .ql-code-block { background: transparent; padding: 0; color: inherit; }
.ql-editor a { text-decoration: underline; }
.ql-editor img { max-width: 100%; border-radius: 8px; margin: 20px 0; }
.ql-editor hr { border: none; border-top: 1px solid var(--line); margin: 2em 0; }
.ql-editor table { border-collapse: collapse; width: 100%; margin: 1.5em 0; font-size: 15px; }
.ql-editor th, .ql-editor td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; }
.ql-editor th { background: oklch(0.97 0.004 95); }
.ql-editor.ql-blank::before { color: var(--muted); font-style: normal; }

/* 通用按钮 / 表单 */
.btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 10px 18px; border-radius: 8px; font-size: 14px; transition: .15s; font-family: var(--sans); text-decoration: none; }
.btn:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { opacity: .92; color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn.ghost:hover { color: var(--brand); background: transparent; }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
input[type=text], input[type=password], input[type=date], textarea, select { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; font-family: inherit; background: #fff; color: var(--text); transition: border-color .15s; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); }
input::placeholder, textarea::placeholder { color: var(--muted); }
.meta-date { max-width: 220px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 16px 0 6px; }

/* 窄屏：白纸收边 */
@media (max-width: 880px) {
  .write-area { margin: 16px auto 60px; padding: 26px 20px 24px; border-radius: 12px; }
  .write-area .write-title { font-size: 24px; padding: 12px 14px; }
}

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); text-align: center; padding: 60px 10px; font-size: 15px; }

/* 登录遮罩 */
.login-overlay { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 100; }
.login-card { width: min(360px, 90vw); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 34px 30px; box-shadow: var(--shadow); }
.login-card .brand { justify-content: center; font-size: 22px; margin-bottom: 8px; cursor: default; }
.login-card input { margin-bottom: 14px; }
.login-err { color: var(--danger); font-size: 13px; min-height: 18px; text-align: center; margin: 10px 0 0; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(10px); background: oklch(0.24 0.012 80); color: #fff; padding: 11px 20px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: .22s; z-index: 60; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 后台：拾穗管理 ===== */
.admin-nav { display: flex; gap: 4px; margin-left: 18px; }
.admin-nav a { color: var(--ink-soft); font-size: 14px; padding: 6px 12px; border-radius: 8px; text-decoration: none; cursor: pointer; }
.admin-nav a:hover { background: color-mix(in oklch, var(--ink-soft) 10%, transparent); }
.admin-nav a.active { color: var(--brand); background: color-mix(in oklch, var(--brand) 12%, transparent); }

#view-bookmarks .bm-edit { margin-top: 18px; }
.bm-form { display: flex; flex-direction: column; gap: 12px; max-width: 42em; }
.bm-form input, .bm-form textarea {
  font: inherit; padding: 11px 13px; border-radius: 10px;
  border: 1px solid color-mix(in oklch, var(--ink-soft) 22%, transparent);
  background: var(--bg); color: var(--text); resize: vertical;
}
.bm-form input:focus, .bm-form textarea:focus { outline: none; border-color: var(--brand); }
.bm-private { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 14px; cursor: pointer; }
.bm-private input { width: auto; }
