/* ==========================================================================
   卡片工坊 — 纸墨极简案头样式（9 款主题 / 5 款质感 / 6 款字体）
   ========================================================================== */

:root,
[data-theme='xuan'] {
  color-scheme: light;

  --bg: #FAF9F6;
  --sidebar-bg: #F1EEE8;
  --nav-active: #E3DED3;
  --surface: #FFFFFF;
  --surface-muted: #F6F4EF;
  --surface-hover: #F6F4EF;

  --border: #E4E0D8;
  --border-subtle: #EEEAE2;
  --border-input: #DAD5CA;
  --border-hover: #B9B3A8;

  --ink: #1F1D1A;
  --ink-body: #3E3A35;
  --ink-muted: #5F5A53;
  --ink-subtle: #6F6A62;

  --accent: #9C3F2B;
  --accent-hover: #863423;
  --accent-contrast: #FFFFFF;
  --accent-soft: rgba(156, 63, 43, 0.1);

  --radius-sm: 6px;
  --radius-md: 8px;

  --font-size-base: 14px;
  --font-serif: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', Georgia, serif;
  --font-sans: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme='sepia'] {
  color-scheme: light;

  --bg: #F5EEDB;
  --sidebar-bg: #ECE2CA;
  --nav-active: #E0D3B5;
  --surface: #FBF7EC;
  --surface-muted: #F2E9D4;
  --surface-hover: #EFE4CA;

  --border: #DED2B7;
  --border-subtle: #E8DEC7;
  --border-input: #CFC0A1;
  --border-hover: #AD9B79;

  --ink: #2C241B;
  --ink-body: #473B2E;
  --ink-muted: #675847;
  --ink-subtle: #786957;

  --accent: #8C4A27;
  --accent-hover: #753B1D;
  --accent-contrast: #FFFFFF;
  --accent-soft: rgba(140, 74, 39, 0.12);
}

[data-theme='matcha'] {
  color-scheme: light;

  --bg: #EDF3EC;
  --sidebar-bg: #E1EAE0;
  --nav-active: #D1DFD0;
  --surface: #F6FAF5;
  --surface-muted: #E9F0E8;
  --surface-hover: #E3ECE1;

  --border: #D1DEC9;
  --border-subtle: #DFEAD9;
  --border-input: #BFD0B6;
  --border-hover: #9BB291;

  --ink: #1F2B24;
  --ink-body: #334339;
  --ink-muted: #4D6255;
  --ink-subtle: #5E7466;

  --accent: #3B6E52;
  --accent-hover: #2E5941;
  --accent-contrast: #FFFFFF;
  --accent-soft: rgba(59, 110, 82, 0.12);
}

[data-theme='nord-light'] {
  color-scheme: light;

  --bg: #F4F6F9;
  --sidebar-bg: #E8ECF2;
  --nav-active: #D8DFE9;
  --surface: #FFFFFF;
  --surface-muted: #EEF1F6;
  --surface-hover: #E9EEF5;

  --border: #DCE2EC;
  --border-subtle: #E7ECF3;
  --border-input: #C9D2E0;
  --border-hover: #9CA8BC;

  --ink: #242C37;
  --ink-body: #394454;
  --ink-muted: #526074;
  --ink-subtle: #647388;

  --accent: #3B658C;
  --accent-hover: #2E5274;
  --accent-contrast: #FFFFFF;
  --accent-soft: rgba(59, 101, 140, 0.11);
}

[data-theme='rose-dawn'] {
  color-scheme: light;

  --bg: #FAF4ED;
  --sidebar-bg: #F2E9E1;
  --nav-active: #E5D9CE;
  --surface: #FFFAF3;
  --surface-muted: #F6EEE4;
  --surface-hover: #F2E7DC;

  --border: #E5D9CF;
  --border-subtle: #EEE4DA;
  --border-input: #D6C6B9;
  --border-hover: #B8A496;

  --ink: #37324A;
  --ink-body: #514B66;
  --ink-muted: #6B6582;
  --ink-subtle: #7B7591;

  --accent: #B4637A;
  --accent-hover: #9B5065;
  --accent-contrast: #FFFFFF;
  --accent-soft: rgba(180, 99, 122, 0.12);
}

[data-theme='charcoal'],
[data-theme='dark'] {
  color-scheme: dark;

  --bg: #161513;
  --sidebar-bg: #1D1B18;
  --nav-active: #2C2924;
  --surface: #201E1A;
  --surface-muted: #26231F;
  --surface-hover: #282520;

  --border: #312E29;
  --border-subtle: #292621;
  --border-input: #3E3932;
  --border-hover: #5A5349;

  --ink: #F2EFEA;
  --ink-body: #D6D0C6;
  --ink-muted: #ADA69A;
  --ink-subtle: #8E877C;

  --accent: #C75D45;
  --accent-hover: #D46C55;
  --accent-contrast: #FFFFFF;
  --accent-soft: rgba(199, 93, 69, 0.16);
}

[data-theme='everforest-dark'] {
  color-scheme: dark;

  --bg: #232A2E;
  --sidebar-bg: #1E2428;
  --nav-active: #323C41;
  --surface: #2B3338;
  --surface-muted: #272F34;
  --surface-hover: #313B41;

  --border: #3A454B;
  --border-subtle: #313A3F;
  --border-input: #47545B;
  --border-hover: #62737C;

  --ink: #E5DAC2;
  --ink-body: #D3C6AA;
  --ink-muted: #A7B09E;
  --ink-subtle: #859289;

  --accent: #83C092;
  --accent-hover: #94CE9E;
  --accent-contrast: #1B221F;
  --accent-soft: rgba(131, 192, 146, 0.16);
}

[data-theme='nord-dark'] {
  color-scheme: dark;

  --bg: #1E2430;
  --sidebar-bg: #181D27;
  --nav-active: #2E3440;
  --surface: #2A3242;
  --surface-muted: #242B39;
  --surface-hover: #30394A;

  --border: #384154;
  --border-subtle: #2F3748;
  --border-input: #444F65;
  --border-hover: #5E6C88;

  --ink: #ECEFF4;
  --ink-body: #D8DEE9;
  --ink-muted: #AEB7C7;
  --ink-subtle: #8A95AA;

  --accent: #81A1C1;
  --accent-hover: #91B1D1;
  --accent-contrast: #161C26;
  --accent-soft: rgba(129, 161, 193, 0.18);
}

[data-theme='rose-moon'] {
  color-scheme: dark;

  --bg: #1F1D2E;
  --sidebar-bg: #191726;
  --nav-active: #2E2B44;
  --surface: #2A273F;
  --surface-muted: #252238;
  --surface-hover: #312E49;

  --border: #3B3757;
  --border-subtle: #312D48;
  --border-input: #484468;
  --border-hover: #67628C;

  --ink: #EAE8FA;
  --ink-body: #D5D2EB;
  --ink-muted: #AAA6C7;
  --ink-subtle: #8B86AB;

  --accent: #EA9A97;
  --accent-hover: #F2AAA7;
  --accent-contrast: #221923;
  --accent-soft: rgba(234, 154, 151, 0.16);
}

/* 字体家族档位 */

[data-font='editorial'] {
  --font-serif: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', Georgia, serif;
  --font-sans: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
}

[data-font='wenkai'] {
  --font-serif: 'LXGW WenKai Screen', 'LXGW WenKai', 'Kaiti SC', 'STKaiti', 'KaiTi', 'Noto Serif SC', serif;
  --font-sans: 'LXGW WenKai Screen', 'LXGW WenKai', 'Kaiti SC', 'STKaiti', 'KaiTi', 'Noto Sans SC', sans-serif;
}

[data-font='song'] {
  --font-serif: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'SimSun', Georgia, serif;
  --font-sans: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'SimSun', Georgia, serif;
}

[data-font='fangsong'] {
  --font-serif: 'ZCOOL XiaoWei', 'FangSong', 'STFangsong', 'Noto Serif SC', serif;
  --font-sans: 'FangSong', 'STFangsong', 'FangSong_GB2312', 'Noto Serif SC', serif;
}

[data-font='kaiti'] {
  --font-serif: 'Kaiti SC', 'STKaiti', 'KaiTi', 'KaiTi_GB2312', 'Noto Serif SC', serif;
  --font-sans: 'Kaiti SC', 'STKaiti', 'KaiTi', 'KaiTi_GB2312', 'Noto Serif SC', serif;
}

[data-font='modern'] {
  --font-serif: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-sans: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
}

/* 阅读字号档位 */

[data-font-size='compact'] {
  --font-size-base: 13px;
}

[data-font-size='standard'] {
  --font-size-base: 14px;
}

[data-font-size='large'] {
  --font-size-base: 15.5px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--accent);
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

a,
button,
select,
summary,
[role='switch'],
[role='tab'] {
  touch-action: manipulation;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

@media (pointer: fine) {
  html {
    overscroll-behavior: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-input);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

/* ---------------- Skip Link ---------------- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--ink);
  font-size: 13px;
  font-weight: 500;
}

.skip-link:focus {
  position: fixed;
  left: 12px;
  top: 12px;
}

/* ---------------- 整站双栏骨架 ---------------- */

.app-shell {
  display: flex;
  align-items: stretch;
  min-height: 100svh;
  background: var(--bg);
}

.mobile-bar {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  min-width: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 18px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
  height: 100svh;
  overflow-y: auto;
}

.sidebar-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px;
}

.project-switcher-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.switcher-caret {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--ink-subtle);
  transition: transform 0.14s ease;
}

.brand-home-btn[aria-expanded='true'] .switcher-caret {
  transform: rotate(180deg);
}

.project-popover {
  position: fixed;
  z-index: 75;
  max-height: 70svh;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(31, 29, 26, 0.14);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project-popover-head {
  padding: 6px 8px 4px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-subtle);
}

.project-popover-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-popover-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease;
}

.project-popover-item:hover {
  background: var(--surface-hover);
}

.project-popover-item.is-current {
  background: var(--sidebar-bg);
}

.project-popover-seal {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 4px;
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
}

.project-popover-seal.is-current {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.project-popover-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.project-popover-text strong {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-popover-text span {
  font-size: 11px;
  color: var(--ink-subtle);
}

.project-popover-check {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
}

.project-popover-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

.project-popover-action {
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  font-size: 13px;
  color: var(--ink-body);
  cursor: pointer;
  transition: background-color 0.14s ease;
}

.project-popover-action:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.project-popover-action.is-accent {
  color: var(--accent);
  font-weight: 500;
}

.sidebar .sidebar-close-btn {
  display: none;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-home-btn {
  width: 100%;
  min-width: 0;
  padding: 4px 6px;
  margin: -4px -6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease;
}

.brand-home-btn:hover {
  background: color-mix(in srgb, var(--nav-active) 55%, transparent);
}

.brand-seal {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-contrast);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--ink-subtle);
}

.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-label {
  padding: 0 8px 6px;
  font-size: 12px;
  color: var(--ink-subtle);
}

.sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-body);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.nav-item:hover {
  background: color-mix(in srgb, var(--nav-active) 55%, transparent);
  color: var(--ink);
}

.nav-item[aria-current='page'] {
  background: var(--nav-active);
  color: var(--ink);
  font-weight: 500;
}

.nav-count {
  font-size: 12px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.foot-action {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 13px;
  color: var(--ink-body);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.foot-action:hover {
  background: color-mix(in srgb, var(--nav-active) 55%, transparent);
  color: var(--ink);
}

.foot-action.is-active {
  color: var(--accent);
  font-weight: 500;
}

.foot-meta {
  font-size: 11.5px;
  color: var(--ink-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 112px;
}

.diff-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 11px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mode-caption {
  padding: 8px 8px 0;
  font-size: 12px;
  color: var(--ink-subtle);
  line-height: 1.5;
}

/* ---------------- 主工作区 ---------------- */

.workspace-main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 40px clamp(16px, 4vw, 48px) 64px;
  background-color: var(--bg);
}

[data-bg-pattern='paper'] .workspace-main,
.appearance-preview-card[data-bg-pattern='paper'] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.038'/%3E%3C/svg%3E");
}

[data-bg-pattern='dot'] .workspace-main,
.appearance-preview-card[data-bg-pattern='dot'] {
  background-image: radial-gradient(color-mix(in srgb, var(--ink-subtle) 22%, transparent) 1px, transparent 1px);
  background-size: 24px 24px;
}

[data-bg-pattern='grid'] .workspace-main,
.appearance-preview-card[data-bg-pattern='grid'] {
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--border) 62%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--border) 62%, transparent) 1px, transparent 1px);
  background-size: 28px 28px;
}

[data-bg-pattern='lined'] .workspace-main,
.appearance-preview-card[data-bg-pattern='lined'] {
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 31px,
    color-mix(in srgb, var(--border) 70%, transparent) 31px,
    color-mix(in srgb, var(--border) 70%, transparent) 32px
  );
}

.workspace-main:focus:not(:focus-visible) {
  outline: none;
}

.workspace-inner {
  max-width: 1120px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ---------------- 页面头部与按钮 ---------------- */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 600px;
  min-width: 0;
}

.page-title-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  text-wrap: balance;
}

.page-count {
  font-size: 14px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.page-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-muted);
  border: 1px solid var(--border-input);
  border-radius: 10px;
  padding: 1px 8px;
  line-height: 1.5;
}

.pill-tag.is-accent {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-input);
  background: var(--surface);
  color: var(--ink-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.btn:hover:not(:disabled) {
  border-color: var(--border-hover);
  color: var(--ink);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-contrast);
}

.btn-outline-strong {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--surface);
}

.btn-outline-strong:hover:not(:disabled) {
  background: var(--surface-muted);
  border-color: var(--ink);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-muted);
  border-color: transparent;
  color: var(--ink);
}

.btn-danger {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.btn-danger:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.btn-icon {
  width: 40px;
  padding: 0;
}

.btn-icon.btn-sm {
  width: 32px;
}

.btn-full {
  width: 100%;
}

.text-link-btn {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 14px;
  color: var(--ink-body);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.text-link-btn:hover {
  color: var(--ink);
}

.text-link-btn.is-sm {
  min-height: auto;
  font-size: 12px;
  color: var(--ink-muted);
}

/* ---------------- 检索与筛选工具栏 ---------------- */

.toolbar-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.search-field {
  flex: 1 1 260px;
  min-width: 200px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-field svg {
  position: absolute;
  left: 12px;
  color: var(--ink-subtle);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 14px;
  color: var(--ink);
  transition: border-color 0.14s ease;
}

.search-field input:focus {
  border-color: var(--ink);
}

.search-field input::placeholder {
  color: var(--ink-subtle);
}

.filter-select {
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  color: var(--ink-body);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.14s ease;
}

.filter-select:hover {
  border-color: var(--border-hover);
}

.switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  font-size: 13px;
  color: var(--ink-body);
  cursor: pointer;
}

.switch-track {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: var(--border-hover);
  transition: background-color 0.15s ease;
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 7px;
  background: var(--bg);
  transition: transform 0.15s ease;
}

.switch-btn[aria-checked='true'] .switch-track {
  background: var(--ink);
}

.switch-btn[aria-checked='true'] .switch-thumb {
  transform: translateX(14px);
}

/* ---------------- 成熟度几何圆点 ---------------- */

.maturity-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.maturity-inline.is-pending {
  color: var(--accent);
}

.maturity-inline.is-locked {
  color: var(--ink);
}

/* ---------------- 画廊卡片网格 ---------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.gallery-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.gallery-card:hover {
  border-color: var(--border-hover);
}

.gallery-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-subtle);
}

.gallery-card-identity {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-card-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

.gallery-card-summary {
  margin: 0;
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink-body);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gallery-card-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-subtle);
}

.gallery-card-flags {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ---------------- 极简左对齐空状态 ---------------- */

.empty-state {
  max-width: 480px;
  padding-top: 48px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-state h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}

.empty-state p {
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink-muted);
}

.empty-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  padding-top: 8px;
}

/* ---------------- 独立双栏卡片详情与编辑页 ---------------- */

.detail-wrap {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.detail-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.detail-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  font-size: 14px;
  color: var(--ink-muted);
  cursor: pointer;
}

.detail-back-btn:hover {
  color: var(--ink);
}

.detail-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.save-hint {
  font-size: 13px;
  color: var(--ink-muted);
}

.overflow-menu {
  position: absolute;
  top: 46px;
  right: 0;
  z-index: 30;
  min-width: 176px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(31, 29, 26, 0.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.overflow-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 13px;
  color: var(--ink-body);
  text-align: left;
  cursor: pointer;
}

.overflow-item:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.overflow-item.is-danger {
  color: var(--accent);
}

.detail-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 720px;
}

.detail-meta-kicker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-muted);
}

.detail-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(28px, 3vw, 36px);
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
}

.detail-subtitle {
  margin: 0;
  font-size: 16px;
  color: var(--ink-muted);
}

.detail-columns {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 48px;
}

.detail-main-col {
  flex: 999 1 520px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.detail-side-col {
  flex: 1 1 280px;
  max-width: 320px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-section + .detail-section,
.detail-two-col {
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.detail-section-label {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
}

.detail-prose {
  margin: 0;
  max-width: 660px;
  font-size: calc(var(--font-size-base) + 1px);
  line-height: 1.85;
  color: var(--ink);
  white-space: pre-wrap;
}

.detail-prose.is-lead {
  font-size: calc(var(--font-size-base) + 2px);
}

.detail-prose.is-muted {
  color: var(--ink-subtle);
}

.detail-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
}

.detail-two-col > .detail-section {
  padding-top: 0;
  border-top: 0;
}

.contrast-split-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}

.contrast-half {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.contrast-half + .contrast-half {
  border-left: 1px solid var(--border);
}

.contrast-caption {
  font-size: 12px;
  color: var(--ink-subtle);
}

.contrast-caption.is-accent {
  color: var(--accent);
}

.contrast-subnote {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-muted);
}

.side-section {
  display: flex;
  flex-direction: column;
}

.side-section .detail-section-label {
  margin-bottom: 8px;
}

.hairline-dl,
.hairline-ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
}

.hairline-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  font-size: 14px;
}

.hairline-row:last-child {
  border-bottom: 1px solid var(--border);
}

.hairline-dt {
  color: var(--ink-muted);
  flex-shrink: 0;
}

.hairline-dd {
  margin: 0;
  text-align: right;
  color: var(--ink);
  min-width: 0;
  word-break: break-word;
}

.hairline-dd.is-empty {
  color: var(--ink-subtle);
}

.hairline-link-btn {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 14px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  min-width: 0;
}

.hairline-link-btn:hover {
  text-decoration: underline;
}

.hairline-right-tag {
  font-size: 12px;
  color: var(--ink-subtle);
  flex-shrink: 0;
}

.private-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: var(--sidebar-bg);
  border-radius: var(--radius-md);
}

.private-box-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
}

.private-box-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink-body);
  white-space: pre-wrap;
}

.private-box-foot {
  font-size: 12px;
  color: var(--ink-subtle);
}

/* ---------------- 详情编辑态与表单控件 ---------------- */

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label,
.field-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
}

.input-control,
.textarea-control,
.select-control {
  width: 100%;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  transition: border-color 0.14s ease;
}

.input-control,
.select-control {
  height: 40px;
  padding: 0 12px;
}

.input-control.is-title {
  height: auto;
  padding: 8px 12px;
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
}

.textarea-control {
  min-height: 92px;
  padding: 10px 12px;
  line-height: 1.75;
  resize: vertical;
}

.textarea-control.is-mono {
  min-height: 150px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
}

.input-control:focus,
.textarea-control:focus,
.select-control:focus {
  border-color: var(--ink);
}

.inline-add-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.inline-add-row .select-control {
  flex: 1 1 auto;
}

.chip-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.chip-option {
  padding: 4px 10px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--ink-body);
  font-size: 12.5px;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.chip-option:hover {
  border-color: var(--border-hover);
}

.chip-option.is-selected {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.inline-alert {
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
}

.inline-alert strong {
  color: var(--accent);
}

/* ---------------- 双轨排章板 ---------------- */

.segmented-control {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--sidebar-bg);
}

.segmented-btn {
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: 13px;
  color: var(--ink-muted);
  cursor: pointer;
}

.segmented-btn[aria-selected='true'] {
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
}

.lane-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.lane-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lane-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.lane-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}

.beat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.beat-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color 0.14s ease, opacity 0.14s ease;
}

.beat-row:hover {
  border-color: var(--border-hover);
}

.beat-row.is-draggable {
  cursor: grab;
}

.beat-row.dragging {
  opacity: 0.45;
}

.beat-row.drag-over {
  border-color: var(--accent);
}

.beat-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}

.beat-id-group {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.beat-order {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-subtle);
  font-variant-numeric: tabular-nums;
}

.beat-title-btn {
  padding: 0;
  border: 0;
  background: transparent;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.beat-title-btn:hover {
  text-decoration: underline;
}

.beat-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.beat-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-subtle);
}

.beat-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 24px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.beat-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.beat-field-label {
  font-size: 12px;
  color: var(--ink-subtle);
}

.beat-field-text {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink-body);
}

.inline-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12px;
  color: var(--ink-muted);
}

.inline-link {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 12px;
  color: var(--ink-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.inline-link:hover {
  color: var(--ink);
}

/* ---------------- 势力×阵营矩阵 ---------------- */

.matrix-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.camp-ledger {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}

.camp-ledger-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
}

.camp-ledger-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.camp-ledger-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ledger-col {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.ledger-col + .ledger-col {
  border-left: 1px solid var(--border);
}

.ledger-col-title {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-subtle);
}

.ledger-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--border-subtle);
}

.ledger-item:first-of-type {
  border-top: 0;
  padding-top: 2px;
}

.ledger-item-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.ledger-item-name {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.ledger-item-name:hover {
  text-decoration: underline;
}

.stance-flag {
  font-size: 12px;
  color: var(--ink-subtle);
  white-space: nowrap;
}

.stance-flag.is-double {
  color: var(--accent);
  font-weight: 500;
}

/* ---------------- 首页总览 ---------------- */

.overview-quick-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.overview-empty-banner {
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.overview-empty-banner h2 {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}

.overview-empty-banner p {
  margin: 0;
  max-width: 680px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink-muted);
}

.overview-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.overview-block-head,
.overview-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.overview-section-head .text-link-btn {
  min-height: auto;
  font-size: 13px;
}

.section-heading {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.overview-head-note {
  font-size: 12.5px;
  color: var(--ink-subtle);
}

.overview-progress-card {
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.overview-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.overview-progress-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.overview-progress-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--ink-muted);
}

.overview-progress-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot.is-locked {
  background: var(--ink);
}

.legend-dot.is-draft {
  background: var(--border-hover);
}

.legend-dot.is-pending {
  background: var(--accent);
}

.legend-dot.is-archived {
  background: var(--border);
}

.overview-progress-bar {
  display: flex;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-muted);
  overflow: hidden;
  gap: 1px;
}

.bar-seg.is-locked {
  background: var(--ink);
}

.bar-seg.is-draft {
  background: var(--border-hover);
}

.bar-seg.is-pending {
  background: var(--accent);
}

.bar-seg.is-archived {
  background: var(--border);
}

.overview-deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 12px;
}

.overview-deck-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.overview-deck-tile:hover {
  border-color: var(--border-hover);
}

.overview-tile-main {
  flex: 1 1 auto;
  width: 100%;
  padding: 16px 44px 14px 16px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.overview-deck-tile.is-empty .overview-tile-main {
  padding: 16px 16px 12px;
}

.overview-tile-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.overview-tile-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
}

.overview-tile-num {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--ink);
}

.overview-tile-sub {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-subtle);
}

.overview-tile-add {
  position: absolute;
  top: 10px;
  right: 8px;
  width: 30px;
  height: 30px;
}

.overview-tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 16px;
  border-top: 1px solid var(--border-subtle);
}

.overview-tile-meta {
  font-size: 12px;
  color: var(--ink-subtle);
}

.overview-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.overview-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.overview-section {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.overview-diag-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.overview-diag-group + .overview-diag-group {
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.overview-diag-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-subtle);
}

.overview-diag-more {
  padding-top: 4px;
  font-size: 12px;
  color: var(--ink-subtle);
}

.overview-list {
  display: flex;
  flex-direction: column;
}

.overview-row,
.overview-row-split {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 9px 6px;
  border: 0;
  border-top: 1px solid var(--border-subtle);
  background: transparent;
  text-align: left;
  transition: background-color 0.14s ease;
}

.overview-row {
  cursor: pointer;
  border-radius: 4px;
}

.overview-row:first-child,
.overview-row-split:first-child {
  border-top: 0;
}

.overview-row:hover {
  background: var(--surface-hover);
}

.overview-row-split-main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.overview-row-split-main:hover strong {
  text-decoration: underline;
}

.overview-row-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.overview-row-main strong,
.overview-row-split-main strong {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.overview-row-sub {
  font-size: 12.5px;
  color: var(--ink-subtle);
  line-height: 1.5;
}

.overview-row-meta {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--ink-muted);
}

.overview-row-right {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.overview-beat-order {
  flex-shrink: 0;
  min-width: 34px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-subtle);
}

.accent-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.overview-clean-note {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink-subtle);
}

.meta-list {
  margin: 0;
  display: flex;
  flex-direction: column;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  border-top: 1px solid var(--border-subtle);
  font-size: 13.5px;
}

.meta-row:first-child {
  border-top: 0;
}

.meta-row dt {
  color: var(--ink-muted);
}

.meta-row dd {
  margin: 0;
  color: var(--ink);
  font-weight: 500;
}

.overview-foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}

/* ---------------- 全部项目（书架总览） ---------------- */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.project-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  transition: border-color 0.14s ease;
}

.project-card:hover {
  border-color: var(--border-hover);
}

.project-card.is-active {
  border-color: var(--accent);
}

.project-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.project-card-brand {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.project-seal {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: var(--radius-sm);
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
}

.project-seal.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.project-card-titles {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.project-card-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.project-card-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.project-card-sub {
  margin: 0;
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.5;
}

.project-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--ink-body);
}

.project-card-stats strong {
  color: var(--ink);
  font-weight: 600;
}

.project-card-meta {
  font-size: 12px;
  color: var(--ink-subtle);
}

.project-card-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.project-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-danger-text {
  color: var(--accent);
}

.btn-danger-text:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent);
}

.project-delete-confirm {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12.5px;
  color: var(--ink);
}

.project-delete-confirm-btns {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.projects-demo-strip {
  padding: 18px 20px;
  border: 1px dashed var(--border-hover);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.projects-demo-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.projects-demo-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.projects-demo-actions {
  flex-shrink: 0;
}

/* ---------------- 关系图谱（多透镜分层架构） ---------------- */

.graph-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}

.graph-toolbar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.graph-toolbar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.graph-toolbar .filter-select {
  height: 34px;
  max-width: 196px;
}

.graph-zoom-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.graph-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  min-height: 480px;
}

.graph-canvas-wrap {
  position: relative;
  min-width: 0;
  overflow: auto;
  background-color: var(--surface);
  background-image: radial-gradient(color-mix(in srgb, var(--border-hover) 55%, transparent) 1px, transparent 1px);
  background-size: 20px 20px;
}

.graph-canvas-wrap svg {
  width: 100%;
  height: auto;
  min-height: 460px;
  display: block;
  user-select: none;
  cursor: grab;
}

.graph-stage-empty {
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: var(--ink-subtle);
  font-size: 14px;
}

.graph-col-header {
  font-size: 11.5px;
  font-weight: 500;
  fill: var(--ink-subtle);
  letter-spacing: 0.02em;
}

.graph-edge {
  transition: opacity 0.14s ease;
}

.graph-edge-path {
  stroke: var(--border-hover);
  stroke-width: 1.35;
  transition: stroke 0.14s ease, stroke-width 0.14s ease;
}

.graph-edge.is-accent .graph-edge-path {
  stroke: var(--accent);
  stroke-width: 1.55;
}

.graph-edge.is-dashed-muted .graph-edge-path {
  stroke: var(--ink-subtle);
}

.graph-edge-dot {
  fill: var(--border-hover);
}

.graph-edge.is-accent .graph-edge-dot {
  fill: var(--accent);
}

.graph-edge-label {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.graph-edge-label.is-shown,
.graph-edge.is-active .graph-edge-label,
.graph-edge.is-preview .graph-edge-label {
  opacity: 1;
}

.edge-label-bg {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 1;
}

.graph-edge.is-accent .edge-label-bg {
  stroke: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.edge-label-text {
  font-size: 10.5px;
  font-weight: 500;
  fill: var(--ink-body);
}

.graph-edge.is-accent .edge-label-text {
  fill: var(--accent);
}

#relation-svg.has-focus .graph-node.is-dimmed,
#relation-svg.has-focus .graph-edge.is-dimmed {
  opacity: 0.22;
}

#relation-svg.has-preview .graph-node:not(.is-preview):not(.is-selected):not(.is-active),
#relation-svg.has-preview .graph-edge:not(.is-preview):not(.is-active) {
  opacity: 0.22;
}

#relation-svg .graph-edge.is-active,
#relation-svg .graph-edge.is-preview,
#relation-svg .graph-node.is-preview {
  opacity: 1;
}

#relation-svg .graph-edge.is-active .graph-edge-path,
#relation-svg .graph-edge.is-preview .graph-edge-path {
  stroke: var(--ink);
  stroke-width: 2;
}

#relation-svg .graph-edge.is-accent.is-active .graph-edge-path,
#relation-svg .graph-edge.is-accent.is-preview .graph-edge-path {
  stroke: var(--accent);
  stroke-width: 2.1;
}

.graph-node {
  cursor: pointer;
  transition: opacity 0.14s ease;
}

.graph-node-box {
  stroke: var(--border-input);
  stroke-width: 1.1;
  transition: stroke 0.14s ease, stroke-width 0.14s ease;
}

.graph-node--camp .graph-node-box {
  stroke: var(--border-hover);
}

.graph-node:hover .graph-node-box,
.graph-node.is-preview .graph-node-box,
.graph-node.is-active .graph-node-box {
  stroke: var(--ink-body);
  stroke-width: 1.4;
}

.graph-node.is-selected .graph-node-box,
.graph-node.is-ego-center .graph-node-box {
  stroke: var(--accent);
  stroke-width: 2;
}

.graph-node-meta {
  font-size: 10px;
  fill: var(--ink-subtle);
}

.graph-node-flag {
  font-size: 10px;
  font-weight: 500;
  fill: var(--ink-muted);
}

.graph-node-flag.is-accent {
  fill: var(--accent);
}

.graph-node-title {
  font-size: 12.5px;
  font-weight: 600;
  fill: var(--ink);
}

.graph-node-title.is-center {
  font-family: var(--font-serif);
  font-size: 14.5px;
}

/* 关系图谱右侧检视栏 */

.graph-inspector {
  border-left: 1px solid var(--border);
  background: var(--surface-muted);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.graph-inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.graph-inspector-head .text-link-btn {
  min-height: auto;
  font-size: 12px;
}

.graph-inspector-meta {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-subtle);
}

.graph-inspector-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

.graph-inspector-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-body);
}

.graph-spy-note {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12.5px;
  color: var(--ink);
}

.graph-spy-note strong {
  color: var(--accent);
  font-weight: 600;
}

.graph-inspector-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.graph-inspector-subhead {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-subtle);
  margin-bottom: 6px;
}

.graph-inspector-rel {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.graph-rel-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.graph-rel-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.14s ease;
}

.graph-rel-item:hover {
  border-color: var(--border-hover);
}

.graph-rel-tag {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--ink-muted);
  background: var(--surface-muted);
  padding: 1px 6px;
  border-radius: 4px;
}

.graph-rel-tag.is-accent {
  color: var(--accent);
  background: var(--accent-soft);
}

.graph-rel-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph-rel-type {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--ink-subtle);
}

.graph-legend {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.graph-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.legend-line {
  width: 24px;
  height: 0;
  border-top: 2px solid var(--border-hover);
  flex-shrink: 0;
}

.legend-line.is-accent {
  border-top: 2px dashed var(--accent);
}

.legend-box-dashed {
  width: 18px;
  height: 12px;
  border: 1px dashed var(--border-hover);
  border-radius: 3px;
  background: var(--surface);
  flex-shrink: 0;
}

.graph-inspector-empty {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-subtle);
}

/* ---------------- 伏笔雷达 ---------------- */

.radar-groups {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.radar-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}

.radar-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.radar-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.radar-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
}

.radar-row:first-child {
  border-top: 0;
}

.radar-row-main {
  flex: 1 1 360px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.radar-row-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}

.radar-row-title {
  padding: 0;
  border: 0;
  background: transparent;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.radar-row-title:hover {
  text-decoration: underline;
}

.radar-row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.warn-text {
  font-size: 12px;
  color: var(--accent);
}

/* ---------------- 模态框与登录遮罩 ---------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(31, 29, 26, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overscroll-behavior: contain;
}

.modal-panel {
  width: min(680px, 100%);
  max-height: 86svh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(31, 29, 26, 0.14);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.panel-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overscroll-behavior: contain;
}

.panel-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
}

.diff-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.diff-row {
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.diff-row:first-child {
  border-top: 0;
}

.diff-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.diff-op {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
}

.diff-change {
  font-size: 12.5px;
  color: var(--ink-muted);
  padding-left: 16px;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-box {
  width: min(400px, 100%);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-muted);
}

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 110;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(31, 29, 26, 0.14);
}

.toast.error {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

/* ---------------- 外观与字体设置弹窗 ---------------- */

.appearance-scope-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.appearance-scope-hint {
  font-size: 12px;
  color: var(--ink-subtle);
}

.appearance-override-note {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink);
}

.appearance-preview-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--bg);
}

.appearance-preview-inner {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.appearance-preview-meta {
  font-size: 11.5px;
  color: var(--accent);
  font-weight: 500;
}

.appearance-preview-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}

.appearance-preview-prose {
  margin: 0;
  font-family: var(--font-sans);
  font-size: calc(var(--font-size-base) + 0.5px);
  line-height: 1.7;
  color: var(--ink-body);
}

.appearance-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.appearance-subhead {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.appearance-sublabel {
  font-size: 12px;
  color: var(--ink-subtle);
}

.theme-swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
}

.theme-swatch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.theme-swatch:hover {
  border-color: var(--border-hover);
  background: var(--surface-muted);
}

.theme-swatch[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.theme-chip {
  position: relative;
  width: 34px;
  height: 26px;
  flex: 0 0 34px;
  border-radius: 5px;
  border: 1px solid transparent;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 3px;
}

.theme-chip-card {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 14px;
  height: 18px;
  border-radius: 2px;
  opacity: 0.92;
}

.theme-chip-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.theme-swatch-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.theme-swatch-text strong {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.theme-swatch-text span {
  font-size: 11px;
  color: var(--ink-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bg-pattern-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.bg-pattern-btn {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.bg-pattern-btn:hover {
  border-color: var(--border-hover);
}

.bg-pattern-btn[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.bg-pattern-sample {
  width: 100%;
  height: 36px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg);
}

.bg-pattern-sample[data-preview-pattern='paper'] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
}

.bg-pattern-sample[data-preview-pattern='dot'] {
  background-image: radial-gradient(color-mix(in srgb, var(--ink-subtle) 38%, transparent) 1px, transparent 1px);
  background-size: 8px 8px;
}

.bg-pattern-sample[data-preview-pattern='grid'] {
  background-image:
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 10px 10px;
}

.bg-pattern-sample[data-preview-pattern='lined'] {
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 9px,
    var(--border) 9px,
    var(--border) 10px
  );
}

.bg-pattern-name {
  font-size: 12px;
  color: var(--ink-body);
}

.font-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.font-preset-btn {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.font-preset-btn:hover {
  border-color: var(--border-hover);
}

.font-preset-btn[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.font-preset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.font-preset-head strong {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.font-preset-sample {
  font-size: 16px;
  color: var(--ink);
  line-height: 1.4;
}

.font-preset-desc {
  font-size: 11.5px;
  color: var(--ink-subtle);
  line-height: 1.45;
}

/* ---------------- 响应式适配（移动端 < 900px） ---------------- */

@media (max-width: 900px) {
  .mobile-bar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
  }

  .mobile-brand {
    font-family: var(--font-serif);
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(31, 29, 26, 0.32);
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    overscroll-behavior: contain;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar .sidebar-close-btn {
    display: inline-flex;
  }

  .nav-item,
  .foot-action {
    min-height: 40px;
  }

  .workspace-main {
    padding: 24px 16px 48px;
  }

  .detail-columns {
    gap: 28px;
  }

  .detail-side-col {
    max-width: 100%;
    flex-basis: 100%;
  }

  .detail-two-col,
  .contrast-split-box,
  .camp-ledger-grid,
  .overview-columns,
  .graph-layout,
  .projects-grid,
  .font-preset-grid {
    grid-template-columns: 1fr;
  }

  .bg-pattern-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .projects-demo-strip {
    flex-direction: column;
    align-items: flex-start;
  }

  .graph-inspector {
    border-left: 0;
    border-top: 1px solid var(--border);
  }

  .graph-toolbar .filter-select {
    max-width: 100%;
    flex: 1 1 160px;
  }

  .contrast-half + .contrast-half,
  .ledger-col + .ledger-col {
    border-left: 0;
    border-top: 1px solid var(--border);
  }

  .radar-row-side {
    align-items: flex-start;
  }
}

/* ---------------- 账户与 Notion 集成弹窗 ---------------- */

.account-tabs {
  align-self: flex-start;
}

.account-status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.account-status-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.account-status-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.account-status-sub {
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-muted);
  word-break: break-word;
}

.account-status-sub code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
}

.input-with-action {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.input-with-action .input-control {
  flex: 1 1 200px;
  min-width: 0;
}

.input-control.is-mono-sm {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.account-db-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-db-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.account-env-key {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-subtle);
}

.account-test-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  overflow: hidden;
}

.account-test-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--ink);
}

.account-test-list {
  display: flex;
  flex-direction: column;
}

.account-test-row {
  display: grid;
  grid-template-columns: 20px 88px 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12.5px;
}

.account-test-row:first-child {
  border-top: 0;
}

.account-test-mark {
  font-weight: 700;
  text-align: center;
}

.account-test-row.is-ok .account-test-mark {
  color: var(--tone-locked-ink, var(--ink));
}

.account-test-row.is-fail .account-test-mark,
.account-test-row.is-fail .account-test-detail {
  color: var(--accent);
}

.account-test-row.is-skip {
  color: var(--ink-subtle);
}

.account-test-name {
  font-weight: 500;
  color: var(--ink);
}

.account-test-row.is-skip .account-test-name {
  color: var(--ink-subtle);
}

.account-test-detail {
  color: var(--ink-muted);
  min-width: 0;
  word-break: break-word;
}

.account-guide {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  background: var(--surface);
  font-size: 12.5px;
  color: var(--ink-muted);
}

.account-guide summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--ink);
}

.account-guide ol {
  margin: 10px 0 2px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  line-height: 1.65;
}

.account-guide a {
  color: var(--accent);
  text-decoration: underline;
}

.account-guide code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--surface-muted);
}

.password-strength {
  font-size: 11.5px;
  font-weight: 500;
}

.password-strength.is-strong {
  color: var(--tone-locked-ink, var(--ink));
}

.password-strength.is-good {
  color: var(--ink-body);
}

.password-strength.is-warn {
  color: var(--accent);
}

.password-strength.is-muted {
  color: var(--ink-subtle);
}

.account-success-note {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
}

@media (max-width: 900px) {
  .account-db-grid {
    grid-template-columns: 1fr;
  }
}
