/* ==========================================================================
   个人知识碎片沉淀站 · components.css（配合 tokens.css 使用）
   纪律：零裸 hex（L1 只在 tokens.css）；动效 150ms ease-out；断点字面量 768/1024
   ========================================================================== */

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-ui);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, ul, ol, figure, blockquote, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; }
a { color: inherit; }
img { max-width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: var(--input-fg); }
mark { background: var(--mark-bg); color: var(--mark-fg); border-radius: 2px; padding: 0 2px; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.lucide { flex: none; vertical-align: -0.125em; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: var(--space-3); top: -48px; z-index: var(--z-toast);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3); transition: top var(--motion-base) var(--ease-standard);
}
.skip-link:focus-visible { top: var(--space-3); }

/* ---------- buttons / badges ---------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: var(--touch-min); padding: 0 var(--space-4);
  border-radius: var(--radius-md); font-size: var(--text-md); font-weight: var(--weight-medium);
  text-decoration: none;
  transition: background-color var(--motion-base) var(--ease-standard),
              color var(--motion-base) var(--ease-standard),
              border-color var(--motion-base) var(--ease-standard);
}
.btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-fg); }
.btn-primary:hover { background: var(--btn-primary-hover); }
.btn-primary:active { background: var(--btn-primary-active); }
.btn-primary:disabled { background: var(--surface-warm); color: var(--meta); cursor: not-allowed; }
.btn-ghost { color: var(--btn-ghost-fg); }
.btn-ghost:hover { background: var(--btn-ghost-hover-bg); }
.btn-danger { background: var(--btn-danger-bg); color: var(--btn-danger-fg); }
.btn-danger:hover { background: var(--btn-danger-hover); }
.btn.danger, .iconbtn.danger { color: var(--danger); }

.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--touch-min); height: var(--touch-min);
  border-radius: var(--radius-md); color: var(--fg-2);
  transition: background-color var(--motion-base) var(--ease-standard), color var(--motion-base) var(--ease-standard);
}
.iconbtn:hover { background: var(--btn-ghost-hover-bg); }
.iconbtn.danger:hover { background: var(--danger-soft); }

.badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  font-size: var(--text-xs); line-height: var(--leading-badge); font-weight: var(--weight-medium);
  background: var(--badge-bg); color: var(--badge-fg);
  border-radius: var(--radius-sm); padding: 2px 6px; white-space: nowrap;
}
.badge-btn { border: 0; cursor: pointer; }
.badge-link { text-decoration: none; }
.badge-link:hover { background: var(--border); }

/* ---------- shell：顶栏 / 侧栏 / 抽屉 ---------- */
.site-head {
  display: none; position: sticky; top: 0; z-index: var(--z-sticky);
  height: var(--header-h); align-items: center; justify-content: space-between;
  padding: 0 var(--space-3); background: var(--surface); border-bottom: 1px solid var(--border-soft);
}
.site-head-name { font-size: var(--text-base); font-weight: var(--weight-semibold); text-decoration: none; }

.shell { max-width: calc(var(--sidebar-w) + var(--measure) + var(--space-12)); margin: 0 auto; padding: var(--space-6) var(--space-4) var(--space-16); }
.side { display: none; }
.feed { max-width: var(--measure); margin: 0 auto; }

.side-name { display: block; font-size: var(--text-base); font-weight: var(--weight-semibold); text-decoration: none; padding: var(--space-2) var(--space-3); margin-bottom: var(--space-2); }
.navlist-a {
  display: flex; align-items: center; gap: var(--space-3);
  height: 40px; padding: 0 var(--space-3); border-radius: var(--radius-md);
  font-size: var(--text-md); color: var(--fg-2); text-decoration: none;
  transition: background-color var(--motion-base) var(--ease-standard), color var(--motion-base) var(--ease-standard);
}
.navlist-a:hover { background: var(--surface-warm); }
.navlist-a.is-active { background: var(--accent-soft); color: var(--accent); }
.navlist-admin { margin-top: var(--space-4); }

.drawer { position: fixed; inset: 0; z-index: var(--z-drawer); }
.drawer-mask { position: absolute; inset: 0; background: rgba(var(--slate-900-rgb), 0.32); }
.drawer-panel {
  position: absolute; left: 0; top: 0; bottom: 0; width: 280px; max-width: 84vw;
  background: var(--surface); padding: var(--space-3);
  transform: translateX(0); transition: transform var(--motion-enter) var(--ease-standard);
}
.drawer.is-entering .drawer-panel, .drawer.is-leaving .drawer-panel { transform: translateX(-100%); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 0 var(--space-2) var(--space-2); }
.drawer-name { font-size: var(--text-base); font-weight: var(--weight-semibold); }

/* ---------- 标签树（侧栏） ---------- */
.tagtree { margin-top: var(--space-6); padding: 0 var(--space-3); }
.tagtree-t { font-size: var(--text-sm); color: var(--muted); font-weight: var(--weight-medium); margin-bottom: var(--space-2); }
.tagtree-row { display: flex; align-items: center; gap: var(--space-2); min-height: 32px; border-radius: var(--radius-md); color: var(--muted); }
.tagtree-row.is-active { background: var(--accent-soft); color: var(--accent); }
.tagtree-row.is-sub { padding-left: var(--space-6); }
.tagtree-name { flex: 1; min-width: 0; font-size: var(--text-md); color: var(--fg-2); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tagtree-row.is-active .tagtree-name { color: var(--accent); }
.tagtree-n { font-size: var(--text-xs); color: var(--meta); font-variant-numeric: tabular-nums; }
.tagtree-more { display: inline-flex; align-items: center; gap: var(--space-1); margin-top: var(--space-2); font-size: var(--text-sm); color: var(--muted); text-decoration: none; }

/* ---------- 页面头 / 分段 / 工具行 ---------- */
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-6); }
.page-head h1 { font-size: var(--text-xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-display); }
.page-head-n { font-size: var(--text-sm); color: var(--muted); }

.seg { display: inline-flex; gap: var(--space-1); margin-bottom: var(--space-4); }
.seg-a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--space-3); border-radius: var(--radius-md); font-size: var(--text-md); color: var(--fg-2); text-decoration: none; transition: background-color var(--motion-base) var(--ease-standard), color var(--motion-base) var(--ease-standard); }
.seg-a:hover { background: var(--surface-warm); }
.seg-a.is-active { background: var(--accent-soft); color: var(--accent); font-weight: var(--weight-medium); }

/* ---------- memo 卡片 ---------- */
.memo { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius-lg); padding: var(--space-5); transition: border-color var(--motion-base) var(--ease-standard); }
.memo + .memo { margin-top: var(--space-4); }
.memo:hover { border-color: var(--card-hover-border); }
.memo-head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.memo-title { font-size: var(--text-lg); font-weight: var(--weight-medium); line-height: var(--leading-tight); letter-spacing: var(--tracking-display); margin-bottom: var(--space-2); }
.ts { font-size: var(--text-sm); color: var(--muted); text-decoration: none; }
.memo-body { font-size: var(--text-base); line-height: var(--leading-body); color: var(--fg); overflow-wrap: break-word; }
.memo-body p + p { margin-top: 1em; }
.memo-body img { border-radius: var(--radius-md); }
.memo-body pre { overflow-x: auto; max-width: 100%; }
.memo-excerpt p { color: var(--fg-2); }
.memo-full { overflow: hidden; max-height: 0; transition: max-height var(--motion-base) var(--ease-standard); }
.memo-full.is-open { max-height: var(--memo-full-h, 2000px); }
.memo-fold { margin-top: var(--space-2); }
.memo-expand, .memo-collapse { display: inline-flex; align-items: center; gap: var(--space-1); min-height: 32px; font-size: var(--text-md); color: var(--muted); text-decoration: none; }
.memo-expand:hover, .memo-collapse:hover { color: var(--fg-2); }
.memo-foot { display: flex; align-items: flex-start; gap: var(--space-3); margin-top: var(--space-3); }
.memo-tags { flex: 1; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); }
.memo-tag { font-size: var(--text-sm); color: var(--muted); text-decoration: none; }
.memo-tag:hover { color: var(--fg-2); }

.memo-menu { position: relative; margin-left: auto; }
.memo-menu summary { list-style: none; }
.memo-menu summary::-webkit-details-marker { display: none; }
.memo-menu-list { position: absolute; right: 0; top: calc(100% + var(--space-1)); z-index: var(--z-sticky); min-width: 160px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--elev-overlay); padding: var(--space-1); }
.memo-menu-list a, .memo-menu-list button { display: flex; align-items: center; gap: var(--space-2); width: 100%; min-height: 40px; padding: 0 var(--space-3); border-radius: var(--radius-sm); font-size: var(--text-md); color: var(--fg-2); text-decoration: none; text-align: left; }
.memo-menu-list a:hover, .memo-menu-list button:hover { background: var(--surface-warm); }
.memo-menu-list button.danger { color: var(--danger); }

/* ---------- 日期分隔线 / 分页 / 空态 ---------- */
.day { display: flex; align-items: center; gap: var(--space-3); color: var(--divider-fg); font-size: var(--text-sm); font-weight: var(--weight-regular); margin: var(--space-10) 0 var(--space-4); }
.day::after { content: ""; flex: 1; border-top: 1px solid var(--divider-line); }
.memo + .day { margin-top: var(--space-10); }

.pager { display: flex; align-items: center; justify-content: center; gap: var(--space-4); margin-top: var(--space-8); }
.pager-cur { font-size: var(--text-sm); color: var(--muted); }

.empty { text-align: center; padding: 18vh var(--space-4) var(--space-16); color: var(--meta); }
.empty-title { margin-top: var(--space-3); font-size: var(--text-base); font-weight: var(--weight-medium); color: var(--fg-2); }
.empty-hint { margin-top: var(--space-1); font-size: var(--text-md); color: var(--muted); }
.empty .btn { margin-top: var(--space-4); }
.hot-t { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin-top: var(--space-4); }

/* ---------- 快记框（PC 置顶 / H5 底部栏） ---------- */
.quicknote { background: var(--surface); border: 1px solid var(--input-border); border-radius: var(--radius-lg); box-shadow: var(--elev-raised); padding: var(--space-4); margin-bottom: var(--space-8); }
.quicknote:focus-within { border-color: var(--input-focus-border); box-shadow: var(--elev-raised), var(--focus-ring); }
.quicknote textarea { display: block; width: 100%; min-height: 72px; max-height: 240px; border: 0; resize: none; font-size: var(--text-base); line-height: var(--leading-ui); background: transparent; }
.quicknote textarea:focus { outline: none; }
.quicknote textarea::placeholder { color: var(--input-placeholder); }
.quicknote-bar-row { display: flex; align-items: center; margin-top: var(--space-2); }
.quicknote-actions { display: flex; align-items: center; gap: var(--space-1); margin-left: auto; }
.quicknote-send { min-height: 40px; }
.quicknote-count { font-size: var(--text-xs); color: var(--meta); }
.quicknote-error { margin-top: var(--space-2); font-size: var(--text-md); color: var(--danger); }
.quicknote-error button { color: var(--danger); text-decoration: underline; }
.quicknote-thumbs { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.quicknote-thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-md); border: 1px solid var(--border); }
.quicknote-thumbs .thumb { position: relative; }
.quicknote-thumbs .thumb button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: var(--radius-pill); background: var(--toast-bg); color: var(--toast-fg); display: flex; align-items: center; justify-content: center; }
.quicknote-vis[aria-pressed="true"] { color: var(--accent); }
.quicknote.is-sending textarea { color: var(--muted); }
.lucide-spin { animation: qn-spin 1s linear infinite; }
@keyframes qn-spin { to { transform: rotate(360deg); } }

.quicknote-bar { display: none; }
.quicknote-bar-fake { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); width: 100%; min-height: var(--quicknote-h); padding: 0 var(--space-4); background: var(--surface); border: 1px solid var(--input-border); border-radius: var(--radius-lg); color: var(--input-placeholder); }
.quicknote-panel { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-modal); background: var(--surface); border-top: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: var(--elev-overlay); padding: var(--space-3) var(--space-3) calc(var(--space-3) + env(safe-area-inset-bottom)); }
.quicknote-panel .quicknote { box-shadow: none; border: 0; padding: 0; margin: 0; border-radius: 0; }
.quicknote-panel .quicknote:focus-within { box-shadow: none; }

/* ---------- 详情页（阅读层） ---------- */
.page-reader { background: var(--page-reader-bg); }
.reader { max-width: var(--measure); margin: 0 auto; }
.reader-back { margin-bottom: var(--space-2); margin-left: calc(-1 * var(--space-4)); }
.reader h1 { font-size: var(--text-2xl); line-height: var(--leading-tight); letter-spacing: var(--tracking-display); font-weight: var(--weight-semibold); margin: var(--space-4) 0 var(--space-3); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); font-size: var(--text-sm); color: var(--muted); padding-bottom: var(--space-5); border-bottom: 1px solid var(--border); margin-bottom: var(--space-8); }
.meta-tags { display: inline-flex; align-items: center; gap: var(--space-2); }
.meta-tags a { color: var(--muted); text-decoration: none; }
.meta-tags a:hover { color: var(--fg-2); }

.prose { font-size: var(--text-base); line-height: var(--leading-body); overflow-wrap: break-word; }
.prose p + p { margin-top: 1em; }
.prose h2 { font-size: var(--text-lg); font-weight: var(--weight-medium); line-height: var(--leading-tight); letter-spacing: var(--tracking-display); margin: var(--space-10) 0 var(--space-4); }
.prose h3 { font-size: var(--text-base); font-weight: var(--weight-medium); margin: var(--space-8) 0 var(--space-3); }
.prose h4 { font-size: var(--text-base); font-weight: var(--weight-medium); margin: var(--space-6) 0 var(--space-2); }
.prose ul, .prose ol { margin: var(--space-4) 0; padding-left: var(--space-6); }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { line-height: var(--leading-body); }
.prose li + li { margin-top: var(--space-2); }
.prose li > ul, .prose li > ol { margin: var(--space-2) 0 0; padding-left: var(--space-6); }
.prose a { color: var(--accent); text-decoration: none; }
.prose a:hover { text-decoration: underline; }
.prose code { font-family: var(--font-mono); font-size: 0.875em; background: var(--surface-warm); border-radius: var(--radius-sm); padding: 2px 4px; }
.prose pre { position: relative; background: var(--surface-warm); border-radius: var(--radius-md); padding: var(--space-4); margin: var(--space-4) 0; font-size: var(--text-md); overflow-x: auto; }
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose blockquote { border-left: 2px solid var(--border); color: var(--muted); padding-left: var(--space-4); margin: var(--space-4) 0; }
.prose table { border-collapse: collapse; margin: var(--space-4) 0; width: 100%; font-size: var(--text-md); }
.prose th, .prose td { border: 1px solid var(--border); padding: var(--space-2) var(--space-3); text-align: left; }
.prose th { background: var(--surface-warm); font-weight: var(--weight-medium); }
.prose img { border-radius: var(--radius-md); margin: var(--space-2) 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-10) 0; }
.copy-btn { position: absolute; top: var(--space-2); right: var(--space-2); width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); color: var(--muted); display: flex; align-items: center; justify-content: center; }
.copy-btn:hover { color: var(--fg-2); }

/* 问/答分段（ai_conversation 详情，DESIGN P2） */
.dlg-q { border-left: 2px solid var(--dialogue-rule); background: var(--dialogue-q-bg); padding: var(--space-3) var(--space-4); border-radius: 0 var(--radius-md) var(--radius-md) 0; margin: var(--space-4) 0; }
.dlg-a { margin: var(--space-4) 0; padding-left: calc(var(--space-4) + 2px); }
.dlg-role { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--muted); margin-bottom: var(--space-1); }

.toc { border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-8); font-size: var(--text-md); }
.toc summary { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; color: var(--fg-2); font-weight: var(--weight-medium); }
.toc ol { margin-top: var(--space-3); padding-left: var(--space-6); list-style: decimal; }
.toc a { color: var(--fg-2); text-decoration: none; }
.toc a:hover { color: var(--accent); }

.siblings { display: flex; justify-content: space-between; gap: var(--space-4); margin-top: var(--space-12); padding-top: var(--space-6); border-top: 1px solid var(--border); }
.siblings-a { display: inline-flex; align-items: center; gap: var(--space-2); max-width: 48%; font-size: var(--text-md); color: var(--fg-2); text-decoration: none; }
.siblings-a:hover { color: var(--accent); }
.siblings-next { margin-left: auto; text-align: right; }

/* ---------- 搜索页 ---------- */
.searchbox { display: flex; align-items: center; gap: var(--space-2); height: 48px; border: 1px solid var(--input-border); border-radius: var(--radius-md); background: var(--surface); padding: 0 var(--space-3); color: var(--muted); }
.searchbox:focus-within { border-color: var(--input-focus-border); box-shadow: var(--focus-ring); }
.searchbox input { flex: 1; border: 0; background: transparent; font-size: var(--text-base); }
.searchbox input:focus { outline: none; }
.searchbox input::placeholder { color: var(--input-placeholder); }
.search-filter-note { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-3) 0; font-size: var(--text-md); color: var(--fg-2); }
.search-filter-x { display: inline-flex; color: var(--muted); }
.count { font-size: var(--text-sm); color: var(--muted); margin: var(--space-3) 0 var(--space-5); }
.hint { background: var(--warn-soft); color: var(--fg-2); font-size: var(--text-sm); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); margin-bottom: var(--space-4); }
.memo-result-link { color: inherit; text-decoration: none; }
.memo-snippet { color: var(--fg-2); }

/* ---------- 标签页 / 归档页 ---------- */
.taglist { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0 var(--space-4); }
.tagrow { display: flex; align-items: center; gap: var(--space-2); min-height: 36px; border-top: 1px solid var(--table-border); font-size: var(--text-md); color: var(--fg-2); }
.tagrow:first-child, .taggroup:first-child > .tagrow { border-top: 0; }
.tagrow.is-sub { padding-left: var(--space-6); }
.tagrow-name { color: var(--fg-2); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tagrow-name.is-parent { font-weight: var(--weight-medium); }
a.tagrow-name:hover { color: var(--accent); }
.tagrow .n { margin-left: auto; font-size: var(--text-sm); color: var(--meta); font-variant-numeric: tabular-nums; }
.taggroup summary.tagrow { cursor: pointer; list-style: none; }
.taggroup summary.tagrow::-webkit-details-marker { display: none; }
.taggroup[open] > summary .lucide { transform: rotate(90deg); }
.taggroup > summary .lucide { transition: transform var(--motion-base) var(--ease-standard); }

.mon-group { margin-bottom: var(--space-2); }
.mon { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--text-md); font-weight: var(--weight-medium); color: var(--fg-2); border-bottom: 1px solid var(--border); padding-bottom: var(--space-2); margin: var(--space-10) 0 var(--space-2); }
.mon-group:first-of-type .mon { margin-top: var(--space-6); }
.mon-n { font-weight: var(--weight-regular); color: var(--meta); }
.arow { display: flex; align-items: center; gap: var(--space-3); min-height: 36px; font-size: var(--text-md); }
.arow time { width: 56px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: var(--text-sm); flex: none; }
.arow a { color: var(--fg); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.arow a:hover { color: var(--accent); }

/* ---------- 关于页（Brand register，禁 Hero） ---------- */
.about-id h1 { font-size: var(--text-2xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-display); margin-bottom: var(--space-4); }
.about .who { font-size: var(--text-base); line-height: var(--leading-body); color: var(--fg); }
.about-note { margin-top: var(--space-2); font-size: var(--text-md); color: var(--muted); }
.sec-t { font-size: var(--text-lg); font-weight: var(--weight-medium); margin-bottom: var(--space-5); }
.about-feat { margin-top: var(--space-16); }
.about-feat .memo + .memo { margin-top: var(--space-6); }
.about-contact { margin-top: var(--space-16); font-size: var(--text-md); color: var(--fg-2); }
.about-contact a { color: var(--accent); text-decoration: none; }
.about-contact a:hover { text-decoration: underline; }

/* ---------- 登录页 ---------- */
.page-login { background: var(--page-admin-bg); }
.login { width: 360px; max-width: calc(100vw - var(--space-8)); margin: 18vh auto 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-8); }
.login-name { font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.login-sub { margin: var(--space-1) 0 var(--space-5); font-size: var(--text-sm); color: var(--muted); }
.login-field { display: block; margin-bottom: var(--space-4); }
.login-label { display: block; font-size: var(--text-sm); color: var(--muted); margin-bottom: var(--space-1); }
.login-field input { width: 100%; height: 44px; border: 1px solid var(--input-border); border-radius: var(--radius-md); padding: 0 var(--space-3); background: var(--input-bg); }
.login-field input:focus { outline: none; border-color: var(--input-focus-border); box-shadow: var(--focus-ring); }
.login-field input:disabled { background: var(--input-disabled-bg); }
.login-btn { width: 100%; justify-content: center; }
.errorbar { display: flex; align-items: center; gap: var(--space-2); background: var(--danger-soft); color: var(--danger); font-size: var(--text-md); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); margin-bottom: var(--space-4); }
.errorbar .btn { margin-left: auto; min-height: 32px; }

/* ---------- 后台 ---------- */
.admin-head { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); padding: 0 var(--space-4); background: var(--surface); border-bottom: 1px solid var(--border-soft); position: sticky; top: 0; z-index: var(--z-sticky); }
.admin-head-name { font-size: var(--text-base); font-weight: var(--weight-semibold); text-decoration: none; }
.admin-main { max-width: 1080px; margin: 0 auto; padding: var(--space-6) var(--space-4) var(--space-16); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
.toolbar .seg { margin-bottom: 0; }
.toolbar-tag { position: relative; display: inline-flex; align-items: center; color: var(--muted); }
.toolbar-tag select { appearance: none; min-height: 36px; border: 1px solid var(--input-border); border-radius: var(--radius-md); background: var(--surface); padding: 0 var(--space-6) 0 var(--space-3); font-size: var(--text-md); }
.toolbar-tag .lucide { position: absolute; right: var(--space-2); pointer-events: none; }
.toolbar-search { display: flex; align-items: center; gap: var(--space-2); width: 240px; min-height: 36px; border: 1px solid var(--input-border); border-radius: var(--radius-md); background: var(--surface); padding: 0 var(--space-3); color: var(--muted); margin-left: auto; }
.toolbar-search input { flex: 1; border: 0; background: transparent; font-size: var(--text-md); }
.toolbar-search input:focus { outline: none; }

.batchbar { display: flex; align-items: center; gap: var(--space-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--elev-raised); padding: var(--space-2) var(--space-3); margin-bottom: var(--space-3); font-size: var(--text-md); color: var(--fg-2); }
.batchbar .btn { min-height: 32px; padding: 0 var(--space-2); }

.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.atable { width: 100%; min-width: 720px; border-collapse: collapse; }
.atable th { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--table-head-fg); text-align: left; letter-spacing: 0.02em; padding: var(--space-2) var(--space-3); }
.atable td { height: 40px; border-top: 1px solid var(--table-border); padding: 0 var(--space-3); font-size: var(--text-md); }
.atable tbody tr { transition: background-color var(--motion-base) var(--ease-standard); }
.atable tbody tr:hover { background: var(--table-row-hover); }
.atable-check { width: 36px; }
.atable-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.atable-date { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); font-size: var(--text-sm); text-align: right; }
.atable-title a { color: var(--fg); text-decoration: none; display: inline-block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.atable-title a:hover { color: var(--accent); }
.atable-imgs { font-size: var(--text-xs); color: var(--meta); margin-left: var(--space-2); }
.atable-tags { color: var(--muted); font-size: var(--text-sm); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atable-ops { white-space: nowrap; }
.atable-ops .iconbtn, .atable-ops form { display: inline-flex; }
.visform { display: inline; }

/* ---------- 编辑页 ---------- */
.editor-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.editor-title { width: 100%; border: 0; border-bottom: 1px solid transparent; background: transparent; font-size: var(--text-lg); font-weight: var(--weight-medium); padding: var(--space-2) 0; margin-bottom: var(--space-4); }
.editor-title:focus { outline: none; border-bottom-color: var(--input-focus-border); }
.editor-title::placeholder { color: var(--input-placeholder); }
.etabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border); }
.etab { display: inline-flex; align-items: center; gap: var(--space-1); min-height: 40px; padding: 0 var(--space-3); font-size: var(--text-md); color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.etab.is-active { color: var(--accent); border-bottom-color: var(--accent); font-weight: var(--weight-medium); }
.editor-md { width: 100%; min-height: 50vh; border: 0; background: transparent; font-family: var(--font-mono); font-size: var(--text-md); line-height: 1.6; padding: var(--space-4) 0; resize: vertical; }
.editor-md:focus { outline: none; }
.preview-note { background: var(--surface-warm); color: var(--muted); font-size: var(--text-xs); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); margin: var(--space-3) 0; }
.preview-body { max-width: var(--measure); padding: var(--space-4) 0; }
.preview-empty { color: var(--muted); font-size: var(--text-md); }
.editor-meta { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-6); border-top: 1px solid var(--border); padding-top: var(--space-5); margin-top: var(--space-4); }
.editor-field { flex: 1 1 220px; }
.editor-label { display: block; font-size: var(--text-sm); color: var(--muted); margin-bottom: var(--space-1); }
.editor-hint { display: block; font-size: var(--text-xs); color: var(--muted); margin-top: var(--space-1); }
.editor-field input[type="text"], .editor-field select { width: 100%; min-height: 40px; border: 1px solid var(--input-border); border-radius: var(--radius-md); background: var(--input-bg); padding: 0 var(--space-3); }
.editor-field input:focus, .editor-field select:focus { outline: none; border-color: var(--input-focus-border); box-shadow: var(--focus-ring); }
.editor-vis { flex: 0 0 auto; }
.vis-opt { display: inline-flex; align-items: center; gap: var(--space-1); min-height: 40px; margin-right: var(--space-4); font-size: var(--text-md); color: var(--fg-2); }
.vis-opt input { accent-color: var(--accent); }

/* ---------- Toast / 对话框 / 骨架屏 ---------- */
.toast-root { position: fixed; top: var(--space-4); left: 50%; transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--space-2); pointer-events: none; }
.toast { display: flex; align-items: center; gap: var(--space-2); background: var(--toast-bg); color: var(--toast-fg); font-size: var(--text-md); border-radius: var(--radius-md); padding: var(--space-2) var(--space-4); box-shadow: var(--elev-overlay); opacity: 0; transform: translateY(-8px); transition: opacity var(--motion-enter) var(--ease-standard), transform var(--motion-enter) var(--ease-standard); pointer-events: auto; }
.toast.is-in { opacity: 1; transform: translateY(0); }
.toast .iconbtn { width: 28px; height: 28px; color: var(--toast-fg); }

.dialog { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-6); max-width: 360px; box-shadow: var(--elev-overlay); }
.dialog::backdrop { background: rgba(var(--slate-900-rgb), 0.32); }
.dialog-text { font-size: var(--text-base); color: var(--fg); line-height: var(--leading-ui); }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-5); }

.skel { position: relative; overflow: hidden; background: var(--skeleton-base); border-radius: var(--radius-sm); }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, var(--skeleton-shine), transparent); animation: skel-shine 1.2s linear infinite; }
@keyframes skel-shine { to { transform: translateX(100%); } }
.memo-skel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-5); margin-bottom: var(--space-4); }
.memo-skel .skel { display: block; height: 14px; margin-top: var(--space-3); }
.memo-skel .skel:first-child { width: 64px; height: 20px; margin-top: 0; }
.memo-skel .skel:nth-child(2) { width: 100%; }
.memo-skel .skel:nth-child(3) { width: 92%; }
.memo-skel .skel:nth-child(4) { width: 61%; }

/* ---------- 响应式 ---------- */
@media (max-width: 1023px) {
  .site-head { display: flex; }
  .shell { padding-top: var(--space-4); }
}
@media (min-width: 1024px) {
  .shell { display: flex; gap: var(--space-8); align-items: flex-start; }
  .side { display: block; width: var(--sidebar-w); flex: none; position: sticky; top: var(--space-6); }
  .feed { flex: 1; min-width: 0; }
}
@media (max-width: 767px) {
  .shell { padding-left: var(--space-4); padding-right: var(--space-4); padding-bottom: calc(var(--quicknote-h) + var(--space-8) + env(safe-area-inset-bottom)); }
  .reader { padding-left: 0; padding-right: 0; }
  .reader-back { margin-left: 0; }
  .seg { overflow-x: auto; max-width: 100%; }
  .quicknote-bar { display: block; position: fixed; left: var(--space-3); right: var(--space-3); bottom: calc(var(--space-3) + env(safe-area-inset-bottom)); z-index: var(--z-sticky); }
  .arow time { width: 44px; }
  .siblings-a { max-width: 44%; }
  .toolbar-search { width: 100%; margin-left: 0; }
  .admin-main { padding-left: var(--space-3); padding-right: var(--space-3); }
  .editor-meta { flex-direction: column; gap: var(--space-4); }
}
@media (prefers-reduced-motion: reduce) {
  .skel::after { animation: none; }
  .lucide-spin { animation: none; }
}
