/* ============ 设计变量 ============ */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f0f2f5;
  --border: #e4e7ec;
  --border-strong: #d3d8e0;
  --text: #171a1f;
  --text-2: #59616e;
  --text-3: #8d96a3;
  --primary: #4c6ef5;
  --primary-hover: #3b5bdb;
  --primary-soft: #edf1ff;
  --amber: #f59f00;
  --amber-soft: #fff6e5;
  --green: #12b886;
  --green-soft: #e6fbf5;
  --red: #f03e3e;
  --red-soft: #ffecec;
  --purple: #7950f2;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 2px 8px rgba(16, 24, 40, .07);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, .10);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, .16);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --topbar-h: 60px;
  --sidebar-w: 232px;
  --content-max: 1240px;
}

html[data-theme="dark"] {
  --bg: #14161a;
  --surface: #1c1f25;
  --surface-2: #22262e;
  --surface-3: #2a2f38;
  --border: #2e343d;
  --border-strong: #3d444f;
  --text: #e9edf2;
  --text-2: #9aa4b2;
  --text-3: #6f7885;
  --primary: #6c8bff;
  --primary-hover: #85a0ff;
  --primary-soft: #1e2743;
  --amber-soft: #3a2d12;
  --green-soft: #12322a;
  --red-soft: #3a1c1c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 2px 8px rgba(0, 0, 0, .35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .4);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 顶栏 ============ */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 16px; font-weight: 700; letter-spacing: -.2px;
  white-space: nowrap;
}
.brand .logo {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: grid; place-items: center; color: #fff; font-size: 15px;
  box-shadow: 0 2px 8px rgba(76, 110, 245, .35);
}
.search-box {
  flex: 1; max-width: 460px; position: relative; display: flex; align-items: center;
}
.search-box svg { position: absolute; left: 11px; color: var(--text-3); pointer-events: none; }
.search-box input {
  width: 100%; height: 38px;
  padding: 0 34px 0 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  outline: none; transition: .15s;
}
.search-box input:focus {
  border-color: var(--primary); background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.search-box .clear {
  position: absolute; right: 8px; width: 20px; height: 20px; border-radius: 50%;
  display: none; place-items: center; color: var(--text-3); background: var(--surface-3);
}
.search-box.has-value .clear { display: grid; }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center; color: var(--text-2);
  border: 1px solid transparent; transition: .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.active { background: var(--primary-soft); color: var(--primary); }

.btn {
  height: 38px; padding: 0 16px; border-radius: 10px;
  display: inline-flex; align-items: center; gap: 7px;
  font-weight: 600; font-size: 13.5px; transition: .15s;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn-primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(76, 110, 245, .28);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { color: var(--red); border-color: transparent; }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; justify-content: center; }

/* ============ 布局 ============ */
.layout {
  display: flex; align-items: flex-start;
  max-width: var(--content-max); margin: 0 auto;
  padding: 0 16px; gap: 20px;
}
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  position: sticky; top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 18px 4px 40px;
}
.side-group { margin-bottom: 20px; }
.side-title {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3); padding: 0 10px; margin-bottom: 6px;
}
.side-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 9px;
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  transition: .12s; cursor: pointer; width: 100%; text-align: left;
}
.side-item:hover { background: var(--surface-3); color: var(--text); }
.side-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.side-item .ico { width: 17px; height: 17px; flex: 0 0 17px; opacity: .85; }
.side-item .count {
  margin-left: auto; font-size: 11.5px; font-weight: 600;
  color: var(--text-3); background: var(--surface-3);
  padding: 1px 7px; border-radius: 20px; min-width: 22px; text-align: center;
}
.side-item.active .count { background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary); }
.tag-dot { width: 8px; height: 8px; border-radius: 3px; flex: 0 0 8px; }
.tag-empty { padding: 6px 10px; color: var(--text-3); font-size: 13px; }

.main { flex: 1; min-width: 0; padding: 18px 0 60px; }

/* ============ 工具条 ============ */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 2px 14px; flex-wrap: wrap;
}
.result-count { font-size: 13px; color: var(--text-2); }
.result-count b { color: var(--text); font-weight: 650; }
.spacer { flex: 1; }
.segmented {
  display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 3px; gap: 2px;
}
.segmented button {
  padding: 5px 11px; border-radius: 7px; font-size: 12.5px; font-weight: 600;
  color: var(--text-2); transition: .15s; display: inline-flex; align-items: center; gap: 5px;
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented svg { width: 14px; height: 14px; }

.active-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 2px 12px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 10px; border-radius: 20px;
  background: var(--primary-soft); color: var(--primary);
  font-size: 12.5px; font-weight: 600;
}
.filter-chip button { color: inherit; opacity: .7; display: grid; place-items: center; }
.filter-chip button:hover { opacity: 1; }

/* ============ 卡片网格 ============ */
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
}
.grid.list-view { grid-template-columns: 1fr; gap: 10px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  display: flex; flex-direction: column;
  transition: .18s; cursor: pointer; position: relative;
  box-shadow: var(--shadow-sm);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.card-cover {
  position: relative; aspect-ratio: 16 / 9; background: var(--surface-3);
  overflow: hidden; display: grid; place-items: center;
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-cover .ph { color: var(--text-3); font-size: 26px; }
.play-badge {
  position: absolute; inset: 0; margin: auto;
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(0, 0, 0, .55); backdrop-filter: blur(4px);
  display: grid; place-items: center; color: #fff;
  transition: .18s; border: 1.5px solid rgba(255, 255, 255, .3);
}
.card:hover .play-badge { transform: scale(1.08); background: rgba(0, 0, 0, .68); }
.play-badge svg { width: 18px; height: 18px; margin-left: 2px; }

.type-badge {
  position: absolute; top: 8px; left: 8px;
  padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  background: rgba(0, 0, 0, .62); color: #fff; backdrop-filter: blur(4px);
  display: inline-flex; align-items: center; gap: 4px;
}
.status-badge {
  position: absolute; top: 8px; right: 8px;
  padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 700;
  backdrop-filter: blur(4px);
}
.status-badge.pending { background: rgba(245, 159, 0, .92); color: #4a2c00; }
.status-badge.failed { background: rgba(240, 62, 62, .92); color: #fff; }
.status-badge.ready { background: rgba(18, 184, 134, .92); color: #fff; }
.progress-line { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--amber); transition: width .3s; }

.card-body { padding: 12px 13px 13px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.card-title {
  font-size: 14.5px; font-weight: 650; line-height: 1.45; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-summary {
  font-size: 12.8px; color: var(--text-2); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 11.8px; color: var(--text-3); margin-top: auto; padding-top: 2px;
}
.card-meta .src { font-weight: 600; color: var(--text-2); max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }

.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2); max-width: 100%;
}
.chip .cdot { width: 6px; height: 6px; border-radius: 2px; flex: 0 0 6px; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card-actions {
  position: absolute; top: 8px; right: 8px; display: flex; gap: 4px;
  opacity: 0; transition: .15s;
}
.card:hover .card-actions { opacity: 1; }
.card-actions button {
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(0, 0, 0, .5); color: #fff; backdrop-filter: blur(4px);
  display: grid; place-items: center; transition: .15s;
}
.card-actions button:hover { background: rgba(0, 0, 0, .72); }
.card-actions button.on { background: var(--amber); }
.card.has-progress .card-actions { display: none; }

/* 列表视图 */
.list-view .card { flex-direction: row; align-items: stretch; }
.list-view .card-cover { width: 172px; flex: 0 0 172px; aspect-ratio: auto; min-height: 104px; }
.list-view .card-body { padding: 12px 14px; min-width: 0; }
.list-view .card-title { -webkit-line-clamp: 1; }
.list-view .card-summary { -webkit-line-clamp: 2; }

/* ============ 空状态 / 骨架 ============ */
.empty {
  text-align: center; padding: 72px 20px; color: var(--text-3);
}
.empty .big { font-size: 44px; margin-bottom: 12px; opacity: .8; }
.empty h3 { margin: 0 0 6px; font-size: 16px; color: var(--text-2); font-weight: 650; }
.empty p { margin: 0 0 18px; font-size: 13.5px; }

.skeleton { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.skeleton .sk-cover { aspect-ratio: 16/9; }
.skeleton .sk-body { padding: 13px; display: flex; flex-direction: column; gap: 8px; }
.sk-line { height: 12px; border-radius: 6px; }
.skeleton .sk-cover, .sk-line {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
  background-size: 400% 100%; animation: shimmer 1.3s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ============ 弹窗 ============ */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(16, 20, 28, .5); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 16px;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: 100%; max-width: 560px; max-height: 90vh;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: pop .18s cubic-bezier(.2, .9, .3, 1.2);
  border: 1px solid var(--border);
}
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98) } to { opacity: 1; transform: none } }
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 15.5px; font-weight: 700; }
.modal-body { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot {
  padding: 14px 18px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end; align-items: center;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 650; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.input, .textarea, .select {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface-2); outline: none; transition: .15s;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--primary); background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.textarea.tall { min-height: 200px; font-size: 13.5px; }

.tabs { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 3px; gap: 2px; }
.tabs button {
  padding: 6px 13px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--text-2); transition: .15s;
}
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* 标签输入 */
.tag-input {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 7px 9px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface-2); cursor: text; transition: .15s; min-height: 40px;
}
.tag-input:focus-within { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px var(--primary-soft); }
.tag-input .tag-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 6px 3px 9px; border-radius: 6px; font-size: 12.5px; font-weight: 600;
  background: var(--primary-soft); color: var(--primary);
}
.tag-input .tag-pill button { opacity: .65; display: grid; place-items: center; }
.tag-input .tag-pill button:hover { opacity: 1; }
.tag-input input { flex: 1; min-width: 110px; border: none; outline: none; background: transparent; padding: 3px 2px; }
.tag-suggest { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.tag-suggest button {
  padding: 3px 9px; border-radius: 14px; font-size: 12px; font-weight: 600;
  border: 1px dashed var(--border-strong); color: var(--text-2); transition: .12s;
}
.tag-suggest button:hover { border-style: solid; border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

.switch { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; }
.switch input { display: none; }
.switch .track {
  width: 40px; height: 22px; border-radius: 20px; background: var(--border-strong);
  position: relative; transition: .18s; flex: 0 0 40px;
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: .18s; box-shadow: var(--shadow-sm);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(18px); }
.field.row { flex-direction: row; gap: 22px; align-items: center; }

/* ============ Toast ============ */
.toast-wrap {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: max-content; max-width: 90vw;
}
.toast {
  padding: 10px 16px; border-radius: 10px; background: #1f2430; color: #fff;
  font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-md);
  animation: toastIn .22s cubic-bezier(.2, .9, .3, 1.2);
  display: flex; align-items: center; gap: 8px; max-width: 100%;
}
.toast.err { background: var(--red); }
.toast.ok { background: #12b886; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }

/* ============ 阅读页 ============ */
.reader {
  max-width: 780px; margin: 0 auto; padding: 22px 18px 90px;
}
.reader-top { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.reader h1 {
  font-size: 26px; line-height: 1.35; font-weight: 750; margin: 0 0 12px;
  letter-spacing: -.3px;
}
.reader .meta-line {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-3); margin-bottom: 18px;
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.reader .meta-line a { color: var(--primary); font-weight: 600; }
.player {
  width: 100%; border-radius: var(--radius); overflow: hidden;
  background: #000; margin-bottom: 18px; box-shadow: var(--shadow-md);
}
.player video { width: 100%; display: block; max-height: 70vh; background: #000; }
.player-wrap {
  position: relative; border-radius: var(--radius); overflow: hidden; margin-bottom: 18px;
  background: #000; aspect-ratio: 16/9; display: grid; place-items: center;
}
.player-wrap img { width: 100%; height: 100%; object-fit: cover; }
.player-wrap .lock-note {
  position: absolute; inset: auto 0 0 0; padding: 10px 14px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .8)); color: #fff; font-size: 12.5px;
}

/* 正文排版 */
.article {
  font-size: 16px; line-height: 1.85; color: var(--text);
  word-wrap: break-word; overflow-wrap: break-word;
}
.article img { max-width: 100%; height: auto; border-radius: var(--radius-sm); display: block; margin: 16px auto; }
.article p { margin: 0 0 16px; }
.article h1, .article h2, .article h3, .article h4 {
  margin: 28px 0 14px; line-height: 1.4; font-weight: 700; letter-spacing: -.2px;
}
.article h1 { font-size: 22px; } .article h2 { font-size: 19px; }
.article h3 { font-size: 17px; } .article h4 { font-size: 15.5px; }
.article a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.article ul, .article ol { padding-left: 24px; margin: 0 0 16px; }
.article li { margin-bottom: 6px; }
.article blockquote {
  margin: 16px 0; padding: 10px 16px; border-left: 3px solid var(--primary);
  background: var(--surface-2); color: var(--text-2); border-radius: 0 8px 8px 0;
}
.article pre {
  background: var(--surface-3); padding: 14px 16px; border-radius: 10px;
  overflow-x: auto; font-size: 13.5px; line-height: 1.6; margin: 0 0 16px;
}
.article code {
  background: var(--surface-3); padding: 2px 6px; border-radius: 5px; font-size: 13.5px;
}
.article pre code { background: none; padding: 0; }
.article table { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 14px; display: block; overflow-x: auto; }
.article th, .article td { border: 1px solid var(--border); padding: 8px 11px; text-align: left; }
.article th { background: var(--surface-2); font-weight: 650; }
.article hr { border: none; border-top: 1px solid var(--border); margin: 26px 0; }
.article figure { margin: 16px 0; }
.article figcaption { text-align: center; font-size: 13px; color: var(--text-3); margin-top: 8px; }

.note-box {
  background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent);
  border-radius: var(--radius); padding: 13px 15px; margin: 24px 0; font-size: 14.5px; line-height: 1.75;
}
.note-box .nt {
  font-size: 12px; font-weight: 700; color: var(--amber); letter-spacing: .04em;
  text-transform: uppercase; margin-bottom: 5px;
}
.note-box textarea {
  width: 100%; border: none; background: transparent; outline: none; resize: vertical;
  min-height: 60px; font-size: 14.5px; line-height: 1.75;
}

.warn-box {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 18px;
  font-size: 13.5px; color: var(--text-2); display: flex; gap: 9px; align-items: flex-start;
}
.warn-box.err { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.warn-box b { color: var(--text); }

.reader-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ============ 设置面板 ============ */
.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-row .sr-label { font-size: 13.5px; font-weight: 600; }
.setting-row .sr-desc { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.tool-status { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.tool-status .dot { width: 7px; height: 7px; border-radius: 50%; }
.tool-status.ok .dot { background: var(--green); }
.tool-status.ok { color: var(--green); }
.tool-status.no .dot { background: var(--red); }
.tool-status.no { color: var(--red); }
.code-block {
  background: var(--surface-3); border-radius: 8px; padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.7; overflow-x: auto; white-space: pre-wrap; word-break: break-all;
  margin-top: 8px;
}

/* ============ 移动端 ============ */
.menu-btn { display: none; }
.scrim { display: none; }

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
}

@media (max-width: 768px) {
  :root { --topbar-h: 56px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .brand span { display: none; }
  .menu-btn { display: grid; }
  .search-box { max-width: none; }
  .btn span.txt { display: none; }
  .btn { padding: 0 12px; }

  .layout { padding: 0 12px; gap: 0; }
  .sidebar {
    position: fixed; z-index: 60; left: 0; top: var(--topbar-h);
    width: 268px; flex: none; background: var(--surface);
    border-right: 1px solid var(--border);
    height: calc(100dvh - var(--topbar-h));
    padding: 16px 10px 40px;
    transform: translateX(-100%); transition: transform .24s cubic-bezier(.3, .8, .3, 1);
    box-shadow: none;
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .scrim {
    display: block; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 50;
    background: rgba(0, 0, 0, .4); opacity: 0; pointer-events: none; transition: .24s;
  }
  .scrim.show { opacity: 1; pointer-events: auto; }

  .main { padding: 14px 0 80px; }
  .grid { grid-template-columns: 1fr; gap: 10px; }
  .grid.list-view .card-cover { width: 116px; flex: 0 0 116px; min-height: 84px; }
  .card-actions { opacity: 1; }
  .toolbar { gap: 8px; }
  .segmented button .lg { display: none; }

  .reader { padding: 16px 14px 90px; }
  .reader h1 { font-size: 21px; }
  .article { font-size: 15.5px; line-height: 1.8; }
  .modal { max-width: none; max-height: 92dvh; border-radius: 16px 16px 0 0; align-self: flex-end; }
  .overlay { padding: 0; align-items: end; }
  @keyframes pop { from { transform: translateY(30px) } to { transform: none } }
}

@media (max-width: 480px) {
  .grid.list-view .card-cover { width: 92px; flex: 0 0 92px; }
  .grid.list-view .card-title { font-size: 14px; }
}

.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;
}

/* 写入密码浮层（添加/修改收藏时弹出，区别于整页登录） */
#pwdOverlay {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(3px);
}
.pwd-modal {
  width: min(360px, 92vw); background: var(--surface, #fff);
  color: var(--text, #171a1f);
  border-radius: 14px; padding: 22px 22px 18px;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
  font-size: 14px;
  border: 1px solid var(--border, #e4e7ec);
}
.pwd-modal h3 { margin: 0 0 6px; font-size: 17px; }
.pwd-modal p { margin: 0 0 14px; color: var(--text-3, #6f7885); font-size: 13px; line-height: 1.5; }
.pwd-modal input[type=password] {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--border-strong, #d3d8e0);
  background: var(--bg, #f5f6f8);
  color: var(--text, #171a1f);
  border-radius: 10px; font-size: 15px; outline: none; box-sizing: border-box;
}
.pwd-modal input[type=password]::placeholder { color: var(--text-3, #8d96a3); }
.pwd-modal input[type=password]:focus { border-color: var(--accent, #4f46e5); background: var(--surface, #fff); }
.pwd-err { color: #ff5a5a; font-size: 12.5px; min-height: 16px; margin: 8px 2px 0; font-weight: 600; }
.pwd-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.pwd-actions .btn { padding: 9px 20px; border-radius: 10px; border: 1px solid var(--border, #e4e7ec); background: var(--surface-2, #fafbfc); color: var(--text, #171a1f); cursor: pointer; font-size: 13.5px; }
.pwd-actions .btn-primary { background: var(--accent, #4f46e5); color: #fff; border-color: transparent; }
.pwd-actions .btn-primary:disabled { opacity: 0.7; cursor: wait; }
