/* ============================================================
 *  小说管理系统 · 设计 Token
 *  风格：macOS System Settings / Linear / Vercel Dashboard
 *  目标：高信息密度、行内操作、表格优先、克制留白
 * ============================================================ */
:root {
  --bg: #f5f5f7;
  --bg-elev: #ffffff;
  --bg-soft: #f2f2f4;
  --bg-tint: #e8e8eb;
  --bg-hover: rgba(0, 0, 0, 0.04);
  --bg-active: rgba(0, 113, 227, 0.10);

  --text: #1d1d1f;
  --text-2: #515154;
  --text-3: #86868b;
  --text-4: #a1a1a6;
  --border: rgba(0, 0, 0, 0.08);
  --border-2: rgba(0, 0, 0, 0.12);
  --border-3: rgba(0, 0, 0, 0.18);

  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.10);
  --green: #1e8e3e;
  --green-soft: rgba(52, 199, 89, 0.16);
  --orange: #c46b00;
  --orange-soft: rgba(255, 159, 10, 0.16);
  --red: #d70015;
  --red-soft: rgba(255, 59, 48, 0.16);
  --purple: #8e44ad;
  --purple-soft: rgba(175, 82, 222, 0.16);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.10), 0 2px 6px rgba(0, 0, 0, 0.04);

  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
          "Helvetica Neue", Helvetica, "Microsoft YaHei", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  --side-w: 232px;
  --side-w-collapsed: 60px;
  --header-h: 52px;
  --z-scrollbar: 55;
  --z-scrollbar-panel: 60;
  --z-drawer-mask: 220;
  --z-drawer: 230;
  --z-drawer-tool: 235;
  --z-floating-tool: 65;
  --z-toast: 300;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --bg-elev: #161618;
    --bg-soft: #1c1c1e;
    --bg-tint: #2c2c2e;
    --bg-hover: rgba(255, 255, 255, 0.06);
    --bg-active: rgba(41, 151, 255, 0.16);
    --text: #f5f5f7;
    --text-2: #c7c7cc;
    --text-3: #8e8e93;
    --text-4: #6e6e73;
    --border: rgba(255, 255, 255, 0.08);
    --border-2: rgba(255, 255, 255, 0.14);
    --border-3: rgba(255, 255, 255, 0.22);
    --accent: #2997ff;
    --accent-hover: #41a3ff;
    --accent-soft: rgba(41, 151, 255, 0.18);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  }
}

/* ==================== 重置 ==================== */
*, *::before, *::after {
  box-sizing: border-box;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
*::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-width: none;
}
body {
  margin: 0; min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.5;
  overscroll-behavior: none;
  scrollbar-width: none;
}
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; padding: 0; }
input, textarea, select { font-family: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
.boot { position: fixed; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: 13px; }

html::-webkit-scrollbar,
body::-webkit-scrollbar,
.scroll-host::-webkit-scrollbar { width: 0; height: 0; }

.custom-scrollbar {
  position: fixed;
  width: 6px;
  z-index: var(--z-scrollbar);
  border-radius: 999px;
  pointer-events: auto;
  background: transparent;
  contain: strict;
}
.custom-scrollbar.is-hidden {
  display: none;
}
.custom-scrollbar-window {
  z-index: var(--z-scrollbar);
}
.custom-scrollbar-panel {
  z-index: var(--z-scrollbar-panel);
}
.custom-scrollbar-layer {
  z-index: var(--z-drawer-tool);
}
.custom-scrollbar-thumb {
  width: 6px;
  min-height: 32px;
  border-radius: 999px;
  background: rgba(0,0,0,0.22);
  transition: background 0.14s var(--ease), opacity 0.14s var(--ease);
  opacity: 0.58;
}
.custom-scrollbar:hover .custom-scrollbar-thumb,
.custom-scrollbar-thumb.dragging { background: rgba(0,0,0,0.38); opacity: 0.9; }
@media (prefers-color-scheme: dark) {
  .custom-scrollbar-thumb { background: rgba(255,255,255,0.24); }
  .custom-scrollbar:hover .custom-scrollbar-thumb,
  .custom-scrollbar-thumb.dragging { background: rgba(255,255,255,0.42); }
}
.scroll-host {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  position: relative;
  overscroll-behavior: contain;
  scroll-padding-bottom: 72px;
}
.scroll-host.has-panel-top {
  padding-bottom: 54px;
}
.tbl-wrap.scroll-host.has-panel-top {
  padding-bottom: 54px;
}

/* ==================== 登录 ==================== */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card {
  width: 100%; max-width: 360px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px 28px 28px;
  box-shadow: var(--shadow-md);
  text-align: center;
  animation: fadeIn 0.4s var(--ease);
}
.login-logo {
  width: 48px; height: 48px; margin: 0 auto 16px;
  background: linear-gradient(135deg, #0071e3, #5e5ce6);
  border-radius: 12px;
  display: grid; place-items: center;
  color: #fff; font-size: 22px; font-weight: 600;
}
.login h1 { font-size: 20px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.01em; }
.login p { color: var(--text-3); margin: 0 0 22px; font-size: 13px; }
.login input {
  width: 100%; padding: 10px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 14px; outline: none;
  transition: all 0.18s var(--ease);
}
.login input:focus { border-color: var(--accent); background: var(--bg-elev); box-shadow: 0 0 0 3px var(--accent-soft); }
.login .err { color: var(--red); font-size: 12px; margin-top: 8px; min-height: 14px; }
.login .btn-primary { display: block; width: 100%; margin-top: 14px; padding: 10px 18px; background: var(--accent); color: #fff; border-radius: var(--r-md); font-size: 14px; font-weight: 500; transition: all 0.18s var(--ease); }
.login .btn-primary:hover { background: var(--accent-hover); }

/* ==================== 主布局 ==================== */
.layout { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.sidebar-mask { display: none; }  /* 默认隐藏，避免占据 grid 槽位 */

/* 侧边栏 */
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.side-head {
  height: var(--header-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.side-logo {
  width: 26px; height: 26px;
  background: linear-gradient(135deg, #0071e3, #5e5ce6);
  border-radius: 7px;
  display: grid; place-items: center;
  color: #fff; font-size: 14px; font-weight: 700;
  flex-shrink: 0;
}
.side-title {
  font-size: 13.5px; font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-title .sub { display: block; font-size: 11px; font-weight: 400; color: var(--text-3); margin-top: 1px; }

.side-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
}
.side-section { margin-bottom: 14px; }
.side-section-title {
  font-size: 10.5px;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  padding: 4px 10px 6px;
}
.side-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
  position: relative;
}
.side-item:hover { background: var(--bg-hover); color: var(--text); }
.side-item.active { background: var(--bg-active); color: var(--accent); }
.side-item .ico { width: 16px; height: 16px; flex-shrink: 0; display: grid; place-items: center; }
.side-item .ico svg { width: 16px; height: 16px; }
.side-item .label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.side-item .badge {
  margin-left: auto;
  background: var(--bg-soft);
  color: var(--text-3);
  font-size: 10.5px; font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  font-feature-settings: 'tnum';
}
.side-item.active .badge { background: var(--accent); color: #fff; }

.side-foot {
  border-top: 1px solid var(--border);
  padding: 10px;
  display: flex; gap: 6px; flex-wrap: wrap;
}
.side-foot button {
  flex: 1;
  padding: 6px 8px;
  font-size: 12px; color: var(--text-2);
  border-radius: var(--r-sm);
  display: flex; align-items: center; gap: 6px;
  justify-content: center;
  transition: background 0.12s var(--ease);
}
.side-foot button:hover { background: var(--bg-hover); color: var(--text); }
.side-foot svg { width: 13px; height: 13px; }

/* 主区 */
.main-col { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--header-h);
  background: rgba(245, 245, 247, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
}
@media (prefers-color-scheme: dark) { .topbar { background: rgba(10,10,10,0.80); } }
.topbar .menu-btn { display: none; }
.crumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); min-width: 0; }
.crumb .here { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb-sep { color: var(--text-4); }
.topbar-search {
  margin-left: auto;
  position: relative;
  width: 240px;
}
.topbar-search input {
  width: 100%; padding: 6px 10px 6px 30px;
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: 13px; outline: none;
  transition: all 0.15s var(--ease);
}
.topbar-search input:focus { border-color: var(--accent); background: var(--bg-elev); box-shadow: 0 0 0 3px var(--accent-soft); }
.topbar-search::before {
  content: ''; position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>") center/contain no-repeat;
}
.topbar-actions { display: flex; gap: 4px; }

.icon-btn {
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: var(--text-2);
  transition: background 0.12s var(--ease);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

/* 内容容器 */
.page {
  padding: 24px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}
.page-head { margin-bottom: 18px; display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; margin: 0; font-family: var(--font-display); }
.page-sub { color: var(--text-3); font-size: 13px; margin-top: 4px; }
.page-actions { display: flex; gap: 8px; }

/* ==================== 按钮 ==================== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  font-size: 13px; font-weight: 500;
  background: var(--accent); color: #fff;
  border-radius: var(--r-md);
  transition: all 0.14s var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(0.97); }
.btn.ghost { background: var(--bg-elev); color: var(--text); border: 1px solid var(--border-2); }
.btn.ghost:hover { background: var(--bg-soft); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn svg { width: 14px; height: 14px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==================== 统计卡 ==================== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 1080px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .kpi-grid { grid-template-columns: 1fr 1fr; } }

.kpi {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  position: relative;
}
.kpi-row { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: 12px; color: var(--text-3); font-weight: 500; }
.kpi-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}
.kpi-icon svg { width: 15px; height: 15px; }
.kpi-icon.green { background: var(--green-soft); color: var(--green); }
.kpi-icon.orange { background: var(--orange-soft); color: var(--orange); }
.kpi-icon.purple { background: var(--purple-soft); color: var(--purple); }
.kpi-value {
  margin-top: 12px;
  font-size: 26px; font-weight: 600;
  letter-spacing: -0.018em;
  font-feature-settings: 'tnum';
  line-height: 1.1;
  font-family: var(--font-display);
}
.kpi-value .unit { font-size: 13px; color: var(--text-3); font-weight: 500; margin-left: 4px; }
.kpi-sub { margin-top: 4px; font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }

.skeleton-gap { margin-top: 12px; }
.skeleton-card { margin-top: 12px; }
.skeleton-kpi { height: 104px; }
.skel-line {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--bg-soft), var(--bg-tint), var(--bg-soft));
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
}
.skel-line.big { height: 24px; margin-top: 16px; margin-bottom: 10px; }
.skel-line.w10 { width: 10%; }
.skel-line.w15 { width: 15%; }
.skel-line.w18 { width: 18%; }
.skel-line.w20 { width: 20%; }
.skel-line.w25 { width: 25%; }
.skel-line.w35 { width: 35%; }
.skel-line.w40 { width: 40%; }
.skel-line.w45 { width: 45%; }
.skel-line.w55 { width: 55%; }
.skel-line.w60 { width: 60%; }
.skel-line.w70 { width: 70%; }
.skel-line.w90 { width: 90%; }
.skel-chart {
  height: 260px;
  border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--bg-soft), var(--bg-tint), var(--bg-soft));
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
}
.skeleton-table { padding: 8px 14px 14px; }
.skeleton-row {
  min-height: 43px;
  display: grid;
  grid-template-columns: 90px 1fr 120px 100px;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}
.skeleton-row:last-child { border-bottom: 0; }
.skel-box {
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--bg-soft), var(--bg-tint), var(--bg-soft));
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  flex-shrink: 0;
}
.skeleton-file .name {
  display: grid;
  gap: 8px;
}

/* ==================== 卡 / 区段 ==================== */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card-head .sub { color: var(--text-3); font-size: 12.5px; }
.card-body { padding: 18px; }

.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.split-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 980px) { .split-2, .split-3 { grid-template-columns: 1fr; } }

.health-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 1180px) { .health-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .health-grid { grid-template-columns: 1fr; } }
.health-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-elev);
}
.health-ico {
  width: 30px; height: 30px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--green-soft);
  color: var(--green);
}
.health-item.warn .health-ico { background: var(--orange-soft); color: var(--orange); }
.health-ico svg { width: 15px; height: 15px; }
.health-main { min-width: 0; }
.health-label { color: var(--text-3); font-size: 11.5px; }
.health-value { margin-top: 2px; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.health-sub { margin-top: 2px; color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ==================== 表格 ==================== */
.tbl-wrap { overflow-x: auto; }
.tbl-wrap.long-list { overflow: auto; }
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  min-width: 600px;
}
.tbl thead th {
  position: sticky; top: 0;
  background: var(--bg-elev);
  color: var(--text-3);
  font-weight: 500;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl thead th.num { text-align: right; }
.tbl tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tbl tbody td.num { text-align: right; font-feature-settings: 'tnum'; }
.tbl tbody tr { transition: background 0.10s var(--ease); cursor: pointer; }
.tbl tbody tr:hover { background: var(--bg-hover); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .mono { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.tbl .ellipsis {
  max-width: 380px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tbl .actions { display: flex; gap: 4px; justify-content: flex-end; }
.tbl tbody tr.chapter-marked { background: rgba(255, 204, 0, 0.08); }
.tbl tbody tr.chapter-marked:hover { background: rgba(255, 204, 0, 0.13); }
.chapter-title-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mark-chip {
  flex-shrink: 0;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #8a5a00;
  background: rgba(255, 204, 0, 0.18);
  border: 1px solid rgba(255, 204, 0, 0.28);
}
.mark-btn svg { width: 14px; height: 14px; }
.mark-btn.active {
  color: #8a5a00;
  background: rgba(255, 204, 0, 0.18);
  border-color: rgba(255, 204, 0, 0.32);
}
@media (prefers-color-scheme: dark) {
  .tbl tbody tr.chapter-marked { background: rgba(255, 214, 10, 0.10); }
  .tbl tbody tr.chapter-marked:hover { background: rgba(255, 214, 10, 0.16); }
  .mark-chip, .mark-btn.active { color: #ffd60a; background: rgba(255, 214, 10, 0.14); border-color: rgba(255, 214, 10, 0.26); }
}

/* ==================== 徽章 ==================== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  font-size: 11.5px; font-weight: 500;
  background: var(--bg-soft);
  color: var(--text-2);
  border-radius: 999px;
  font-feature-settings: 'tnum';
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.4;
}
.badge.b { background: var(--accent-soft); color: var(--accent); }
.badge.g { background: var(--green-soft); color: var(--green); }
.badge.o { background: var(--orange-soft); color: var(--orange); }
.badge.r { background: var(--red-soft); color: var(--red); }
.badge.p { background: var(--purple-soft); color: var(--purple); }
.badge.mark { background: rgba(255, 204, 0, 0.18); color: #8a5a00; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ==================== 工具栏 ==================== */
.toolbar {
  display: flex; gap: 8px; align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.toolbar .input {
  flex: 1; min-width: 180px;
  position: relative;
}
.toolbar .input input {
  width: 100%;
  padding: 6px 10px 6px 30px;
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: 13px; outline: none;
  transition: all 0.15s var(--ease);
}
.toolbar .input input:focus { border-color: var(--accent); background: var(--bg-elev); box-shadow: 0 0 0 3px var(--accent-soft); }
.toolbar .input::before {
  content: ''; position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>") center/contain no-repeat;
}
.toolbar select {
  padding: 6px 10px;
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: 13px;
  appearance: none;
  padding-right: 26px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
}
.toolbar select:focus { border-color: var(--accent); background-color: var(--bg-elev); }
.toolbar .meta { font-size: 12px; color: var(--text-3); padding: 0 6px; font-feature-settings: 'tnum'; }
.tbl-foot { padding: 10px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); display: flex; justify-content: space-between; }

/* ==================== 阅读器抽屉（章节内容） ==================== */
.drawer-mask {
  position: fixed; inset: 0; z-index: var(--z-drawer-mask);
  background: rgba(0,0,0,0.32);
  backdrop-filter: blur(2px);
  display: none;
}
.drawer-mask.open { display: block; animation: fade 0.18s var(--ease); }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: var(--z-drawer);
  width: min(880px, 100%);
  background: var(--bg-elev);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  animation: slideIn 0.28s var(--ease);
}
.drawer.open { display: flex; }
@media (max-width: 880px) { .drawer { width: 100%; } }

.drawer-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  position: sticky; top: 0; z-index: 1;
}
.drawer-head .title-block { flex: 1; min-width: 0; }
.drawer-head .t { font-size: 14px; font-weight: 600; letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-head .s { font-size: 11.5px; color: var(--text-3); margin-top: 2px; font-feature-settings: 'tnum'; display: flex; gap: 8px; flex-wrap: wrap; }
.drawer-body {
  flex: 1; overflow-y: auto;
  padding: 24px 32px 64px;
  scroll-padding-bottom: 96px;
}
.drawer-body.scroll-host.has-panel-top {
  padding-bottom: 88px;
}
.drawer-foot {
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  display: flex; gap: 8px;
  background: var(--bg-elev);
  position: sticky; bottom: 0;
}
.drawer-foot .spacer { flex: 1; }
@media (max-width: 640px) {
  .drawer-body { padding: 20px 18px 80px; }
  .drawer-body.scroll-host.has-panel-top { padding-bottom: 96px; }
}

/* 章节阅读器排版 */
.chapter-reader {
  font-size: 16px;
  line-height: 1.85;
  color: var(--text);
  font-family: "Iowan Old Style", "Apple Garamond", "PingFang SC", "Songti SC", "STSong", serif;
  letter-spacing: 0.01em;
  max-width: 720px;
}
.chapter-reader p { text-indent: 2em; margin: 0 0 14px; }
.chapter-reader h1, .chapter-reader h2 { font-family: var(--font); text-indent: 0; font-weight: 600; }

/* Markdown */
.md { font-size: 14px; line-height: 1.7; color: var(--text); word-wrap: break-word; }
.md h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 14px; }
.md h2 { font-size: 17px; font-weight: 600; margin: 22px 0 10px; }
.md h3 { font-size: 14px; font-weight: 600; margin: 18px 0 8px; }
.md p { margin: 0 0 10px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; }
.md li { margin-bottom: 3px; }
.md code { font-family: var(--mono); font-size: 0.88em; background: var(--bg-soft); padding: 1px 6px; border-radius: 4px; }
.md pre { background: var(--bg-soft); padding: 12px 14px; border-radius: var(--r-md); overflow-x: auto; font-size: 12.5px; }
.md pre code { background: transparent; padding: 0; }
.md blockquote { margin: 0 0 12px; padding: 4px 14px; border-left: 3px solid var(--accent); background: var(--bg-soft); border-radius: 0 6px 6px 0; color: var(--text-2); }
.md table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13px; }
.md th, .md td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.md th { background: var(--bg-soft); font-weight: 600; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

/* ==================== 图表 ==================== */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-size: 10px; fill: var(--text-3); font-family: var(--font); font-feature-settings: 'tnum'; }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 3; }

/* ==================== 仪表盘 - 进度条 ==================== */
.progress { height: 6px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #5e5ce6);
  border-radius: 999px;
  transition: width 1s var(--ease);
}

/* ==================== 列表（设定） ==================== */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; padding: 14px; }
.file-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer; text-align: left;
  transition: all 0.14s var(--ease);
}
.file-row:hover { border-color: var(--border-2); background: var(--bg-soft); }
.file-row .ico { width: 30px; height: 30px; flex-shrink: 0; background: var(--accent-soft); color: var(--accent); border-radius: var(--r-sm); display: grid; place-items: center; }
.file-row .ico svg { width: 14px; height: 14px; }
.file-row .name { font-size: 13px; font-weight: 500; min-width: 0; flex: 1; }
.file-row .name .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row .name .d {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.file-row .name .s { font-size: 11px; color: var(--text-3); margin-top: 1px; font-feature-settings: 'tnum'; }

.mini-bar { margin-bottom: 14px; }
.mini-bar:last-child { margin-bottom: 0; }
.mini-bar-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--text-2); }
.mini-bar-head b { font-weight: 600; color: var(--text); font-feature-settings: 'tnum'; }
.mini-track { height: 7px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; margin-top: 6px; }
.mini-fill { height: 100%; border-radius: 999px; background: var(--accent); }
.mini-bar.ok .mini-fill { background: var(--green); }
.mini-bar.warn .mini-fill { background: var(--orange); }
.mini-bar.info .mini-fill { background: var(--purple); }

.short-list {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.short-list-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 6px;
}
.short-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.short-row:last-child { border-bottom: 0; }
.short-main {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-2);
  font-size: 12.5px;
}

.risk-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.risk-row:first-child { padding-top: 0; }
.risk-row:last-child { border-bottom: 0; padding-bottom: 0; }
.risk-main { min-width: 0; flex: 1; }
.risk-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.risk-sub { margin-top: 2px; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.plot-list { padding: 4px 14px 14px; }
.plot-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.plot-row:last-child { border-bottom: 0; }
.plot-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.plot-top strong {
  min-width: 0;
  flex: 1;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plot-exp {
  flex-shrink: 0;
  color: var(--text-3);
  font-size: 12px;
}
.plot-meta {
  margin-top: 5px;
  color: var(--text-3);
  font-size: 12px;
}
.plot-note {
  margin-top: 5px;
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==================== 定时任务 ==================== */
.cron-error {
  padding: 18px;
  color: var(--red);
}
.progress-table {
  display: grid;
  gap: 8px;
}
.progress-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.45fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.progress-row:last-child { border-bottom: 0; }
.progress-key {
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.45;
}
.progress-val {
  min-width: 0;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.5;
  word-break: break-word;
}
.cron-run {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.cron-run:first-child { padding-top: 0; }
.cron-run:last-child { border-bottom: 0; padding-bottom: 0; }
.cron-run-main { min-width: 0; flex: 1; }
.cron-run-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cron-run-sub { margin-top: 2px; color: var(--text-3); font-size: 12px; }
.cron-job-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
  padding: 14px;
}
.cron-job {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  background: var(--bg-elev);
  min-width: 0;
}
.cron-job-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.cron-job-title {
  font-size: 14px;
  font-weight: 600;
}
.cron-job-id {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 11.5px;
}
.cron-job-meta {
  margin-top: 12px;
  display: grid;
  gap: 4px;
}
.cron-job-meta .progress-row {
  grid-template-columns: 120px minmax(0, 1fr);
  padding: 4px 0;
}
.cron-job-error {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--red-soft);
  color: var(--red);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}
.job-prompt {
  margin: 12px 0 0;
  padding: 10px;
  min-height: 92px;
  max-height: 170px;
  overflow: auto;
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.cron-job-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}
.prompt-editor {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 0;
  min-height: 560px;
}
.prompt-file-list {
  border-right: 1px solid var(--border);
  padding: 12px;
  display: grid;
  align-content: start;
  gap: 8px;
  background: var(--bg-soft);
}
.prompt-file {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-elev);
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease);
}
.prompt-file:hover { border-color: var(--border-2); }
.prompt-file.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.prompt-file-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.prompt-file-meta {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--text-3);
  word-break: break-word;
}
.prompt-editor-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.prompt-textarea {
  flex: 1;
  width: 100%;
  min-height: 520px;
  resize: vertical;
  border: 0;
  outline: none;
  padding: 16px 18px;
  background: var(--bg-elev);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
}
.prompt-textarea:focus {
  box-shadow: inset 0 0 0 2px var(--accent-soft);
}
.prompt-editor-actions {
  min-height: 54px;
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.prompt-editor-actions .meta {
  margin-right: auto;
  color: var(--text-3);
  font-size: 12px;
  font-feature-settings: 'tnum';
}

.back-top, .panel-top-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--text-2);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s var(--ease), transform 0.16s var(--ease), background 0.12s var(--ease);
}
.back-top {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: var(--z-floating-tool);
  transform: translateY(8px);
}
.panel-top-btn {
  position: sticky;
  left: calc(100% - 44px);
  bottom: max(12px, env(safe-area-inset-bottom));
  margin: 18px 10px 10px auto;
  z-index: 4;
  transform: translateY(6px);
}
.back-top.show, .panel-top-btn.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.back-top:hover, .panel-top-btn:hover { background: var(--bg-soft); color: var(--text); }
.back-top svg, .panel-top-btn svg { width: 15px; height: 15px; }
body.drawer-open .back-top {
  opacity: 0;
  pointer-events: none;
}

/* ==================== 空态 ==================== */
.empty {
  padding: 48px 24px; text-align: center; color: var(--text-3);
  font-size: 13px;
}
.empty .ico { width: 40px; height: 40px; margin: 0 auto 10px; background: var(--bg-soft); border-radius: 12px; display: grid; place-items: center; color: var(--text-3); }
.empty .ico svg { width: 20px; height: 20px; }
.empty .t { font-size: 13.5px; font-weight: 500; color: var(--text-2); }
.empty .s { margin-top: 4px; font-size: 12px; }

/* ==================== 搜索结果 ==================== */
.search-result {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s var(--ease);
}
.search-result:hover { background: var(--bg-hover); }
.search-result .meta { display: flex; gap: 6px; margin-bottom: 4px; font-size: 11px; align-items: center; flex-wrap: wrap; }
.search-result .ctx {
  font-size: 13px; line-height: 1.55; color: var(--text-2);
  white-space: pre-wrap;
  font-family: var(--font);
}
.search-result mark { background: var(--accent-soft); color: var(--accent); border-radius: 3px; padding: 0 2px; font-weight: 600; }

/* ==================== 角色 ==================== */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; padding: 14px; }
.char-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: all 0.14s var(--ease);
}
.char-row:hover { border-color: var(--border-2); }
.char-row .ava { width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 600; }
.char-row .meta { min-width: 0; flex: 1; }
.char-row .meta .n { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.char-row .meta .d { font-size: 11.5px; color: var(--text-3); margin-top: 1px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }

/* ==================== Toast ==================== */
.toast-wrap { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--text);
  color: var(--bg-elev);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toast 2.6s var(--ease) forwards;
  display: flex; align-items: center; gap: 6px;
}
.toast svg { width: 14px; height: 14px; }

@keyframes toast {
  0% { opacity: 0; transform: translateY(20px); }
  10%, 80% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-10px); }
}
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.skel { background: linear-gradient(90deg, var(--bg-soft), var(--bg-tint), var(--bg-soft)); background-size: 200% 100%; animation: shimmer 1.6s infinite; border-radius: 8px; }

/* ==================== 响应式（移动端） ==================== */
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 80;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.26s var(--ease);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-mask {
    position: fixed; inset: 0; z-index: 70;
    background: rgba(0,0,0,0.36);
  }
  .sidebar-mask.open { display: block; animation: fade 0.18s var(--ease); }
  .topbar .menu-btn { display: grid; }
  .topbar-search { width: auto; max-width: 200px; }
  .page { padding: 16px; }
  .prompt-editor { grid-template-columns: 1fr; min-height: auto; }
  .prompt-file-list { border-right: 0; border-bottom: 1px solid var(--border); }
  .prompt-textarea { min-height: 420px; }
  .cron-job-grid { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .topbar-search { display: none; }
  .progress-row,
  .cron-job-meta .progress-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .prompt-editor-actions {
    flex-wrap: wrap;
    justify-content: stretch;
  }
  .prompt-editor-actions .meta {
    width: 100%;
  }
  .prompt-editor-actions .btn {
    flex: 1;
    justify-content: center;
  }
}

.text-3 { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.text-muted { color: var(--text-3); }
.mono { font-family: var(--mono); }

/* =====================================================
 *  OAuth loading + pretty login screen
 * ===================================================== */
.sso-loading {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 60%),
    var(--bg);
}
.sso-card {
  width: 100%; max-width: 380px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 36px 32px 28px;
  box-shadow: var(--shadow-md);
  text-align: center;
  animation: fadeIn 0.32s var(--ease);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.sso-card.error h1 { color: var(--red); }
.sso-card h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; margin: 0; }
.sso-card p { color: var(--text-3); font-size: 14px; margin: 0; }
.sso-spinner {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 3px solid var(--bg-soft);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.sso-btn {
  margin-top: 6px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff;
  border: 0; padding: 11px 22px; border-radius: 999px;
  font-size: 14.5px; font-weight: 500; cursor: pointer;
  transition: background 0.15s var(--ease), transform 0.06s;
}
.sso-btn:hover { background: var(--accent-hover); }
.sso-btn:active { transform: scale(0.98); }
.sso-tip { color: var(--text-4); font-size: 12px; margin-top: 4px; }
.sso-tip .mono { font-family: var(--mono); color: var(--text-3); }

/* Logo grid (4 颜色块) on login */
.login-card-pretty .logo-grid {
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  width: 64px; height: 64px; gap: 4px;
  border-radius: 14px; overflow: hidden;
  margin-bottom: 8px;
  box-shadow: 0 6px 18px rgba(0,113,227,0.18);
}
.login-card-pretty .g { width: 100%; height: 100%; border-radius: 4px; }
.login-card-pretty .g1 { background: linear-gradient(135deg, #0071e3, #5e5ce6); }
.login-card-pretty .g2 { background: linear-gradient(135deg, #34c759, #30b0c7); }
.login-card-pretty .g3 { background: linear-gradient(135deg, #ff9500, #ff2d55); }
.login-card-pretty .g4 { background: linear-gradient(135deg, #af52de, #ff375f); }

/* =====================================================
 *  Sidebar account card
 * ===================================================== */
.side-account {
  flex: 1 1 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  margin: 0 0 4px;
  border-radius: 12px;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  transition: background .15s, border-color .15s;
}
.side-account:hover { background: var(--bg-tint); border-color: var(--border-2); }
.side-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0a66ff, #6f53fb);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 600; font-size: 14px;
  overflow: hidden;
  flex-shrink: 0;
}
.side-avatar img { width: 100%; height: 100%; object-fit: cover; }
.side-uinfo { min-width: 0; flex: 1; }
.side-uname { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-usub { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* =====================================================
 *  Novel Auth · 毛玻璃弹窗（参考 bear-music AuthModal）
 * ===================================================== */
.novel-auth-wrap {
  position: fixed; inset: 0;
  overflow: hidden;
  background: var(--bg);
  z-index: 100;
}

/* 底层占位骨架：让模态背后有"内容感"，不空旷 */
.novel-auth-bg {
  position: absolute; inset: 0;
  padding: 18px;
  display: flex; flex-direction: column; gap: 14px;
  opacity: 0.65;
}
.novel-auth-bg .bg-bar {
  height: 44px; border-radius: 12px;
  background: var(--bg-soft);
}
.novel-auth-bg .bg-cols {
  flex: 1; display: grid;
  grid-template-columns: 220px 1fr; gap: 14px;
  min-height: 0;
}
.novel-auth-bg .bg-side {
  border-radius: 14px;
  background: var(--bg-soft);
}
.novel-auth-bg .bg-main {
  display: flex; flex-direction: column; gap: 14px;
}
.novel-auth-bg .bg-block {
  border-radius: 14px;
  background: var(--bg-soft);
  height: 120px;
}
.novel-auth-bg .bg-block.tall { height: 220px; }
.novel-auth-bg .bg-block.wide { flex: 1; min-height: 120px; }

/* 毛玻璃遮罩 */
.novel-auth-backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 9, 12, 0.36);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
}
@media (prefers-color-scheme: dark) {
  .novel-auth-backdrop { background: rgba(0,0,0,0.46); }
}

/* 弹窗卡片 */
.novel-auth-card {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(380px, calc(100vw - 32px));
  background: var(--bg-elev, #fff);
  color: var(--text, #1d1d1f);
  border-radius: 20px;
  padding: 24px 22px 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  display: flex; flex-direction: column; gap: 14px;
  animation: novelModalIn 0.22s var(--ease);
}
@keyframes novelModalIn {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 8px)); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}

.novel-auth-card .badge-row { display: flex; justify-content: center; }
.novel-auth-card .oauth-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(0,113,227,0.10);
  color: var(--accent, #0071e3);
  font-size: 12px; font-weight: 500;
  padding: 6px 12px; border-radius: 999px;
  letter-spacing: 0.02em;
}
.novel-auth-card .oauth-pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #34c759;
  box-shadow: 0 0 0 3px rgba(52,199,89,0.18);
}

.novel-auth-card .head { text-align: center; }
.novel-auth-card .head .title {
  font-size: 20px; font-weight: 600; letter-spacing: -0.01em;
}
.novel-auth-card .head .subtitle {
  font-size: 13px; color: var(--text-3, #86868b);
  margin-top: 6px; line-height: 1.55;
}

.novel-auth-card .primary-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; width: 100%; height: 46px;
  border-radius: 999px;
  font-size: 15px; font-weight: 500;
  border: none; cursor: pointer;
  background: var(--accent, #0071e3); color: #fff;
  transition: background .15s, transform .06s;
}
.novel-auth-card .primary-btn:hover { background: var(--accent-hover, #005bbf); }
.novel-auth-card .primary-btn:active { transform: scale(0.985); }
.novel-auth-card .primary-btn .ic {
  display: inline-grid; place-items: center; width: 16px; height: 16px;
}
.novel-auth-card .primary-btn .ic svg { width: 100%; height: 100%; }

.novel-auth-card .trust-row {
  display: flex; justify-content: center; align-items: center;
  gap: 10px; padding-top: 4px;
  font-size: 11.5px; color: var(--text-3, #86868b);
}
.novel-auth-card .t-item { display: inline-flex; align-items: center; gap: 5px; }
.novel-auth-card .t-ic {
  width: 13px; height: 13px;
  display: inline-grid; place-items: center;
  color: var(--accent, #0071e3);
}
.novel-auth-card .t-ic svg { width: 100%; height: 100%; }
.novel-auth-card .t-sep {
  width: 1px; height: 10px; background: var(--border, rgba(0,0,0,0.10));
}

.novel-auth-card .foot-hint {
  font-size: 11px; text-align: center;
  color: var(--text-4, #86868b);
}
.novel-auth-card .foot-hint a {
  color: inherit; text-decoration: none;
  border-bottom: 1px dashed var(--text-4, #c7c7cc);
}

@media (max-width: 600px) {
  .novel-auth-bg .bg-cols { grid-template-columns: 1fr; }
  .novel-auth-bg .bg-side { display: none; }
}

/* ---- Keyboard focus ring (a11y) ---- */
:where(a, button, input, select, textarea):focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---- Respect reduced-motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
 *  小说切换器（侧栏头部）+ 书架总览
 * ============================================================ */
.side-head.switcher { height: auto; padding: 0; display: block; position: relative; }
.novel-switch-trigger {
  width: 100%; height: var(--header-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; background: none; border: 0; cursor: pointer;
  color: var(--text); text-align: left;
  transition: background .12s;
}
.novel-switch-trigger:hover { background: var(--bg-hover); }
.novel-switch-trigger.open { background: var(--bg-hover); }
.novel-switch-trigger .side-title { flex: 1; min-width: 0; }
.novel-switch-trigger .st-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch-caret { flex-shrink: 0; color: var(--text-3); display: grid; place-items: center; transition: transform .18s; }
.switch-caret svg { width: 16px; height: 16px; }
.novel-switch-trigger.open .switch-caret { transform: rotate(180deg); }

.novel-menu {
  position: absolute; top: calc(var(--header-h) - 2px); left: 8px; right: 8px; z-index: 40;
  background: var(--bg-elev); border: 1px solid var(--border-2);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  padding: 6px; max-height: 60vh; overflow-y: auto;
}
.novel-menu-item {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; background: none; border: 0; border-radius: var(--r-sm);
  cursor: pointer; color: var(--text); text-align: left; transition: background .12s;
}
.novel-menu-item:hover { background: var(--bg-hover); }
.novel-menu-item.active { background: var(--accent-soft); }
.novel-menu-item .nm-text { flex: 1; min-width: 0; }
.novel-menu-item .nm-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.novel-menu-item .nm-meta { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.novel-menu-item .nm-check { flex-shrink: 0; color: var(--accent); display: grid; place-items: center; }
.novel-menu-item .nm-check svg { width: 16px; height: 16px; }
.novel-menu-all {
  width: 100%; display: flex; align-items: center; gap: 8px;
  margin-top: 4px; padding: 8px 10px; background: none; border: 0; border-top: 1px solid var(--border);
  border-radius: 0 0 var(--r-sm) var(--r-sm); cursor: pointer; color: var(--accent);
  font-size: 12.5px; font-weight: 600; transition: background .12s;
}
.novel-menu-all:hover { background: var(--bg-hover); }
.novel-menu-all .ico { display: grid; place-items: center; }
.novel-menu-all .ico svg { width: 16px; height: 16px; }

/* 书架卡片网格 */
.novel-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px; margin-top: 4px;
}
.novel-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s, border-color .12s;
  display: flex; flex-direction: column; gap: 10px;
}
.novel-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-2); }
.novel-card.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.nc-top { display: flex; align-items: center; gap: 12px; }
.nc-cover {
  width: 44px; height: 44px; flex-shrink: 0;
  background: linear-gradient(135deg, #0071e3, #5e5ce6);
  border-radius: var(--r-md); display: grid; place-items: center;
  color: #fff; font-size: 20px; font-weight: 700; font-family: var(--font-display);
}
.nc-head { min-width: 0; flex: 1; }
.nc-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nc-badge { flex-shrink: 0; font-size: 10.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 1px 7px; border-radius: 999px; }
.nc-id { font-size: 11px; color: var(--text-3); margin-top: 2px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.nc-synopsis { font-size: 12.5px; color: var(--text-2); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nc-phase { font-size: 12px; color: var(--text-3); }
.nc-progress { display: flex; align-items: center; gap: 10px; }
.nc-bar { flex: 1; height: 6px; background: var(--bg-tint); border-radius: 999px; overflow: hidden; }
.nc-bar-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }
.nc-prog-text { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.nc-stats { display: flex; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; }
.nc-stat { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nc-stat .k { font-size: 11px; color: var(--text-3); }
.nc-stat .v { font-size: 16px; font-weight: 700; font-family: var(--font-display); }
.nc-stat.warn .v { color: var(--orange); }
.nc-updated { font-size: 11px; color: var(--text-4); }
