:root {
  --bg: oklch(0.975 0.006 95);
  --card: #ffffff;
  --text: oklch(0.27 0.012 80);
  --ink-soft: oklch(0.45 0.012 85);
  --muted: oklch(0.60 0.01 85);
  --line: oklch(0.92 0.006 90);
  --brand: oklch(0.50 0.11 168);
  --brand-soft: oklch(0.96 0.025 168);
  --danger: oklch(0.52 0.05 250);
  --shadow: 0 1px 2px rgba(20,30,28,.04), 0 20px 48px rgba(20,30,28,.08);
  --shadow-sm: 0 1px 2px rgba(20,30,28,.04), 0 6px 18px rgba(20,30,28,.05);
  --serif: "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 18px;
}

* { 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: 8px; }

/* 顶栏 */
.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; }
.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; }

/* 布局 */
.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: 30px; }
.view-head h2 { font-family: var(--serif); font-size: 26px; margin: 0; }

/* 草稿列表 */
.art-list { display: grid; gap: 16px; }
.art-item { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 14px; padding: 20px 24px; border: 1px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; transition: .18s; box-shadow: var(--shadow-sm); }
.art-item:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow); }
.art-item .t { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16.5px; }
.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); }

/* 写作页 */
.write-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 16px 4px; margin-bottom: 14px; background: color-mix(in oklch, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.save-status { color: var(--muted); font-size: 13px; }
.write-area { max-width: 920px; margin: 0 auto; padding: 44px 0 180px; }
.write-title { font-family: var(--serif); font-size: 42px; font-weight: 700; line-height: 1.28; border: none; padding: 10px 0; background: transparent; width: 100%; color: var(--text); letter-spacing: .5px; }
.write-sub { display: flex; align-items: center; gap: 16px; margin: 10px 0 26px; }
.write-tags { border: none; padding: 6px 0; background: transparent; color: var(--ink-soft); font-size: 14px; flex: 1; }
.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: 12px; padding: 4px; }
.seg-btn { border: none; background: transparent; padding: 9px 18px; border-radius: 9px; 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; }

/* 简介 / 访问路径 */
.write-summary { border: none; padding: 10px 0; background: transparent; color: var(--ink-soft); font-size: 16px; line-height: 1.7; width: 100%; }
.write-title:focus, .write-tags:focus, .write-summary:focus, .write-slug:focus { outline: none; }
.write-title::placeholder, .write-tags::placeholder, .write-summary::placeholder { color: var(--muted); }
.slug-row { display: flex; align-items: center; gap: 8px; margin: 0 0 32px; font-size: 13px; color: var(--muted); }
.slug-label { white-space: nowrap; }
.slug-prefix { color: var(--muted); }
.write-slug { border: none; border-bottom: 1px solid var(--line); border-radius: 0; padding: 5px 2px; background: transparent; font-size: 13px; flex: 1; color: var(--ink-soft); transition: border-color .15s; }
.write-slug:focus { border-color: var(--brand); }

/* Toast UI 编辑器：宽敞的书写体验 */
#editor { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: #fff; box-shadow: var(--shadow-sm); }
.toastui-editor-defaultUI { border: none; font-family: var(--sans); }
.toastui-editor-toolbar { background: oklch(0.985 0.004 95); border-bottom: 1px solid var(--line); padding: 10px 8px; }
.toastui-editor-contents { font-size: 17px; line-height: 1.95; padding: 34px 40px; }
.toastui-editor-contents p { margin: 0 0 1.2em; }
.toastui-editor-contents h1, .toastui-editor-contents h2, .toastui-editor-contents h3 { font-family: var(--serif); }
.toastui-editor-md-container .toastui-editor-md-editor,
.toastui-editor-md-container .toastui-editor-md-preview { font-size: 16px; line-height: 1.9; }

/* 通用按钮 / 表单 */
.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: 11px; font-size: 14px; transition: .15s; font-family: var(--sans); }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.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], textarea, select { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; 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); }
label { display: block; font-size: 13px; color: var(--muted); margin: 16px 0 6px; }

.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: oklch(0.975 0.006 95); 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); }
