/* =========================================================
   拾编 · 写作台
   ========================================================= */

body {
  font-family: Inter, 'Noto Sans SC', -apple-system, 'PingFang SC', sans-serif;
}
main#article {
  max-width: 1180px;
  padding-top: clamp(84px, 11vh, 112px);
  padding-bottom: 80px;
}
.read-progress,
.toc { display: none; }

.st {
  max-width: 1120px;
  margin: 0 auto;
}

/* ---------- 顶部 ---------- */
.st-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.st-eyebrow {
  margin: 0 0 10px;
  color: var(--ink-faint);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .24em;
}
.st-eyebrow span { margin-right: 7px; color: var(--gold); font-size: 10px; }
.st-head h1 {
  margin: 0 0 8px;
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
  font-size: clamp(1.8rem, 3.6vw, 2.5rem);
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: .01em;
}
.st-sub { margin: 0; color: var(--ink-faint); font-size: 12.5px; line-height: 1.8; }
.st-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.st-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--ink-faint);
  font-size: 12px;
  text-decoration: none;
  transition: color .2s ease;
}
.st-back:hover { color: var(--accent); }

/* ---------- 按钮 ---------- */
.st-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: all .18s ease;
}
.st-btn:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.st-btn-primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 10px 22px -14px var(--accent);
}
.st-btn-primary:hover {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent));
}
.st-btn-ghost { border-color: transparent; background: transparent; color: var(--ink-faint); }
.st-btn-ghost:hover { background: var(--paper-soft); }
.st-btn-danger,
.st-btn.st-danger {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: var(--accent-soft);
  color: var(--accent);
}
.st-btn.st-danger:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.st-link-danger {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-faint);
  font-family: inherit;
  font-size: 11.5px;
  cursor: pointer;
  transition: color .18s ease;
}
.st-link-danger:hover { color: var(--accent); }

/* ---------- 数据卡 ---------- */
.st-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.st-stat {
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.st-stat b {
  display: block;
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.2;
}
.st-stat span { color: var(--ink-faint); font-size: 10.5px; letter-spacing: .04em; }

/* ---------- 工具条 / 上传 ---------- */
.st-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.st-toolbar-hint { color: var(--ink-faint); font-size: 10.5px; }

.st-upload-panel {
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  animation: st-rise .3s ease both;
}
.st-upload-panel[hidden] { display: none; }
.st-upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, .9fr) auto;
  gap: 10px;
  align-items: end;
}
.st-upload-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--ink-faint);
  font-size: 10.5px;
  letter-spacing: .04em;
}
.st-file {
  width: 100%;
  padding: 6px 9px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  background: var(--paper-soft);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 11.5px;
}
.st-help {
  margin: 10px 0 0;
  color: var(--ink-faint);
  font-size: 10.5px;
  line-height: 1.8;
}
.st-help code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--paper-soft);
  border: 1px solid var(--line-soft);
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
}

/* ---------- 布局 ---------- */
.st-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}
.st-panel {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.st-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.st-panel-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .05em;
}
.st-panel-head h2 b {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--ink-faint);
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 600;
}
.st-panel-head a { color: var(--accent); font-size: 11.5px; text-decoration: none; }
.st-panel-head a:hover { text-decoration: underline; }

/* ---------- 筛选 ---------- */
.st-filters {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.st-filters .st-input { width: auto; min-width: 110px; }
.st-filters input[type="search"] { flex: 1; min-width: 160px; }

/* ---------- 表格 ---------- */
.st-table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.st-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 12px;
}
.st-table th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .12em;
  text-align: left;
  white-space: nowrap;
}
.st-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-soft);
  vertical-align: top;
}
.st-table tr:last-child td { border-bottom: 0; }
.st-table tr:hover td { background: color-mix(in srgb, var(--paper-soft) 55%, transparent); }
.st-post-title {
  display: block;
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.5;
  text-decoration: none;
  transition: color .18s ease;
}
.st-post-title:hover { color: var(--accent); }
.st-slug {
  display: block;
  margin-top: 2px;
  color: var(--ink-faint);
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  white-space: nowrap;
}
.st-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
}
.st-badge.published { background: rgba(107, 143, 113, .14); color: #5d7f63; }
.st-badge.draft { background: rgba(209, 154, 63, .16); color: #9a7220; }
:root[data-theme="dark"] .st-badge.published { background: rgba(127, 174, 134, .16); color: #8fc096; }
:root[data-theme="dark"] .st-badge.draft { background: rgba(224, 176, 92, .16); color: #e0b05c; }
.st-cats { display: flex; gap: 4px; flex-wrap: wrap; }
.st-cats span {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-faint);
  font-size: 9.5px;
  white-space: nowrap;
}
.st-cats i { color: var(--ink-faint); font-size: 9.5px; font-style: normal; }
.st-table time { color: var(--ink-faint); font-size: 10.5px; white-space: nowrap; }
.st-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.st-row-actions a {
  color: var(--ink-faint);
  font-size: 11.5px;
  text-decoration: none;
  transition: color .18s ease;
}
.st-row-actions a:hover { color: var(--accent); }
.st-row-actions form { display: inline; margin: 0; }
.st-table-empty {
  padding: 40px 10px !important;
  color: var(--ink-faint);
  text-align: center;
}
.st-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
  color: var(--ink-faint);
  font-size: 11px;
}
.st-pager a { color: var(--accent); text-decoration: none; }
.st-pager a:hover { text-decoration: underline; }

/* ---------- 分类面板 ---------- */
.st-cat-list { list-style: none; margin: 0 0 18px; padding: 0; }
.st-cat-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 8px;
}
.st-cat-list li:last-child { border-bottom: 0; }
.st-cat-list li.is-editing { background: var(--accent-soft); }
.st-cat-info { min-width: 0; flex: 1; }
.st-cat-info a {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.st-cat-info a:hover { color: var(--accent); }
.st-cat-info small {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  color: var(--ink-faint);
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.st-cat-count {
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--ink-faint);
  font-size: 9.5px;
  text-align: center;
}
.st-cat-actions { display: flex; align-items: center; gap: 7px; }
.st-cat-actions a {
  color: var(--ink-faint);
  font-size: 10.5px;
  text-decoration: none;
}
.st-cat-actions a:hover { color: var(--accent); }
.st-cat-actions form { display: inline; margin: 0; }
.st-cat-empty { color: var(--ink-faint); font-size: 11.5px; }
.st-cat-form-title {
  margin: 0 0 10px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
  font-size: 13px;
  font-weight: 700;
}
.st-cat-form { display: flex; flex-direction: column; gap: 8px; }
.st-cat-form label,
.st-field label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--ink-faint);
  font-size: 10.5px;
  letter-spacing: .05em;
}
.st-cat-form .st-input,
.st-field .st-input { width: 100%; }

/* ---------- 输入 ---------- */
.st-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.65;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.st-input:focus {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.st-input[type="search"]:focus { box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.st-input { resize: vertical; }
.st-form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

/* ---------- 消息 / 错误 ---------- */
.st-messages { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.st-msg {
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-faint);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.7;
}
.st-msg.success { border-left-color: #6b8f71; }
.st-msg.info { border-left-color: var(--c4); }
.st-msg.warning { border-left-color: var(--gold); }
.st-msg.error { border-left-color: var(--accent); color: var(--accent); }

.st .errorlist {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  color: var(--accent);
  font-size: 10.5px;
  line-height: 1.7;
}
.st .errorlist li { margin: 0; }

/* ---------- 编辑器 ---------- */
.st-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}
.st-editor-main,
.st-side-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.st-editor-main { padding: 20px 22px; }
.st-side-card { padding: 16px 18px; }
.st-editor-side { display: flex; flex-direction: column; gap: 14px; }

.st-field { margin-bottom: 14px; }
.st-field:last-child { margin-bottom: 0; }
.st-title-input {
  padding: 10px 12px;
  font-family: 'Noto Serif SC', serif;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.5;
}
.st-editor-meta-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 14px;
}
.st-content-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.st-content-head > label {
  color: var(--ink-faint);
  font-size: 10.5px;
  letter-spacing: .05em;
}
.st-md-import {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  color: var(--ink-faint);
  font-size: 10px;
  cursor: pointer;
  transition: all .18s ease;
}
.st-md-import:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.st-md-import input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.st-char-count { margin-left: auto; color: var(--ink-faint); font-size: 10px; font-variant-numeric: tabular-nums; }
.st-char-count b { color: var(--ink-soft); font-weight: 600; }
.st-content {
  min-height: 58vh;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-soft);
  color: var(--ink);
  font-family: 'JetBrains Mono', 'Noto Serif SC', monospace;
  font-size: 12.5px;
  line-height: 1.85;
  resize: vertical;
  tab-size: 2;
}

.st-side-card h2 {
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line);
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
}
.st-side-card .st-field { margin-bottom: 10px; }
.st-side-card .st-form-actions { margin-top: 10px; }
.st-side-card .st-help { margin-top: 8px; }

.st-check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  max-height: 190px;
  overflow-y: auto;
  padding-right: 4px;
}
.st-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-soft);
  font-size: 11px;
  cursor: pointer;
}
.st-check input { accent-color: var(--accent); }
.st-check span { line-height: 1.6; }

.st-danger-zone { border-color: color-mix(in srgb, var(--accent) 22%, var(--line)); }

/* ---------- 锁定页 ---------- */
.st-lock-page {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 240px);
  padding: 20px 0 60px;
}
.st-lock-card {
  width: min(92vw, 410px);
  padding: 34px 34px 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: var(--shadow);
  text-align: center;
}
.st-lock-card h1 {
  margin: 0 0 8px;
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
  font-size: 1.9rem;
  font-weight: 900;
}
.st-lock-sub { margin: 0 0 20px; color: var(--ink-faint); font-size: 12px; line-height: 1.8; }
.st-unlock-form { display: flex; gap: 7px; }
.st-unlock-form input {
  flex: 1;
  min-width: 0;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper-soft);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  outline: none;
}
.st-unlock-form input:focus {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.st-unlock-form .st-btn { flex: none; }
.st-error {
  margin: 12px 0 0;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  line-height: 1.7;
}
.st-lock-hint { margin: 16px 0 0; color: var(--ink-faint); font-size: 10px; }

.st-note {
  margin: 26px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  color: var(--ink-faint);
  font-size: 10.5px;
  line-height: 1.9;
}

@keyframes st-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .st-layout,
  .st-editor { grid-template-columns: 1fr; }
  .st-editor-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}

@media (max-width: 720px) {
  .st-head { align-items: flex-start; }
  .st-head-actions { width: 100%; }
  .st-stats { grid-template-columns: repeat(3, 1fr); }
  .st-stat { padding: 10px 12px; }
  .st-stat b { font-size: 18px; }
  .st-upload-grid { grid-template-columns: 1fr; }
  .st-filters .st-input { flex: 1; min-width: 0; }
  .st-editor-main { padding: 16px; }
  .st-editor-meta-row { grid-template-columns: 1fr; }
  .st-panel { padding: 14px; }
  .st-content { min-height: 48vh; }
}

@media (max-width: 420px) {
  .st-stats { grid-template-columns: repeat(2, 1fr); }
  .st-unlock-form { flex-direction: column; }
  .st-unlock-form .st-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .st-upload-panel { animation: none; }
  .st-btn { transition: none; }
}

/* JS 临时提示 */
.st-js-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 1100;
  max-width: min(90vw, 460px);
  padding: 9px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  line-height: 1.7;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity .2s ease, transform .2s ease;
}
.st-js-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
