/* ============================================================
   极简导航 · v3 样式表
   设计方向：克制的纸感极简 —— 无阴影、无渐变、细线分隔、单一强调色
   主题：跟随系统 + 手动切换（html[data-theme] 优先）
   ============================================================ */

/* ---------- 设计令牌 ---------- */
:root {
  --bg: oklch(98.6% 0.003 85);
  --surface: oklch(99.6% 0.001 85);
  --border: oklch(91.5% 0.006 260);
  --border-strong: oklch(82% 0.012 260);
  --control-border: oklch(65% 0.012 260);
  --text: oklch(23% 0.014 260);
  --text-dim: oklch(50% 0.012 260);
  --text-faint: oklch(54% 0.01 260);
  --accent: oklch(50% 0.11 252);
  --accent-hover: oklch(44% 0.11 252);
  --on-accent: #fff;
  --accent-soft: oklch(95.5% 0.028 252);
  --danger: oklch(52% 0.16 25);
  --danger-soft: oklch(96% 0.03 25);
  --warn: oklch(55% 0.13 70);
  --ok: oklch(52% 0.12 150);
  --mark: oklch(92% 0.09 95);
  --pin-active: oklch(65% 0.15 85);

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;

  --radius: 8px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --pad: clamp(18px, 4vw, 44px);
}

:root[data-theme="dark"] {
  --bg: oklch(17.5% 0.008 262);
  --surface: oklch(21% 0.008 262);
  --border: oklch(29% 0.01 262);
  --border-strong: oklch(41% 0.014 262);
  --control-border: oklch(52% 0.014 262);
  --text: oklch(93% 0.006 262);
  --text-dim: oklch(72% 0.01 262);
  --text-faint: oklch(64% 0.012 262);
  --accent: oklch(76% 0.1 252);
  --accent-hover: oklch(83% 0.09 252);
  /* 深色主题强调色偏亮，按钮文字改用深色以保证对比度 */
  --on-accent: oklch(19% 0.02 252);
  --accent-soft: oklch(28% 0.04 252);
  --danger: oklch(68% 0.14 25);
  --danger-soft: oklch(30% 0.05 25);
  --warn: oklch(78% 0.11 70);
  --ok: oklch(75% 0.12 150);
  --mark: oklch(45% 0.11 95);
  --pin-active: oklch(72% 0.15 85);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: oklch(17.5% 0.008 262);
    --surface: oklch(21% 0.008 262);
    --border: oklch(29% 0.01 262);
    --border-strong: oklch(41% 0.014 262);
    --control-border: oklch(52% 0.014 262);
    --text: oklch(93% 0.006 262);
    --text-dim: oklch(72% 0.01 262);
    --text-faint: oklch(64% 0.012 262);
    --accent: oklch(76% 0.1 252);
    --accent-hover: oklch(83% 0.09 252);
    --on-accent: oklch(19% 0.02 252);
    --accent-soft: oklch(28% 0.04 252);
    --danger: oklch(68% 0.14 25);
    --danger-soft: oklch(30% 0.05 25);
    --warn: oklch(78% 0.11 70);
    --ok: oklch(75% 0.12 150);
    --mark: oklch(45% 0.11 95);
    --pin-active: oklch(72% 0.15 85);
  }
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

code {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.85em;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--pad); }

/* ---------- 可达性 ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 50;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.85rem;
  transition: top 0.18s var(--ease);
}

.skip:focus { top: 12px; }

/* ---------- 页头 ---------- */
.masthead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(38px, 6vw, 68px) 0 clamp(20px, 3vw, 30px);
}
.masthead > div { min-width: 0; }

.masthead h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.masthead p { margin: 6px 0 0; color: var(--text-dim); font-size: 0.9rem; }

.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }

.i-sun { display: none; }
.i-moon { display: block; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: block; }
  :root:not([data-theme="light"]) .i-moon { display: none; }
}

/* ---------- 工具行 ---------- */
.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.search { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; }
.search-icon { flex: none; color: var(--text-faint); }

.search input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 2px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s var(--ease);
}

.search input::placeholder { color: var(--text-faint); }
.search input:focus { border-bottom-color: var(--accent); }

.hint-kbd {
  flex: none;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.count { flex: none; padding-bottom: 8px; color: var(--text-faint); font-family: var(--mono); font-size: 0.76rem; }
.toolbar .icon-btn { margin-bottom: 4px; }

/* ---------- 分类 ---------- */
.category { margin: clamp(32px, 4.5vw, 52px) 0 0; }
.category-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }

.category-name {
  position: relative;
  margin: 0;
  padding-left: 11px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-dim);
}

.category-name::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 13px;
  border-radius: 2px;
  background: oklch(62% 0.11 var(--hue, 250));
}

.category-count { font-family: var(--mono); font-size: 0.72rem; color: var(--text-faint); }
.rule { flex: 1 1 auto; height: 1px; background: var(--border); }
[data-pinned] .category-name { color: var(--text); }
[data-pinned] .category-name::before { background: oklch(72% 0.15 85); }

/* ---------- 卡片 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: clamp(10px, 1.2vw, 14px);
}

.card {
  position: relative;
  display: block;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.18s var(--ease), transform 0.18s var(--ease);
}

.card[hidden] { display: none !important; }
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.card:active { transform: translateY(0); }
.card.is-active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.card:hover .card-host { color: var(--text-dim); }

.card-link {
  display: flex;
  gap: 12px;
  min-width: 0;
}

.mark {
  position: relative;
  flex: none;
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: oklch(94% 0.042 var(--hue, 250));
  color: oklch(42% 0.09 var(--hue, 250));
  font-size: 0.95rem;
  font-weight: 600;
  overflow: hidden;
}

:root[data-theme="dark"] .mark { background: oklch(30% 0.05 var(--hue, 250)); color: oklch(80% 0.09 var(--hue, 250)); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mark { background: oklch(30% 0.05 var(--hue, 250)); color: oklch(80% 0.09 var(--hue, 250)); }
}

.mark-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 4px; background: var(--surface); }

.card-body { display: block; min-width: 0; flex: 1 1 auto; }

.card-title { display: flex; align-items: center; gap: 6px; padding-right: 72px; font-weight: 550; letter-spacing: 0; }
.card-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }

.pin {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s var(--ease), color 0.18s var(--ease), background 0.18s var(--ease);
}

.pin:hover { background: var(--accent-soft); color: var(--accent); }
.card:hover .pin, .pin:focus-visible, .pin.is-on { opacity: 1; }
.pin.is-on { color: var(--pin-active); }

.card > .pin {
  position: absolute;
  z-index: 2;
  top: 8px;
  right: 32px;
  padding: 0;
}

.arrow {
  position: absolute;
  top: 16px;
  right: 14px;
  opacity: 0;
  transform: translate(-3px, 2px);
  color: var(--text-faint);
  font-size: 0.8rem;
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}

.card:hover .arrow { opacity: 1; transform: translate(0, 0); }

.card-desc {
  display: -webkit-box;
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 0.83rem;
  line-height: 1.45;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-host {
  display: block;
  margin-top: 5px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.18s var(--ease);
}

.card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 7px 0 0 46px; }

.chip {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-size: 0.71rem;
  line-height: 1.55;
  color: var(--text-dim);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}

.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.sm { padding: 1px 7px; font-size: 0.7rem; cursor: default; }
.chip.sm:hover { border-color: var(--border); color: var(--text-dim); }

/* ---------- 空状态 / 页脚 ---------- */
.empty { margin: clamp(40px, 8vw, 80px) auto; max-width: 420px; text-align: center; color: var(--text-dim); }
.empty-title { font-size: 1.02rem; font-weight: 600; color: var(--text); margin: 0 0 8px; }
.empty p { margin: 0 0 18px; font-size: 0.88rem; }

.foot {
  margin: clamp(46px, 7vw, 76px) 0 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--text-faint);
  font-size: 0.78rem;
  font-family: var(--mono);
}

.foot a, .linklike {
  border: 0;
  border-bottom: 1px solid transparent;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.foot a:hover, .linklike:hover { border-bottom-color: var(--border-strong); color: var(--text-dim); }
.foot-right { display: flex; gap: 14px; align-items: center; }

/* ---------- 快捷键浮层 ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: oklch(20% 0.01 260 / 0.45); }
.modal[hidden] { display: none; }
.modal-open { overflow: hidden; }

.modal-box {
  width: min(440px, 100%);
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.keys { margin: 0; display: grid; gap: 9px; }
.keys > div { display: flex; align-items: baseline; gap: 12px; }
.keys dt { flex: 0 0 132px; display: flex; gap: 3px; flex-wrap: wrap; }
.keys dd { margin: 0; color: var(--text-dim); font-size: 0.85rem; }

kbd {
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

.modal-tip { margin: 16px 0 0; color: var(--text-faint); font-size: 0.78rem; line-height: 1.6; }

/* ============================================================
   登录页
   ============================================================ */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.auth-card {
  width: min(360px, 100%);
  padding: 30px 28px 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.auth-brand { display: flex; justify-content: center; margin-bottom: 14px; }

.auth-mark {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 11px;
  background: oklch(94% 0.05 252);
  color: oklch(42% 0.11 252);
  font-size: 1.05rem;
  font-weight: 600;
}

:root[data-theme="dark"] .auth-mark { background: oklch(30% 0.06 252); color: oklch(80% 0.11 252); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .auth-mark { background: oklch(30% 0.06 252); color: oklch(80% 0.11 252); }
}

.auth-title { margin: 0; text-align: center; font-size: 1.15rem; font-weight: 600; letter-spacing: 0; }
.auth-sub { margin: 5px 0 22px; text-align: center; color: var(--text-faint); font-size: 0.82rem; }

.check {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 18px;
  color: var(--text-dim);
  font-size: 0.82rem;
  cursor: pointer;
}

.check input { accent-color: var(--accent); width: 15px; height: 15px; }
.btn-block { width: 100%; justify-content: center; }

.auth-back { display: block; margin-top: 16px; text-align: center; color: var(--text-faint); font-size: 0.8rem; }
.auth-back:hover { color: var(--text-dim); }
.auth-tip { margin: 18px 0 0; max-width: 360px; text-align: center; color: var(--text-faint); font-size: 0.74rem; line-height: 1.7; }

/* ============================================================
   后台
   ============================================================ */
.panel { max-width: 1120px; margin: 0 auto; padding: clamp(30px, 5vw, 56px) var(--pad) 60px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.panel-head h1 { margin: 0; font-size: 1.25rem; font-weight: 600; letter-spacing: 0; overflow-wrap: anywhere; }
.panel-sub { margin: 5px 0 0; color: var(--text-faint); font-size: 0.8rem; }

.role-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-faint);
}

.head-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.stat-row {
  display: flex;
  gap: 20px;
  margin-top: 18px;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.stat-row b { color: var(--text); font-size: 1rem; margin-right: 4px; }
.hint-line { margin-top: 18px; color: var(--text-faint); font-size: 0.78rem; line-height: 1.7; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), color 0.18s var(--ease);
}

.btn:hover { border-color: var(--text-faint); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-text { border-color: transparent; background: transparent; padding: 4px 7px; color: var(--text-dim); font-size: 0.8rem; }
.btn-text:hover { color: var(--text); background: var(--accent-soft); }
.btn-text.danger:hover { color: var(--danger); background: var(--danger-soft); }

.table { width: 100%; table-layout: fixed; border-collapse: collapse; margin-top: 16px; }

.table th {
  text-align: left;
  padding: 8px 10px 8px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0;
}

.table td { padding: 11px 10px 11px 0; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 0.88rem; }
.table tr:hover td { background: color-mix(in oklab, var(--accent-soft) 55%, transparent); }

tr.dragging { opacity: 0.45; }
tr.dragging td { background: var(--accent-soft); }

.col-drag { width: 26px; color: var(--text-faint); }
.col-drag svg { display: block; }
.drag-handle { display: inline-grid; place-items: center; cursor: grab; touch-action: none; }
.drag-handle:active { cursor: grabbing; }
.col-name { width: 30%; }
.col-cat { width: 92px; }
.col-tags { width: 112px; }
.col-act { width: 218px; }

.cell-name { min-width: 0; font-weight: 550; }
.cell-name .pin { display: inline-grid; vertical-align: -4px; opacity: 1; margin-right: 4px; }
.row-name { overflow-wrap: anywhere; }

.row-icon { width: 16px; height: 16px; vertical-align: -3px; margin-right: 5px; border-radius: 3px; object-fit: contain; }

.cell-url {
  display: block;
  max-width: 100%;
  min-width: 0;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.76rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-desc { color: var(--text-dim); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.cell-actions { text-align: right; white-space: nowrap; }
.inline { display: inline-flex; }
.icon-action { align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.72rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* 表单 */
.form { max-width: 560px; margin-top: 26px; }
.field { margin-bottom: 18px; }

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-dim);
}

.field label em { color: var(--danger); font-style: normal; }

.field input, .field textarea, .field select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.18s var(--ease);
}

.field textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field .tip { margin-top: 5px; color: var(--text-faint); font-size: 0.75rem; }

.admin-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.6fr) repeat(4, minmax(110px, 0.8fr)) auto;
  gap: 10px;
  align-items: end;
  margin-top: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.admin-filters label { display: grid; min-width: 0; gap: 5px; }
.admin-filters label > span { color: var(--text-faint); font-size: 0.72rem; font-weight: 600; }
.admin-filters input, .admin-filters select {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 6px 9px;
  border: 1px solid var(--control-border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  outline: none;
}
.admin-filters input:focus, .admin-filters select:focus { border-color: var(--accent); }
.filter-actions { display: flex; gap: 4px; align-items: center; min-height: 36px; }
.filter-actions .btn { height: 36px; }

.row-status { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 5px; vertical-align: 1px; }
.status-pill {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-faint);
  font-size: 0.64rem;
  font-weight: 500;
}
.status-hidden { border-color: color-mix(in oklab, var(--warn) 50%, var(--border)); color: var(--warn); }

.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.74rem;
}

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 24px; }

.form-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 24px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.form-options legend {
  padding: 0 6px;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 600;
}

.form-options .check { margin: 0; }
.icon-clear { margin: 8px 0 0; }

/* ---------- 管理控制台 / 内容设置 ---------- */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
}

.dashboard-stat {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  transition: border-color 0.18s var(--ease), transform 0.18s var(--ease);
}

.dashboard-stat:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.dashboard-stat-label { color: var(--text-faint); font-size: 0.78rem; }
.dashboard-stat strong { font-family: var(--mono); font-size: 1.45rem; font-weight: 600; }

.dashboard-section, .taxonomy-section, .settings-reset {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head h2, .settings-reset h2 { margin: 0; font-size: 0.98rem; font-weight: 600; }
.section-meta { color: var(--text-faint); font-family: var(--mono); font-size: 0.72rem; }
.dashboard-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.empty-inline { margin: 14px 0 0; color: var(--text-faint); font-size: 0.84rem; }

.activity-list { margin-top: 12px; }
.activity-row {
  display: grid;
  grid-template-columns: 82px 150px minmax(0, 1fr) max-content;
  gap: 10px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
}
.activity-action { color: var(--accent); font-family: var(--mono); }
.activity-entity { color: var(--text-dim); }
.activity-detail { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-faint); }
.activity-time { color: var(--text-faint); font-family: var(--mono); font-size: 0.7rem; }

.settings-form { margin-top: 24px; }
.settings-section { margin: 0; padding: 22px 0 26px; border: 0; border-bottom: 1px solid var(--border); }
.settings-section:first-child { padding-top: 0; }
.settings-section legend { padding: 0; color: var(--text); font-size: 0.94rem; font-weight: 600; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; }
.settings-field { margin: 0; }
.settings-field-wide { grid-column: 1 / -1; }
.settings-actions { margin-top: 24px; }
.settings-reset p { margin: 8px 0 12px; color: var(--text-faint); font-size: 0.82rem; }
.field .field-error { color: var(--danger); }
[aria-invalid="true"] { border-color: var(--danger) !important; }

.taxonomy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; margin-top: 24px; }
.taxonomy-create { display: flex; gap: 8px; margin-top: 14px; }
.taxonomy-create input { min-width: 0; flex: 1 1 auto; padding: 8px 9px; border: 1px solid var(--control-border); border-radius: 7px; background: var(--surface); color: var(--text); font: inherit; font-size: 0.84rem; outline: none; }
.taxonomy-create input:focus { border-color: var(--accent); }
.taxonomy-list { margin-top: 14px; }
.taxonomy-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.taxonomy-edit { display: flex; min-width: 0; align-items: center; gap: 8px; }
.taxonomy-edit input { min-width: 0; flex: 1 1 auto; padding: 6px 8px; border: 1px solid var(--control-border); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; font-size: 0.84rem; }
.taxonomy-count { flex: none; min-width: 24px; color: var(--text-faint); font-family: var(--mono); font-size: 0.72rem; text-align: right; }
.taxonomy-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px; margin-top: 5px; }
.taxonomy-delete { display: inline-flex; align-items: center; gap: 2px; }
.taxonomy-delete select { max-width: 132px; min-width: 0; padding: 5px 6px; border: 1px solid var(--control-border); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; font-size: 0.72rem; }

.alert {
  margin-top: 16px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-left: 2px solid var(--danger);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.84rem;
}

.alert.ok { border-left-color: var(--ok); }
.alert.warn { border-left-color: var(--warn); }
.alert a { color: var(--accent); border-bottom: 1px solid currentColor; }

/* 账号设置 */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 28px;
  margin-top: 24px;
}

.card-form { padding: 0; }
.sec-title { margin: 0; font-size: 0.95rem; font-weight: 600; }
.card-form .form { margin-top: 14px; max-width: none; }

.account-meta {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 8px;
  font-size: 0.8rem;
}

.account-meta div { display: flex; justify-content: space-between; gap: 12px; }
.account-meta span { color: var(--text-faint); }
.account-meta b { font-weight: 550; }

/* ============================================================
   分类导航（sticky）+ 锚点定位
   ============================================================ */
html { scroll-behavior: smooth; }

.catnav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.catnav ul {
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.catnav ul::-webkit-scrollbar { display: none; }
.catnav li { flex: none; }
.catnav li[hidden] { display: none; }

.catnav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: 0.85rem;
  white-space: nowrap;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.catnav-item:hover { color: var(--text); }

.catnav-item.is-current {
  color: var(--text);
  font-weight: 550;
  border-bottom-color: var(--accent);
}

.catnav-n { font-family: var(--mono); font-size: 0.7rem; color: var(--text-faint); }
.catnav-item.is-current .catnav-n { color: var(--accent); }

.anchor { display: block; height: 0; }
.category { scroll-margin-top: 60px; }

/* 后台面包屑 */
.crumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 14px;
  font-size: 0.78rem;
  color: var(--text-faint);
}

.crumbs a { color: var(--text-dim); border-bottom: 1px solid transparent; }
.crumbs a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.crumbs .sep { opacity: 0.45; }
.crumbs .cur { color: var(--text); font-weight: 550; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .col-desc, .col-tags { display: none; }
  .admin-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filter-search { grid-column: span 2; }
}

@media (max-width: 700px) {
  .table, .table tbody, .table tr, .table td { display: block; }
  .table .col-drag, .table .col-name, .table .col-cat, .table .col-tags,
  .table .col-desc, .table .col-act { width: auto; }
  .table thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .table { table-layout: auto; }
  .table tr {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 0 8px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }
  .table td { min-width: 0; padding: 0; border: 0; }
  .table td.col-drag { grid-column: 1; grid-row: 1 / span 3; padding-top: 3px; }
  .table td.cell-name { grid-column: 2; grid-row: 1; }
  .table td.cell-category { grid-column: 2; grid-row: 2; margin-top: 6px; }
  .table td.cell-tags, .table td.cell-desc { display: none; }
  .table td.cell-actions { grid-column: 2; grid-row: 3; display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 3px 6px; margin-top: 8px; white-space: normal; }
  .table td.cell-actions .inline { display: inline-flex; }
  .table td.cell-actions .btn-text { padding: 4px 6px; }
  .cell-url { max-width: 100%; }
  .cell-name .pin { margin-right: 3px; }
  .table tr:hover td { background: transparent; }
  .table tr:hover { background: color-mix(in oklab, var(--accent-soft) 55%, transparent); }
  .account-grid { grid-template-columns: minmax(0, 1fr); }
  .dashboard-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid, .taxonomy-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-field-wide { grid-column: auto; }
  .activity-row { grid-template-columns: 70px minmax(0, 1fr); gap: 4px 8px; }
  .activity-detail { grid-column: 2; }
  .activity-time { grid-column: 2; }
  .admin-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-search { grid-column: 1 / -1; }
  .filter-actions { justify-content: flex-end; }
}

@media (max-width: 620px) {
  .masthead h1 { font-size: 1.65rem; }
  .grid { grid-template-columns: 1fr; }
  .toolbar { flex-wrap: nowrap; gap: 8px; }
  .count { padding-bottom: 4px; }
  .foot { flex-direction: column; align-items: flex-start; gap: 6px; }
  .keys dt { flex-basis: 108px; }
  .cell-actions .btn-text { padding: 4px 5px; }
  .admin-filters { grid-template-columns: minmax(0, 1fr); }
  .filter-search { grid-column: auto; }
  .filter-actions { justify-content: flex-start; }
  .pagination { justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .card:hover { transform: none; }
}

/* 触屏设备没有 hover，收藏按钮需常驻，否则手机上无法操作 */
@media (hover: none) {
  .pin { width: 36px; height: 36px; opacity: 1; }
  .icon-action { width: 36px; height: 36px; }
  .card > .pin { top: 4px; right: 28px; }
  .arrow { opacity: 1; transform: translate(0, 0); }
}
