/* =========================================================
   CloudMark 2.0 — 私人书房 · 黄铜与纸
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Manrope:wght@300;400;500;600;700&family=Noto+Serif+SC:wght@400;500;600&family=Noto+Sans+SC:wght@300;400;500&display=swap');

:root {
  --sans: "Manrope", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --serif: "Instrument Serif", "Noto Serif SC", "Songti SC", "Iowan Old Style", Georgia, serif;
  --mono: "SFMono-Regular", "Cascadia Code", Consolas, "Liberation Mono", monospace;
  --radius: 18px;
  --radius-sm: 12px;
  --topbar-h: 72px;
  --sidebar-w: 296px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --fs: 1.2;
  --accent-rgb: 199, 162, 101;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08080a;
  --bg-elev: #0e0e11;
  --surface: rgba(255, 255, 255, .038);
  --surface-solid: #131316;
  --surface-hover: #1a1a1e;
  --surface-active: #222226;
  --line: rgba(243, 239, 230, .075);
  --line-strong: rgba(243, 239, 230, .17);
  --ink: #f3efe6;
  --ink-soft: #c9c3b6;
  --muted: #8a857c;
  --faint: #5c5750;
  --accent: #c7a265;
  --accent-rgb: 199, 162, 101;
  --accent-soft: rgba(var(--accent-rgb), .13);
  --accent-line: rgba(var(--accent-rgb), .34);
  --accent-ink: #1a1207;
  --accent-grad: linear-gradient(160deg, #e2c78f 0%, #bd9456 100%);
  --green: #7fa98f;
  --red: #d87a63;
  --red-soft: rgba(216, 122, 99, .13);
  --blue: #8aa6b8;
  --shadow: 0 44px 90px -40px rgba(0, 0, 0, .95);
  --shadow-sm: 0 26px 50px -30px rgba(0, 0, 0, .92);
  --favicon-bg: rgba(255, 255, 255, .045);
  --sheen: rgba(255, 255, 255, .2);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f2eee4;
  --bg-elev: #f7f4ec;
  --surface: rgba(255, 253, 248, .78);
  --surface-solid: #fbf8f1;
  --surface-hover: #efe9db;
  --surface-active: #e7dfce;
  --line: rgba(42, 36, 26, .1);
  --line-strong: rgba(42, 36, 26, .2);
  --ink: #1d1a14;
  --ink-soft: #3b362d;
  --muted: #746c61;
  --faint: #a39a8b;
  --accent: #9a6f32;
  --accent-rgb: 154, 111, 50;
  --accent-soft: rgba(var(--accent-rgb), .1);
  --accent-line: rgba(var(--accent-rgb), .3);
  --accent-ink: #fff9ef;
  --accent-grad: linear-gradient(160deg, #c79a55 0%, #96682c 100%);
  --green: #4f7a5f;
  --red: #a94f3c;
  --red-soft: rgba(169, 79, 60, .1);
  --blue: #3a6b86;
  --shadow: 0 40px 80px -40px rgba(72, 55, 26, .28);
  --shadow-sm: 0 22px 42px -28px rgba(72, 55, 26, .22);
  --favicon-bg: rgba(30, 26, 18, .045);
  --sheen: rgba(255, 255, 255, .75);
}

/* 松烟 —— 墨绿与苔色 */
[data-theme="forest"] {
  color-scheme: dark;
  --bg: #07100b;
  --bg-elev: #0b1610;
  --surface: rgba(255, 255, 255, .038);
  --surface-solid: #111f18;
  --surface-hover: #17291f;
  --surface-active: #1d3326;
  --line: rgba(230, 240, 228, .075);
  --line-strong: rgba(230, 240, 228, .17);
  --ink: #ecf2e8;
  --ink-soft: #c1ccba;
  --muted: #84917e;
  --faint: #5a6656;
  --accent: #9dc08b;
  --accent-rgb: 157, 192, 139;
  --accent-soft: rgba(var(--accent-rgb), .13);
  --accent-line: rgba(var(--accent-rgb), .34);
  --accent-ink: #0b170c;
  --accent-grad: linear-gradient(160deg, #cbe3b4 0%, #93bd7e 100%);
  --green: #8fc49a;
  --red: #d98a70;
  --red-soft: rgba(217, 138, 112, .13);
  --blue: #8fb6b6;
  --shadow: 0 44px 90px -40px rgba(0, 0, 0, .95);
  --shadow-sm: 0 26px 50px -30px rgba(0, 0, 0, .92);
  --favicon-bg: rgba(255, 255, 255, .045);
  --sheen: rgba(255, 255, 255, .2);
}

/* 深海 —— 石板与青蓝 */
[data-theme="ocean"] {
  color-scheme: dark;
  --bg: #070b11;
  --bg-elev: #0b1118;
  --surface: rgba(255, 255, 255, .038);
  --surface-solid: #101821;
  --surface-hover: #16212c;
  --surface-active: #1c2a38;
  --line: rgba(228, 238, 248, .075);
  --line-strong: rgba(228, 238, 248, .17);
  --ink: #edf3f9;
  --ink-soft: #bfcbd9;
  --muted: #7e8c9c;
  --faint: #54616f;
  --accent: #86b8cf;
  --accent-rgb: 134, 184, 207;
  --accent-soft: rgba(var(--accent-rgb), .13);
  --accent-line: rgba(var(--accent-rgb), .34);
  --accent-ink: #06131a;
  --accent-grad: linear-gradient(160deg, #b3dcea 0%, #6d9fb6 100%);
  --green: #7fb9a3;
  --red: #d68c78;
  --red-soft: rgba(214, 140, 120, .13);
  --blue: #8aa9c9;
  --shadow: 0 44px 90px -40px rgba(0, 0, 0, .95);
  --shadow-sm: 0 26px 50px -30px rgba(0, 0, 0, .92);
  --favicon-bg: rgba(255, 255, 255, .045);
  --sheen: rgba(255, 255, 255, .2);
}

/* 绛色 —— 暮光与铜红 */
[data-theme="rose"] {
  color-scheme: dark;
  --bg: #0e0708;
  --bg-elev: #140b0d;
  --surface: rgba(255, 255, 255, .038);
  --surface-solid: #1b1013;
  --surface-hover: #24151a;
  --surface-active: #2d1a20;
  --line: rgba(246, 234, 232, .075);
  --line-strong: rgba(246, 234, 232, .17);
  --ink: #f5ebe8;
  --ink-soft: #d0bcb7;
  --muted: #937f7b;
  --faint: #675452;
  --accent: #d19b86;
  --accent-rgb: 209, 155, 134;
  --accent-soft: rgba(var(--accent-rgb), .13);
  --accent-line: rgba(var(--accent-rgb), .34);
  --accent-ink: #1b0a05;
  --accent-grad: linear-gradient(160deg, #efd0bf 0%, #c3866d 100%);
  --green: #93b79c;
  --red: #e07a63;
  --red-soft: rgba(224, 122, 99, .13);
  --blue: #96a9c4;
  --shadow: 0 44px 90px -40px rgba(0, 0, 0, .95);
  --shadow-sm: 0 26px 50px -30px rgba(0, 0, 0, .92);
  --favicon-bg: rgba(255, 255, 255, .045);
  --sheen: rgba(255, 255, 255, .2);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: calc(14px * var(--fs));
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1080px 720px at 86% -14%, rgba(var(--accent-rgb), .12), transparent 62%),
    radial-gradient(880px 620px at -8% 106%, rgba(110, 138, 152, .07), transparent 60%);
}
[data-theme="light"] body::before {
  background:
    radial-gradient(1080px 720px at 86% -14%, rgba(var(--accent-rgb), .22), transparent 62%),
    radial-gradient(880px 620px at -8% 106%, rgba(110, 138, 152, .1), transparent 60%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}
[data-theme="light"] body::after { opacity: .028; }
body:has(dialog[open]) { overflow: hidden; }

h1, h2, h3, p, dl, dd, dt, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: var(--accent); }
img { display: block; max-width: 100%; }

svg {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(140, 135, 125, .25); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(140, 135, 125, .4); background-clip: content-box; border: 3px solid transparent; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: calc(9.5px * var(--fs));
  font-weight: 500;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before {
  content: "";
  width: 14px;
  height: 1px;
  background: currentColor;
  opacity: .55;
  flex: none;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 17px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: calc(13px * var(--fs));
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
  transition: transform .2s var(--ease), background .22s, border-color .22s, box-shadow .3s, color .22s, filter .22s;
}
.btn svg { width: 15px; height: 15px; }
.btn:active { transform: scale(.975); }
.btn--accent {
  background: var(--accent-grad);
  color: var(--accent-ink);
  border-color: rgba(255, 255, 255, .22);
  box-shadow: 0 14px 30px -16px rgba(var(--accent-rgb), .8), inset 0 1px 0 rgba(255, 255, 255, .42);
}
.btn--accent:hover { filter: brightness(1.06); box-shadow: 0 18px 36px -16px rgba(var(--accent-rgb), .95), inset 0 1px 0 rgba(255, 255, 255, .42); }
.btn--ghost { border-color: var(--line-strong); color: var(--ink-soft); background: rgba(255, 255, 255, .025); }
.btn--ghost:hover { background: var(--surface-hover); color: var(--ink); border-color: rgba(var(--accent-rgb), .34); }
.btn--danger { background: var(--red); color: #fff; border-color: rgba(255, 255, 255, .16); }
.btn--danger:hover { filter: brightness(1.06); }
.btn--ghost-danger { border-color: transparent; color: var(--red); background: var(--red-soft); }
.btn--ghost-danger:hover { border-color: var(--red); }
.btn--sm { height: 32px; padding: 0 12px; font-size: calc(12px * var(--fs)); }
.btn--block { width: 100%; height: 48px; letter-spacing: .04em; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; filter: none; }

.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  color: var(--muted);
  transition: background .16s, color .16s, transform .16s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--surface-hover); color: var(--ink); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.is-on { color: var(--accent); background: var(--accent-soft); }

.link-btn {
  padding: 0;
  color: var(--accent);
  font-size: calc(12px * var(--fs));
  font-weight: 600;
}
.link-btn:hover { text-decoration: underline; }

kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-hover);
  color: var(--muted);
  font-family: var(--mono);
  font-size: calc(10px * var(--fs));
  line-height: 1.5;
  text-align: center;
}

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: calc(11px * var(--fs)); font-weight: 600; letter-spacing: .04em; color: var(--muted); }
.field--full { grid-column: 1 / -1; }
.field-hint { display: flex; justify-content: space-between; gap: 12px; min-height: 16px; font-size: calc(11px * var(--fs)); color: var(--muted); }
.field-hint.is-error { color: var(--red); }
.field-hint.is-ok { color: var(--green); }

input[type="text"], input[type="search"], input[type="password"], input[type="url"], input[type="number"], select, textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: calc(13px * var(--fs));
  transition: border-color .16s, box-shadow .16s, background .16s;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 62px; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface-solid);
}
select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 17px, calc(100% - 11px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
option { background: var(--surface-solid); color: var(--ink); }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input { padding-right: 96px; }
.input-action {
  position: absolute;
  right: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 9px;
  border-radius: 7px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: calc(11px * var(--fs));
  font-weight: 600;
}
.input-action svg { width: 13px; height: 13px; }
.input-action:hover { background: var(--accent-line); }
.input-action:disabled { opacity: .6; cursor: progress; }

.checkbox { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: calc(12.5px * var(--fs)); color: var(--ink-soft); }
.checkbox input { width: 15px; height: 15px; accent-color: var(--accent); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-error { min-height: 18px; margin-top: 10px; font-size: calc(12px * var(--fs)); color: var(--red); text-align: center; }

/* ---------- 登录 ---------- */
.login {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.12fr .88fr;
  background: #08080a;
}
.login__visual {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding: clamp(36px, 7vw, 96px);
  border-right: 1px solid rgba(243, 239, 230, .07);
  background:
    radial-gradient(760px 560px at 12% 14%, rgba(var(--accent-rgb), .2), transparent 62%),
    radial-gradient(620px 520px at 90% 96%, rgba(110, 138, 152, .1), transparent 60%),
    linear-gradient(165deg, #0d0d10 0%, #08080a 58%, #060608 100%);
}
.login__grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .55;
  background-image:
    linear-gradient(rgba(243, 239, 230, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(243, 239, 230, .045) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at 32% 38%, #000 0%, transparent 76%);
}
.login__top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; position: relative; z-index: 1; }
.login__top .brand__mark {
  border-radius: 13px;
  border: 1px solid rgba(var(--accent-rgb), .34);
  color: var(--accent);
  background: linear-gradient(160deg, rgba(var(--accent-rgb), .22), rgba(var(--accent-rgb), .03));
  box-shadow: 0 12px 30px -16px rgba(var(--accent-rgb), .7), inset 0 1px 0 rgba(255, 255, 255, .1);
}
.login__top .eyebrow { color: rgba(228, 200, 143, .78); }
.login__visual h1 {
  position: relative;
  z-index: 1;
  font-family: var(--serif);
  font-size: calc(clamp(42px, 5.2vw, 72px) * var(--fs));
  line-height: 1.08;
  font-weight: 400;
  letter-spacing: -.01em;
  color: #f3efe6;
}
.login__visual em { font-style: italic; color: var(--accent); }
.login__lede {
  position: relative;
  z-index: 1;
  max-width: 420px;
  color: rgba(243, 239, 230, .56);
  font-size: calc(14px * var(--fs));
  line-height: 1.85;
}
.login__points {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 16px;
  font-size: calc(11px * var(--fs));
  letter-spacing: .08em;
  color: rgba(243, 239, 230, .44);
}
.login__points li { display: flex; gap: 14px; align-items: center; }
.login__points span { font-family: var(--mono); color: var(--accent); }
.login__panel { display: grid; place-items: center; padding: 32px; background: #0b0b0d; }
.login__card {
  position: relative;
  width: 100%;
  max-width: 380px;
  padding: 34px;
  border: 1px solid rgba(243, 239, 230, .12);
  border-radius: 24px;
  background: linear-gradient(172deg, #161619 0%, #0d0d0f 100%);
  box-shadow: 0 50px 100px -46px rgba(0, 0, 0, .95), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.login__card .field > span { color: rgba(255, 255, 255, .5); }
.login__card .field + .field { margin-top: 14px; }
.login__card input,
.login__card select { background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .12); color: #f3efe5; }
.login__card input:focus,
.login__card select:focus { background: rgba(255, 255, 255, .08); }
.login__card select option { background: #181b21; color: #f3efe5; }
.login__card .input-action { color: #f0b45c; background: rgba(230, 162, 60, .14); }
.login__card-head { display: flex; flex-direction: column; gap: 7px; margin-bottom: 26px; }
.login__card-head h2 { font-family: var(--serif); font-size: calc(31px * var(--fs)); font-weight: 400; letter-spacing: -.005em; color: #f3efe6; }
.login__card-head p { font-size: calc(12.5px * var(--fs)); line-height: 1.7; color: rgba(243, 239, 230, .44); }
.login__icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 13px;
  color: #e4c88f;
  background: linear-gradient(160deg, rgba(var(--accent-rgb), .22), rgba(var(--accent-rgb), .04));
  border: 1px solid rgba(var(--accent-rgb), .32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
}
.login__icon svg { width: 19px; height: 19px; stroke-width: 1.5; }
.login__card .btn--block { margin-top: 22px; }
.login__card .form-error { text-align: left; }
.login__card input:focus,
.login__card select:focus { border-color: rgba(var(--accent-rgb), .55); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .08); }
.login__hint { margin-top: 8px; font-size: calc(11.5px * var(--fs)); line-height: 1.75; color: rgba(243, 239, 230, .32); }

/* ---------- 工作区 ---------- */
.workspace {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}
.main { min-width: 0; }

/* ---------- 侧栏 ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(14, 14, 17, .94) 0%, rgba(9, 9, 11, .9) 100%);
  backdrop-filter: blur(24px) saturate(140%);
  z-index: 30;
}
[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, rgba(250, 247, 239, .94) 0%, rgba(242, 238, 228, .9) 100%);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; }
.brand__mark {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(var(--accent-rgb), .22), rgba(var(--accent-rgb), .03));
  color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), .34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 10px 26px -16px rgba(var(--accent-rgb), .7);
}
.brand__mark svg { width: 20px; height: 20px; stroke-width: 1.6; }
.brand__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.brand__text h1 { font-family: var(--serif); font-size: calc(22px * var(--fs)); font-weight: 400; letter-spacing: .005em; line-height: 1; }
.brand__text span { font-family: var(--sans); font-size: calc(8.5px * var(--fs)); font-weight: 500; letter-spacing: .26em; color: var(--faint); }
.sidebar__close { display: none; margin-left: auto; }
.sidebar__scroll { flex: 1; overflow-y: auto; padding: 0 12px 16px; }
.nav-section { margin-bottom: 24px; }
.nav-label { padding: 0 10px; margin-bottom: 8px; font-family: var(--sans); font-size: calc(9.5px * var(--fs)); font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--faint); }
.nav-label-row { display: flex; align-items: center; justify-content: space-between; padding-right: 4px; margin-bottom: 4px; }
.nav-label-row .nav-label { margin-bottom: 0; }
.nav-label-row .icon-btn { width: 26px; height: 26px; }
.nav-label-row .icon-btn svg { width: 14px; height: 14px; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 11px;
  color: var(--ink-soft);
  font-size: calc(13.5px * var(--fs));
  text-align: left;
  transition: background .25s var(--ease), color .25s, box-shadow .25s;
}
.nav-item svg { width: 16px; height: 16px; color: var(--muted); transition: color .25s; }
.nav-item:hover { background: rgba(255, 255, 255, .04); color: var(--ink); }
[data-theme="light"] .nav-item:hover { background: rgba(30, 26, 18, .045); }
.nav-item.is-active {
  color: var(--ink);
  background: linear-gradient(90deg, var(--accent-soft), rgba(var(--accent-rgb), .015));
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .16);
}
.nav-item.is-active svg { color: var(--accent); }
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), .5);
}
.nav-item__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item__count { font-family: var(--sans); font-size: calc(10.5px * var(--fs)); color: var(--faint); font-variant-numeric: tabular-nums; }
.nav-item.is-active .nav-item__count { color: rgba(228, 200, 143, .75); }
.nav-item.is-drop { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }

.folder-tree { display: flex; flex-direction: column; gap: 2px; }
.folder-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 11px;
  padding: 0 6px 0 0;
  transition: background .25s;
}
.folder-row:hover { background: rgba(255, 255, 255, .04); }
[data-theme="light"] .folder-row:hover { background: rgba(30, 26, 18, .045); }
.folder-row.is-active { background: var(--accent-soft); }
.folder-row.is-drop { box-shadow: inset 0 0 0 1px var(--accent-line); background: var(--accent-soft); }
.folder-row__toggle {
  width: 18px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--faint);
  flex: none;
}
.folder-row__toggle svg { width: 12px; height: 12px; transition: transform .18s var(--ease); }
.folder-row__toggle.is-open svg { transform: rotate(90deg); }
.folder-row__toggle.is-empty { visibility: hidden; }
.folder-row__main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  color: var(--ink-soft);
  font-size: calc(13.5px * var(--fs));
  text-align: left;
}
.folder-row.is-active .folder-row__main { color: var(--ink); }
.folder-row__dot { width: 6px; height: 6px; border-radius: 2px; background: var(--faint); flex: none; }
.folder-row__icon { display: inline-grid; place-items: center; width: 16px; height: 16px; flex: none; }
.folder-row__icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.folder-row__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-row__count { font-family: var(--mono); font-size: calc(11px * var(--fs)); color: var(--muted); }
.folder-row.is-active .folder-row__main { color: var(--ink); font-weight: 600; }
.folder-row__actions { display: none; gap: 1px; flex: none; }
.folder-row:hover .folder-row__actions { display: flex; }
.folder-row:hover .folder-row__count { display: none; }
.folder-row__actions .icon-btn { width: 24px; height: 24px; }
.folder-row__actions .icon-btn svg { width: 13px; height: 13px; }
.folder-empty {
  width: 100%;
  padding: 14px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  font-size: calc(13px * var(--fs));
  text-align: left;
}
.folder-empty span { color: var(--accent); }
.folder-empty:hover { border-color: var(--accent-line); color: var(--ink); }

.tag-list { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 6px; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid rgba(var(--accent-rgb), .15);
  border-radius: 7px;
  background: rgba(var(--accent-rgb), .075);
  color: rgba(228, 200, 143, .9);
  font-size: calc(11px * var(--fs));
  letter-spacing: .02em;
  transition: color .25s, border-color .25s, background .25s;
}
.tag-chip small { font-family: var(--sans); font-size: calc(10px * var(--fs)); opacity: .6; }
.tag-chip:hover { color: var(--ink); border-color: rgba(var(--accent-rgb), .38); background: rgba(var(--accent-rgb), .13); }
.tag-chip.is-active { color: var(--accent-ink); border-color: transparent; background: var(--accent-grad); }
[data-theme="light"] .tag-chip { color: var(--accent); background: var(--accent-soft); border-color: rgba(var(--accent-rgb), .22); }

.sidebar__foot { border-top: 1px solid var(--line); padding: 12px 14px 14px; }
.storage-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-family: var(--sans);
  font-size: calc(10px * var(--fs));
  letter-spacing: .08em;
  color: var(--faint);
}
.storage-line span:last-child { color: var(--ink-soft); }
.foot-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.foot-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  color: var(--muted);
  font-size: calc(12px * var(--fs));
}
.foot-btn svg { width: 14px; height: 14px; }
.foot-btn:hover { background: var(--surface-hover); color: var(--ink); }
.foot-btn--danger:hover { color: var(--red); }
.sidebar-scrim { display: none; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 8, 10, .92), rgba(8, 8, 10, .72));
  backdrop-filter: blur(26px) saturate(140%);
}
[data-theme="light"] .topbar {
  background: linear-gradient(180deg, rgba(247, 244, 236, .92), rgba(242, 238, 228, .76));
}
.menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 7px; min-width: 0; flex: none; max-width: 30%; font-size: calc(12px * var(--fs)); color: var(--muted); }
.crumbs svg { width: 13px; height: 13px; color: var(--faint); }
.crumbs .crumb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs .crumb:last-child { color: var(--ink-soft); font-weight: 600; }
.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 520px;
  margin-left: auto;
  height: 42px;
  padding: 0 8px 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .03);
  transition: border-color .25s, box-shadow .25s, background .25s;
}
[data-theme="light"] .search { background: rgba(255, 253, 248, .7); }
.search:focus-within { border-color: var(--accent-line); background: var(--surface-solid); box-shadow: 0 0 0 4px var(--accent-soft); }
.search__icon { width: 16px; height: 16px; color: var(--faint); margin-left: 2px; transition: color .25s; }
.search:focus-within .search__icon { color: var(--accent); }
.search input {
  flex: 1;
  height: 100%;
  padding: 0 10px;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: calc(12.5px * var(--fs));
}
.search input:focus { outline: none; box-shadow: none; background: transparent; }
.search input::-webkit-search-cancel-button { display: none; }
.search__clear { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 99px; color: var(--muted); }
.search__clear:hover { background: var(--surface-hover); color: var(--ink); }
.search__kbd { flex: none; margin-left: 4px; color: var(--faint); border-color: var(--line); }
.topbar__actions { display: flex; align-items: center; gap: 6px; flex: none; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: calc(11px * var(--fs));
  white-space: nowrap;
}
.status-pill .dot { width: 6px; height: 6px; border-radius: 99px; background: var(--green); box-shadow: 0 0 0 3px rgba(154, 200, 107, .14); }
.status-pill[data-state="saving"] .dot { background: var(--accent); animation: pulse 1s infinite; box-shadow: 0 0 0 3px var(--accent-soft); }
.status-pill[data-state="error"] .dot, .status-pill[data-state="conflict"] .dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.status-pill[data-state="offline"] .dot { background: var(--faint); box-shadow: none; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- 内容 ---------- */
.content { padding: 38px 40px 120px; max-width: 1560px; margin: 0 auto; }
.page-head {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 26px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.page-head__main { min-width: 0; flex: 1; }
.page-head__meta { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.page-head__meta .eyebrow { color: var(--accent); }
.page-title {
  font-family: var(--serif);
  font-size: calc(clamp(30px, 3.4vw, 46px) * var(--fs));
  font-weight: 400;
  letter-spacing: -.005em;
  line-height: 1.08;
  overflow-wrap: anywhere;
}
.page-sub { margin-top: 9px; color: var(--muted); font-size: calc(12px * var(--fs)); line-height: 1.7; }
.page-sub b { color: var(--ink-soft); font-weight: 600; }
.view-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.seg__btn {
  width: 30px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
}
.seg__btn svg { width: 15px; height: 15px; }
.seg__btn:hover { color: var(--ink); }
.seg__btn.is-active { background: var(--accent-soft); color: var(--accent); }
.sort-select { width: auto; min-width: 104px; height: 32px; font-size: calc(12px * var(--fs)); background-color: var(--surface); }
.sort-note {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: calc(12px * var(--fs));
  white-space: nowrap;
}
.sort-note svg { width: 13px; height: 13px; }
.density-btn { color: var(--muted); }
.density-btn.is-on { color: var(--accent); }

/* ---------- 书签网格 ---------- */
.bookmark-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 18px;
}
.bookmark-grid.is-compact { grid-template-columns: repeat(auto-fill, minmax(216px, 1fr)); gap: 12px; }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 158px;
  padding: 18px 18px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(300px 180px at 88% -18%, rgba(var(--accent-rgb), .07), transparent 68%),
    linear-gradient(165deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .012) 58%, rgba(255, 255, 255, .02));
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .02);
  cursor: pointer;
  overflow: hidden;
  animation: cardIn .5s var(--ease) backwards;
  transition: transform .45s var(--ease), border-color .35s, background .35s, box-shadow .45s;
  user-select: none;
}
[data-theme="light"] .card {
  background:
    radial-gradient(300px 180px at 88% -18%, rgba(var(--accent-rgb), .1), transparent 68%),
    linear-gradient(165deg, rgba(255, 253, 248, .95), rgba(255, 253, 248, .68));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}
.bookmark-grid .card:nth-child(1) { animation-delay: 0ms; }
.bookmark-grid .card:nth-child(2) { animation-delay: 35ms; }
.bookmark-grid .card:nth-child(3) { animation-delay: 70ms; }
.bookmark-grid .card:nth-child(4) { animation-delay: 105ms; }
.bookmark-grid .card:nth-child(5) { animation-delay: 140ms; }
.bookmark-grid .card:nth-child(6) { animation-delay: 175ms; }
.bookmark-grid .card:nth-child(7) { animation-delay: 210ms; }
.bookmark-grid .card:nth-child(8) { animation-delay: 245ms; }
.bookmark-grid .card:nth-child(9) { animation-delay: 280ms; }
.bookmark-grid .card:nth-child(10) { animation-delay: 315ms; }
.bookmark-grid .card:nth-child(11) { animation-delay: 350ms; }
.bookmark-grid .card:nth-child(12) { animation-delay: 385ms; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.card::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: -1px;
  height: 1px;
  border-radius: 1px;
  background: linear-gradient(90deg, transparent, var(--sheen), transparent);
  opacity: .45;
  transition: opacity .3s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(var(--accent-rgb), .34);
  background:
    radial-gradient(340px 200px at 85% -10%, rgba(var(--accent-rgb), .13), transparent 70%),
    linear-gradient(165deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .016));
  box-shadow: 0 26px 50px -30px rgba(0, 0, 0, .95);
}
[data-theme="light"] .card:hover {
  background:
    radial-gradient(340px 200px at 85% -10%, rgba(var(--accent-rgb), .16), transparent 70%),
    var(--surface-solid);
  box-shadow: var(--shadow-sm);
}
.card:hover::after { opacity: 1; }
.card:active { transform: translateY(-1px) scale(.995); }
.card.is-selected { border-color: rgba(var(--accent-rgb), .6); background: linear-gradient(165deg, rgba(var(--accent-rgb), .14), rgba(var(--accent-rgb), .03)); box-shadow: 0 0 0 1px rgba(var(--accent-rgb), .4); }
.card.is-dragging { opacity: .4; }
.card.is-drop-before::before, .card.is-drop-after::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(230, 162, 60, .5);
}
.card.is-drop-before::before { left: -8px; }
.card.is-drop-after::before { right: -8px; }
.card__check {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface-solid);
  color: transparent;
  opacity: 0;
  transition: opacity .15s, background .15s, border-color .15s;
}
.card__check svg { width: 11px; height: 11px; stroke-width: 3; }
.card:hover .card__check, .card.is-selected .card__check, .is-selecting .card__check { opacity: 1; }
.card.is-selected .card__check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.card__actions {
  position: absolute;
  top: 9px;
  right: 9px;
  display: flex;
  gap: 1px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity .15s, transform .15s;
}
.card:hover .card__actions, .card.is-selected .card__actions { opacity: 1; transform: none; }
.card__actions .icon-btn {
  width: 25px;
  height: 25px;
  background: color-mix(in srgb, var(--surface-solid) 72%, transparent);
  backdrop-filter: blur(6px);
}
.card__actions .icon-btn svg { width: 13px; height: 13px; }
.card__actions .icon-btn.is-pinned { color: var(--accent); }
.card__actions .icon-btn.is-pinned svg { fill: currentColor; }
.card__head { display: flex; align-items: flex-start; gap: 11px; padding-right: 18px; }
.favicon {
  position: relative;
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--favicon-bg);
}
.favicon img { position: relative; z-index: 1; width: 20px; height: 20px; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35)); }
.favicon__fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: calc(17px * var(--fs));
  font-weight: 400;
  background: transparent !important;
  color: var(--accent) !important;
}
[data-theme="light"] .favicon__fallback { color: var(--accent) !important; }
.palette__icon .favicon { width: 100%; height: 100%; border: 0; border-radius: 7px; background: transparent; }
.palette__icon .favicon img { width: 15px; height: 15px; }
.palette__icon .favicon__fallback { font-size: calc(11px * var(--fs)); }
.card__heading { min-width: 0; flex: 1; padding-top: 1px; }
.card__title {
  font-size: calc(14.5px * var(--fs));
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: .002em;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.card__domain {
  margin-top: 4px;
  font-family: var(--sans);
  font-size: calc(10.5px * var(--fs));
  letter-spacing: .03em;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card__tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.card__tags .tag-chip { cursor: pointer; padding: 2px 8px; font-size: calc(10px * var(--fs)); }
.card__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(243, 239, 230, .055);
  font-size: calc(10.5px * var(--fs));
  color: var(--faint);
}
[data-theme="light"] .card__foot { border-top-color: rgba(42, 36, 26, .065); }
.card__foot svg { width: 12px; height: 12px; }
.card__foot .sep { margin: 0 1px; opacity: .45; }
.card__folder { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 55%; }
.card__folder span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__pin { color: var(--accent); display: inline-flex; align-items: center; gap: 3px; }
.card__pin svg { fill: currentColor; }
.is-compact .card { min-height: 112px; padding: 13px 14px 11px; }
.is-compact .card__description { display: none; }
.card__description {
  margin-top: 8px;
  font-size: calc(11.5px * var(--fs));
  line-height: 1.55;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- 列表视图 ---------- */
.bookmark-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.row {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 168px 132px 74px 28px;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .14s;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-hover); }
.row.is-selected { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.row.is-dragging { opacity: .4; }
.row__main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.row .favicon { width: 27px; height: 27px; border-radius: 8px; }
.row .favicon img { width: 15px; height: 15px; }
.row__text { min-width: 0; }
.row__title { font-size: calc(13px * var(--fs)); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__url { font-family: var(--mono); font-size: calc(10px * var(--fs)); color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__tags { display: flex; gap: 4px; overflow: hidden; }
.row__tags .tag-chip { padding: 1px 6px; font-size: calc(9.5px * var(--fs)); white-space: nowrap; }
.row__folder { display: flex; align-items: center; gap: 5px; font-size: calc(11px * var(--fs)); color: var(--muted); overflow: hidden; }
.row__folder svg { width: 12px; height: 12px; }
.row__folder span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__stat { font-family: var(--mono); font-size: calc(10px * var(--fs)); color: var(--faint); text-align: right; }
.row__actions { display: flex; gap: 2px; opacity: 0; }
.row:hover .row__actions, .row.is-selected .row__actions { opacity: 1; }
.row__actions .icon-btn { width: 25px; height: 25px; }
.row__actions .icon-btn.is-pinned { color: var(--accent); }
.row__actions .icon-btn.is-pinned svg { fill: currentColor; }
.row__actions .icon-btn svg { width: 13px; height: 13px; }
.row .card__check { position: static; opacity: 0; }
.row:hover .card__check, .row.is-selected .card__check { opacity: 1; }
.row.is-selected .card__check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- 空状态 ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 340px;
  padding: 52px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 22px;
  background: radial-gradient(circle at 50% 0%, rgba(var(--accent-rgb), .06), transparent 62%);
  text-align: center;
  animation: cardIn .5s var(--ease) backwards;
}
.empty-state__art {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(255, 255, 255, .028);
  color: var(--accent);
  opacity: 1;
}
.empty-state__art svg { width: 24px; height: 24px; stroke-width: 1.4; }
.empty-state h3 { font-family: var(--serif); font-size: calc(24px * var(--fs)); font-weight: 400; }
.empty-state p { max-width: 360px; color: var(--muted); font-size: calc(12.5px * var(--fs)); line-height: 1.8; }
.empty-state__actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }
.empty-inline { padding: 42px 20px; text-align: center; color: var(--muted); font-size: calc(12.5px * var(--fs)); }
.empty-inline strong { display: block; margin-bottom: 4px; font-family: var(--serif); font-size: calc(19px * var(--fs)); color: var(--ink); font-weight: 400; }

/* ---------- 同步冲突 ---------- */
.conflict-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(226, 112, 95, .34);
  border-radius: 12px;
  background: var(--red-soft);
}
.conflict-banner > svg { width: 18px; height: 18px; color: var(--red); }
.conflict-banner > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.conflict-banner strong { font-size: calc(12.5px * var(--fs)); }
.conflict-banner span { font-size: calc(11px * var(--fs)); color: var(--muted); }

/* ---------- 选择栏 ---------- */
.selection-bar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: calc(100vw - 32px);
  padding: 9px 10px 9px 18px;
  border: 1px solid rgba(var(--accent-rgb), .28);
  border-radius: 16px;
  background: rgba(14, 14, 17, .92);
  backdrop-filter: blur(22px) saturate(140%);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .9);
  animation: rise .3s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 10px); } }
.selection-bar__count { font-size: calc(12px * var(--fs)); color: var(--muted); white-space: nowrap; }
.selection-bar__count span { font-family: var(--serif); font-size: calc(19px * var(--fs)); font-weight: 400; color: var(--accent); margin-right: 2px; }
.selection-bar__actions { display: flex; gap: 2px; }
.bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: calc(11.5px * var(--fs));
}
.bar-btn svg { width: 14px; height: 14px; }
.bar-btn:hover { background: var(--surface-hover); color: var(--ink); }
.bar-btn--danger { color: var(--red); }
.bar-btn--danger:hover { background: var(--red-soft); }

/* ---------- 弹窗 ---------- */
.dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 18px;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: auto;
  display: none;
}
.dialog[open] { display: flex; align-items: center; justify-content: center; }
.dialog::backdrop { background: rgba(4, 4, 6, .7); backdrop-filter: blur(16px); }
.dialog-card {
  position: relative;
  width: min(600px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: linear-gradient(172deg, var(--surface-solid) 0%, var(--bg-elev) 100%);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .05);
  animation: pop .34s var(--ease);
}
.dialog--sm .dialog-card { width: min(440px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.dialog-head h2 { margin-top: 7px; font-family: var(--serif); font-size: calc(27px * var(--fs)); font-weight: 400; letter-spacing: -.005em; }
.dialog-head .eyebrow { color: var(--accent); }
.dialog-close { margin: -4px -4px 0 0; }
.dialog-copy { margin-bottom: 18px; color: var(--muted); font-size: calc(12.5px * var(--fs)); line-height: 1.75; }
.dialog-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.dialog-foot .spacer { flex: 1; }
.spacer { flex: 1; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
  transition: transform .15s, border-color .15s;
}
.swatch:hover { transform: scale(1.08); }
.swatch.is-active { border-color: var(--ink); }
.swatch--none { position: relative; background: var(--surface-hover); }
.swatch--none::after { content: ""; position: absolute; left: 5px; right: 5px; top: 50%; height: 1px; background: var(--muted); transform: rotate(-45deg); }

.icon-picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.icon-pick {
  display: grid;
  place-items: center;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-soft);
  background: var(--surface);
  transition: border-color .16s, color .16s, background .16s;
}
.icon-pick svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.icon-pick:hover { border-color: var(--line-strong); color: var(--ink); }
.icon-pick.is-active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.icon-pick--none span { font-size: calc(15px * var(--fs)); line-height: 1; color: var(--muted); }

/* ---------- 偏好设置 ---------- */
.settings-list { display: flex; flex-direction: column; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.setting-row:last-child { border-bottom: 0; }
.setting-row__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.setting-row__text strong { font-size: calc(13px * var(--fs)); font-weight: 600; }
.setting-row__text small { color: var(--muted); font-size: calc(11px * var(--fs)); }
.segmented {
  display: inline-flex;
  flex: none;
  padding: 2px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-hover);
}
.segmented button {
  padding: 4px 9px;
  border-radius: 7px;
  color: var(--muted);
  font-size: calc(11.5px * var(--fs));
  white-space: nowrap;
  transition: background .16s, color .16s;
}
.segmented button:hover { color: var(--ink); }
.segmented button.is-active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* 主题选择器 */
#settings-dialog .dialog-card { width: min(468px, 100%); }
.setting-row--stack { flex-direction: column; align-items: stretch; gap: 13px; }
.theme-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.theme-swatch {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 7px;
  border-radius: 13px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: transform .25s var(--ease), border-color .25s, background .25s, box-shadow .25s;
}
.theme-swatch:hover { transform: translateY(-2px); border-color: rgba(var(--accent-rgb), .45); }
.theme-swatch.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent), 0 10px 24px -16px rgba(var(--accent-rgb), .8);
}
.theme-swatch__canvas {
  position: relative;
  display: block;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--line);
}
.sw-panel {
  position: absolute;
  left: 6px;
  top: 6px;
  right: 6px;
  bottom: 6px;
  border-radius: 5px;
  background: var(--surface-solid);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
  border: 1px solid var(--line);
}
.sw-line {
  position: absolute;
  left: 15px;
  top: 16px;
  width: 40%;
  height: 3px;
  border-radius: 2px;
  background: var(--ink);
  opacity: .55;
}
.sw-line--short { top: 24px; width: 26%; opacity: .22; }
.sw-dot {
  position: absolute;
  right: 15px;
  top: 15px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), .65);
}
.theme-swatch--auto .sw-panel {
  background: linear-gradient(135deg, #08080a 0 50%, #f2eee4 50% 100%);
}
.sw-split {
  position: absolute;
  left: 50%;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: rgba(199, 162, 101, .55);
}
.theme-swatch__label {
  padding: 0 3px;
  font-size: calc(11px * var(--fs));
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.theme-swatch.is-active .theme-swatch__label { color: var(--accent); font-weight: 600; }

/* ---------- Cloudflare 免费额度 ---------- */
.quota-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.quota-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.quota-head .eyebrow { color: var(--accent); }
.quota-head strong { display: block; margin-top: 3px; font-size: calc(13px * var(--fs)); font-weight: 600; }
.quota-list { display: flex; flex-direction: column; gap: 13px; }
.quota-row__head { display: flex; justify-content: space-between; gap: 10px; font-size: calc(12px * var(--fs)); }
.quota-row__head span { color: var(--ink-soft); }
.quota-row__head b { font-family: var(--mono); font-size: calc(11.5px * var(--fs)); font-weight: 600; color: var(--muted); }
.quota-bar { position: relative; height: 5px; margin: 7px 0 5px; border-radius: 99px; background: var(--surface-hover); overflow: hidden; }
.quota-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 99px;
  background: var(--accent-grad);
  transition: width .4s var(--ease);
}
.quota-row[data-level="warn"] .quota-bar i { background: var(--accent); }
.quota-row[data-level="danger"] .quota-bar i { background: var(--red); }
.quota-row__foot { display: flex; justify-content: space-between; gap: 10px; font-family: var(--mono); font-size: calc(10.5px * var(--fs)); color: var(--muted); }
.quota-note { margin-top: 10px; font-size: calc(11px * var(--fs)); line-height: 1.7; color: var(--muted); }
.quota-note.is-error { color: var(--red); }

.import-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 28px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  text-align: center;
  transition: border-color .16s, background .16s;
}
.import-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.import-drop > svg { width: 26px; height: 26px; color: var(--accent); margin-bottom: 2px; }
.import-drop strong { font-size: calc(13px * var(--fs)); }
.import-drop span { color: var(--muted); font-size: calc(11.5px * var(--fs)); }
.import-drop .btn { margin-top: 8px; }
.import-summary {
  display: flex;
  gap: 20px;
  margin-top: 16px;
  padding: 13px 16px;
  border-radius: 12px;
  background: var(--surface-hover);
  font-size: calc(12px * var(--fs));
  color: var(--muted);
}
.import-summary b { color: var(--ink); font-family: var(--mono); font-size: calc(16px * var(--fs)); margin-right: 3px; }
.radio-group { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.radio {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.radio:hover { border-color: var(--line-strong); }
.radio:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.radio input { margin-top: 3px; accent-color: var(--accent); }
.radio span { display: flex; flex-direction: column; gap: 1px; }
.radio strong { font-size: calc(12.5px * var(--fs)); }
.radio small { color: var(--muted); font-size: calc(11px * var(--fs)); }
.export-options { display: flex; flex-direction: column; gap: 8px; }
.export-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
}
.export-option:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.export-option > svg { width: 20px; height: 20px; color: var(--accent); }
.export-option span { display: flex; flex-direction: column; gap: 2px; }
.export-option strong { font-size: calc(12.5px * var(--fs)); }
.export-option small { color: var(--muted); font-size: calc(11px * var(--fs)); }

.shortcut-list { display: flex; flex-direction: column; gap: 2px; }
.shortcut-list > div { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.shortcut-list > div:last-child { border-bottom: 0; }
.shortcut-list dt { display: flex; gap: 4px; flex: none; }
.shortcut-list dd { color: var(--muted); font-size: calc(12px * var(--fs)); }

/* ---------- 命令面板 ---------- */
.dialog--palette { align-items: flex-start; padding-top: 11vh; }
.palette {
  width: min(640px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface-solid);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: pop .18s var(--ease);
}
.palette__search { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.palette__search > svg { width: 18px; height: 18px; color: var(--accent); }
.palette__search input {
  flex: 1;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: calc(15px * var(--fs));
}
.palette__search input:focus { outline: none; box-shadow: none; background: transparent; }
.palette__list { max-height: min(56vh, 460px); overflow-y: auto; padding: 7px; }
.palette__group { padding: 9px 11px 5px; font-family: var(--mono); font-size: calc(9px * var(--fs)); letter-spacing: .18em; text-transform: uppercase; color: var(--faint); }
.palette__item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
}
.palette__item.is-active { background: var(--accent-soft); }
.palette__item.is-active .palette__title { color: var(--accent); }
.palette__icon {
  width: 28px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-hover);
  color: var(--muted);
  overflow: hidden;
}
.palette__icon svg { width: 14px; height: 14px; }
.palette__icon img { width: 16px; height: 16px; object-fit: contain; }
.palette__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.palette__title { font-size: calc(12.5px * var(--fs)); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette__meta { font-family: var(--mono); font-size: calc(9.5px * var(--fs)); color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette__hint { font-size: calc(10px * var(--fs)); color: var(--faint); font-family: var(--mono); white-space: nowrap; }
.palette__empty { padding: 34px 16px; text-align: center; color: var(--muted); font-size: calc(12px * var(--fs)); }
.palette__foot {
  display: flex;
  gap: 16px;
  padding: 9px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--faint);
  font-size: calc(10px * var(--fs));
}
.palette__foot span { display: flex; align-items: center; gap: 4px; }
.palette__foot kbd { min-width: 16px; padding: 0 3px; font-size: calc(9px * var(--fs)); }

/* ---------- Toast ---------- */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
  max-width: min(380px, calc(100vw - 40px));
  padding: 11px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(18, 18, 21, .95);
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 40px -22px rgba(0, 0, 0, .95);
  font-size: calc(12.5px * var(--fs));
  color: var(--ink-soft);
  pointer-events: auto;
  animation: toast-in .34s var(--ease);
}
[data-theme="light"] .toast { background: rgba(253, 250, 243, .96); }
.toast > svg { width: 15px; height: 15px; color: var(--green); }
.toast.is-error > svg { color: var(--red); }
.toast__text { flex: 1; }
.toast__action { color: var(--accent); font-size: calc(11.5px * var(--fs)); font-weight: 600; white-space: nowrap; }
.toast.is-leaving { animation: toast-out .2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

.noscript { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 200; }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .content { padding: 24px 24px 92px; }
  .topbar { padding: 0 20px; gap: 12px; }
  .row { grid-template-columns: 30px minmax(0, 1fr) 130px 80px 26px; }
  .row__folder { display: none; }
}
@media (max-width: 960px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(300px, 84vw);
    transform: translateX(-102%);
    transition: transform .26s var(--ease);
    box-shadow: 30px 0 60px rgba(0, 0, 0, .3);
  }
  .sidebar.is-open { transform: none; }
  .sidebar__close { display: inline-grid; }
  .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(5, 6, 8, .55);
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .26s;
  }
  .sidebar-scrim.is-open { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-grid; }
  .crumbs { display: none; }
  .search { max-width: none; }
  .search__kbd { display: none; }
  .status-pill__text { display: none; }
  .status-pill { width: 30px; padding: 0; justify-content: center; }
  .topbar { gap: 8px; }
}
@media (max-width: 720px) {
  .login { grid-template-columns: 1fr; }
  .login__visual { display: none; }
  .login__panel { padding: 20px; }
  .login__card { padding: 26px 22px; }
  .content { padding: 20px 16px 110px; }
  .topbar { height: 60px; padding: 0 12px; }
  .topbar__actions .btn span { display: none; }
  .topbar__actions .btn { width: 38px; padding: 0; }
  .page-head { align-items: flex-start; }
  .view-controls { width: 100%; }
  .bookmark-grid { grid-template-columns: 1fr; }
  .bookmark-grid.is-compact { grid-template-columns: 1fr 1fr; gap: 8px; }
  .is-compact .card { min-height: 100px; padding: 11px; }
  .is-compact .card__head { gap: 8px; padding-right: 0; }
  .is-compact .favicon { width: 28px; height: 28px; }
  .is-compact .card__foot { display: none; }
  .row { grid-template-columns: 26px minmax(0, 1fr) 26px; padding: 10px 12px; }
  .row__tags, .row__stat { display: none; }
  .selection-bar { left: 12px; right: 12px; transform: none; flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 12px; width: auto; }
  .selection-bar__count { text-align: center; }
  .selection-bar__actions { justify-content: space-between; }
  .bar-btn span { display: none; }
  .bar-btn { padding: 0 8px; }
  .form-grid { grid-template-columns: 1fr; }
  .setting-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .segmented { display: flex; }
  .segmented button { flex: 1; text-align: center; }
  .icon-picker { grid-template-columns: repeat(7, 1fr); }
  .dialog { padding: 10px; }
  .dialog-card { padding: 20px 18px; border-radius: 16px; }
  .toasts { left: 12px; right: 12px; bottom: 12px; align-items: stretch; }
  .toast { max-width: none; }
}
@media (max-width: 420px) {
  .bookmark-grid.is-compact { grid-template-columns: 1fr; }
}

@media (hover: none) {
  .card__actions, .row__actions { opacity: 1; }
  .card__check, .row .card__check { opacity: 1; }
  .folder-row__actions { display: flex; }
  .folder-row:hover .folder-row__count { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
