/* ============================================================
   墨迹 · Markdown 笔记时间轴
   ============================================================ */

:root {
  color-scheme: dark;

  /* 表面 */
  --bg: #0a0d13;
  --bg-elev: #101827;
  --bg-elev-2: #0d1420;
  --panel: #121821;
  --panel-2: #161e2b;
  --card-a: #141b26;
  --card-b: #111722;
  --rail-a: #141c27;
  --rail-b: #10161f;
  --input: #0d131c;
  --zone: #0c121b;
  --thumb: #0c121a;
  --mini: #0a0f16;
  --drawer: #0e141c;
  --drawer-foot: #0c1119;
  --pre: #0b1017;
  --th: #151d28;
  --nav-on: #1b2534;
  --search: #0e141d;
  --hover: #0f1621;
  --tab-a: #1e293b;
  --tab-b: #18212e;
  --auth-card-a: rgba(22, 30, 43, 0.92);
  --auth-card-b: rgba(15, 21, 31, 0.96);
  --empty-a: rgba(20, 27, 38, 0.6);
  --empty-b: rgba(14, 20, 28, 0.3);
  --toast-bg: rgba(24, 33, 47, 0.96);
  --bg-0: rgba(10, 13, 19, 0);
  --topbar: rgba(10, 13, 19, 0.72);
  --scrim: rgba(4, 6, 10, 0.9);
  --scrim-soft: rgba(4, 7, 11, 0.66);

  /* 线 */
  --line: #1f2836;
  --line-soft: #18202c;
  --edge: #2b3a50;
  --edge-2: #263348;
  --dot: #33415a;
  --dot-core: #3b4a63;
  --scroll: #232d3d;
  --scroll-hover: #2f3d52;

  /* 文字 */
  --text: #e7ecf6;
  --text-dim: #a4b1c6;
  --muted: #6d7a8f;
  --faint: #4c586c;
  --md-text: #c8d3e4;
  --md-strong: #dbe4f3;
  --pre-text: #bfcde3;
  --code-text: #a9c2ff;
  --chip-text: #c3d2ee;

  /* 品牌 */
  --accent: #7c9cff;
  --accent-soft: rgba(124, 156, 255, 0.14);
  --accent-2: #f0b45f;
  --danger: #ff7373;
  --ok: #7ee0b0;
  --brand-a: #d9e6ff;
  --brand-b: #8fadff;
  --brand-c: #7c9cff;
  --btn-a: #cfe0ff;
  --btn-b: #9fbaff;
  --on-brand: #0a0e16;

  /* 高光叠层 */
  --hi-1: rgba(255, 255, 255, 0.04);
  --hi-2: rgba(255, 255, 255, 0.06);
  --hi-line: rgba(255, 255, 255, 0.55);

  /* 装饰光 */
  --glow-a: #16233a;
  --glow-b: #1a1830;
  --orb-a: #2f4c8f;
  --orb-b: #45367a;
  --app-glow-a: rgba(46, 66, 110, 0.35);
  --app-glow-b: rgba(46, 36, 84, 0.28);
  --hero-tint: rgba(124, 156, 255, 0.11);
  --hero-bg: rgba(20, 27, 38, 0.92);
  --hero-line: rgba(124, 156, 255, 0.16);

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px -22px rgba(0, 0, 0, 0.8);
  --font: "Inter", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", "SF Mono", Consolas, monospace;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f4f6fb;
  --bg-elev: #eaeff8;
  --bg-elev-2: #eef2fa;
  --panel: #ffffff;
  --panel-2: #f7f9fd;
  --card-a: #ffffff;
  --card-b: #fbfcff;
  --rail-a: #ffffff;
  --rail-b: #f8fafd;
  --input: #ffffff;
  --zone: #f7f9fd;
  --thumb: #edf1f7;
  --mini: #edf1f7;
  --drawer: #ffffff;
  --drawer-foot: #f8fafd;
  --pre: #f3f6fc;
  --th: #f1f4fa;
  --nav-on: #e6eefc;
  --search: #ffffff;
  --hover: #f1f4fa;
  --tab-a: #ffffff;
  --tab-b: #f2f5fb;
  --auth-card-a: rgba(255, 255, 255, 0.94);
  --auth-card-b: rgba(248, 250, 253, 0.98);
  --empty-a: rgba(255, 255, 255, 0.72);
  --empty-b: rgba(244, 247, 252, 0.4);
  --toast-bg: rgba(255, 255, 255, 0.98);
  --bg-0: rgba(244, 246, 251, 0);
  --topbar: rgba(255, 255, 255, 0.78);
  --scrim: rgba(18, 26, 40, 0.42);
  --scrim-soft: rgba(18, 26, 40, 0.28);

  --line: #dce3ee;
  --line-soft: #e8edf5;
  --edge: #c3d0e2;
  --edge-2: #d3ddeb;
  --dot: #b3c0d4;
  --dot-core: #93a2b8;
  --scroll: #d3dbe8;
  --scroll-hover: #bcc7d8;

  --text: #131a26;
  --text-dim: #46536a;
  --muted: #69758a;
  --faint: #94a0b2;
  --md-text: #2d3849;
  --md-strong: #131a26;
  --pre-text: #33405a;
  --code-text: #3f5fd0;
  --chip-text: #33415c;

  --accent: #4a6bf0;
  --accent-soft: rgba(74, 107, 240, 0.1);
  --accent-2: #c68a20;
  --danger: #d94a4a;
  --ok: #16895c;
  --brand-a: #6d8bf7;
  --brand-b: #4a6bf0;
  --brand-c: #3a58d8;
  --btn-a: #5c7bf7;
  --btn-b: #4260e4;
  --on-brand: #ffffff;

  --hi-1: rgba(23, 35, 58, 0.038);
  --hi-2: rgba(23, 35, 58, 0.07);
  --hi-line: rgba(255, 255, 255, 0.85);

  --glow-a: #e4ecfb;
  --glow-b: #ece7fb;
  --orb-a: #c9d9f7;
  --orb-b: #dad2f6;
  --app-glow-a: rgba(120, 152, 220, 0.16);
  --app-glow-b: rgba(150, 132, 220, 0.12);
  --hero-tint: rgba(74, 107, 240, 0.07);
  --hero-bg: #ffffff;
  --hero-line: rgba(74, 107, 240, 0.16);

  --shadow: 0 18px 46px -24px rgba(23, 35, 58, 0.3);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

.is-hidden {
  display: none !important;
}

::selection {
  background: rgba(124, 156, 255, 0.32);
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--scroll);
  border-radius: 99px;
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-hover);
}

/* ── 通用按钮 ───────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 22px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: 0.2px;
  color: var(--on-brand);
  background: linear-gradient(180deg, var(--btn-a) 0%, var(--btn-b) 100%);
  box-shadow: 0 10px 26px -12px rgba(124, 156, 255, 0.9), inset 0 1px 0 var(--hi-line);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 16px 32px -14px rgba(124, 156, 255, 1);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.btn-primary.sm {
  height: 38px;
  padding: 0 16px;
  font-size: 13.5px;
}

.btn-ghost {
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  color: var(--text-dim);
  font-size: 13px;
  border: 1px solid transparent;
  transition: all 0.18s ease;
}
.btn-ghost:hover {
  color: var(--text);
  background: var(--hi-1);
  border-color: var(--line);
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--muted);
  transition: all 0.18s ease;
}
.icon-btn:hover {
  color: var(--text);
  background: var(--hi-2);
}

.link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(124, 156, 255, 0.4);
}

/* ── 字段 ───────────────────────────────────────────────── */
.field {
  display: block;
  margin-bottom: 16px;
}
.field > span {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  margin-bottom: 7px;
}
.field > span em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
  font-size: 11.5px;
}
.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 11px;
  background: var(--input);
  border: 1px solid var(--line);
  color: var(--text);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.field textarea {
  resize: vertical;
  min-height: 120px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
}
.field input::placeholder,
.field textarea::placeholder {
  color: var(--faint);
}
.field input:focus,
.field textarea:focus {
  border-color: rgba(124, 156, 255, 0.55);
  box-shadow: 0 0 0 3.5px rgba(124, 156, 255, 0.12);
  background: var(--hover);
}

.form-error {
  min-height: 18px;
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--danger);
}

/* ============================================================
   登录页
   ============================================================ */
.auth-view {
  position: relative;
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  overflow: hidden;
  background:
    radial-gradient(900px 600px at 15% 10%, var(--glow-a) 0%, transparent 60%),
    radial-gradient(800px 500px at 85% 90%, var(--glow-b) 0%, transparent 65%),
    var(--bg);
}

.auth-noise {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image: radial-gradient(var(--hi-1) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(circle at 50% 40%, #000 20%, transparent 78%);
  pointer-events: none;
}

.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.45;
  pointer-events: none;
  animation: float 14s ease-in-out infinite;
}
.orb-a {
  width: 340px;
  height: 340px;
  background: var(--orb-a);
  top: -110px;
  left: -80px;
}
.orb-b {
  width: 300px;
  height: 300px;
  background: var(--orb-b);
  bottom: -120px;
  right: -60px;
  animation-delay: -6s;
}
@keyframes float {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(20px, -26px, 0) scale(1.08);
  }
}

.auth-card {
  position: relative;
  width: min(420px, 100%);
  padding: 34px 32px 26px;
  border-radius: 22px;
  background: linear-gradient(180deg, var(--auth-card-a), var(--auth-card-b));
  border: 1px solid rgba(124, 156, 255, 0.13);
  box-shadow: 0 40px 90px -40px #000, inset 0 1px 0 var(--hi-2);
  backdrop-filter: blur(18px);
  animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.auth-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 26px;
}
.auth-brand h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 1px;
}
.auth-brand p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}
.mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  font-weight: 700;
  font-size: 20px;
  color: var(--on-brand);
  background: linear-gradient(160deg, var(--btn-a), var(--brand-b) 70%, var(--accent));
  box-shadow: 0 10px 24px -12px rgba(124, 156, 255, 0.9);
  flex: none;
}
.mark.sm {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 14px;
}

.auth-tabs {
  position: relative;
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 22px;
  background: var(--zone);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
}
.auth-tabs .tab {
  position: relative;
  z-index: 1;
  flex: 1;
  height: 34px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.2s ease;
}
.auth-tabs .tab.is-active {
  color: var(--text);
}
.tab-indicator {
  position: absolute;
  z-index: 0;
  top: 4px;
  left: 4px;
  height: 34px;
  width: calc(50% - 6px);
  border-radius: 9px;
  background: linear-gradient(180deg, var(--tab-a), var(--tab-b));
  border: 1px solid var(--edge-2);
  box-shadow: 0 4px 14px -8px #000;
  transition: transform 0.28s cubic-bezier(0.3, 1.2, 0.4, 1);
}
.auth-tabs[data-mode="register"] .tab-indicator {
  transform: translateX(calc(100% + 4px));
}

#authForm .btn-primary {
  width: 100%;
  margin-top: 4px;
}
.auth-foot {
  margin: 20px 0 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--faint);
}
.auth-foot code {
  font-family: var(--mono);
  color: var(--muted);
}

/* ============================================================
   主应用
   ============================================================ */
.app-view {
  min-height: 100%;
  background:
    radial-gradient(1100px 500px at 78% -10%, var(--app-glow-a) 0%, transparent 62%),
    radial-gradient(900px 600px at 0% 100%, var(--app-glow-b) 0%, transparent 60%),
    var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 62px;
  padding: 0 26px;
  background: var(--topbar);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(16px) saturate(140%);
}
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
}
.logo-text {
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 15px;
}

.searchbox {
  position: relative;
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--search);
  border: 1px solid var(--line);
  color: var(--muted);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.searchbox:focus-within {
  border-color: rgba(124, 156, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(124, 156, 255, 0.1);
  color: var(--accent);
}
.searchbox input {
  flex: 1;
  border: 0;
  outline: none;
  background: none;
  font-size: 13.5px;
  color: var(--text);
}
.searchbox input::placeholder {
  color: var(--faint);
}
.searchbox input::-webkit-search-cancel-button {
  filter: invert(0.6);
}

.user-area {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex: none;
}
.avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  color: var(--on-brand);
  background: linear-gradient(160deg, var(--brand-a), var(--brand-b));
}
.user-name {
  font-size: 13px;
  color: var(--text-dim);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 栅格 ───────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 34px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 26px 120px;
}

/* ── 左侧栏 ─────────────────────────────────────────────── */
.rail {
  position: sticky;
  top: 86px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.rail-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--rail-a), var(--rail-b));
  border: 1px solid var(--line-soft);
}
.rail-stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.rail-stat b {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.rail-stat span {
  font-size: 12px;
  color: var(--muted);
}

.rail-section h3 {
  margin: 0 0 10px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
}
.rail-months {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.month-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
  text-align: left;
  border-left: 2px solid transparent;
  transition: all 0.16s ease;
}
.month-link:hover {
  background: var(--hi-1);
  color: var(--text);
}
.month-link.is-current {
  color: var(--text);
  background: var(--accent-soft);
  border-left-color: var(--accent);
}
.month-link em {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── 舞台 ───────────────────────────────────────────────── */
.stage {
  min-width: 0;
}
.stage-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}
.stage-head h1 {
  margin: 0;
  font-size: 27px;
  letter-spacing: -0.4px;
  font-weight: 700;
}
.stage-head p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

/* ── 时间轴 ─────────────────────────────────────────────── */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
}

.tl-group {
  position: sticky;
  top: 62px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0 10px;
  margin-left: 46px;
  background: linear-gradient(180deg, var(--bg) 62%, var(--bg-0));
}
.tl-group-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted);
}
.tl-group::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

.tl-item {
  --shift: 0px;
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 18px;
  padding: 0 0 26px;
}

.tl-axis {
  position: relative;
  display: flex;
  justify-content: center;
  padding-top: 22px;
}
.tl-axis::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: -26px;
  width: 1px;
  background: linear-gradient(180deg, var(--line) 0%, var(--line) 72%, transparent 100%);
}
.tl-item:first-of-type .tl-axis::before {
  top: 26px;
}
.tl-item:last-of-type .tl-axis::before {
  bottom: auto;
  height: 34px;
}
.tl-dot {
  position: relative;
  z-index: 1;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dot);
  border: 1.5px solid var(--dot-core);
  transition: all 0.25s ease;
}
.tl-item:hover .tl-dot,
.tl-item.is-fresh .tl-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(124, 156, 255, 0.16), 0 0 14px rgba(124, 156, 255, 0.7);
}

.tl-card {
  position: relative;
  padding: 20px 22px;
  border-radius: var(--radius);
  transform: translate3d(var(--shift, 0), 0, 0);
  will-change: transform;
  background: linear-gradient(180deg, var(--card-a) 0%, var(--card-b) 100%);
  border: 1px solid var(--line-soft);
  box-shadow: 0 1px 0 var(--hi-1) inset;
  transition: border-color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
  animation: cardIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.tl-card:hover {
  border-color: var(--edge);
  box-shadow: var(--shadow);
}

.tl-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}
.tl-head h2 {
  margin: 0;
  font-size: 17.5px;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: -0.2px;
  word-break: break-word;
}
.tl-time {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 3px;
}
.tl-time svg {
  opacity: 0.55;
}

/* md 渲染区 */
.tl-card .md {
  position: relative;
  max-height: 320px;
  overflow: hidden;
  mask-image: linear-gradient(180deg, #000 76%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 76%, transparent 100%);
  transition: max-height 0.35s ease;
}
.tl-card.is-expanded .md {
  max-height: none;
  mask-image: none;
  -webkit-mask-image: none;
}

.tl-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.tl-foot .spacer {
  flex: 1;
}
.act-btn {
  font-size: 12.5px;
  color: var(--text-dim);
  padding: 5px 9px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.16s ease;
}
.act-btn:hover {
  color: var(--text);
  background: var(--hi-1);
  border-color: var(--line);
}
.act-btn.danger:hover {
  color: var(--danger);
  background: rgba(255, 115, 115, 0.09);
  border-color: rgba(255, 115, 115, 0.24);
}
.tl-file {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--muted);
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--hi-1);
  border: 1px solid var(--line-soft);
}
.tl-file svg {
  opacity: 0.7;
}

/* 缩略图 */
.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--thumb);
  cursor: zoom-in;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.thumb:hover img {
  transform: scale(1.06);
}

/* ── Markdown 正文样式 ──────────────────────────────────── */
.md {
  font-size: 14.2px;
  color: var(--md-text);
  line-height: 1.75;
  word-wrap: break-word;
}
.md > :first-child {
  margin-top: 0;
}
.md > :last-child {
  margin-bottom: 0;
}
.md h1,
.md h2,
.md h3,
.md h4,
.md h5,
.md h6 {
  color: var(--text);
  margin: 1.5em 0 0.6em;
  line-height: 1.35;
  font-weight: 650;
  letter-spacing: -0.2px;
}
.md h1 {
  font-size: 1.5em;
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--line-soft);
}
.md h2 {
  font-size: 1.26em;
  padding-bottom: 0.34em;
  border-bottom: 1px solid var(--line-soft);
}
.md h3 {
  font-size: 1.1em;
}
.md h4,
.md h5,
.md h6 {
  font-size: 1em;
  color: var(--text-dim);
}
.md p {
  margin: 0.85em 0;
}
.md a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(124, 156, 255, 0.32);
  transition: border-color 0.16s ease, color 0.16s ease;
}
.md a:hover {
  border-bottom-color: var(--accent);
}
.md strong {
  color: var(--text);
  font-weight: 650;
}
.md em {
  color: var(--md-strong);
}
.md del {
  color: var(--muted);
}
.md hr {
  border: 0;
  height: 1px;
  margin: 1.6em 0;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}
.md ul,
.md ol {
  margin: 0.8em 0;
  padding-left: 1.4em;
}
.md li {
  margin: 0.34em 0;
}
.md li::marker {
  color: var(--dot-core);
}
.md blockquote {
  margin: 1em 0;
  padding: 0.5em 1em;
  border-left: 2px solid rgba(124, 156, 255, 0.5);
  background: rgba(124, 156, 255, 0.055);
  border-radius: 0 8px 8px 0;
  color: var(--text-dim);
}
.md blockquote > :first-child {
  margin-top: 0;
}
.md blockquote > :last-child {
  margin-bottom: 0;
}
.md code {
  font-family: var(--mono);
  font-size: 0.87em;
  padding: 0.16em 0.42em;
  border-radius: 5px;
  background: rgba(124, 156, 255, 0.11);
  border: 1px solid rgba(124, 156, 255, 0.13);
  color: var(--code-text);
}
.md pre {
  margin: 1em 0;
  padding: 14px 16px;
  border-radius: 11px;
  background: var(--pre);
  border: 1px solid var(--line);
  overflow: auto;
  line-height: 1.6;
}
.md pre code {
  padding: 0;
  border: 0;
  background: none;
  color: var(--pre-text);
  font-size: 12.8px;
}
.md img {
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  margin: 0.6em 0;
  display: block;
  cursor: zoom-in;
}
.md table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 13.2px;
  display: block;
  overflow-x: auto;
}
.md th,
.md td {
  padding: 8px 12px;
  border: 1px solid var(--line);
  text-align: left;
}
.md th {
  background: var(--th);
  color: var(--text);
  font-weight: 600;
}
.md tr:nth-child(even) td {
  background: var(--hi-1);
}

/* ── 空状态 / 加载 ──────────────────────────────────────── */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 72px 24px;
  text-align: center;
  border-radius: var(--radius);
  border: 1px dashed var(--edge-2);
  background: linear-gradient(180deg, var(--empty-a), var(--empty-b));
}
.empty-icon {
  color: var(--dot);
  margin-bottom: 4px;
}
.empty h2 {
  margin: 0;
  font-size: 17px;
}
.empty p {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
  max-width: 320px;
}

.sentinel {
  height: 1px;
}
.load-hint {
  padding: 18px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  min-height: 20px;
}
.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 6px;
  vertical-align: -2px;
  border-radius: 50%;
  border: 1.6px solid var(--dot);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── 悬浮按钮 ───────────────────────────────────────────── */
.fab {
  position: fixed;
  right: 30px;
  bottom: 30px;
  z-index: 45;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: var(--on-brand);
  background: linear-gradient(160deg, var(--brand-a), var(--btn-b) 72%, var(--brand-c));
  box-shadow: 0 18px 40px -14px rgba(124, 156, 255, 0.9), inset 0 1px 0 var(--hi-line);
  transition: transform 0.2s cubic-bezier(0.3, 1.4, 0.4, 1), box-shadow 0.2s ease;
}
.fab:hover {
  transform: translateY(-3px) rotate(90deg);
  box-shadow: 0 24px 48px -14px rgba(124, 156, 255, 1);
}
.fab:active {
  transform: scale(0.95);
}

/* ============================================================
   上传抽屉
   ============================================================ */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  visibility: hidden;
  pointer-events: none;
}
.drawer.is-open {
  visibility: visible;
  pointer-events: auto;
}
.drawer-scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim-soft);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.drawer.is-open .drawer-scrim {
  opacity: 1;
}
.drawer-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(860px, calc(100vw - 48px));
  max-height: min(88vh, 920px);
  display: flex;
  flex-direction: column;
  background: var(--drawer);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.75);
  transform: translate(-50%, -46%) scale(0.97);
  opacity: 0;
  transition:
    transform 0.32s cubic-bezier(0.32, 0.72, 0, 1),
    opacity 0.24s ease;
}
.drawer.is-open .drawer-panel {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 26px;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 18px 18px 0 0;
}
.drawer-head h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0.2px;
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 26px 28px;
}
.drawer-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 26px;
  border-top: 1px solid var(--line-soft);
  background: var(--drawer-foot);
  border-radius: 0 0 18px 18px;
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 24px 18px;
  margin-bottom: 18px;
  text-align: center;
  border-radius: 13px;
  border: 1.5px dashed var(--edge-2);
  background: var(--zone);
  cursor: pointer;
  transition: all 0.2s ease;
}
.dropzone:hover,
.dropzone.is-over {
  border-color: rgba(124, 156, 255, 0.6);
  background: rgba(124, 156, 255, 0.055);
}
.dropzone.small {
  padding: 16px;
}
.dropzone p {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
}
.dropzone b {
  color: var(--text);
}
.dz-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 6px;
  border-radius: 10px;
  font-size: 16px;
  color: var(--accent);
  background: rgba(124, 156, 255, 0.11);
  border: 1px solid rgba(124, 156, 255, 0.18);
}
.dz-hint {
  font-size: 11.5px;
  color: var(--muted);
}

.picked {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 7px 12px;
  border-radius: 9px;
  background: rgba(124, 156, 255, 0.09);
  border: 1px solid rgba(124, 156, 255, 0.2);
  font-size: 12.5px;
  color: var(--chip-text);
  max-width: 100%;
}
.picked span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picked small {
  color: var(--muted);
  flex: none;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 7px;
  width: 100%;
  margin-top: 10px;
}
.thumb-grid:empty {
  margin: 0;
}
.mini {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--mini);
}
.mini img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mini button {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  color: #fff;
  background: rgba(8, 11, 16, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.18);
  opacity: 0;
  transition: opacity 0.16s ease;
}
.mini:hover button {
  opacity: 1;
}

/* ── 灯箱 ───────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 40px;
  background: var(--scrim);
  backdrop-filter: blur(6px);
  cursor: zoom-out;
  animation: fade 0.2s ease both;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: 0 40px 100px -30px #000;
}

/* ── Toast ──────────────────────────────────────────────── */
.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  padding: 10px 18px;
  border-radius: 11px;
  font-size: 13px;
  color: var(--text);
  background: var(--toast-bg);
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px -18px #000;
  animation: toastIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.toast.err {
  border-color: rgba(255, 115, 115, 0.4);
  color: var(--danger);
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 940px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 24px 18px 110px;
  }
  .rail {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    gap: 14px;
  }
  .rail-card {
    grid-auto-flow: column;
    gap: 18px;
    flex: none;
  }
  .rail-section {
    display: none;
  }
  .desktop-only {
    display: none;
  }
  .stage-head h1 {
    font-size: 23px;
  }
  .tl-item {
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 12px;
  }
  .tl-card {
    padding: 16px;
  }
  .tl-group {
    margin-left: 30px;
  }
  .topbar {
    padding: 0 16px;
    gap: 12px;
  }
  .user-name {
    display: none;
  }
}

@media (max-width: 940px) {
  .drawer-panel {
    width: calc(100vw - 28px);
    max-height: 92vh;
    border-radius: 14px;
  }
  .drawer-head,
  .drawer-foot {
    border-radius: 0;
  }
}
@media (max-width: 560px) {
  .logo-text {
    display: none;
  }
  .searchbox {
    max-width: none;
  }
  .fab {
    right: 18px;
    bottom: 18px;
  }
}

/* ============================================================
   公开 / 私密 · 主页 · 广场
   ============================================================ */

/* 顶栏导航 */
.topnav {
  display: flex;
  gap: 2px;
  flex: none;
  padding: 3px;
  border-radius: 10px;
  background: var(--hi-1);
  border: 1px solid var(--line-soft);
}
.topnav a {
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.16s ease;
}
.topnav a:hover {
  color: var(--text);
  background: var(--hi-2);
}
.topnav a.is-active {
  color: var(--text);
  background: var(--nav-on);
  box-shadow: inset 0 1px 0 var(--hi-2);
}

/* 无侧栏时单列 */
.layout.no-rail {
  grid-template-columns: minmax(0, 1fr);
  max-width: 880px;
}

/* 笔记本视图：横向铺开，侧栏贴近左边，编辑区拿到更多宽度 */
.layout.no-rail.is-nb {
  max-width: 1480px;
  padding: 26px 34px 72px;
}
.layout.is-nb .notebooks-view {
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
}

/* 主页头部 */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px;
  margin-bottom: 24px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--hero-tint), var(--hero-bg) 55%);
  border: 1px solid var(--hero-line);
  box-shadow: inset 0 1px 0 var(--hi-1);
}
.hero-avatar {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: none;
  border-radius: 18px;
  font-size: 24px;
  font-weight: 700;
  color: var(--on-brand);
  background: linear-gradient(160deg, var(--brand-a), var(--brand-b) 75%, var(--accent));
  box-shadow: 0 12px 28px -14px rgba(124, 156, 255, 0.9);
}
.hero-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.2px;
}
.hero-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 5px;
  color: var(--accent);
  background: rgba(124, 156, 255, 0.16);
  border: 1px solid rgba(124, 156, 255, 0.3);
}
.hero-meta {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
}

/* 可见性徽章 */
.vis-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  background: var(--hi-1);
  border: 1px solid var(--line);
  transition: all 0.16s ease;
}
.vis-badge .vb-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.vis-badge.is-public {
  color: var(--ok);
  border-color: rgba(126, 224, 176, 0.3);
  background: rgba(126, 224, 176, 0.075);
}
.vis-badge:hover:not(:disabled) {
  filter: brightness(1.18);
  transform: translateY(-1px);
}
.vis-badge.is-static {
  cursor: default;
}

/* 作者 */
.author-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--accent);
  background: rgba(124, 156, 255, 0.08);
  border: 1px solid rgba(124, 156, 255, 0.18);
  text-decoration: none;
  transition: background 0.16s ease;
}
.author-chip:hover {
  background: rgba(124, 156, 255, 0.16);
}

/* 抽屉里的可见性选择 */
.vis-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.vis-item {
  position: relative;
  display: grid;
  gap: 1px;
  padding: 11px 13px;
  text-align: left;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--zone);
  transition: all 0.18s ease;
}
.vis-item b {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}
.vis-item small {
  font-size: 10.8px;
  line-height: 1.45;
  color: var(--muted);
}
.vis-item .vis-dot {
  position: absolute;
  top: 11px;
  right: 11px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--dot);
  transition: all 0.18s ease;
}
.vis-item:hover {
  border-color: var(--edge);
  background: var(--hover);
}
.vis-item.is-active {
  border-color: rgba(124, 156, 255, 0.5);
  background: rgba(124, 156, 255, 0.07);
}
.vis-item.is-active b {
  color: var(--text);
}
.vis-item.is-active .vis-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 156, 255, 0.15);
}
.vis-item[data-vis="public"].is-active {
  border-color: rgba(126, 224, 176, 0.45);
  background: rgba(126, 224, 176, 0.07);
}
.vis-item[data-vis="public"].is-active .vis-dot {
  background: var(--ok);
  border-color: var(--ok);
  box-shadow: 0 0 0 3px rgba(126, 224, 176, 0.14);
}

@media (max-width: 940px) {
  .topnav a {
    padding: 5px 9px;
    font-size: 12px;
  }
  .profile-hero {
    padding: 18px;
  }
}

@media (max-width: 640px) {
  #navMine {
    display: none;
  }
  .vis-seg {
    grid-template-columns: 1fr;
  }
  .tl-foot {
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* ── 发现：作者列表 ─────────────────────────────────────── */
.author-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 12px;
}
.author-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--card-a) 0%, var(--card-b) 100%);
  border: 1px solid var(--line-soft);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.author-card:hover {
  border-color: var(--edge);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.ac-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 700;
  color: var(--on-brand);
  background: linear-gradient(160deg, var(--brand-a), var(--brand-b) 75%, var(--accent));
}
.ac-body {
  flex: 1;
  min-width: 0;
}
.ac-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ac-meta {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
}
.ac-arrow {
  flex: none;
  color: var(--muted);
  transition: transform 0.18s ease, color 0.18s ease;
}
.author-card:hover .ac-arrow {
  transform: translateX(3px);
  color: var(--accent);
}
.grid-hint {
  grid-column: 1 / -1;
  padding: 44px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}


/* ============================================================
   主题切换按钮
   ============================================================ */
.theme-btn {
  flex: none;
  color: var(--text-dim);
}
.theme-btn:hover {
  color: var(--accent);
  background: var(--hi-2);
}
.theme-btn .ico-moon {
  display: none;
}
:root[data-theme="light"] .theme-btn .ico-sun {
  display: none;
}
:root[data-theme="light"] .theme-btn .ico-moon {
  display: block;
}
.auth-theme-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
}

/* 浅色下的少量特调：阴影与深色遮罩 */
:root[data-theme="light"] .tl-card {
  box-shadow: 0 1px 2px rgba(23, 35, 58, 0.05), 0 10px 26px -20px rgba(23, 35, 58, 0.35);
}
:root[data-theme="light"] .tl-card:hover {
  box-shadow: 0 14px 36px -22px rgba(23, 35, 58, 0.4);
}
:root[data-theme="light"] .auth-card {
  box-shadow: 0 30px 70px -40px rgba(23, 35, 58, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
:root[data-theme="light"] .drawer-panel {
  box-shadow: -30px 0 60px -40px rgba(23, 35, 58, 0.4);
}
:root[data-theme="light"] .lightbox img {
  box-shadow: 0 30px 70px -30px rgba(23, 35, 58, 0.6);
}
:root[data-theme="light"] .btn-primary {
  box-shadow: 0 10px 24px -14px rgba(66, 96, 228, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
:root[data-theme="light"] .btn-primary:hover {
  box-shadow: 0 16px 30px -16px rgba(66, 96, 228, 0.7);
}
:root[data-theme="light"] .fab {
  box-shadow: 0 18px 36px -16px rgba(66, 96, 228, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
:root[data-theme="light"] .mark,
:root[data-theme="light"] .avatar,
:root[data-theme="light"] .hero-avatar,
:root[data-theme="light"] .ac-avatar {
  box-shadow: 0 10px 22px -14px rgba(66, 96, 228, 0.6);
}
:root[data-theme="light"] .md code {
  background: rgba(74, 107, 240, 0.09);
  border-color: rgba(74, 107, 240, 0.16);
}
:root[data-theme="light"] .md blockquote {
  background: rgba(74, 107, 240, 0.055);
  border-left-color: rgba(74, 107, 240, 0.45);
}
:root[data-theme="light"] .thumb img,
:root[data-theme="light"] .md img {
  background: #ffffff;
}

/* ============================================================
   笔记本（仅本人可见）
   ============================================================ */
.notebooks-view {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

/* 左侧笔记本栏 */
.nb-side {
  position: sticky;
  top: 82px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card-a), var(--card-b));
  border: 1px solid var(--line);
  max-height: calc(100vh - 110px);
}
.nb-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 8px;
}
.nb-side-head h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
}
.nb-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.nb-item {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: 10px;
  transition: background 0.16s ease;
}
.nb-item:hover {
  background: var(--hi-1);
}
.nb-item.is-active {
  background: var(--hi-1);
  box-shadow: inset 2px 0 0 var(--accent);
}
.nb-item-name {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  text-align: left;
  color: var(--text-dim);
  font-size: 13.5px;
  background: transparent;
  border: none;
  cursor: pointer;
}
.nb-item.is-active .nb-item-name {
  color: var(--text);
  font-weight: 600;
}
.nb-item-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nb-count {
  flex: none;
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.nb-item-actions {
  display: flex;
  gap: 2px;
  padding-right: 6px;
  opacity: 0;
  transition: opacity 0.16s ease;
}
.nb-item:hover .nb-item-actions {
  opacity: 1;
}
.nb-act {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
}
.nb-act:hover {
  background: var(--hi-2, var(--hi-1));
  color: var(--text);
}
.nb-act.danger:hover {
  color: #ff7b7b;
}
.nb-new {
  padding: 4px;
}
.nb-new input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--accent);
  background: var(--bg-0);
  color: var(--text);
  font-size: 13px;
}

/* 右侧主区 */
.nb-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.nb-main-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.nb-head-text h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.2px;
}
.nb-meta {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}
.nb-note-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.nb-note {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  padding: 16px 17px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--card-a), var(--card-b));
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.nb-note:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.nb-note-title {
  font-size: 14.5px;
  font-weight: 650;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nb-note-ex {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.nb-note-meta {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* 编辑器 */
.nb-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card-a), var(--card-b));
  border: 1px solid var(--line);
}
.nb-editor-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nb-title-input {
  flex: 1;
  min-width: 0;
  padding: 6px 4px;
  font-size: 18px;
  font-weight: 650;
  color: var(--text);
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
}
.nb-title-input:focus {
  border-bottom-color: var(--accent);
  outline: none;
}
.nb-editor-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.nb-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: var(--bg-0);
  border: 1px solid var(--line-soft);
}
.nb-tab {
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  cursor: pointer;
}
.nb-tab.is-active {
  background: var(--hi-1);
  color: var(--text);
  font-weight: 600;
}
.nb-editor-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nb-move {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
}
.nb-move select {
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-0);
  color: var(--text);
  font-size: 12.5px;
  max-width: 150px;
}
.nb-textarea {
  width: 100%;
  min-height: 52vh;
  resize: vertical;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: var(--bg-0);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.7;
}
.nb-textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.nb-preview {
  min-height: 52vh;
  padding: 18px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: var(--bg-0);
}
.nb-hint {
  margin: 0;
  min-height: 16px;
  font-size: 11.5px;
  color: var(--muted);
}

@media (max-width: 940px) {
  .layout.no-rail.is-nb {
    padding: 20px 16px 60px;
  }
  .layout.is-nb .notebooks-view {
    grid-template-columns: 1fr;
  }
  .nb-side {
    position: static;
    max-height: none;
  }
  .nb-list {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .nb-item {
    flex: 0 0 auto;
  }
}

/* ============================================================
   管理员入口 / 控制台
   ============================================================ */

/* 登录卡片左下角的小齿轮：默认几乎不可见，hover 才显形 */
.admin-entry {
  position: absolute;
  left: 14px;
  bottom: 13px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--faint);
  opacity: 0.26;
  cursor: pointer;
  transition: opacity 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.admin-entry:hover,
.admin-entry:focus-visible {
  opacity: 1;
  color: var(--text-dim);
  border-color: var(--line);
  outline: none;
}

.admin-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 18px;
  padding: 9px 12px;
  border: 1px solid var(--edge-2);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  font-size: 12px;
  letter-spacing: 0.3px;
  color: var(--text-dim);
}
.admin-mode-bar button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
}
.admin-mode-bar button:hover {
  text-decoration: underline;
}

.admin-view {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  overflow-y: auto;
}

.admin-top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  background: var(--topbar);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.admin-brand h1 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.2px;
}
.admin-brand p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.admin-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 28px 60px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.admin-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card-a), var(--card-b));
}
.admin-stat b {
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.4px;
}
.admin-stat span {
  font-size: 12px;
  color: var(--muted);
}

.admin-panel {
  padding: 18px 20px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.admin-panel-head {
  margin-bottom: 14px;
}
.admin-panel-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.admin-panel-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.admin-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.admin-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.admin-switch-track {
  position: relative;
  width: 40px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--tab-b);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.admin-switch-dot {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s ease, background 0.2s ease;
}
.admin-switch input:checked + .admin-switch-track {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.admin-switch input:checked + .admin-switch-track .admin-switch-dot {
  transform: translateX(18px);
  background: var(--accent);
}
.admin-switch input:focus-visible + .admin-switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  white-space: nowrap;
}
.admin-table th,
.admin-table td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
}
.admin-table thead th {
  position: sticky;
  top: 0;
  background: var(--th);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  text-transform: uppercase;
}
.admin-table tbody tr:hover {
  background: var(--hover);
}
.admin-table tbody tr:last-child td {
  border-bottom: 0;
}
.admin-table .mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.2px;
}
.admin-table .muted {
  color: var(--faint);
}
.admin-table .danger {
  color: var(--danger);
}
.admin-table .ok {
  color: var(--ok);
}
.ua-cell {
  display: inline-block;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  color: var(--muted);
}

.admin-pwd-warn {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.admin-pwd-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-pwd-row input {
  flex: 1 1 180px;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--input);
  color: var(--text);
  font-size: 13px;
}
.admin-pwd-row input:focus {
  border-color: var(--accent);
  outline: none;
}

@media (max-width: 760px) {
  .admin-top {
    padding: 14px 16px;
  }
  .admin-body {
    padding: 18px 16px 48px;
  }
  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
