/* ==========================================================================
   modern.css · 「Astral Archive · 星穹档案馆」
   --------------------------------------------------------------------------
   现代大气视觉升级层。在 app.css / admin.css / theme.css 之后加载，
   以令牌覆盖 + 组件重塑的方式替换旧皮肤，不改动 JS / DOM 契约。
   深色 = 深邃夜空 + 极光；浅色 = 晨雾白瓷 + 柔和光晕。
   ========================================================================== */

/* ---------- 1. 设计令牌 ---------- */
:root {
  /* 字体：界面纯系统无衬线，只有大型展示标题使用编辑感衬线 */
  --modern-sans: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei",
    system-ui, -apple-system, "PingFang SC", "Noto Sans SC", sans-serif;
  --modern-display: "Segoe UI Variable Display", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei",
    system-ui, -apple-system, sans-serif;
  --modern-serif: "Georgia", "Times New Roman", "Songti SC", "STSong", "SimSun", serif;

  --font-sans: var(--modern-sans);
  --font-mono: ui-monospace, "Cascadia Mono", "Cascadia Code", "SF Mono", Consolas, monospace;
  --mh-font-display: var(--modern-display);
  --mh-font-reading: var(--modern-sans);
  --mh-tracking-wide: 0.18em;

  /* 基础几何 */
  --sidebar-w: 262px;
  --detail-w: 398px;
  --header-h: 64px;
  --status-h: 38px;
  --modern-radius: 16px;
  --modern-radius-lg: 20px;
  --modern-ease: cubic-bezier(0.22, 0.7, 0.25, 1);

  /* 极光与月金 */
  --aurora-violet: #9b8cff;
  --aurora-rose: #ff9fb0;
  --aurora-gold: #e8c57a;
  --mh-gold: #a9772a;
  --mh-gold-bright: #c79a48;
  --mh-gold-soft: rgba(169, 119, 42, 0.09);
  --mh-gold-line: rgba(169, 119, 42, 0.22);
  --mh-gold-ink: #7a5a1f;
  --mh-gold-rule: rgba(169, 119, 42, 0.20);
  --mh-gold-glow: rgba(169, 119, 42, 0.10);
  --mh-rose: #b65d73;
  --mh-rose-soft: rgba(182, 93, 115, 0.10);
  --mh-violet: #6f5bd6;
  --mh-violet-soft: rgba(111, 91, 214, 0.10);
  --mh-glow-warm: rgba(232, 197, 122, 0.14);
  --mh-glow-cool: rgba(155, 140, 255, 0.15);
  --mh-glass-bg: rgba(255, 255, 255, 0.62);
  --mh-glass-border: rgba(255, 255, 255, 0.72);
  --mh-glass-blur: blur(24px) saturate(1.35);
  --mh-grain: none;
  --mh-decor-filter: none;

  /* 主题色板 · 晨雾白瓷 */
  --bg: #f5f6fb;
  --bg-elevated: #ffffff;
  --bg-sunken: #eef0f8;
  --bg-subtle: #f4f5fa;
  --bg-hover: #efeff8;
  --bg-active: #e9e8f5;
  --text: #15151e;
  --text-2: #4d4f61;
  --text-3: #626679;
  --text-4: #6b6f80;
  --border: rgba(22, 22, 42, 0.08);
  --border-strong: rgba(22, 22, 42, 0.14);
  --modern-line: rgba(22, 22, 42, 0.08);
  --modern-line-strong: rgba(22, 22, 42, 0.16);
  --modern-hairline: rgba(255, 255, 255, 0.8);
  --brand: #6a54d8;
  --brand-hover: #5943c6;
  --brand-soft: rgba(106, 84, 216, 0.09);
  --brand-soft-2: rgba(106, 84, 216, 0.16);
  --brand-border: rgba(106, 84, 216, 0.26);
  --danger: #bf3f4c;
  --danger-soft: rgba(191, 63, 76, 0.09);
  --danger-border: rgba(191, 63, 76, 0.26);
  --success: #1f8560;
  --success-soft: rgba(31, 133, 96, 0.10);
  --warning: #97681c;
  --warning-soft: rgba(151, 104, 28, 0.10);
  --info: #386dc0;
  --canvas-bg: #f5f5fc;
  --canvas-dot: rgba(78, 66, 132, 0.14);
  --edge: rgba(87, 73, 146, 0.42);
  --edge-hot: rgba(106, 84, 216, 0.66);
  --overlay: rgba(10, 8, 22, 0.38);
  --shadow-sm: 0 1px 2px rgba(30, 24, 70, 0.05), 0 2px 8px rgba(30, 24, 70, 0.04);
  --shadow-md: 0 10px 30px -18px rgba(30, 24, 70, 0.34), 0 2px 8px rgba(30, 24, 70, 0.05);
  --shadow-lg: 0 28px 70px -34px rgba(30, 24, 70, 0.42), 0 6px 18px rgba(30, 24, 70, 0.06);
  --focus-ring: 0 0 0 3px rgba(106, 84, 216, 0.18);
  --mark-bg: rgba(232, 197, 122, 0.32);
  --mark-text: #674b12;

  /* 玻璃与主体表面 */
  --modern-glass: rgba(255, 255, 255, 0.64);
  --modern-glass-strong: rgba(255, 255, 255, 0.82);
  --modern-glass-dark: rgba(255, 255, 255, 0.06);
  --modern-tint: rgba(255, 255, 255, 0.58);
  --modern-border: rgba(22, 22, 42, 0.08);
  --modern-border-strong: rgba(22, 22, 42, 0.14);
  --modern-ghost-border: rgba(255, 255, 255, 0.72);
  --modern-shadow-shell: 0 30px 80px -44px rgba(29, 22, 74, 0.35), 0 8px 22px -16px rgba(29, 22, 74, 0.18);
  --modern-shadow-panel: 0 18px 50px -30px rgba(29, 22, 74, 0.30), 0 2px 8px rgba(29, 22, 74, 0.05);
  --modern-shadow-card: 0 12px 30px -22px rgba(35, 27, 80, 0.28), 0 1px 2px rgba(35, 27, 80, 0.05);
  --modern-node-bg: linear-gradient(158deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.72));
  --modern-node-border: rgba(28, 26, 56, 0.10);
  --modern-node-shadow: 0 8px 22px -16px rgba(38, 28, 84, 0.35), 0 1px 1px rgba(38, 28, 84, 0.05);
  --modern-node-shadow-hover: 0 18px 38px -22px rgba(48, 34, 110, 0.44), 0 2px 6px rgba(38, 28, 84, 0.06);
  --modern-primary-bg: linear-gradient(135deg, #211d32 0%, #171522 58%, #2c2644 100%);
  --modern-primary-ink: #ffffff;
  --modern-primary-shadow: 0 12px 24px -16px rgba(23, 21, 34, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  --modern-toolbar-bg: rgba(255, 255, 255, 0.72);
  --modern-detail-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.86) 0%, rgba(250, 250, 255, 0.72) 52%, rgba(245, 245, 252, 0.64) 100%);
  --modern-side-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(252, 252, 255, 0.54));
  --modern-chat-surface: radial-gradient(980px 680px at 84% -8%, rgba(155, 140, 255, 0.10), transparent 62%),
    radial-gradient(760px 600px at 0% 104%, rgba(255, 159, 176, 0.08), transparent 64%),
    linear-gradient(180deg, #f7f7fd 0%, #f4f5fb 100%);
  --modern-star: rgba(72, 62, 118, 0.15);
  --modern-constellation: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 180'%3E%3Cg fill='none' stroke='%239b8cff' stroke-width='0.7' opacity='0.55'%3E%3Cpath d='M20 120 76 84l44 26 58-52 48 34 52-24'/%3E%3Cpath d='M76 84l-8-44M120 110l22 44M178 58l-14-34M226 92l38 28'/%3E%3C/g%3E%3Cg fill='%23c79a48'%3E%3Ccircle cx='20' cy='120' r='1.6'/%3E%3Ccircle cx='76' cy='84' r='1.2'/%3E%3Ccircle cx='120' cy='110' r='1.4'/%3E%3Ccircle cx='178' cy='58' r='1.8'/%3E%3Ccircle cx='226' cy='92' r='1.1'/%3E%3Ccircle cx='278' cy='68' r='1.5'/%3E%3C/g%3E%3C/svg%3E");

  /* 旧令牌映射（让旧组件自动接入新皮肤） */
  --mh-paper: #fbfbfe;
  --mh-paper-deep: #f1f1f9;
  --mh-ink-soft: #4d4f61;
  --mh-ink-faint: #626679;
  --mh-line-soft: rgba(22, 22, 42, 0.07);
  --mh-line: rgba(22, 22, 42, 0.11);
  --mh-line-strong: rgba(22, 22, 42, 0.20);
  --mh-hover-bg: rgba(74, 59, 150, 0.06);
  --mh-active-bg: rgba(74, 59, 150, 0.11);
  --mh-canvas-veil: rgba(245, 246, 251, 0.55);
  --mh-vignette: rgba(48, 38, 92, 0.07);
  --mh-seal: #211d32;
  --mh-seal-2: #3a3157;
  --mh-seal-ink: #ffffff;
  --mh-sheet-top: rgba(255, 255, 255, 0.72);
  --mh-sheet-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 12px 30px -24px rgba(38, 28, 84, 0.32);
  --mh-halo: 0 0 0 1px rgba(106, 84, 216, 0.42), 0 0 0 5px rgba(106, 84, 216, 0.08);
  --mh-shadow-card: 0 10px 26px -20px rgba(35, 27, 80, 0.32), 0 1px 2px rgba(35, 27, 80, 0.04);
  --mh-shadow-float: 0 20px 48px -28px rgba(35, 27, 80, 0.40), 0 2px 8px rgba(35, 27, 80, 0.06);
  --mh-shadow-soft: var(--modern-shadow-panel);
  --mh-shadow-lift: var(--modern-shadow-shell);
  --mh-shadow-inner: inset 0 1px 0 rgba(255, 255, 255, 0.72);

  --mh-surface-head: rgba(255, 255, 255, 0.72);
  --mh-surface-side: var(--modern-side-surface);
  --mh-surface-card: var(--modern-node-bg);
  --mh-surface-soft: linear-gradient(180deg, rgba(250, 250, 255, 0.88), rgba(245, 245, 252, 0.72));
  --mh-surface-toolbar: var(--modern-toolbar-bg);
  --mh-surface-input: rgba(255, 255, 255, 0.80);
  --mh-surface-foot: rgba(247, 247, 253, 0.70);
  --mh-surface-modal: linear-gradient(160deg, rgba(255, 255, 255, 0.96), rgba(247, 246, 253, 0.96));
  --mh-surface-detail: var(--modern-detail-surface);
  --mh-kind-tint: color-mix(in srgb, var(--kind-color, var(--brand)) 10%, #ffffff);
  --mh-kind-edge: color-mix(in srgb, var(--kind-color, var(--brand)) 24%, transparent);
  --mh-kind-ink: color-mix(in srgb, var(--kind-color, var(--brand)) 54%, #15151e);
  --mh-node-spine: var(--kind-color, var(--brand));
}

html[data-theme="dark"] {
  /* 主题色板 · 深邃夜空 */
  --bg: #07070d;
  --bg-elevated: #101019;
  --bg-sunken: #09090f;
  --bg-subtle: #12121c;
  --bg-hover: #181825;
  --bg-active: #1e1d2d;
  --text: #f3f1fa;
  --text-2: #c3bfd2;
  --text-3: #928da5;
  --text-4: #8b859d;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --brand: #a99aff;
  --brand-hover: #c0b4ff;
  --brand-soft: rgba(155, 140, 255, 0.12);
  --brand-soft-2: rgba(155, 140, 255, 0.22);
  --brand-border: rgba(155, 140, 255, 0.34);
  --danger: #ff8a93;
  --danger-soft: rgba(255, 138, 147, 0.12);
  --danger-border: rgba(255, 138, 147, 0.30);
  --success: #61d6a6;
  --success-soft: rgba(97, 214, 166, 0.12);
  --warning: #e8c57a;
  --warning-soft: rgba(232, 197, 122, 0.12);
  --info: #8db4f2;
  --canvas-bg: #08080f;
  --canvas-dot: rgba(219, 211, 255, 0.12);
  --edge: rgba(174, 159, 255, 0.22);
  --edge-hot: rgba(190, 177, 255, 0.60);
  --overlay: rgba(3, 3, 9, 0.66);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35), 0 2px 10px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 14px 38px -22px rgba(0, 0, 0, 0.8), 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 34px 80px -32px rgba(0, 0, 0, 0.9), 0 8px 24px rgba(0, 0, 0, 0.34);
  --focus-ring: 0 0 0 3px rgba(155, 140, 255, 0.24);
  --mark-bg: rgba(232, 197, 122, 0.24);
  --mark-text: #f4dca8;

  --mh-gold: #e8c57a;
  --mh-gold-bright: #f5dda9;
  --mh-gold-soft: rgba(232, 197, 122, 0.10);
  --mh-gold-line: rgba(232, 197, 122, 0.24);
  --mh-gold-ink: #e8c57a;
  --mh-gold-rule: rgba(232, 197, 122, 0.20);
  --mh-gold-glow: rgba(232, 197, 122, 0.10);
  --mh-rose: #ff9fb0;
  --mh-rose-soft: rgba(255, 159, 176, 0.10);
  --mh-violet: #9b8cff;
  --mh-violet-soft: rgba(155, 140, 255, 0.12);
  --mh-glow-warm: rgba(232, 197, 122, 0.10);
  --mh-glow-cool: rgba(155, 140, 255, 0.16);
  --mh-glass-bg: rgba(15, 15, 26, 0.56);
  --mh-glass-border: rgba(255, 255, 255, 0.10);
  --mh-line-soft: rgba(255, 255, 255, 0.07);
  --mh-line: rgba(255, 255, 255, 0.11);
  --mh-line-strong: rgba(255, 255, 255, 0.20);
  --mh-hover-bg: rgba(155, 140, 255, 0.08);
  --mh-active-bg: rgba(155, 140, 255, 0.13);
  --mh-canvas-veil: rgba(7, 7, 13, 0.55);
  --mh-vignette: rgba(0, 0, 0, 0.34);
  --mh-paper: #0d0d16;
  --mh-paper-deep: #08080f;
  --mh-ink-soft: #c3bfd2;
  --mh-ink-faint: #928da5;
  --mh-seal: #181626;
  --mh-seal-2: #312a4b;
  --mh-seal-ink: #f4e7ca;
  --mh-sheet-top: rgba(255, 255, 255, 0.04);
  --mh-sheet-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 18px 44px -26px rgba(0, 0, 0, 0.8);
  --mh-halo: 0 0 0 1px rgba(180, 166, 255, 0.48), 0 0 0 5px rgba(155, 140, 255, 0.11);
  --mh-shadow-card: 0 12px 30px -22px rgba(0, 0, 0, 0.85), 0 1px 2px rgba(0, 0, 0, 0.4);
  --mh-shadow-float: 0 24px 55px -28px rgba(0, 0, 0, 0.9), 0 2px 10px rgba(0, 0, 0, 0.35);
  --mh-shadow-soft: var(--modern-shadow-panel);
  --mh-shadow-lift: var(--modern-shadow-shell);
  --mh-shadow-inner: inset 0 1px 0 rgba(255, 255, 255, 0.05);

  --modern-glass: rgba(13, 13, 23, 0.58);
  --modern-glass-strong: rgba(17, 17, 28, 0.74);
  --modern-glass-dark: rgba(255, 255, 255, 0.055);
  --modern-tint: rgba(255, 255, 255, 0.045);
  --modern-line: rgba(255, 255, 255, 0.075);
  --modern-line-strong: rgba(255, 255, 255, 0.15);
  --modern-hairline: rgba(255, 255, 255, 0.09);
  --modern-border: rgba(255, 255, 255, 0.075);
  --modern-border-strong: rgba(255, 255, 255, 0.14);
  --modern-ghost-border: rgba(255, 255, 255, 0.08);
  --modern-shadow-shell: 0 34px 90px -42px rgba(0, 0, 0, 0.92), 0 8px 24px -16px rgba(0, 0, 0, 0.7);
  --modern-shadow-panel: 0 22px 60px -34px rgba(0, 0, 0, 0.85), 0 2px 10px rgba(0, 0, 0, 0.28);
  --modern-shadow-card: 0 14px 34px -24px rgba(0, 0, 0, 0.86), 0 1px 2px rgba(0, 0, 0, 0.4);
  --modern-node-bg: linear-gradient(158deg, rgba(29, 28, 46, 0.78), rgba(15, 15, 26, 0.72));
  --modern-node-border: rgba(255, 255, 255, 0.09);
  --modern-node-shadow: 0 14px 32px -22px rgba(0, 0, 0, 0.82), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --modern-node-shadow-hover: 0 24px 48px -24px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --modern-primary-bg: linear-gradient(135deg, #d5ccff 0%, #a99aff 46%, #8f7cff 100%);
  --modern-primary-ink: #100d1c;
  --modern-primary-shadow: 0 16px 32px -18px rgba(121, 101, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  --modern-toolbar-bg: rgba(15, 15, 26, 0.70);
  --modern-detail-surface: linear-gradient(180deg, rgba(15, 15, 26, 0.72) 0%, rgba(10, 10, 19, 0.78) 52%, rgba(8, 8, 15, 0.86) 100%);
  --modern-side-surface: linear-gradient(180deg, rgba(15, 15, 26, 0.72), rgba(9, 9, 17, 0.78));
  --modern-chat-surface: radial-gradient(1000px 680px at 82% -8%, rgba(155, 140, 255, 0.12), transparent 62%),
    radial-gradient(800px 600px at 0% 106%, rgba(255, 159, 176, 0.07), transparent 64%),
    linear-gradient(180deg, rgba(12, 12, 22, 0.82), rgba(7, 7, 13, 0.92)),
    url("/assets/img/hero-stars.jpg") center 36% / cover no-repeat;
  --modern-star: rgba(227, 219, 255, 0.24);
  --modern-constellation: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 180'%3E%3Cg fill='none' stroke='%23b3a4ff' stroke-width='0.7' opacity='0.5'%3E%3Cpath d='M20 120 76 84l44 26 58-52 48 34 52-24'/%3E%3Cpath d='M76 84l-8-44M120 110l22 44M178 58l-14-34M226 92l38 28'/%3E%3C/g%3E%3Cg fill='%23e8c57a'%3E%3Ccircle cx='20' cy='120' r='1.6'/%3E%3Ccircle cx='76' cy='84' r='1.2'/%3E%3Ccircle cx='120' cy='110' r='1.4'/%3E%3Ccircle cx='178' cy='58' r='1.8'/%3E%3Ccircle cx='226' cy='92' r='1.1'/%3E%3Ccircle cx='278' cy='68' r='1.5'/%3E%3C/g%3E%3C/svg%3E");

  --mh-surface-head: rgba(12, 12, 22, 0.74);
  --mh-surface-side: var(--modern-side-surface);
  --mh-surface-card: var(--modern-node-bg);
  --mh-surface-soft: linear-gradient(180deg, rgba(24, 24, 39, 0.78), rgba(15, 15, 26, 0.72));
  --mh-surface-toolbar: var(--modern-toolbar-bg);
  --mh-surface-input: rgba(255, 255, 255, 0.045);
  --mh-surface-foot: rgba(9, 9, 17, 0.68);
  --mh-surface-modal: linear-gradient(160deg, rgba(21, 21, 36, 0.97), rgba(11, 11, 20, 0.98));
  --mh-surface-detail: var(--modern-detail-surface);
  --mh-kind-tint: color-mix(in srgb, var(--kind-color, var(--brand)) 16%, transparent);
  --mh-kind-edge: color-mix(in srgb, var(--kind-color, var(--brand)) 34%, transparent);
  --mh-kind-ink: color-mix(in srgb, var(--kind-color, var(--brand)) 58%, #ffffff);
  --mh-node-spine: var(--kind-color, var(--brand));
  --sidebar-foot-border: rgba(255, 255, 255, 0.07);
}

/* ---------- 2. 基础与全局氛围 ---------- */
html {
  background-color: var(--bg);
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

body {
  margin: 0;
  font-family: var(--modern-sans);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1000px 720px at 6% -12%, rgba(255, 159, 176, 0.14), transparent 62%),
    radial-gradient(1180px 780px at 90% -16%, rgba(155, 140, 255, 0.20), transparent 64%),
    radial-gradient(920px 720px at 50% 112%, rgba(232, 197, 122, 0.12), transparent 64%),
    linear-gradient(180deg, #f8f9fd 0%, #f4f5fb 54%, #eef0f8 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html[data-theme="dark"] body {
  background-color: #07070d;
  background-image:
    radial-gradient(980px 680px at 10% -8%, rgba(255, 159, 176, 0.10), transparent 60%),
    radial-gradient(1120px 760px at 94% -12%, rgba(155, 140, 255, 0.18), transparent 64%),
    radial-gradient(1000px 760px at 50% 112%, rgba(232, 197, 122, 0.06), transparent 66%),
    linear-gradient(180deg, rgba(7, 7, 13, 0.58), rgba(7, 7, 13, 0.88)),
    url("/assets/img/hero-stars.jpg");
  background-size: auto, auto, auto, auto, cover;
  background-position: center, center, center, center, center 42%;
  background-attachment: fixed;
}

::selection {
  color: var(--text);
  background: rgba(155, 140, 255, 0.28);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--modern-line-strong) transparent;
}

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

*::-webkit-scrollbar-thumb {
  background: var(--modern-line-strong);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--text-4);
  border: 3px solid transparent;
  background-clip: content-box;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}

h1, h2, h3, h4, h5, p {
  margin: 0;
}

kbd {
  font-family: var(--font-mono);
  color: var(--text-3);
  background: var(--modern-tint);
  border: 1px solid var(--modern-line-strong);
  border-radius: 5px;
  box-shadow: none;
}

/* 去掉旧皮肤的纸纹、烫金角花、双线框与装饰噪音 */
.canvas-ornament,
.canvas-fog,
.detail-panel::before,
.detail-panel::after,
.detail-panel::before,
.detail-watermark,
.admin-substrate-card::before,
.admin-substrate-card::after,
.admin-detail::before,
.admin-chat::after,
.admin-hero-orbit,
.admin-hero-halo::after,
.admin-hero-moon,
.admin-detail-empty-illustration::before,
.admin-detail-empty-illustration::after,
.admin-detail-empty::after,
.admin-settings-modal::before,
.admin-settings-modal::after,
.modal::before,
.app-error-card::before,
.side-signature .sig-hat,
.side-signature .sig-phases,
.side-signature .sig-rule {
  display: none !important;
}

/* ---------- 3. 按钮 / 输入 / 焦点 ---------- */
.btn {
  height: 34px;
  padding: 0 14px;
  gap: 7px;
  font-family: var(--modern-sans);
  font-size: 12.5px;
  font-weight: 550;
  letter-spacing: 0.005em;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: background-color 160ms var(--modern-ease), border-color 160ms var(--modern-ease),
    color 160ms var(--modern-ease), box-shadow 160ms var(--modern-ease), transform 140ms var(--modern-ease);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.sm {
  height: 30px;
  padding: 0 11px;
  font-size: 11.5px;
  border-radius: 9px;
}

.btn.primary {
  color: var(--modern-primary-ink);
  background: var(--modern-primary-bg);
  border-color: transparent;
  box-shadow: var(--modern-primary-shadow);
}

html[data-theme="dark"] .btn.primary {
  color: var(--modern-primary-ink);
  background: var(--modern-primary-bg);
  border-color: transparent;
  box-shadow: var(--modern-primary-shadow);
  text-shadow: none;
}

html[data-theme="dark"] .btn.primary:hover {
  color: var(--modern-primary-ink);
  background: var(--modern-primary-bg);
  filter: brightness(1.07);
  box-shadow: var(--modern-primary-shadow), 0 0 24px rgba(155, 140, 255, 0.20);
}

.btn.primary:hover {
  background: var(--modern-primary-bg);
  filter: brightness(1.07);
  box-shadow: var(--modern-primary-shadow), 0 0 24px rgba(155, 140, 255, 0.18);
}

.btn.ghost {
  color: var(--text-2);
  background: transparent;
  border-color: transparent;
}

.btn.ghost:hover {
  color: var(--text);
  background: var(--bg-hover);
  border-color: var(--modern-line);
}

.btn.subtle,
.btn.outline {
  color: var(--text-2);
  background: var(--modern-tint);
  border-color: var(--modern-line);
  box-shadow: none;
}

.btn.subtle:hover,
.btn.outline:hover {
  color: var(--text);
  border-color: var(--modern-line-strong);
  background: var(--bg-hover);
}

.btn.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-border);
}

.btn.danger:hover {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
}

.btn:disabled {
  opacity: 0.5;
  transform: none;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-2);
  background: transparent;
  transition: background-color 160ms var(--modern-ease), border-color 160ms var(--modern-ease),
    color 160ms var(--modern-ease), transform 140ms var(--modern-ease);
}

.icon-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
  border-color: var(--modern-line);
}

.icon-btn.sm {
  width: 29px;
  height: 29px;
  border-radius: 8px;
}

.icon {
  stroke-width: 1.7;
}

.input,
.select,
.textarea {
  font-family: var(--modern-sans);
  color: var(--text);
  background: var(--modern-tint);
  border: 1px solid var(--modern-line);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 var(--modern-hairline);
}

html[data-theme="dark"] .input,
html[data-theme="dark"] .select,
html[data-theme="dark"] .textarea {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  background: var(--bg-elevated);
  border-color: var(--brand-border);
  box-shadow: var(--focus-ring);
}

.field-label {
  font-family: var(--modern-sans);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.field-hint {
  color: var(--text-3);
}

/* ---------- 4. 悬浮玻璃顶栏 ---------- */
.app-header {
  position: relative;
  z-index: 40;
  flex: 0 0 var(--header-h);
  height: var(--header-h);
  margin: 10px 16px 0;
  padding: 0 12px;
  gap: 14px;
  background: var(--modern-glass);
  border: 1px solid var(--modern-hairline);
  border-radius: 17px;
  box-shadow: var(--modern-shadow-panel), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  -webkit-backdrop-filter: blur(26px) saturate(1.4);
  backdrop-filter: blur(26px) saturate(1.4);
}

.app-header::after {
  display: none !important;
}

.brand {
  width: auto;
  min-width: 216px;
  gap: 11px;
}

.sidebar-toggle {
  color: var(--text-3);
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

.sidebar-toggle:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.brand-mark {
  position: relative;
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 11px;
  background: linear-gradient(145deg, #292335 0%, #17141f 100%);
  box-shadow: 0 5px 14px -8px rgba(26, 18, 48, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

html[data-theme="dark"] .brand-mark {
  border-color: rgba(255, 255, 255, 0.11);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.02));
  box-shadow: 0 4px 14px -8px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.brand-mark img,
.brand-mark .brand-svg {
  display: none;
}

/* 现代细线徽记：一弯月弧 + 一颗四角星 */
.brand-mark::before {
  content: "";
  width: 17px;
  height: 17px;
  border: 1.3px solid #8a672a;
  border-right-color: transparent;
  border-bottom-color: rgba(138, 103, 42, 0.20);
  border-radius: 50%;
  transform: rotate(-28deg);
  opacity: 0.95;
}

.brand-mark::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--aurora-violet);
  box-shadow:
    0 0 8px rgba(155, 140, 255, 0.75),
    0 0 0 2px rgba(155, 140, 255, 0.10);
}

html[data-theme="dark"] .brand-mark::before {
  border-color: rgba(232, 197, 122, 0.9);
  border-right-color: transparent;
  border-bottom-color: rgba(232, 197, 122, 0.22);
}

html[data-theme="dark"] .brand-mark::after {
  background: var(--aurora-rose);
  box-shadow:
    0 0 8px rgba(255, 159, 176, 0.65),
    0 0 0 2px rgba(255, 159, 176, 0.08);
}

.brand-text {
  min-width: 0;
}

.brand-title {
  font-family: var(--modern-display);
  font-size: 15px;
  font-weight: 620;
  line-height: 1.2;
  letter-spacing: 0.015em;
  color: var(--text);
  text-shadow: none;
}

html[data-theme="dark"] .brand-title {
  color: var(--text);
  text-shadow: none;
}

.brand-sub {
  margin-top: 2px;
  font-family: var(--modern-sans);
  font-size: 0;
  font-weight: 550;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--text-3);
  text-transform: none;
}

.brand-sub::after {
  content: "ASTRAL ARCHIVE · 星穹档案馆";
  display: block;
  font-size: 8.3px;
  font-weight: 550;
  letter-spacing: 0.16em;
  color: var(--text-3);
  white-space: nowrap;
}

.header-search {
  flex: 1;
  justify-content: flex-start;
}

.search-wrap {
  width: 344px;
  max-width: 100%;
}

.search-input {
  height: 38px;
  padding: 0 36px;
  font-size: 12.8px;
  letter-spacing: 0.005em;
  color: var(--text);
  background: color-mix(in srgb, var(--bg-elevated) 50%, transparent);
  border: 1px solid var(--modern-line);
  border-radius: 11px;
  box-shadow: inset 0 1px 0 var(--modern-hairline);
  transition: background-color 160ms var(--modern-ease), border-color 160ms var(--modern-ease),
    box-shadow 160ms var(--modern-ease);
}

html[data-theme="dark"] .search-input {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.075);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.search-input::placeholder {
  color: var(--text-3);
  letter-spacing: 0.015em;
}

.search-input:hover {
  border-color: var(--modern-line-strong);
}

.search-input:focus {
  background: var(--bg-elevated);
  border-color: var(--brand-border);
  box-shadow: var(--focus-ring);
}

.search-icon {
  left: 12px;
  color: var(--text-3);
  opacity: 1;
}

.search-kbd {
  right: 9px;
  color: var(--text-3);
  background: transparent;
  border-color: var(--modern-line-strong);
  box-shadow: none;
}

.header-actions {
  gap: 5px;
}

body .view-switch {
  gap: 2px;
  padding: 3px;
  margin-right: 6px;
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 11px;
  box-shadow: inset 0 1px 0 var(--modern-hairline);
}

body .view-switch-btn {
  height: 30px;
  padding: 0 12px;
  font-family: var(--modern-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-3);
  border-radius: 8px;
}

body .view-switch-btn .icon {
  width: 14px;
  height: 14px;
}

body .view-switch-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

body .view-switch-btn.active {
  color: var(--text);
  background: var(--modern-glass-strong);
  box-shadow: 0 2px 8px -2px rgba(34, 26, 80, 0.16), inset 0 1px 0 var(--modern-hairline);
  font-weight: 600;
}

body .view-switch-btn[data-view="admin"].active {
  color: var(--text);
  background: var(--modern-glass-strong);
}

html[data-theme="dark"] body .view-switch-btn.active {
  background: rgba(255, 255, 255, 0.09);
  box-shadow: 0 2px 10px -2px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.header-actions .btn.ghost {
  height: 34px;
  color: var(--text-2);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.header-actions .btn.ghost:hover {
  color: var(--text);
  background: var(--bg-hover);
  border-color: var(--modern-line);
}

.header-actions .btn.primary {
  height: 34px;
  padding: 0 16px;
  border-radius: 10px;
}

.header-divider {
  width: 1px;
  height: 18px;
  margin: 0 3px;
  background: var(--modern-line);
}

#btnTheme .icon {
  width: 17px;
  height: 17px;
}

.header-actions .icon-btn {
  color: var(--text-3);
}

.header-actions .icon-btn:hover {
  color: var(--text);
}

/* ---------- 5. 悬浮主壳与侧栏 ---------- */
.app-body {
  margin: 10px 16px 0;
  overflow: hidden;
  border: 1px solid var(--modern-hairline);
  border-radius: var(--modern-radius-lg);
  background: var(--modern-tint);
  box-shadow: var(--modern-shadow-shell);
}

html[data-theme="dark"] .app-body {
  border-color: var(--modern-line);
  background: rgba(255, 255, 255, 0.02);
}

.sidebar {
  background: var(--modern-side-surface);
  border-right: 1px solid var(--modern-line);
  box-shadow: none;
  -webkit-backdrop-filter: blur(24px) saturate(1.25);
  backdrop-filter: blur(24px) saturate(1.25);
}

html[data-theme="dark"] .sidebar {
  border-color: var(--modern-line);
  box-shadow: none;
}

.sidebar-scroll {
  padding: 16px 14px 8px;
}

.side-section {
  margin-bottom: 20px;
}

.side-heading {
  position: relative;
  height: auto;
  margin-bottom: 11px;
  padding: 0 4px;
  gap: 8px;
  font-family: var(--modern-sans);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.side-heading::before {
  content: "";
  width: 4px;
  height: 4px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  opacity: 0.8;
  transform: none;
}

.side-heading::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: -6px;
  height: 1px;
  background: linear-gradient(90deg, var(--modern-line), transparent 92%);
  pointer-events: none;
}

.side-heading .side-action {
  z-index: 1;
}

.side-action {
  padding: 2px 5px;
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--text-3);
  border-radius: 5px;
}

.side-action:hover {
  color: var(--brand);
  background: var(--brand-soft);
}

.stats-grid {
  gap: 7px;
  padding: 0 1px;
}

.stat-cell {
  padding: 11px 12px 9px;
  background: var(--modern-glass-strong);
  border: 1px solid var(--modern-line);
  border-radius: 13px;
  box-shadow: 0 6px 18px -16px rgba(35, 27, 80, 0.28), inset 0 1px 0 var(--modern-hairline);
  transition: transform 160ms var(--modern-ease), border-color 160ms var(--modern-ease),
    box-shadow 160ms var(--modern-ease);
}

html[data-theme="dark"] .stat-cell {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.075);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.stat-cell::before {
  display: none;
}

.stat-cell:hover {
  transform: translateY(-2px);
  border-color: var(--modern-line-strong);
  box-shadow: var(--modern-shadow-card);
}

.stat-value {
  font-family: var(--modern-display);
  font-size: 26px;
  font-weight: 380;
  line-height: 1.05;
  letter-spacing: -0.035em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-value .unit {
  font-family: var(--modern-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-3);
}

.stat-label {
  margin-top: 4px;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.kind-filters {
  gap: 1px;
}

.kind-row {
  position: relative;
  min-height: 31px;
  padding: 5px 8px;
  gap: 9px;
  font-size: 12.5px;
  color: var(--text-2);
  border-radius: 9px;
  transition: background-color 140ms var(--modern-ease), color 140ms var(--modern-ease);
}

.kind-row:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.kind-row.active {
  color: var(--text);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand-border);
}

.kind-row.active::before {
  display: none;
}

.kind-dot {
  width: 6px;
  height: 6px;
  background: var(--kind-color, var(--brand));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--kind-color, var(--brand)) 13%, transparent);
}

.kind-row .kind-count {
  font-family: var(--modern-sans);
  font-size: 10px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.kind-empty {
  font-size: 11.5px;
  color: var(--text-3);
}

.tag-filters {
  gap: 6px;
  padding: 0 1px;
}

.tag-chip-sm {
  padding: 3px 9px;
  font-size: 10.5px;
  letter-spacing: 0.01em;
  color: var(--text-2);
  background: var(--modern-glass-strong);
  border: 1px solid var(--modern-line);
  border-radius: 999px;
  box-shadow: none;
  transition: background-color 140ms var(--modern-ease), border-color 140ms var(--modern-ease);
}

html[data-theme="dark"] .tag-chip-sm {
  background: rgba(255, 255, 255, 0.04);
}

.tag-chip-sm:hover {
  color: var(--text);
  border-color: var(--modern-line-strong);
  background: var(--bg-hover);
}

.tag-chip-sm.active {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: var(--brand-border);
  box-shadow: none;
}

.tag-chip-sm .tag-count,
.tag-chip-sm.active .tag-count {
  color: var(--text-3);
  font-size: 9.5px;
}

.switch-list {
  gap: 1px;
  padding: 0;
}

.switch-row {
  padding: 7px 5px 7px 7px;
  font-size: 12px;
  color: var(--text-2);
  border-radius: 8px;
}

.switch-row:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.switch-track {
  width: 34px;
  height: 20px;
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line-strong);
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgba(28, 22, 64, 0.08);
}

html[data-theme="dark"] .switch-track {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.13);
}

.switch-thumb {
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border: 0;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(20, 16, 50, 0.24);
}

.switch-row input:checked + .switch-track {
  background: linear-gradient(135deg, #b8a9ff, #8a76f5);
  border-color: transparent;
  box-shadow: 0 0 0 3px rgba(155, 140, 255, 0.10);
}

.switch-row input:checked + .switch-track .switch-thumb {
  background: #ffffff;
  border-color: transparent;
  box-shadow: 0 1px 3px rgba(20, 16, 50, 0.3);
  transform: translateX(14px);
}

html[data-theme="dark"] .switch-row input:checked + .switch-track {
  background: linear-gradient(135deg, #cabbff, #907dff);
  border-color: transparent;
  box-shadow: 0 0 0 3px rgba(155, 140, 255, 0.13);
}

html[data-theme="dark"] .switch-row input:checked + .switch-track .switch-thumb {
  background: #16131f;
  border-color: transparent;
}

/* 把纵向空间留给筛选等真实功能，旧签名视为装饰噪音收起 */
.side-signature {
  display: none !important;
}

.sidebar-foot {
  gap: 8px;
  padding: 11px 17px;
  font-family: var(--modern-sans);
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--text-3);
  border-top: 1px solid var(--modern-line);
  background: transparent;
}

.sidebar-foot .icon {
  color: var(--text-3);
  opacity: 0.8;
}

/* ---------- 6. 公共画布 · 星野与玻璃节点 ---------- */
.workspace {
  background: var(--canvas-bg);
}

.canvas-area {
  background-color: var(--canvas-bg);
  background-image:
    radial-gradient(1040px 720px at 88% -12%, rgba(155, 140, 255, 0.21), transparent 62%),
    radial-gradient(820px 600px at -6% 108%, rgba(255, 159, 176, 0.13), transparent 64%),
    radial-gradient(700px 520px at 34% 112%, rgba(232, 197, 122, 0.09), transparent 68%),
    radial-gradient(circle at 1px 1px, var(--canvas-dot) 1px, transparent 0);
  background-size: auto, auto, auto, 26px 26px;
  background-position: center, center, center, 13px 13px;
}

html[data-theme="dark"] .canvas-area {
  background-color: #08080f;
  background-image:
    linear-gradient(180deg, rgba(7, 7, 13, 0.58) 0%, rgba(7, 7, 13, 0.74) 50%, rgba(7, 7, 13, 0.90) 100%),
    radial-gradient(1000px 620px at 82% -8%, rgba(155, 140, 255, 0.16), transparent 62%),
    radial-gradient(760px 520px at 2% 106%, rgba(255, 159, 176, 0.07), transparent 64%),
    radial-gradient(circle at 1px 1px, rgba(226, 218, 255, 0.14) 1px, transparent 0),
    url("/assets/img/hero-stars.jpg");
  background-size: auto, auto, auto, 26px 26px, cover;
  background-position: center, center, center, 13px 13px, center 40%;
  background-repeat: no-repeat, no-repeat, no-repeat, repeat, no-repeat;
}

.canvas-stars {
  display: none;
}

.canvas-atmosphere::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 0;
  pointer-events: none;
  background:
    radial-gradient(560px 380px at 78% 6%, rgba(155, 140, 255, 0.10), transparent 66%),
    radial-gradient(420px 300px at 8% 88%, rgba(255, 159, 176, 0.06), transparent 70%);
}

html[data-theme="dark"] .canvas-atmosphere::before {
  border: 0;
  background:
    radial-gradient(600px 400px at 82% 4%, rgba(155, 140, 255, 0.15), transparent 66%),
    radial-gradient(460px 340px at 6% 92%, rgba(255, 159, 176, 0.07), transparent 70%);
}

.canvas-atmosphere::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 16px;
  width: 300px;
  height: 172px;
  background: var(--modern-constellation) center / contain no-repeat;
  opacity: 0.32;
  pointer-events: none;
}

html[data-theme="dark"] .canvas-atmosphere::after {
  right: 18px;
  bottom: 16px;
  opacity: 0.38;
}

/* 旧月牙让位于照片与星座细线：只保留极淡的一层月光，不抢节点 */
.canvas-moon {
  display: none;
}

.tree-edges path {
  stroke: var(--edge);
  stroke-width: 1.05;
  fill: none;
}

html[data-theme="dark"] .tree-edges path {
  stroke: var(--edge);
}

.tree-edges path.hot {
  stroke: var(--edge-hot);
  stroke-width: 1.4;
  filter: drop-shadow(0 0 4px rgba(155, 140, 255, 0.26));
}

.tree-edges path.selected-path {
  stroke: var(--brand);
  stroke-width: 1.45;
  opacity: 0.82;
}

/* 节点卡片：尺寸契约 244 × 78 保持不变 */
.node-card {
  width: 244px;
  height: 78px;
  padding: 10px 12px 12px;
  overflow: hidden;
  background: var(--modern-node-bg);
  border: 1px solid var(--modern-node-border);
  border-left: 3px solid var(--kind-color, var(--brand));
  border-radius: 15px;
  box-shadow: var(--modern-node-shadow);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  transition: transform 170ms var(--modern-ease), box-shadow 170ms var(--modern-ease),
    border-color 170ms var(--modern-ease), background-color 170ms var(--modern-ease);
}

html[data-theme="dark"] .node-card {
  border-color: rgba(255, 255, 255, 0.11);
  border-left-color: var(--kind-color, var(--brand));
  background: linear-gradient(158deg, rgba(31, 29, 49, 0.86), rgba(15, 15, 26, 0.80));
  box-shadow: 0 16px 34px -24px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.node-card::before {
  content: "";
  position: absolute;
  inset: 0 12px auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), transparent);
  opacity: 0.7;
  pointer-events: none;
}

html[data-theme="dark"] .node-card::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
}

.node-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--kind-color, var(--brand)) 34%, var(--modern-node-border));
  border-left-color: var(--kind-color, var(--brand));
  box-shadow: var(--modern-node-shadow-hover);
}

.node-card.selected {
  border-color: color-mix(in srgb, var(--kind-color, var(--brand)) 58%, transparent);
  border-left-color: var(--kind-color, var(--brand));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--kind-color, var(--brand)) 48%, transparent),
    0 0 0 5px color-mix(in srgb, var(--kind-color, var(--brand)) 10%, transparent),
    var(--modern-node-shadow-hover);
}

.node-card.in-path {
  border-color: color-mix(in srgb, var(--kind-color, var(--brand)) 30%, var(--modern-node-border));
  box-shadow: var(--modern-node-shadow);
}

.node-card.search-hit {
  border-color: var(--aurora-gold);
  box-shadow:
    0 0 0 1px rgba(232, 197, 122, 0.55),
    0 0 26px -6px rgba(232, 197, 122, 0.5),
    var(--modern-node-shadow-hover);
}

.node-card.is-archived {
  opacity: 0.55;
  border-style: dashed;
  border-left-style: solid;
}

.node-card.is-expired .node-title {
  color: var(--text-2);
}

.node-title {
  font-family: var(--modern-sans);
  font-size: 13.4px;
  font-weight: 620;
  letter-spacing: 0.002em;
  line-height: 1.38;
  color: var(--text);
}

.node-meta {
  margin-top: 4px;
  font-size: 10.4px;
  letter-spacing: 0.01em;
  color: var(--text-3);
}

.node-kind {
  font-weight: 600;
  color: var(--mh-kind-ink);
}

.node-icon {
  width: 27px;
  height: 27px;
  font-size: 12.5px;
  background: color-mix(in srgb, var(--kind-color, var(--brand)) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--kind-color, var(--brand)) 24%, transparent);
  border-radius: 9px;
}

.node-count {
  height: 17px;
  padding: 0 6px;
  font-size: 9.5px;
  font-weight: 650;
  color: var(--text-2);
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 999px;
}

.node-importance {
  left: 12px;
  right: 12px;
  bottom: 7px;
  height: 2px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--kind-color, var(--brand)) 12%, transparent);
}

.node-importance > i {
  background: linear-gradient(90deg, var(--kind-color, var(--brand)), color-mix(in srgb, var(--kind-color, var(--brand)) 28%, transparent));
}

.node-toggle {
  width: 20px;
  height: 20px;
  color: var(--text-2);
  background: var(--modern-glass-strong);
  border: 1px solid var(--modern-line-strong);
  border-radius: 50%;
  box-shadow: 0 2px 7px -3px rgba(30, 24, 70, 0.30);
}

html[data-theme="dark"] .node-toggle {
  background: rgba(24, 23, 37, 0.9);
}

.node-toggle:hover {
  color: var(--text);
  background: var(--bg-hover);
  border-color: var(--brand-border);
}

.node-state {
  top: -9px;
  padding: 1px 7px;
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--text-3);
  background: var(--modern-glass-strong);
  border: 1px solid var(--modern-line);
  border-radius: 999px;
  box-shadow: 0 2px 8px -5px rgba(30, 24, 70, 0.3);
}

html[data-theme="dark"] .node-state {
  background: rgba(22, 21, 34, 0.92);
}

.node-state.state-future {
  color: var(--info);
  border-color: color-mix(in srgb, var(--info) 32%, transparent);
}

/* 画布浮件 */
.tree-toolbar {
  top: 18px;
  right: 18px;
  padding: 4px;
  background: var(--modern-toolbar-bg);
  border: 1px solid var(--modern-hairline);
  border-radius: 14px;
  box-shadow: var(--modern-shadow-panel), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
  backdrop-filter: blur(22px) saturate(1.35);
}

html[data-theme="dark"] .tree-toolbar {
  border-color: var(--modern-line);
  box-shadow: 0 16px 36px -22px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.toolbar-sep {
  background: var(--modern-line);
}

.tree-toolbar .btn {
  color: var(--text-2);
  letter-spacing: 0.01em;
}

.tree-toolbar .btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.zoom-level {
  min-width: 46px;
  color: var(--text-2);
  font-family: var(--modern-sans);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  border-radius: 8px;
}

.zoom-level:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.canvas-hint {
  left: 18px;
  bottom: 16px;
  padding: 7px 11px;
  gap: 7px;
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--text-3);
  background: var(--modern-toolbar-bg);
  border: 1px solid var(--modern-hairline);
  border-radius: 9px;
  box-shadow: 0 6px 18px -14px rgba(30, 24, 70, 0.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  backdrop-filter: blur(16px) saturate(1.25);
  opacity: 1;
}

html[data-theme="dark"] .canvas-hint {
  border-color: var(--modern-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.canvas-hint .icon {
  color: var(--text-3);
  opacity: 1;
}

/* 空态：电影感大图收进玻璃卡 */
.tree-empty,
.tree-error {
  inset: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-height: calc(100% - 56px);
  overflow: auto;
}

.tree-empty {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  align-items: center;
  align-content: center;
  gap: 12px 28px;
  width: min(780px, calc(100% - 52px));
  padding: 28px;
  text-align: left;
  background: var(--modern-glass);
  border: 1px solid var(--modern-hairline);
  border-radius: 24px;
  box-shadow: var(--modern-shadow-shell);
  -webkit-backdrop-filter: blur(26px) saturate(1.3);
  backdrop-filter: blur(26px) saturate(1.3);
}

html[data-theme="dark"] .tree-empty {
  border-color: var(--modern-line);
  background: rgba(13, 13, 23, 0.62);
}

.empty-illustration {
  position: relative;
  display: block;
  grid-column: 1;
  grid-row: 1 / 4;
  width: 100%;
  height: 254px;
  margin: 0;
  border-radius: 17px;
  background:
    linear-gradient(180deg, transparent 42%, rgba(7, 7, 13, 0.42) 100%),
    url("/assets/img/welcome-reading.jpg") center 38% / cover no-repeat;
  border: 1px solid var(--modern-hairline);
  box-shadow: 0 18px 40px -26px rgba(20, 14, 48, 0.5);
  filter: none;
}

.empty-illustration::after {
  content: "THE ARCHIVE AWAITS";
  position: absolute;
  left: 16px;
  bottom: 13px;
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.24em;
  color: rgba(255, 255, 255, 0.74);
}

.empty-illustration svg,
.empty-illustration img {
  display: none;
}

.tree-empty h2 {
  grid-column: 2;
  align-self: end;
  font-family: var(--modern-serif);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: 0.005em;
  line-height: 1.15;
  color: var(--text);
}

.tree-empty h2::after {
  display: none;
}

.tree-empty p {
  grid-column: 2;
  max-width: 360px;
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--text-2);
}

.empty-actions {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 6px;
}

.tree-error {
  display: flex;
  max-width: 520px;
  padding: 34px;
  text-align: center;
  background: var(--modern-glass);
  border: 1px solid var(--modern-hairline);
  border-radius: 20px;
  box-shadow: var(--modern-shadow-panel);
}

.tree-error h2 {
  font-family: var(--modern-serif);
  font-size: 28px;
  font-weight: 500;
}

.tree-error p {
  font-size: 12.5px;
  color: var(--text-2);
}

.error-icon {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  border-radius: 50%;
}

.sk-card,
.sk-line,
.sk-block {
  background: linear-gradient(100deg, var(--bg-subtle) 30%, var(--bg-hover) 50%, var(--bg-subtle) 70%);
  background-size: 220% 100%;
  border-color: var(--modern-line);
}

/* 历史视角 */
.history-banner {
  height: 44px;
  padding: 0 18px;
  font-size: 11.5px;
  color: var(--text-2);
  background: color-mix(in srgb, var(--bg-elevated) 78%, transparent);
  border-bottom: 1px solid var(--modern-line);
  box-shadow: none;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.history-banner > .icon {
  color: var(--brand);
}

.history-text strong {
  font-family: var(--modern-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
}

.history-lock {
  padding: 1px 8px;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  border-radius: 999px;
}

/* ---------- 7. 公共详情面板 · 白玻璃档案页 ---------- */
.detail-panel {
  position: relative;
  isolation: isolate;
  background-color: transparent;
  background-image: var(--modern-detail-surface);
  border-left: 1px solid var(--modern-line-strong);
  box-shadow: -22px 0 56px -48px rgba(30, 24, 70, 0.45);
  -webkit-backdrop-filter: blur(26px) saturate(1.25);
  backdrop-filter: blur(26px) saturate(1.25);
}

html[data-theme="dark"] .detail-panel {
  background-color: transparent;
  background-image: var(--modern-detail-surface);
  border-color: var(--modern-line);
  box-shadow: -22px 0 60px -46px rgba(0, 0, 0, 0.9);
}

.detail-empty,
.detail-errorbox {
  align-items: stretch;
  justify-content: center;
  gap: 13px;
  padding: 30px 26px;
  text-align: left;
}

.detail-empty-icon {
  position: relative;
  display: block;
  width: 100%;
  height: 212px;
  margin: 0 0 5px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(7, 7, 13, 0.10) 0%, transparent 44%, rgba(7, 7, 13, 0.62) 100%),
    url("/assets/img/bg-candle.jpg") center 54% / cover no-repeat;
  border: 1px solid var(--modern-hairline);
  border-radius: 17px;
  box-shadow: 0 18px 42px -28px rgba(20, 14, 48, 0.5);
  filter: none;
}

.detail-empty-icon::before {
  display: none;
}

.detail-empty-icon::after {
  content: "ASTRAL ARCHIVE · 记忆档案";
  position: absolute;
  left: 15px;
  bottom: 13px;
  font-family: var(--font-mono);
  font-size: 7.2px;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.78);
}

.detail-empty-icon img {
  display: none;
}

.detail-empty h3,
.detail-errorbox h3 {
  font-family: var(--modern-serif);
  font-size: 23px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.005em;
  color: var(--text);
  text-align: left;
}

.detail-empty h3::after {
  display: none;
}

.detail-empty p,
.detail-errorbox p {
  max-width: 100%;
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--text-2);
  text-align: left;
  text-wrap: pretty;
}

.detail-empty .btn {
  align-self: flex-start;
  margin-top: 2px;
}

.detail-content {
  background: transparent;
}

.detail-head {
  padding: 24px 22px 15px;
}

.detail-head::after {
  display: none;
}

.detail-kicker {
  gap: 6px;
}

.kind-chip {
  height: 23px;
  padding: 0 9px;
  font-family: var(--modern-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.015em;
  color: var(--mh-kind-ink);
  background: color-mix(in srgb, var(--kind-color, var(--brand)) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--kind-color, var(--brand)) 25%, transparent);
  border-radius: 999px;
}

.kind-chip .kind-emoji {
  font-size: 11px;
}

.state-chip {
  height: 23px;
  padding: 0 9px;
  font-size: 9.5px;
  font-weight: 550;
  letter-spacing: 0.03em;
  color: var(--text-3);
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 999px;
}

.version-chip {
  height: 23px;
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-3);
  background: transparent;
  border: 1px solid var(--modern-line);
  border-radius: 999px;
}

.detail-title {
  margin: 12px 0 7px;
  font-family: var(--modern-sans);
  font-size: 23px;
  font-weight: 640;
  line-height: 1.4;
  letter-spacing: -0.018em;
  color: var(--text);
}

.detail-sub {
  gap: 5px 8px;
  font-size: 10.5px;
  letter-spacing: 0.005em;
  color: var(--text-3);
}

.detail-sub .dot {
  opacity: 0.55;
}

.detail-actions {
  gap: 6px;
  margin-top: 14px;
}

.detail-actions .btn {
  height: 30px;
  padding: 0 10px;
  font-size: 11px;
  color: var(--text-2);
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  box-shadow: none;
}

.detail-actions .btn:hover {
  color: var(--text);
  background: var(--bg-hover);
  border-color: var(--modern-line-strong);
}

.detail-actions .btn.primary {
  color: var(--modern-primary-ink);
  background: var(--modern-primary-bg);
  border-color: transparent;
  box-shadow: var(--modern-primary-shadow);
}

html[data-theme="dark"] .detail-actions .btn.primary {
  color: var(--modern-primary-ink);
  background: var(--modern-primary-bg);
}

.detail-crumbs {
  gap: 1px;
  padding: 2px 22px 12px;
  font-size: 10px;
  letter-spacing: 0.005em;
  color: var(--text-3);
}

.crumb {
  padding: 2px 5px;
  color: var(--text-3);
  border-radius: 5px;
}

.crumb:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.crumb.current {
  color: var(--brand);
  font-weight: 600;
}

.crumb-sep {
  color: var(--text-4);
}

.detail-scroll {
  padding: 0 22px 34px;
}

.detail-section {
  margin-top: 21px;
}

.section-head {
  align-items: center;
  gap: 8px;
  margin-bottom: 11px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--modern-line);
}

.content-head {
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--modern-line);
}

.section-title {
  gap: 7px;
  font-family: var(--modern-sans);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.section-title::before {
  display: none;
}

.section-title .icon {
  width: 12px;
  height: 12px;
  color: var(--text-3);
  opacity: 0.9;
}

.section-count {
  min-width: 18px;
  height: 17px;
  font-size: 9px;
  color: var(--text-3);
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
}

.section-link {
  padding: 2px 5px;
  font-size: 10px;
  color: var(--text-3);
  border-radius: 5px;
}

.section-link:hover {
  color: var(--brand);
  background: var(--brand-soft);
}

.meta-card {
  padding: 14px;
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 13px;
  box-shadow: none;
}

.meta-label {
  margin-bottom: 4px;
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.meta-value {
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--text-2);
}

.meta-value.strong {
  color: var(--text);
  font-weight: 600;
}

.imp-track {
  height: 4px;
  background: var(--modern-line);
  box-shadow: none;
  border-radius: 999px;
}

.imp-fill {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--kind-color, var(--brand)), var(--aurora-violet));
}

.imp-num {
  font-size: 10px;
  color: var(--text-3);
}

.tag-list {
  gap: 6px;
}

.tag-chip {
  padding: 3px 9px;
  font-size: 10px;
  letter-spacing: 0.01em;
  color: var(--text-2);
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 999px;
}

.tag-chip:hover {
  color: var(--text);
  border-color: var(--modern-line-strong);
}

.md {
  font-family: var(--modern-sans);
  font-size: 13.2px;
  line-height: 1.9;
  letter-spacing: 0.005em;
  color: var(--text);
}

.md h1,
.md h2,
.md h3,
.md h4 {
  font-family: var(--modern-sans);
  font-weight: 650;
  letter-spacing: -0.01em;
}

.content-body {
  color: var(--text);
}

.detail-empty p kbd {
  font-size: 9.5px;
}

/* 详情中的操作、版本与关联记忆 */
.link-item,
.version-item {
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 11px;
}

.link-item:hover,
.version-item:hover {
  border-color: var(--modern-line-strong);
  background: var(--bg-hover);
}

.access-row {
  gap: 6px;
}

.access-stat {
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 10px;
}

.access-stat .k {
  font-size: 8.5px;
  color: var(--text-3);
}

.access-stat .v {
  color: var(--text);
}

.detail-note {
  color: var(--text-2);
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  border-radius: 11px;
}

/* ---------- 8. 状态栏 ---------- */
.status-bar {
  flex: 0 0 var(--status-h);
  height: var(--status-h);
  gap: 16px;
  padding: 0 26px;
  font-family: var(--modern-sans);
  font-size: 9.5px;
  letter-spacing: 0.045em;
  color: var(--text-3);
  background: transparent;
  border-top: 0;
  box-shadow: none;
}

html[data-theme="dark"] .status-bar {
  background: transparent;
  box-shadow: none;
}

.status-center {
  color: var(--text-4);
  letter-spacing: 0.05em;
}

.status-center kbd {
  height: 16px;
  min-width: 16px;
  padding: 0 4px;
  font-size: 9px;
  color: var(--text-3);
  background: transparent;
  border-color: var(--modern-line-strong);
}

.status-sep {
  color: var(--text-4);
  opacity: 0.7;
}

.status-health .health-dot {
  width: 5px;
  height: 5px;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.pulse-dot {
  width: 5px;
  height: 5px;
  background: var(--aurora-gold);
  box-shadow: 0 0 0 3px var(--mh-gold-soft);
}

html[data-theme="dark"] .status-center,
html[data-theme="dark"] .status-bar {
  color: var(--text-3);
}

/* ---------- 9. 管理员视图 · 星空会客厅 ---------- */
.admin-view,
.admin-settings-modal {
  --adm-panel: #f7f7fd;
  --adm-panel-2: #ffffff;
  --adm-chat: #f5f6fb;
  --adm-card: rgba(255, 255, 255, 0.62);
  --adm-card-solid: #ffffff;
  --adm-line: rgba(25, 24, 48, 0.12);
  --adm-line-soft: rgba(25, 24, 48, 0.07);
  --adm-gold: var(--mh-gold-ink);
  --adm-gold-bright: var(--mh-gold);
  --adm-rose: var(--mh-rose);
  --adm-violet: var(--mh-violet);
  --adm-ink: var(--text);
  --adm-muted: var(--text-3);
  --adm-glass: rgba(255, 255, 255, 0.64);
  --adm-shadow: var(--modern-shadow-panel);
  --adm-shadow-lift: var(--modern-shadow-shell);
  --adm-side-w: 304px;
  --adm-detail-w: 334px;
}

html[data-theme="dark"] .admin-view,
html[data-theme="dark"] .admin-settings-modal {
  --adm-panel: #0c0c15;
  --adm-panel-2: #101019;
  --adm-chat: #08080f;
  --adm-card: rgba(255, 255, 255, 0.045);
  --adm-card-solid: #11111c;
  --adm-line: rgba(255, 255, 255, 0.12);
  --adm-line-soft: rgba(255, 255, 255, 0.07);
  --adm-gold: var(--mh-gold);
  --adm-gold-bright: var(--mh-gold-bright);
  --adm-rose: var(--mh-rose);
  --adm-violet: var(--mh-violet);
  --adm-glass: rgba(15, 15, 26, 0.60);
  --adm-shadow: var(--modern-shadow-panel);
  --adm-shadow-lift: var(--modern-shadow-shell);
}

.admin-view {
  margin: 10px 16px 0;
  overflow: hidden;
  border: 1px solid var(--modern-hairline);
  border-radius: var(--modern-radius-lg);
  background: var(--modern-chat-surface);
  box-shadow: var(--modern-shadow-shell);
}

html[data-theme="dark"] .admin-view {
  border-color: var(--modern-line);
}

body.mode-admin .header-actions {
  gap: 5px;
}

body.mode-admin .app-body {
  display: none;
}

/* 9.1 左栏 · 她的房间 */
.admin-side {
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(420px 300px at 50% -8%, rgba(232, 197, 122, 0.10), transparent 64%),
    radial-gradient(360px 420px at 112% 20%, rgba(155, 140, 255, 0.09), transparent 70%),
    var(--modern-side-surface);
  border-right: 1px solid var(--modern-line);
  box-shadow: none;
  -webkit-backdrop-filter: blur(24px) saturate(1.25);
  backdrop-filter: blur(24px) saturate(1.25);
}

html[data-theme="dark"] .admin-side {
  background:
    radial-gradient(420px 300px at 50% -8%, rgba(232, 197, 122, 0.08), transparent 64%),
    radial-gradient(380px 440px at 112% 16%, rgba(155, 140, 255, 0.10), transparent 70%),
    var(--modern-side-surface);
  border-color: var(--modern-line);
  box-shadow: none;
}

.admin-side::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  width: 100%;
  height: 330px;
  right: auto;
  bottom: auto;
  z-index: 0;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(7, 7, 13, 0.02) 0%, rgba(247, 247, 253, 0.58) 46%, var(--adm-panel) 100%),
    url("/assets/img/portrait-banner.webp") center 22% / cover no-repeat;
  opacity: 0.10;
  filter: saturate(0.88);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.55) 58%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.55) 58%, transparent 100%);
  pointer-events: none;
}

html[data-theme="light"] .admin-side::before {
  display: none;
}

html[data-theme="dark"] .admin-side::before {
  background:
    linear-gradient(180deg, rgba(7, 7, 13, 0.18) 0%, rgba(12, 12, 21, 0.58) 56%, var(--adm-panel) 100%),
    url("/assets/img/portrait-banner.webp") center 28% / cover no-repeat;
  opacity: 0.28;
}

.admin-side > * {
  position: relative;
  z-index: 1;
}

.admin-identity {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 23px 18px 15px;
  text-align: center;
}

.admin-avatar {
  position: relative;
  width: 88px;
  height: 88px;
  padding: 2px;
  border-radius: 50%;
  background: conic-gradient(from 210deg, #dfe4f2, #e8c57a 22%, #cdbfa1 40%, #b8a9ff 64%, #f0d9aa 84%, #dfe4f2);
  box-shadow:
    0 12px 28px -14px rgba(30, 24, 70, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.24),
    0 0 0 6px rgba(155, 140, 255, 0.06);
}

html[data-theme="dark"] .admin-avatar {
  box-shadow:
    0 16px 34px -18px rgba(0, 0, 0, 0.82),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 0 6px rgba(155, 140, 255, 0.07),
    0 0 28px rgba(232, 197, 122, 0.10);
}

.admin-avatar::before {
  content: "";
  position: absolute;
  inset: -24px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 197, 122, 0.12), rgba(155, 140, 255, 0.06) 42%, transparent 68%);
  pointer-events: none;
}

.admin-avatar-img,
.admin-avatar-svg {
  inset: 2px;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  object-position: center 22%;
}

.admin-avatar-orbit {
  display: none;
}

.admin-identity-text {
  min-width: 0;
  width: 100%;
}

.admin-identity-text::before {
  content: "ASTRAL ARCHIVE · KEEPER";
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 500;
  letter-spacing: 0.26em;
  color: var(--text-3);
  opacity: 1;
}

.admin-name {
  font-family: var(--modern-serif);
  font-size: 29px;
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: 0.03em;
  color: var(--text);
  text-shadow: none;
}

html[data-theme="dark"] .admin-name {
  color: var(--text);
  text-shadow: none;
}

.admin-title {
  justify-content: center;
  gap: 0;
  margin-top: 5px;
  font-family: var(--modern-sans);
  font-size: 9px;
  font-weight: 550;
  letter-spacing: 0.16em;
  color: var(--text-3);
}

.admin-title::before,
.admin-title::after {
  display: none;
}

.admin-motto {
  margin-top: 7px;
  font-family: var(--modern-sans);
  font-size: 11px;
  font-style: normal;
  letter-spacing: 0.03em;
  color: var(--text-3);
  opacity: 1;
}

/* 本体统计卡 */
.admin-substrate-card {
  flex: 0 0 auto;
  margin: 0 15px 11px;
  padding: 13px;
  overflow: hidden;
  background: var(--adm-card);
  border: 1px solid var(--modern-line);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 var(--modern-hairline);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
}

html[data-theme="dark"] .admin-substrate-card {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.075);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.admin-card-head {
  align-items: baseline;
  margin-bottom: 10px;
}

.admin-card-label {
  font-family: var(--modern-sans);
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--text-3);
}

.admin-card-label::before {
  display: none;
}

.admin-card-hint {
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.02em;
  color: var(--text-4);
}

.admin-stats {
  gap: 7px;
}

.admin-stat {
  gap: 2px;
  padding: 10px 10px 8px;
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 11px;
  transition: transform 150ms var(--modern-ease), border-color 150ms var(--modern-ease),
    background-color 150ms var(--modern-ease), box-shadow 150ms var(--modern-ease);
}

html[data-theme="dark"] .admin-stat {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.07);
}

.admin-stat::before {
  display: none;
}

.admin-stat::after {
  display: none;
}

.admin-stat:hover {
  transform: translateY(-2px);
  background: var(--bg-hover);
  border-color: var(--modern-line-strong);
  box-shadow: none;
}

.admin-stat.active {
  background: var(--brand-soft);
  border-color: var(--brand-border);
  box-shadow: inset 0 0 0 1px var(--brand-border);
}

.admin-stat-value {
  font-family: var(--modern-display);
  font-size: 28px;
  font-weight: 380;
  line-height: 1.02;
  letter-spacing: -0.04em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.admin-stat-label {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.admin-stat.error .admin-stat-value {
  color: var(--warning);
  font-size: 18px;
}

/* 引擎徽章 */
.admin-engine {
  flex: 0 0 auto;
  gap: 9px;
  margin: 0 15px 10px;
  padding: 10px 12px;
  overflow: hidden;
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 12px;
  box-shadow: none;
  transition: transform 150ms var(--modern-ease), border-color 150ms var(--modern-ease),
    background-color 150ms var(--modern-ease);
}

html[data-theme="dark"] .admin-engine {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(255, 255, 255, 0.07);
}

.admin-engine::before {
  display: none;
}

.admin-engine:hover {
  transform: translateY(-1px);
  border-color: var(--modern-line-strong);
  background: var(--bg-hover);
  box-shadow: none;
}

.admin-engine-dot {
  width: 7px;
  height: 7px;
  background: var(--text-4);
  box-shadow: 0 0 0 3px var(--modern-line);
}

.admin-engine.on-flagship .admin-engine-dot {
  background: var(--aurora-violet);
  box-shadow: 0 0 0 3px rgba(155, 140, 255, 0.13), 0 0 12px rgba(155, 140, 255, 0.55);
}

.admin-engine.on-local .admin-engine-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft), 0 0 12px rgba(97, 214, 166, 0.4);
}

.admin-engine.off .admin-engine-dot {
  background: var(--warning);
  box-shadow: 0 0 0 3px var(--warning-soft);
}

.admin-engine-title {
  font-family: var(--modern-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--text);
}

.admin-engine-sub {
  font-size: 9px;
  letter-spacing: 0.01em;
  color: var(--text-3);
}

.admin-engine > .icon {
  color: var(--text-3);
  opacity: 1;
}

/* 左栏操作与标签页 */
.admin-side-actions {
  gap: 7px;
  padding: 0 15px 10px;
}

.admin-side-actions .btn {
  height: 31px;
  font-size: 11px;
  letter-spacing: 0.01em;
  color: var(--text-2);
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 9px;
  box-shadow: none;
}

.admin-side-actions .btn:hover,
.admin-side-actions .icon-btn:hover {
  color: var(--text);
  border-color: var(--modern-line-strong);
  background: var(--bg-hover);
}

.admin-side-actions .icon-btn {
  width: 31px;
  height: 31px;
  color: var(--text-2);
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 9px;
  box-shadow: none;
}

.admin-tabs {
  gap: 1px;
  padding: 0 12px;
  border-bottom: 1px solid var(--modern-line);
}

.admin-tab {
  gap: 6px;
  height: 40px;
  font-size: 11px;
  letter-spacing: 0.01em;
  color: var(--text-3);
}

.admin-tab .icon {
  width: 13px;
  height: 13px;
  opacity: 0.8;
}

.admin-tab:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.admin-tab.active {
  color: var(--text);
  font-weight: 600;
}

.admin-tab.active .icon {
  opacity: 1;
  color: var(--brand);
}

.admin-tab.active::after {
  right: 18%;
  left: 18%;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  box-shadow: none;
}

.admin-tab.active::before {
  display: none;
}

.admin-tree-scroll {
  padding: 9px 10px 12px;
}

.admin-tree-toolbar {
  padding: 0 7px 8px;
}

.admin-tree-meta {
  font-family: var(--modern-sans);
  font-size: 8.5px;
  letter-spacing: 0.02em;
  color: var(--text-4);
}

.admin-tree-toolbar .side-action {
  font-size: 9px;
  color: var(--text-3);
}

.admin-tree-row {
  min-height: 30px;
  border-radius: 8px;
}

.admin-tree-row:hover {
  background: var(--bg-hover);
}

.admin-tree-row.selected {
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand-border);
}

.admin-tree-row.selected::after {
  background: var(--brand);
  box-shadow: none;
}

.admin-tree-title {
  font-size: 11.5px;
  letter-spacing: 0.005em;
}

.admin-tree-row.selected .admin-tree-title {
  color: var(--text);
}

.admin-tree-toggle {
  color: var(--text-3);
}

.admin-tree-toggle:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.admin-tree-toggle .icon {
  width: 12px;
  height: 12px;
}

.admin-tree-count {
  color: var(--text-4);
}

.admin-tree-dot {
  box-shadow: none;
}

.admin-tree-node.kind-section > .admin-tree-row .admin-tree-title {
  font-family: var(--modern-sans);
  font-size: 9px;
  letter-spacing: 0.13em;
  color: var(--text-3);
}

.admin-panel-state {
  color: var(--text-3);
}

.admin-panel-state > .icon {
  color: var(--text-3);
  opacity: 0.8;
}

.admin-growth::before {
  background: var(--modern-line);
}

.admin-growth-item {
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 11px;
}

.admin-growth-item:hover {
  background: var(--bg-hover);
  border-color: var(--modern-line-strong);
}

.admin-growth-icon {
  background: var(--brand-soft);
  border-color: var(--brand-border);
  color: var(--brand);
}

.admin-growth-icon.distill {
  background: var(--mh-gold-soft);
  border-color: var(--mh-gold-line);
  color: var(--mh-gold-ink);
}

.admin-growth-title {
  font-size: 11.5px;
  color: var(--text);
}

.admin-growth-content,
.admin-growth-meta {
  color: var(--text-3);
}

.admin-growth-tag {
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  color: var(--text-3);
}

.admin-prompt-preview {
  border-color: var(--modern-line);
}

.admin-prompt-preview summary {
  color: var(--text-3);
}

.admin-prompt-preview summary:hover {
  color: var(--brand);
}

.admin-prompt-preview pre {
  color: var(--text-2);
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 10px;
}

/* 9.2 中栏 · 与她的对话 */
.admin-chat {
  position: relative;
  isolation: isolate;
  background: var(--modern-chat-surface);
  border-right: 1px solid var(--modern-line);
}

html[data-theme="dark"] .admin-chat {
  background: var(--modern-chat-surface);
}

.admin-chat::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 16% 18%, rgba(155, 140, 255, 0.30), transparent 62%),
    radial-gradient(1.2px 1.2px at 76% 10%, rgba(232, 197, 122, 0.32), transparent 62%),
    radial-gradient(1px 1px at 62% 42%, rgba(155, 140, 255, 0.22), transparent 62%),
    radial-gradient(1.1px 1.1px at 90% 62%, rgba(232, 197, 122, 0.18), transparent 62%),
    radial-gradient(1px 1px at 30% 76%, rgba(155, 140, 255, 0.20), transparent 62%);
  opacity: 0.72;
}

html[data-theme="dark"] .admin-chat::before {
  background-image:
    radial-gradient(1.1px 1.1px at 16% 18%, rgba(231, 221, 255, 0.55), transparent 62%),
    radial-gradient(1.3px 1.3px at 76% 10%, rgba(232, 197, 122, 0.45), transparent 62%),
    radial-gradient(1px 1px at 62% 42%, rgba(155, 140, 255, 0.45), transparent 62%),
    radial-gradient(1.2px 1.2px at 90% 62%, rgba(232, 197, 122, 0.32), transparent 62%),
    radial-gradient(1px 1px at 30% 76%, rgba(198, 185, 255, 0.35), transparent 62%);
  opacity: 0.78;
}

.admin-chat::after {
  top: -220px;
  right: -160px;
  width: 520px;
  height: 520px;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(155, 140, 255, 0.16), transparent 64%);
  box-shadow: none;
  filter: blur(20px);
  opacity: 1;
}

html[data-theme="dark"] .admin-chat::after {
  background: radial-gradient(circle, rgba(155, 140, 255, 0.20), rgba(255, 159, 176, 0.05) 38%, transparent 68%);
  opacity: 0.9;
}

.admin-chat-head {
  min-height: 66px;
  gap: 12px;
  padding: 12px 22px;
  background: color-mix(in srgb, var(--bg-elevated) 62%, transparent);
  border-bottom: 1px solid var(--modern-line);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  backdrop-filter: blur(22px) saturate(1.3);
}

html[data-theme="dark"] .admin-chat-head {
  background: rgba(10, 10, 18, 0.58);
  border-color: var(--modern-line);
}

.admin-chat-head::after {
  display: none;
}

.admin-chat-mini-avatar {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(232, 197, 122, 0.36);
  background: var(--bg-subtle);
  box-shadow: 0 0 0 3px rgba(155, 140, 255, 0.08);
}

html[data-theme="dark"] .admin-chat-mini-avatar {
  border-color: rgba(232, 197, 122, 0.30);
}

.admin-chat-title {
  font-family: var(--modern-sans);
  font-size: 13.5px;
  font-weight: 620;
  line-height: 1.25;
  letter-spacing: 0.01em;
  color: var(--text);
}

.admin-chat-subtitle {
  max-width: 400px;
  margin-top: 1px;
  font-size: 9.5px;
  letter-spacing: 0.01em;
  color: var(--text-3);
}

.admin-conv-wrap > .icon {
  left: 10px;
  color: var(--text-3);
  opacity: 1;
}

.admin-conv-select {
  width: 180px;
  height: 31px;
  padding: 0 26px 0 29px;
  font-size: 10.5px;
  letter-spacing: 0.01em;
  color: var(--text-2);
  background-color: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 9px;
}

.admin-chat-tools .icon-btn {
  width: 31px;
  height: 31px;
  color: var(--text-2);
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 9px;
}

.admin-chat-tools .icon-btn:hover {
  color: var(--text);
  border-color: var(--modern-line-strong);
  background: var(--bg-hover);
}

.admin-chat-messages {
  gap: 20px;
  padding: 26px 30px 12px;
  scroll-behavior: smooth;
}

/* 聊天空态 · 电影感立绘与玻璃问候卡 */
.admin-chat-empty {
  position: relative;
  width: 100%;
  max-width: 858px;
  margin: auto;
  display: grid;
  grid-template-columns: 326px minmax(0, 1fr);
  align-items: center;
  gap: 36px;
  padding: 14px 10px 22px;
  text-align: left;
  animation: mh-modern-rise 560ms var(--modern-ease) both;
}

.admin-hero-stage {
  position: relative;
  width: 326px;
  height: 438px;
  margin: 0;
  display: grid;
  place-items: center;
}

.admin-hero-stage::before {
  content: "";
  position: absolute;
  inset: -22px;
  z-index: 0;
  border-radius: 46%;
  background:
    radial-gradient(60% 46% at 32% 26%, rgba(155, 140, 255, 0.26), transparent 66%),
    radial-gradient(54% 42% at 72% 76%, rgba(255, 159, 176, 0.14), transparent 68%),
    radial-gradient(44% 34% at 52% 50%, rgba(232, 197, 122, 0.10), transparent 70%);
  filter: blur(12px);
  opacity: 0.9;
  -webkit-mask-image: none;
  mask-image: none;
  pointer-events: none;
}

html[data-theme="dark"] .admin-hero-stage::before {
  opacity: 1;
}

.admin-hero-stage::after {
  content: "";
  position: absolute;
  inset: 8px -16px 14px;
  z-index: 0;
  border-radius: 30px;
  background: var(--modern-constellation) top right / 86% auto no-repeat;
  opacity: 0.45;
  animation: none;
  pointer-events: none;
}

html[data-theme="dark"] .admin-hero-stage::after {
  opacity: 0.55;
}

.admin-hero-halo {
  top: -14px;
  left: -14px;
  z-index: 1;
  width: calc(100% + 28px);
  height: calc(100% + 28px);
  margin: 0;
  border: 1px solid rgba(155, 140, 255, 0.22);
  border-radius: 30px;
  background: none;
  box-shadow: none;
  opacity: 1;
  pointer-events: none;
}

.admin-hero-halo::after {
  display: none;
}

.admin-hero-portrait {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 22px;
  background:
    radial-gradient(120% 88% at 50% 8%, rgba(89, 68, 128, 0.35), transparent 62%),
    linear-gradient(180deg, #282135, #100d17 78%);
  box-shadow:
    0 30px 64px -36px rgba(6, 5, 12, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

html[data-theme="light"] .admin-hero-portrait {
  border-color: rgba(255, 255, 255, 0.62);
  box-shadow:
    0 28px 58px -34px rgba(30, 22, 62, 0.56),
    0 0 0 1px rgba(30, 22, 62, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.admin-hero-portrait::before {
  display: none;
}

.admin-hero-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(180deg, transparent 48%, rgba(7, 6, 12, 0.24) 72%, rgba(7, 6, 12, 0.88) 100%),
    linear-gradient(90deg, rgba(7, 6, 12, 0.18), transparent 32%, transparent 72%, rgba(155, 140, 255, 0.08));
  pointer-events: none;
}

.admin-hero-portrait-img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  image-rendering: auto;
}

.admin-hero-caption {
  bottom: 19px;
  z-index: 4;
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 500;
  letter-spacing: 0.26em;
  color: rgba(255, 245, 231, 0.82);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}

.admin-hero-spark {
  z-index: 3;
  width: 2.5px;
  height: 2.5px;
  background: var(--aurora-gold);
  box-shadow: 0 0 9px rgba(232, 197, 122, 0.8);
  opacity: 0.85;
}

.admin-hero-spark.s1 { top: 20px; left: -24px; }
.admin-hero-spark.s2 { top: 160px; right: -25px; animation-delay: 1.2s; }
.admin-hero-spark.s3 { top: 390px; left: -16px; animation-delay: 2.2s; }

.admin-hero-orbit,
.admin-hero-moon {
  display: none !important;
}

.admin-hero-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 15px;
}

.admin-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 550;
  letter-spacing: 0.22em;
  color: var(--text-3);
}

.admin-hero-eyebrow::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 10px rgba(155, 140, 255, 0.6);
}

.admin-chat-empty h2 {
  margin: 0;
  font-family: var(--modern-serif);
  font-size: 42px;
  font-weight: 500;
  line-height: 1.16;
  letter-spacing: 0.005em;
  color: var(--text);
  text-wrap: balance;
}

.admin-chat-empty h2::after {
  content: "";
  display: block;
  width: 46px;
  height: 1px;
  margin-top: 15px;
  background: linear-gradient(90deg, var(--brand), transparent);
}

.admin-chat-empty p {
  max-width: 430px;
  margin: 0;
  padding: 0;
  font-size: 10.5px;
  line-height: 1.8;
  letter-spacing: 0.005em;
  color: var(--text-3);
  border-left: 0;
  text-wrap: pretty;
}

.admin-chat-greeting {
  position: relative;
  width: 100%;
  padding: 15px 18px 15px 20px;
  overflow: hidden;
  font-family: var(--modern-sans);
  font-size: 12.5px;
  line-height: 1.88;
  letter-spacing: 0.005em;
  text-align: left;
  color: var(--text-2);
  background: var(--modern-glass);
  border: 1px solid var(--modern-hairline);
  border-radius: 15px;
  box-shadow: 0 14px 34px -28px rgba(30, 24, 70, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.32);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  backdrop-filter: blur(22px) saturate(1.3);
}

html[data-theme="dark"] .admin-chat-greeting {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.admin-chat-greeting::before {
  content: "“";
  position: absolute;
  top: -12px;
  left: 13px;
  font-family: var(--modern-serif);
  font-size: 46px;
  line-height: 1;
  color: var(--brand);
  opacity: 0.16;
}

.admin-suggestions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  margin-top: 1px;
  counter-reset: none;
}

.admin-suggestion {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: auto;
  min-height: 36px;
  padding: 0 13px;
  overflow: hidden;
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.005em;
  color: var(--text-2);
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 999px;
  box-shadow: none;
  transition: border-color 150ms var(--modern-ease), color 150ms var(--modern-ease),
    transform 150ms var(--modern-ease), background-color 150ms var(--modern-ease);
}

html[data-theme="dark"] .admin-suggestion {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.075);
}

.admin-suggestion::before {
  display: none;
  counter-increment: none;
}

.admin-suggestion:hover {
  color: var(--text);
  background: var(--bg-hover);
  border-color: var(--modern-line-strong);
  transform: translateY(-2px);
  box-shadow: none;
}

.admin-suggestion .icon {
  width: 13px;
  height: 13px;
  color: var(--text-3);
}

.admin-suggestion .arrow {
  width: 12px;
  height: 12px;
  margin-left: 2px;
  color: var(--text-4);
  opacity: 0.8;
}

.admin-suggestion:hover .icon,
.admin-suggestion:hover .arrow {
  color: var(--brand);
  opacity: 1;
}

/* 消息气泡 */
.admin-msg {
  gap: 11px;
  animation: mh-modern-rise 240ms var(--modern-ease);
}

.admin-msg.assistant {
  max-width: min(88%, 760px);
}

.admin-msg.user {
  max-width: min(84%, 660px);
}

.admin-msg-avatar {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(232, 197, 122, 0.30);
  background: var(--bg-subtle);
  box-shadow: 0 0 0 3px rgba(155, 140, 255, 0.07);
}

.admin-msg-main {
  gap: 5px;
}

.admin-bubble {
  padding: 11px 15px;
  font-size: 12.8px;
  line-height: 1.82;
  color: var(--text);
  background:
    linear-gradient(140deg, rgba(155, 140, 255, 0.14), rgba(255, 159, 176, 0.055) 54%, rgba(255, 255, 255, 0.025)),
    rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(120, 103, 190, 0.18);
  border-radius: 5px 17px 17px 17px;
  box-shadow: 0 10px 26px -22px rgba(40, 28, 90, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.32);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
}

html[data-theme="dark"] .admin-bubble {
  background:
    linear-gradient(140deg, rgba(155, 140, 255, 0.17), rgba(255, 159, 176, 0.045) 54%, transparent),
    rgba(21, 20, 36, 0.66);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 34px -26px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.admin-bubble::before {
  display: none;
}

.admin-msg.user .admin-bubble {
  padding: 11px 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 17px 17px 5px 17px;
  box-shadow: 0 12px 26px -22px rgba(30, 24, 70, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

html[data-theme="dark"] .admin-msg.user .admin-bubble {
  color: var(--text);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.055)),
    rgba(21, 21, 33, 0.7);
  border-color: rgba(255, 255, 255, 0.11);
  box-shadow: 0 14px 30px -24px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.admin-msg.user .admin-bubble::before {
  display: none;
}

.admin-msg.user .admin-bubble a {
  color: var(--brand);
}

.admin-msg.user .admin-bubble code {
  background: var(--modern-glass-dark);
  border-color: var(--modern-line);
}

.admin-bubble.md h1,
.admin-bubble.md h2,
.admin-bubble.md h3,
.admin-bubble.md h4 {
  font-family: var(--modern-sans);
  font-weight: 650;
  letter-spacing: -0.005em;
  color: var(--text);
}

.admin-bubble.md blockquote {
  color: var(--text-2);
  border-left-color: var(--brand-border);
}

.admin-bubble.md code {
  background: var(--modern-glass-dark);
  border-color: var(--modern-line);
  border-radius: 5px;
}

.admin-bubble.md pre {
  background: var(--modern-glass-dark);
  border-color: var(--modern-line);
  border-radius: 9px;
}

html[data-theme="dark"] .admin-bubble.md pre {
  background: rgba(0, 0, 0, 0.24);
}

.admin-msg-meta {
  gap: 6px;
  padding: 0 4px;
  font-size: 8.5px;
  letter-spacing: 0.03em;
  color: var(--text-4);
}

.admin-engine-chip {
  color: var(--text-3);
  background: var(--modern-glass-dark);
  border-color: var(--modern-line);
}

.admin-engine-chip.flagship {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: var(--brand-border);
}

.admin-engine-chip.local {
  color: var(--success);
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 28%, transparent);
}

.admin-thinking {
  color: var(--text-3);
}

.admin-thinking-dots span {
  background: var(--brand);
}

.admin-chat-notice {
  color: var(--text-2);
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 11px;
}

.admin-chat-notice .icon {
  color: var(--info);
}

.admin-chat-status {
  color: var(--text-3);
}

.admin-chat-status.state-thinking {
  color: var(--brand);
}

.admin-chat-errorcard,
.admin-chat-errorcard-actions {
  border-color: var(--modern-line);
}

/* 输入区 · 胶囊 */
.admin-composer {
  gap: 10px;
  padding: 12px 28px 20px;
  background: linear-gradient(180deg, transparent, var(--adm-chat) 46%);
}

.admin-composer::before {
  display: none;
}

.admin-composer-input {
  flex: 1;
  min-height: 46px;
  max-height: 140px;
  padding: 12px 18px;
  font-family: var(--modern-sans);
  font-size: 12.8px;
  line-height: 1.55;
  color: var(--text);
  background: var(--modern-glass);
  border: 1px solid var(--modern-hairline);
  border-radius: 23px;
  box-shadow: 0 10px 30px -28px rgba(30, 24, 70, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  backdrop-filter: blur(20px) saturate(1.25);
}

html[data-theme="dark"] .admin-composer-input {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.admin-composer-input::placeholder {
  color: var(--text-3);
  font-family: var(--modern-sans);
  font-style: normal;
}

.admin-composer-input:focus {
  outline: none;
  background: var(--bg-elevated);
  border-color: var(--brand-border);
  box-shadow: var(--focus-ring);
}

.admin-view .admin-composer .admin-send-btn.btn.primary {
  flex: 0 0 auto;
  height: 46px;
  padding: 0 22px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--modern-primary-ink);
  background: var(--modern-primary-bg);
  border: 1px solid transparent;
  border-radius: 999px;
  box-shadow: var(--modern-primary-shadow);
  text-shadow: none;
}

.admin-view .admin-composer .admin-send-btn.btn.primary:hover {
  color: var(--modern-primary-ink);
  background: var(--modern-primary-bg);
  filter: brightness(1.07);
  transform: translateY(-1px);
  box-shadow: var(--modern-primary-shadow);
}

.admin-send-btn .icon {
  width: 15px;
  height: 15px;
}

/* 9.3 右栏 · 条目档案 */
.admin-detail {
  background:
    radial-gradient(380px 320px at 110% -4%, rgba(155, 140, 255, 0.08), transparent 68%),
    var(--modern-detail-surface);
  border-left: 1px solid var(--modern-line);
  box-shadow: none;
  -webkit-backdrop-filter: blur(26px) saturate(1.2);
  backdrop-filter: blur(26px) saturate(1.2);
}

html[data-theme="dark"] .admin-detail {
  background:
    radial-gradient(380px 320px at 110% -4%, rgba(155, 140, 255, 0.08), transparent 68%),
    var(--modern-detail-surface);
  border-color: var(--modern-line);
}

.admin-detail-empty {
  flex: 1;
  justify-content: center;
  gap: 11px;
  padding: 26px 24px;
  text-align: left;
}

.admin-detail-empty::before {
  content: "PRIVATE ARCHIVE";
  margin-bottom: 3px;
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.24em;
  color: var(--text-3);
  opacity: 1;
}

.admin-detail-empty-illustration {
  position: relative;
  display: block;
  width: 100%;
  height: 224px;
  margin-bottom: 2px;
  overflow: hidden;
  color: transparent;
  background:
    linear-gradient(180deg, transparent 42%, rgba(7, 7, 13, 0.48) 100%),
    url("/assets/img/bg-library-wide.jpg") center 54% / cover no-repeat;
  border: 1px solid var(--modern-hairline);
  border-radius: 17px;
  box-shadow: 0 18px 42px -30px rgba(20, 14, 48, 0.5);
}

html[data-theme="dark"] .admin-detail-empty-illustration {
  border-color: var(--modern-line);
}

.admin-detail-empty-illustration svg {
  display: none;
}

.admin-detail-empty h3 {
  font-family: var(--modern-serif);
  font-size: 23px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.005em;
  color: var(--text);
  text-align: left;
}

.admin-detail-empty p {
  max-width: 250px;
  margin: 0;
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--text-3);
  text-align: left;
}

.admin-detail-form {
  gap: 13px;
  padding: 20px 18px 24px;
}

.admin-detail-form::before {
  content: "ENTRY · 条目档案";
  font-family: var(--modern-sans);
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.18em;
  color: var(--text-3);
  opacity: 1;
}

.admin-detail .field-label {
  font-family: var(--modern-sans);
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.12em;
  color: var(--text-3);
  opacity: 1;
}

.admin-detail .input,
.admin-detail .select,
.admin-detail .textarea {
  background: var(--modern-glass-dark);
  border-color: var(--modern-line);
  border-radius: 9px;
  box-shadow: none;
}

.admin-detail .input:focus,
.admin-detail .select:focus,
.admin-detail .textarea:focus {
  background: var(--bg-elevated);
  border-color: var(--brand-border);
  box-shadow: var(--focus-ring);
}

.admin-detail-content {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.75;
}

.admin-detail-actions .btn {
  border: 1px solid var(--modern-line);
  background: var(--modern-glass-dark);
  color: var(--text-2);
}

.admin-view .admin-detail-actions .btn.primary {
  color: var(--modern-primary-ink);
  background: var(--modern-primary-bg);
  border-color: transparent;
  box-shadow: var(--modern-primary-shadow);
}

.admin-view .admin-detail-actions .btn.primary:hover {
  color: var(--modern-primary-ink);
  background: var(--modern-primary-bg);
  filter: brightness(1.06);
}

.admin-detail-actions .btn.subtle {
  border-color: var(--modern-line);
  background: var(--modern-glass-dark);
}

.admin-detail-versions,
.admin-detail-path {
  border-top-color: var(--modern-line);
}

.admin-detail-versions summary:hover {
  color: var(--brand);
}

.admin-detail-versions summary::before {
  color: var(--text-3);
}

/* ---------- 10. 浮层 / 弹窗 / 时间线 / Toast ---------- */
.search-popover {
  background: var(--modern-glass-strong);
  border: 1px solid var(--modern-hairline);
  border-radius: 15px;
  box-shadow: var(--modern-shadow-shell);
  -webkit-backdrop-filter: blur(26px) saturate(1.35);
  backdrop-filter: blur(26px) saturate(1.35);
}

html[data-theme="dark"] .search-popover {
  background: rgba(13, 13, 23, 0.94);
  border-color: var(--modern-line);
}

.search-status {
  border-bottom-color: var(--modern-line);
  color: var(--text-3);
}

.search-result {
  border-radius: 9px;
}

.search-result:hover {
  background: var(--bg-hover);
}

.search-result.active {
  background: var(--brand-soft);
}

.search-result-title {
  font-family: var(--modern-sans);
}

.search-footer {
  border-top-color: var(--modern-line);
  background: transparent;
}

.menu-popover {
  background: var(--modern-glass-strong);
  border: 1px solid var(--modern-hairline);
  border-radius: 12px;
  box-shadow: var(--modern-shadow-panel);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  backdrop-filter: blur(24px) saturate(1.3);
}

html[data-theme="dark"] .menu-popover {
  background: rgba(15, 15, 26, 0.96);
  border-color: var(--modern-line);
}

.menu-item {
  border-radius: 7px;
}

.menu-item:hover {
  background: var(--bg-hover);
}

.menu-item.danger:hover {
  background: var(--danger-soft);
}

.modal {
  background: var(--mh-surface-modal);
  border: 1px solid var(--modern-hairline);
  border-radius: 20px;
  box-shadow: var(--modern-shadow-shell);
  -webkit-backdrop-filter: blur(26px) saturate(1.25);
  backdrop-filter: blur(26px) saturate(1.25);
}

html[data-theme="dark"] .modal {
  border-color: var(--modern-line);
}

.modal-backdrop,
.admin-settings-modal::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(7px) saturate(0.88);
  -webkit-backdrop-filter: blur(7px) saturate(0.88);
}

.modal-head {
  border-bottom: 1px solid var(--modern-line);
}

.modal-title {
  font-family: var(--modern-sans);
  font-size: 18px;
  font-weight: 640;
  letter-spacing: -0.012em;
}

.modal-sub {
  font-size: 11.5px;
  color: var(--text-3);
}

.modal-foot {
  border-top: 1px solid var(--modern-line);
}

.drawer-backdrop {
  background: rgba(4, 4, 10, 0.24);
  backdrop-filter: blur(2px);
}

.timeline-drawer {
  background: var(--modern-glass-strong);
  border-top: 1px solid var(--modern-hairline);
  box-shadow: 0 -24px 70px -32px rgba(30, 24, 70, 0.36);
  -webkit-backdrop-filter: blur(28px) saturate(1.3);
  backdrop-filter: blur(28px) saturate(1.3);
}

html[data-theme="dark"] .timeline-drawer {
  background: rgba(12, 12, 21, 0.94);
  border-color: var(--modern-line);
}

.drawer-head {
  border-bottom: 1px solid var(--modern-line);
}

.drawer-icon {
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  border-radius: 10px;
}

.drawer-title-wrap h2 {
  font-family: var(--modern-sans);
  font-size: 15px;
  font-weight: 640;
}

.basis-switch {
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 9px;
}

.basis-btn {
  border-radius: 7px;
}

.basis-btn.active {
  background: var(--modern-glass-strong);
  box-shadow: 0 1px 5px -1px rgba(30, 24, 70, 0.16);
}

.timeline-day {
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
}

.timeline-item {
  border-radius: 10px;
}

.timeline-item:hover {
  background: var(--bg-hover);
}

.toast {
  color: var(--text);
  background: var(--modern-glass-strong);
  border: 1px solid var(--modern-hairline);
  border-radius: 12px;
  box-shadow: var(--modern-shadow-panel);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  backdrop-filter: blur(22px) saturate(1.3);
}

html[data-theme="dark"] .toast,
body.mode-admin .toast {
  color: var(--text);
  background: rgba(16, 16, 28, 0.94);
  border-color: var(--modern-line);
}

.admin-settings-modal {
  background: var(--mh-surface-modal);
  border: 1px solid var(--modern-hairline);
  border-radius: 22px;
  box-shadow: var(--modern-shadow-shell);
}

html[data-theme="dark"] .admin-settings-modal {
  background: var(--mh-surface-modal);
  border-color: var(--modern-line);
}

.admin-settings-modal .modal-title {
  font-family: var(--modern-sans);
  font-size: 20px;
  font-weight: 640;
  letter-spacing: -0.015em;
}

.admin-engine-card {
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 13px;
}

.admin-engine-card-title {
  font-family: var(--modern-sans);
  color: var(--text);
}

.admin-engine-tag {
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  color: var(--text-3);
}

/* 公共设置面板 */
.settings-tab {
  border-radius: 9px;
  color: var(--text-2);
}

.settings-tab:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.settings-tab.active {
  color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand-border);
  font-weight: 600;
}

.settings-section-title {
  font-family: var(--modern-sans);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.005em;
  color: var(--text);
}

.settings-section-title .icon {
  color: var(--text-3);
}

.settings-section-desc {
  color: var(--text-3);
}

.settings-row {
  border-bottom: 1px solid var(--modern-line);
}

.settings-row-title {
  font-size: 12px;
  color: var(--text);
}

.settings-row-desc {
  color: var(--text-3);
}

.kv-row {
  border-bottom: 1px solid var(--modern-line);
}

.kv-key {
  color: var(--text-3);
}

.kv-val {
  color: var(--text-2);
}

.settings-code-label {
  color: var(--text-2);
}

.code-block {
  color: var(--text-2);
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 10px;
}

.settings-auth-note {
  color: var(--text-3);
  background: var(--modern-glass-dark);
  border: 1px solid var(--modern-line);
  border-radius: 10px;
}

.settings-auth-note.on {
  color: var(--success);
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 28%, transparent);
}

.theme-option {
  border: 1px solid var(--modern-line);
  border-radius: 12px;
}

.theme-option:hover {
  border-color: var(--modern-line-strong);
}

.theme-option.active {
  border-color: var(--brand-border);
  box-shadow: inset 0 0 0 1px var(--brand-border);
}

/* ---------- 11. 响应式（1024–1920） ---------- */
@media (max-width: 1500px) {
  :root {
    --sidebar-w: 252px;
    --detail-w: 380px;
  }

  .search-wrap {
    width: 310px;
  }

  .admin-view {
    --adm-side-w: 288px;
    --adm-detail-w: 318px;
  }

  .admin-chat-empty {
    grid-template-columns: 294px minmax(0, 1fr);
    gap: 30px;
    max-width: 800px;
  }

  .admin-hero-stage {
    width: 294px;
    height: 396px;
  }

  .admin-chat-empty h2 {
    font-size: 38px;
  }
}

@media (max-width: 1360px) {
  :root {
    --sidebar-w: 242px;
    --detail-w: 354px;
  }

  .brand {
    min-width: 198px;
  }

  .brand-title {
    font-size: 14.5px;
  }

  .search-wrap {
    width: 274px;
  }

  .header-actions .btn.ghost span {
    display: none;
  }

  .header-actions .btn.ghost {
    width: 34px;
    padding: 0;
  }

  .admin-view {
    --adm-side-w: 272px;
    --adm-detail-w: 304px;
  }

  .admin-view .admin-name {
    font-size: 27px;
  }

  .admin-chat-empty {
    grid-template-columns: 258px minmax(0, 1fr);
    gap: 24px;
    max-width: 726px;
  }

  .admin-hero-stage {
    width: 258px;
    height: 350px;
  }

  .admin-chat-empty h2 {
    font-size: 34px;
  }

  .admin-chat-greeting {
    font-size: 11.8px;
    padding: 13px 15px 13px 18px;
  }

  .admin-chat-messages {
    padding: 20px 22px 10px;
  }

  .admin-composer {
    padding: 11px 22px 17px;
  }

  .tree-empty {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .empty-illustration {
    height: 228px;
  }
}

@media (max-width: 1180px) {
  :root {
    --sidebar-w: 232px;
    --detail-w: 322px;
  }

  .app-header {
    gap: 10px;
  }

  .brand {
    min-width: 184px;
  }

  .brand-sub::after {
    font-size: 7.5px;
    letter-spacing: 0.12em;
  }

  .search-wrap {
    width: 238px;
  }

  body .view-switch-btn {
    padding: 0 9px;
  }

  .header-actions .btn.primary span {
    display: none;
  }

  .header-actions .btn.primary {
    width: 34px;
    padding: 0;
  }

  .status-center {
    display: none;
  }

  .admin-view {
    --adm-side-w: 248px;
    --adm-detail-w: 278px;
  }

  .admin-avatar {
    width: 76px;
    height: 76px;
  }

  .admin-name {
    font-size: 25px;
  }

  .admin-chat-subtitle {
    max-width: 220px;
  }

  .admin-chat-empty {
    grid-template-columns: 188px minmax(0, 1fr);
    max-width: 600px;
    gap: 18px;
    padding: 8px 2px 14px;
  }

  .admin-hero-stage {
    width: 188px;
    height: 258px;
  }

  .admin-hero-portrait {
    border-radius: 17px;
  }

  .admin-hero-halo {
    top: -8px;
    left: -8px;
    width: calc(100% + 16px);
    height: calc(100% + 16px);
    border-radius: 23px;
  }

  .admin-hero-portrait-img {
    object-position: center 20%;
  }

  .admin-hero-caption {
    bottom: 12px;
    font-size: 6.5px;
    letter-spacing: 0.18em;
  }

  .admin-hero-spark.s1,
  .admin-hero-spark.s2,
  .admin-hero-spark.s3 {
    display: none;
  }

  .admin-hero-copy {
    gap: 10px;
  }

  .admin-chat-empty h2 {
    font-size: 28px;
  }

  .admin-chat-empty h2::after {
    margin-top: 10px;
  }

  .admin-chat-empty p {
    display: none;
  }

  .admin-chat-greeting {
    padding: 12px 14px;
    font-size: 11.2px;
    line-height: 1.8;
  }

  .admin-suggestions {
    gap: 5px;
  }

  .admin-suggestion {
    min-height: 31px;
    padding: 0 10px;
    font-size: 10.2px;
  }

  .admin-suggestion .arrow {
    display: none;
  }

  .admin-suggestions {
    gap: 6px;
  }

  .admin-suggestion {
    min-height: 33px;
    padding: 0 11px;
    font-size: 10.5px;
  }

  .admin-chat-greeting {
    font-size: 11.5px;
    line-height: 1.8;
  }

  .admin-detail-empty-illustration {
    height: 190px;
  }

  .detail-empty-icon {
    height: 190px;
  }

  .tree-empty {
    grid-template-columns: 1fr;
    width: min(540px, calc(100% - 40px));
    gap: 10px;
    padding: 22px;
  }

  .empty-illustration {
    grid-column: 1;
    grid-row: auto;
    height: 200px;
  }

  .tree-empty h2,
  .tree-empty p,
  .empty-actions {
    grid-column: 1;
  }

  .tree-empty h2 {
    font-family: var(--modern-serif);
    font-size: 26px;
  }
}

@media (max-width: 1024px) {
  :root {
    --sidebar-w: 220px;
    --detail-w: 300px;
  }

  .app-header {
    margin: 8px 12px 0;
    padding: 0 10px;
    gap: 8px;
  }

  .app-body {
    margin: 8px 12px 0;
  }

  .admin-view {
    margin: 8px 12px 0;
    --adm-side-w: 226px;
    --adm-detail-w: 262px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .brand-title {
    font-size: 13.5px;
  }

  .brand {
    min-width: 164px;
    gap: 8px;
  }

  .search-wrap {
    width: 212px;
  }

  .search-input {
    height: 36px;
  }

  body .view-switch-btn {
    padding: 0 7px;
  }

  body .view-switch-btn span {
    display: none;
  }

  .status-bar {
    padding: 0 20px;
    font-size: 9px;
  }

  .admin-view {
    --adm-side-w: 226px;
    --adm-detail-w: 262px;
  }

  .admin-side {
    padding: 0;
  }

  .admin-identity {
    gap: 9px;
    padding: 15px 12px 11px;
  }

  .admin-avatar {
    width: 66px;
    height: 66px;
  }

  .admin-identity-text::before {
    font-size: 6.5px;
    letter-spacing: 0.18em;
    margin-bottom: 4px;
  }

  .admin-name {
    font-size: 23px;
  }

  .admin-motto {
    font-size: 10px;
    margin-top: 4px;
  }

  .admin-substrate-card {
    margin: 0 10px 9px;
    padding: 10px;
  }

  .admin-stat {
    padding: 8px 8px 7px;
  }

  .admin-stat-value {
    font-size: 23px;
  }

  .admin-engine {
    margin: 0 10px 8px;
    padding: 8px 9px;
  }

  .admin-engine-sub {
    display: none;
  }

  .admin-side-actions {
    padding: 0 10px 8px;
  }

  .admin-side-actions .btn span {
    display: none;
  }

  .admin-side-actions .btn {
    flex: 0 0 auto;
    width: 31px;
    padding: 0;
  }

  .admin-tabs {
    padding: 0 7px;
  }

  .admin-tab {
    font-size: 10px;
    gap: 4px;
  }

  .admin-tab .icon {
    width: 12px;
    height: 12px;
  }

  .admin-chat-head {
    padding: 10px 14px;
  }

  .admin-chat-subtitle {
    display: none;
  }

  .admin-conv-select {
    width: 128px;
  }

  .admin-chat-messages {
    padding: 16px 16px 8px;
  }

  .admin-chat-empty {
    grid-template-columns: 148px minmax(0, 1fr);
    max-width: 100%;
    gap: 14px;
    padding: 6px 0 10px;
  }

  .admin-hero-stage {
    width: 148px;
    height: 206px;
  }

  .admin-chat-empty h2 {
    font-size: 25px;
  }

  .admin-chat-empty h2::after {
    margin-top: 8px;
  }

  .admin-chat-greeting {
    padding: 10px 12px;
    font-size: 10.8px;
    line-height: 1.75;
    border-radius: 13px;
  }

  .admin-suggestion {
    min-height: 29px;
    padding: 0 9px;
    font-size: 9.8px;
  }

  .admin-suggestion .icon {
    width: 12px;
    height: 12px;
  }

  .admin-chat-empty p {
    display: none;
  }

  .admin-suggestion {
    min-height: 31px;
  }

  .admin-suggestion .arrow {
    display: none;
  }

  .admin-composer {
    padding: 10px 16px 14px;
  }

  .admin-composer-input {
    min-height: 44px;
    padding: 11px 15px;
  }

  .admin-view .admin-composer .admin-send-btn.btn.primary {
    width: 44px;
    height: 44px;
    padding: 0;
  }

  .admin-view .admin-composer .admin-send-btn.btn.primary span {
    display: none;
  }

  .admin-detail-form {
    padding: 16px 13px 20px;
  }

  .admin-detail-empty {
    padding: 18px 14px;
  }

  .admin-detail-empty-illustration {
    height: 150px;
  }

  .admin-detail-empty p {
    font-size: 10.5px;
  }

  .detail-empty,
  .detail-errorbox {
    padding: 22px 18px;
  }

  .detail-empty-icon {
    height: 168px;
  }

  .detail-head {
    padding: 20px 17px 13px;
  }

  .detail-crumbs {
    padding: 2px 17px 10px;
  }

  .detail-scroll {
    padding: 0 17px 28px;
  }

  .detail-title {
    font-size: 21px;
  }

  .sidebar-scroll {
    padding: 14px 10px 8px;
  }

  .stats-grid {
    gap: 6px;
  }

  .stat-cell {
    padding: 10px;
  }

  .stat-value {
    font-size: 24px;
  }

  .side-section {
    margin-bottom: 19px;
  }
}

@media (max-width: 980px) {
  .admin-view {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "side chat"
      "side chat"
      "detail detail";
    overflow-y: auto;
  }

  .admin-side {
    grid-area: side;
  }

  .admin-chat {
    grid-area: chat;
    height: auto;
    min-height: 520px;
  }

  .admin-detail {
    grid-area: detail;
    min-height: 300px;
  }
}

@media (max-width: 760px) {
  .app-body {
    grid-template-columns: 1fr;
    margin: 8px 8px 0;
  }

  .sidebar,
  .detail-panel {
    display: none;
  }

  .app-header {
    margin: 8px 8px 0;
    flex-wrap: wrap;
    height: auto;
    flex-basis: auto;
    padding: 8px 10px;
    gap: 8px;
  }

  .brand {
    min-width: 0;
  }

  .header-search {
    order: 3;
    flex: 1 0 100%;
  }

  .search-wrap {
    width: 100%;
  }

  .view-switch-btn span {
    display: none;
  }

  .admin-view {
    display: flex;
    flex-direction: column;
    margin: 8px 8px 0;
    overflow-y: auto;
  }

  .admin-side,
  .admin-chat,
  .admin-detail {
    flex: 0 0 auto;
    min-height: 0;
  }

  .admin-chat {
    height: 620px;
  }

  .admin-detail {
    min-height: 320px;
  }

  .status-bar {
    padding: 0 14px;
  }

  .status-right {
    display: none;
  }

  .admin-composer {
    padding: 9px 12px 12px;
  }

  .admin-send-btn span {
    display: none;
  }

  .admin-send-btn {
    width: 44px;
    padding: 0;
  }
}

/* ---------- 12. 动效与可访问性 ---------- */
@keyframes mh-modern-rise {
  from { opacity: 0; transform: translate3d(0, 9px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes mh-modern-breathe {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.035); opacity: 1; }
}

.canvas-moon {
  animation: mh-modern-breathe 24s ease-in-out infinite;
}

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

  .canvas-moon {
    animation: none !important;
  }

  .node-card:hover,
  .btn:hover,
  .admin-stat:hover,
  .admin-suggestion:hover {
    transform: none;
  }
}

/* ==========================================================================
   18. 手机端 / PWA · 移动适配层（≤900px 生效）
   --------------------------------------------------------------------------
   与桌面完全隔离：本层所有布局规则都写在 max-width 查询里，≥1024px 的桌面
   布局、尺寸与交互保持原样。断点分四档：
     ≤900  平板 / 分屏窗口：详情面板 → 底部抽屉，搜索框 → 全屏搜索层
     ≤760  手机横屏 / 小平板：侧栏 → 左侧抽屉
     ≤600  手机竖屏：顶栏收敛为 ☰ / 🔍 / ＋ / ⋯，弹窗全屏、设置单列
     ≤420  窄屏：进一步压缩留白、隐藏非关键装饰
   触摸目标统一 ≥44px，全部浮层遵守 env(safe-area-inset-*)。
   ========================================================================== */

/* ---------- 18.0 手机端专用元素：桌面一律不参与布局 ---------- */
.mobile-only,
.mobile-only-sm,
.mobile-fab,
.mobile-more,
.mobile-scrim,
.mobile-search-bar,
.detail-drawer-head {
  display: none;
}

/* ---------- 18.1 ≤900px：壳层 / 安全区 / 触控目标 ---------- */
@media (max-width: 900px) {
  :root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --mobile-header-h: 50px;
  }

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    overscroll-behavior: none;
    background-image: none !important;
  }

  .app {
    height: 100dvh;
    min-height: 100dvh;
    width: 100%;
    max-width: 100%;
  }

  /* 顶栏：贴边 + 顶部安全区，不再换行（搜索已改为全屏层） */
  .app-header {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    height: calc(var(--mobile-header-h) + var(--safe-top));
    min-height: calc(var(--mobile-header-h) + var(--safe-top));
    margin: 0;
    padding: var(--safe-top) calc(var(--safe-right) + 8px) 0 calc(var(--safe-left) + 8px);
    gap: 6px;
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: none;
    /* backdrop-filter 会在移动端制造 fixed 子元素的包含块，并拖慢滚动；这里改为实色 */
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--bg-elevated);
  }

  .app-header .brand {
    min-width: 0;
    flex: 1 1 auto;
    gap: 8px;
    overflow: hidden;
  }

  .app-header .brand-text {
    min-width: 0;
  }

  .app.sidebar-collapsed .brand-text {
    display: block;
  }

  .app-body {
    margin: 0;
    border-width: 1px 0 0;
    border-radius: 0;
    box-shadow: none;
    min-height: 0;
    /* 详情面板已改为 fixed 抽屉，网格只保留 侧栏 + 画布 两列 */
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }

  .app.sidebar-collapsed .app-body {
    grid-template-columns: minmax(0, 1fr);
  }

  /* 状态栏在手机上隐藏，把高度让给画布 */
  .status-bar {
    display: none;
  }

  /* 44px 触控目标（只在本层新增/顶栏范围内，不改桌面尺寸） */
  .app-header .icon-btn,
  .app-header .btn,
  .mobile-more-item,
  .mobile-fab,
  .detail-drawer-close,
  .drawer-actions .icon-btn,
  .modal-close,
  .switch-row {
    min-width: 44px;
    min-height: 44px;
  }

  .app-header .btn {
    padding: 0 10px;
  }

  .app-header .btn.ghost {
    width: 44px;
    padding: 0;
  }

  /* 树画布：触屏手势（双指捏合 / 双击放大）由 tree.js 接管 */
  .tree-viewport {
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
  }

  /* ---- 18.1.1 详情面板 → 底部抽屉 ---- */
  .detail-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 95;
    display: flex;
    width: 100%;
    max-width: 100%;
    height: 86dvh;
    max-height: 86dvh;
    border-left: 0;
    border-top: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    padding-bottom: var(--safe-bottom);
    box-shadow: 0 -22px 60px -26px rgba(6, 4, 16, 0.6);
    transform: translateY(102%);
    visibility: hidden;
    transition: transform 280ms var(--ease), visibility 0s linear 280ms;
    will-change: transform;
  }

  body.detail-open .detail-panel {
    transform: translateY(0);
    visibility: visible;
    transition: transform 280ms var(--ease), visibility 0s;
  }

  .detail-drawer-head {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 8px;
    touch-action: none;
  }

  .detail-drawer-grip {
    width: 44px;
    height: 4px;
    border-radius: 2px;
    background: var(--border-strong);
    opacity: 0.55;
  }

  .detail-drawer-close {
    position: absolute;
    right: 6px;
    top: 0;
    color: var(--text-3);
  }

  .detail-panel .detail-head {
    padding-top: 6px;
  }

  .detail-panel .detail-scroll {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .detail-watermark {
    display: none;
  }

  /* ---- 18.1.2 搜索：全屏层 ---- */
  .header-search {
    display: none;
  }

  body.search-open .header-search {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: flex;
    flex-direction: column;
    padding: calc(var(--safe-top) + 8px) calc(var(--safe-right) + 10px)
      calc(var(--safe-bottom) + 8px) calc(var(--safe-left) + 10px);
    /* 全屏搜索层必须完全不透明：玻璃质感只留给桌面的下拉浮层 */
    background: var(--bg-elevated);
    background-image: none;
    animation: fadeIn 140ms var(--ease);
  }

  /* 搜索层是 .app-header 的子元素，会被顶栏的 z-index 40 限制在低层；
     打开时把顶栏整体提到遮罩之上，避免遮罩盖住搜索结果 */
  body.search-open .app-header {
    z-index: 111;
  }

  .mobile-search-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin-bottom: 8px;
  }

  .mobile-search-title {
    flex: 1 1 auto;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-2);
  }

  .mobile-search-cancel {
    min-height: 44px;
    padding: 0 14px;
  }

  body.search-open .search-wrap {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
    min-height: 0;
  }

  body.search-open .search-input {
    height: 46px;
    font-size: 16px;
  }

  body.search-open .search-kbd {
    display: none;
  }

  body.search-open .search-popover {
    position: static;
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
    max-height: none;
    min-height: 0;
    margin-top: 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px;
    box-shadow: none;
    /* 结果层同样要实色，否则底下的树会透上来显得发灰 */
    background: var(--bg-elevated);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  /* ---- 18.1.3 手机端浮层：遮罩 / 更多菜单 / FAB ---- */
  .mobile-scrim {
    position: fixed;
    inset: 0;
    z-index: 92;
    display: block;
    background: rgba(6, 4, 14, 0.42);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    animation: fadeIn 160ms var(--ease);
  }

  .mobile-more {
    position: fixed;
    top: calc(var(--safe-top) + var(--mobile-header-h) + 6px);
    right: calc(var(--safe-right) + 8px);
    z-index: 106;
    display: flex;
    flex-direction: column;
    min-width: 208px;
    padding: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 120ms var(--ease);
  }

  .mobile-more-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 0 12px;
    font-size: 13px;
    color: var(--text);
    text-align: left;
    border-radius: 10px;
  }

  .mobile-more-item:hover,
  .mobile-more-item:focus-visible {
    background: var(--bg-hover);
  }

  .mobile-more-item .icon {
    width: 17px;
    height: 17px;
    color: var(--text-3);
  }

  .mobile-more-sep {
    height: 1px;
    margin: 4px 8px;
    background: var(--border);
  }

  .mobile-only {
    display: inline-grid;
  }

  /* ---- 18.1.4 移动端不加载大图背景（首屏省流量 / 首帧更快） ---- */
  html[data-theme="dark"] body,
  html[data-theme="light"] body {
    background-image: none !important;
  }

  .canvas-area,
  html[data-theme="dark"] .canvas-area {
    background-image: none !important;
  }

  .admin-view,
  html[data-theme="dark"] .admin-view {
    background-image: none !important;
  }

  .admin-side::before,
  html[data-theme="dark"] .admin-side::before {
    display: none !important;
  }

  .empty-illustration,
  .detail-empty-icon,
  .admin-detail-empty-illustration {
    background-image: none !important;
  }

  /* ---- 18.1.5 弹窗 / 抽屉在手机上的基础形态 ---- */
  .modal-backdrop {
    padding: 10px;
  }

  .modal,
  .modal.lg,
  .modal.sm,
  .modal.xl {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 20px);
  }

  .modal-body {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .settings-layout {
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 12px;
  }

  .drawer-overlay {
    z-index: 100;
  }

  .timeline-drawer {
    height: min(84dvh, 720px);
    padding-bottom: var(--safe-bottom);
  }

  /* 输入控件在手机上用 16px，避免 iOS 聚焦时自动放大页面 */
  .input,
  .select,
  .textarea,
  textarea,
  input[type="text"],
  input[type="password"],
  input[type="url"],
  input[type="search"] {
    font-size: 16px;
  }
}

/* ---------- 18.2 ≤760px：侧栏 → 左侧抽屉 ---------- */
@media (max-width: 760px) {
  .app-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .app.sidebar-collapsed .app-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 96;
    display: flex;
    width: min(84vw, 320px);
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
    border-right: 1px solid var(--border);
    border-radius: 0 20px 20px 0;
    box-shadow: 26px 0 60px -30px rgba(6, 4, 16, 0.62);
    transform: translateX(-104%);
    visibility: hidden;
    transition: transform 260ms var(--ease), visibility 0s linear 260ms;
    will-change: transform;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
    visibility: visible;
    transition: transform 260ms var(--ease), visibility 0s;
  }

  /* 手机端忽略桌面「折叠侧栏」状态，抽屉始终可正常打开 */
  .app.sidebar-collapsed .sidebar {
    opacity: 1;
    pointer-events: auto;
    border-right-color: var(--border);
  }

  .sidebar-scroll {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .brand-title {
    font-size: 14px;
  }

  .tree-toolbar {
    top: calc(var(--safe-top) + 10px);
    right: calc(var(--safe-right) + 10px);
  }

  .canvas-hint {
    left: calc(var(--safe-left) + 12px);
    bottom: calc(var(--safe-bottom) + 12px);
    max-width: calc(100% - 100px);
  }

  .canvas-hint span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ---------- 18.3 ≤600px：手机竖屏（顶栏收敛 / 弹窗全屏 / 设置单列） ---------- */
@media (max-width: 600px) {
  .mobile-only-sm {
    display: inline-grid;
  }

  /* 顶栏只留 ☰ / 🔍 / ⋯（新建由右下 FAB 承担），其余收进「更多」菜单 */
  .view-switch,
  #btnTimeline,
  #btnTimeMachine,
  #btnTheme,
  #btnSettings,
  #btnNew,
  .header-divider {
    display: none !important;
  }

  .app-header {
    gap: 4px;
    padding-right: calc(var(--safe-right) + 4px);
    padding-left: calc(var(--safe-left) + 4px);
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }

  .brand-svg {
    width: 20px;
    height: 20px;
  }

  .brand-title {
    font-size: 13.5px;
    letter-spacing: 0.03em;
  }

  .detail-panel {
    height: 90dvh;
    max-height: 90dvh;
  }

  /* FAB：拇指可达的快速新建 */
  .mobile-fab {
    position: fixed;
    right: calc(var(--safe-right) + 16px);
    bottom: calc(var(--safe-bottom) + 18px);
    z-index: 88;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    color: #fff;
    background: linear-gradient(145deg, #7488ff 0%, #5868ea 52%, #4756d0 100%);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    box-shadow: 0 14px 30px -12px rgba(71, 86, 208, 0.72), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: opacity 180ms var(--ease), transform 180ms var(--ease);
  }

  .mobile-fab .icon {
    width: 24px;
    height: 24px;
  }

  .mobile-fab:active {
    transform: scale(0.94);
  }

  body.detail-open .mobile-fab,
  body.sidebar-open .mobile-fab,
  body.search-open .mobile-fab,
  body.modal-open .mobile-fab {
    opacity: 0;
    pointer-events: none;
  }

  /* 弹窗全屏：手机上的表单/设置铺满可视区 */
  .modal-backdrop {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
  }

  .modal,
  .modal.lg,
  .modal.sm,
  .modal.xl {
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .modal-head {
    padding: calc(var(--safe-top) + 12px) 16px 10px;
  }

  .modal-body {
    padding: 14px 16px calc(var(--safe-bottom) + 16px);
  }

  .modal-foot {
    flex-wrap: wrap;
    padding: 10px 14px calc(var(--safe-bottom) + 10px);
  }

  .modal-foot .foot-left {
    width: 100%;
    margin-right: 0;
  }

  /* 设置：标签横向滚动 + 内容单列 */
  .settings-layout {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 0;
  }

  .settings-nav {
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .settings-nav::-webkit-scrollbar {
    display: none;
  }

  .settings-tab {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 12px;
    white-space: nowrap;
  }

  .form-grid,
  .shortcuts-grid {
    grid-template-columns: 1fr;
  }

  .token-row {
    flex-wrap: wrap;
  }

  /* 画布工具栏：只保留缩放/适应，避免横向溢出 */
  .tree-toolbar .btn.sm,
  .tree-toolbar .zoom-level,
  .tree-toolbar .toolbar-sep {
    display: none;
  }

  .tree-toolbar {
    padding: 3px;
    border-radius: 12px;
  }

  .empty-illustration {
    display: none;
  }

  .tree-empty {
    padding: 18px 14px;
  }

  .canvas-hint {
    font-size: 10px;
  }

  .drawer-head {
    flex-wrap: wrap;
    gap: 8px;
  }

  .timeline-drawer {
    height: min(88dvh, 760px);
  }
}

/* ---------- 18.4 ≤420px：窄屏（iPhone SE / 小屏） ---------- */
@media (max-width: 420px) {
  .brand-title {
    font-size: 13px;
  }

  .app-header {
    gap: 2px;
  }

  .app-header .icon-btn,
  .app-header .btn,
  .mobile-more-item {
    min-width: 42px;
  }

  .detail-panel {
    height: 92dvh;
    max-height: 92dvh;
  }

  .detail-panel .detail-head {
    padding: 4px 14px 10px;
  }

  .detail-panel .detail-crumbs {
    padding: 0 14px 10px;
  }

  .detail-panel .detail-scroll {
    padding: 0 14px 24px;
  }

  .modal-body {
    padding: 12px 13px calc(var(--safe-bottom) + 14px);
  }

  .mobile-fab {
    width: 52px;
    height: 52px;
    right: calc(var(--safe-right) + 12px);
  }

  .canvas-hint {
    display: none;
  }
}
