/* ==========================================================================
   云记 —— 样式表
   设计基调：青白纸 + 松烟墨 + 朱砂印。三联工作台，细线分隔，不用卡片堆叠。
   ========================================================================== */

:root {
  --paper: #f3f5f0;
  --paper-deep: #eaeee7;
  --sheet: #fcfcf8;
  --ink: #18221f;
  --ink-soft: #43534e;
  --muted: #5f6d66;
  --hair: #dde3db;
  --hair-soft: #e8ece5;
  --celadon: #6d8f86;
  --celadon-deep: #4c6a62;
  --cinnabar: #bc3a26;
  --cinnabar-wash: rgba(188, 58, 38, 0.075);
  --gold: #8a641f;
  --ok: #3f7a5c;

  /* 可换肤衍生令牌 */
  --hover: rgba(24, 34, 31, 0.05);
  --hover-strong: rgba(24, 34, 31, 0.08);
  --hover-note: rgba(255, 255, 255, 0.55);
  --hair-strong: #c9d2c9;
  --sheet-raised: #ffffff;
  --shadow-sm: 0 1px 2px rgba(24, 34, 31, 0.08);
  --focus-ring: 0 0 0 3px rgba(109, 143, 134, 0.14);
  --code-bg: rgba(24, 34, 31, 0.06);
  --pre-bg: #f2f4ee;
  --foot-bg: rgba(243, 245, 240, 0.5);
  --tag-bg: #e6ebe3;
  --tag-bg-hover: #d8e2d5;
  --tag-border: #cfd9cd;
  --on-accent: #f4f7f3;
  --on-ink: #f7f9f4;
  --on-cinnabar: #ffffff;
  --placeholder: #6b7871;
  --placeholder-strong: #7d8981;
  --rail-bg: #18221f;
  --rail-fg: #cdd7d1;
  --rail-fg-dim: #93a49c;
  --rail-hover: rgba(255, 255, 255, 0.08);
  --rail-active: #ffffff;
  --pattern-dot: rgba(109, 143, 134, 0.13);
  --ok-wash: rgba(63, 122, 92, 0.06);
  --ok-ring: rgba(63, 122, 92, 0.15);
  --bad-ring: rgba(188, 58, 38, 0.14);

  /* 版式令牌：主题可切换字体与圆角 */
  --display: var(--serif);
  --shadow-pop: 0 30px 80px -40px rgba(20, 30, 26, 0.75);

  --serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", STSong, SimSun, serif;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei",
    "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --kai: "KaiTi", "STKaiti", "Kaiti SC", "楷体", var(--serif);
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --rail-w: 60px;
  --side-w: 268px;
  --list-w: 322px;
  --radius: 3px;
  --radius-lg: 4px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

a {
  color: inherit;
}

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

[hidden] {
  display: none !important;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius);
}
.skip:focus {
  left: 12px;
}

/* 通用小图标 */
.ico {
  width: 18px;
  height: 18px;
  display: block;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ico-fill {
  fill: currentColor;
  stroke: none;
}

/* ============================ 启动占位 ============================ */
.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 22px;
  background: var(--paper);
  z-index: 60;
}
.boot-mark {
  font-family: var(--kai);
  font-size: 46px;
  line-height: 1;
  color: #fff;
  background: var(--cinnabar);
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 2px;
  box-shadow: 0 10px 26px -14px rgba(188, 58, 38, 0.9);
  animation: stamp 0.55s var(--ease) both;
}
.boot-text {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.12em;
}
@keyframes stamp {
  from {
    opacity: 0;
    transform: scale(1.28) rotate(-6deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(-3deg);
  }
}

/* ============================ 登录页 ============================ */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  background: var(--paper);
}

.auth-brand {
  position: relative;
  padding: 64px clamp(32px, 5vw, 84px) 48px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  border-right: 1px solid var(--hair);
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0 47px,
      rgba(109, 143, 134, 0.09) 47px 48px
    ),
    radial-gradient(120% 90% at 0% 0%, var(--brand-glow) 0%, var(--paper) 62%);
  overflow: hidden;
}

.brand-stack {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}
.brand-vertical {
  writing-mode: vertical-rl;
  font-family: var(--kai);
  font-size: clamp(58px, 7vw, 92px);
  line-height: 1.06;
  letter-spacing: 0.14em;
  color: var(--ink);
  border-left: 3px solid var(--ink);
  padding-left: 16px;
}
.brand-seal {
  align-self: flex-end;
  font-family: var(--kai);
  font-size: 20px;
  color: #fff;
  background: var(--cinnabar);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 2px;
  transform: rotate(-3deg);
  margin-bottom: 8px;
}

.brand-copy {
  max-width: 22em;
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.95;
  color: var(--ink-soft);
  text-align: justify;
}

.brand-meta {
  margin: auto 0 0;
  display: flex;
  gap: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--hair);
  flex-wrap: wrap;
}
.brand-meta div {
  display: grid;
  gap: 2px;
}
.brand-meta dt {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.brand-meta dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-soft);
}

.auth-form-wrap {
  display: grid;
  place-items: center;
  padding: 48px 24px;
}
.auth-form {
  width: min(378px, 100%);
  animation: rise 0.6s 0.12s var(--ease) both;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.auth-title {
  font-family: var(--display);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 6px;
}
.auth-sub {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 13px;
}

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--paper-deep);
  border-radius: var(--radius);
  margin-bottom: 22px;
}
.seg-btn {
  padding: 6px 18px;
  font-size: 13px;
  color: var(--muted);
  border-radius: 2px;
  transition: color 0.16s, background 0.16s;
}
.seg-btn.is-on {
  background: var(--sheet);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.field {
  display: block;
  margin-bottom: 16px;
}
.field > span {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}
.field input {
  width: 100%;
  padding: 11px 13px;
  background: var(--sheet);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.field input::placeholder {
  color: var(--placeholder);
}
.field input:focus {
  outline: none;
  border-color: var(--celadon);
  box-shadow: var(--focus-ring);
}

.form-error {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--cinnabar);
  background: var(--cinnabar-wash);
  border-left: 2px solid var(--cinnabar);
  padding: 7px 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid var(--hair);
  background: var(--sheet);
  font-size: 13.5px;
  color: var(--ink);
  transition: background 0.16s, border-color 0.16s, color 0.16s, transform 0.1s;
}
.btn:hover {
  border-color: var(--hair-strong);
  background: var(--sheet-raised);
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
  font-weight: 500;
  letter-spacing: 0.03em;
}
.btn-primary:hover {
  background: #24322d;
  border-color: #24322d;
}
.btn-block {
  width: 100%;
  height: 42px;
  font-size: 14px;
}
.btn-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--ink-soft);
}
.btn-quiet:hover {
  background: var(--paper-deep);
}
.btn-ghost-danger {
  border-color: transparent;
  color: var(--cinnabar);
  background: transparent;
}
.btn-ghost-danger:hover {
  background: var(--cinnabar-wash);
}
.btn[disabled] {
  opacity: 0.55;
  pointer-events: none;
}

.demo-card {
  margin-top: 22px;
  width: 100%;
  text-align: left;
  display: grid;
  gap: 2px;
  padding: 13px 15px;
  border: 1px dashed var(--hair-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(252, 252, 248, 0.6), transparent);
  transition: border-color 0.16s, background 0.16s;
}
.demo-card:hover {
  border-color: var(--celadon);
  background: var(--sheet);
}
.demo-title {
  font-size: 13px;
  color: var(--ink);
}
.demo-cred {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--celadon-deep);
}
.demo-note {
  font-size: 11.5px;
  color: var(--muted);
}

.auth-net {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--hair);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.auth-net .link-btn {
  margin-left: auto;
  color: var(--celadon-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 12px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
  transition: background 0.2s, box-shadow 0.2s;
}
.dot.is-ok {
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-ring);
}
.dot.is-bad {
  background: var(--cinnabar);
  box-shadow: 0 0 0 3px var(--bad-ring);
}

/* ============================ 主工作台 ============================ */
.app {
  height: 100vh;
  display: grid;
  grid-template-columns: var(--rail-w) var(--side-w) var(--list-w) minmax(0, 1fr);
  background: var(--paper);
}

/* --- 图标导航 --- */
.rail {
  background: var(--rail-bg);
  color: var(--rail-fg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0 16px;
  gap: 18px;
}
.rail-brand {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 2px;
}
.rail-char {
  font-family: var(--kai);
  font-size: 21px;
  color: #fff;
  background: var(--cinnabar);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  transform: rotate(-2deg);
  transition: transform 0.25s var(--ease);
}
.rail-brand:hover .rail-char {
  transform: rotate(2deg) scale(1.04);
}
.rail-nav {
  display: grid;
  gap: 4px;
  justify-items: center;
  width: 100%;
}
.rail-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 2px;
  color: var(--rail-fg-dim);
  position: relative;
  transition: color 0.16s, background 0.16s;
}
.rail-btn:hover {
  color: var(--rail-active);
  background: var(--rail-hover);
}
.rail-btn.is-on {
  color: var(--rail-active);
}
.rail-btn.is-on::before {
  content: "";
  position: absolute;
  left: -11px;
  top: 11px;
  bottom: 11px;
  width: 2px;
  background: var(--cinnabar);
}
.rail-foot {
  margin-top: auto;
  display: grid;
  gap: 8px;
  justify-items: center;
}
.avatar-btn,
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-family: var(--display);
  background: var(--celadon-deep);
  color: #f2f6f2;
  letter-spacing: 0;
}
.avatar-btn:hover {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}

/* --- 侧栏 --- */
.sidebar {
  background: var(--paper-deep);
  border-right: 1px solid var(--hair);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-height: 0;
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 10px 20px;
}
.wordmark {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--ink);
}
.ghost-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 2px;
  color: var(--muted);
  transition: background 0.16s, color 0.16s;
}
.ghost-icon:hover {
  background: var(--hover);
  color: var(--ink);
}

.search {
  margin: 2px 16px 12px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 10px;
  background: var(--sheet);
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  transition: border-color 0.16s, box-shadow 0.16s;
}
.search:focus-within {
  border-color: var(--celadon);
  box-shadow: var(--focus-ring);
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font-size: 13px;
  outline: none;
  color: var(--ink);
}
.search input::placeholder {
  color: var(--placeholder);
}
.search input::-webkit-search-cancel-button {
  display: none;
}
.search kbd {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  border: 1px solid var(--hair);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 0 4px;
  line-height: 15px;
}

.sidebar-scroll {
  overflow-y: auto;
  padding: 4px 12px 20px 12px;
  min-height: 0;
}
.side-group {
  margin-bottom: 24px;
}
.side-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin: 0 0 8px 8px;
}

.folder-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1px;
}
.folder-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.folder-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 2px;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: left;
  transition: background 0.14s, color 0.14s;
}
.folder-btn:hover {
  background: var(--hover);
  color: var(--ink);
}
.folder-btn.is-on {
  background: var(--sheet);
  color: var(--ink);
  box-shadow: inset 2px 0 0 var(--cinnabar);
}
.folder-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.folder-menu {
  opacity: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 2px;
  color: var(--muted);
}
.folder-item:hover .folder-menu,
.folder-menu:focus-visible {
  opacity: 1;
}
.folder-menu:hover {
  background: var(--hover-strong);
}

.side-add {
  margin-left: 8px;
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px;
  border-radius: 2px;
}
.side-add:hover {
  color: var(--ink);
  background: var(--hover);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding-left: 4px;
}
.tag-pill {
  font-size: 11.5px;
  color: var(--celadon-deep);
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 20px;
  transition: background 0.14s, color 0.14s;
}
.tag-pill:hover {
  background: var(--tag-bg-hover);
}
.tag-pill.is-on {
  background: var(--celadon-deep);
  color: var(--on-accent);
  border-color: var(--celadon-deep);
}
.tag-empty {
  font-size: 12px;
  color: var(--muted);
  padding-left: 8px;
}
.tag-n {
  opacity: 0.55;
  margin-left: 3px;
  font-variant-numeric: tabular-nums;
}

.sidebar-foot {
  border-top: 1px solid var(--hair);
  padding: 10px 12px;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 6px;
  border-radius: 2px;
}
.user-chip:hover {
  background: var(--hover);
}
.user-meta {
  display: grid;
  min-width: 0;
  flex: 1;
  line-height: 1.35;
}
.user-name {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-mail {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- 列表 --- */
.list-pane {
  background: var(--paper);
  border-right: 1px solid var(--hair);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}
.list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 20px 16px 12px 20px;
  border-bottom: 1px solid var(--hair-soft);
}
.list-title {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.04em;
}
.list-sub {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.list-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.sort select {
  border: 0;
  background: none;
  font-size: 12px;
  color: var(--muted);
  min-height: 32px;
  padding: 4px 2px;
  cursor: pointer;
}
.sort select:hover {
  color: var(--ink);
}

.note-list {
  overflow-y: auto;
  padding: 4px 0 28px;
  min-height: 0;
}
.note-item {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 16px 13px 12px;
  border-bottom: 1px solid var(--hair-soft);
  transition: background 0.14s;
}
.note-item:hover {
  background: var(--hover-note);
}
.note-item.is-on {
  background: var(--sheet);
}
.note-item.is-on::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: -1px;
  width: 2px;
  background: var(--cinnabar);
}
.note-date {
  text-align: center;
  padding-top: 2px;
  color: var(--muted);
  line-height: 1.1;
}
.note-day {
  display: block;
  font-family: var(--display);
  font-size: 17px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.note-month {
  display: block;
  font-size: 11px;
  letter-spacing: 0.06em;
  margin-top: 2px;
}
.note-main {
  min-width: 0;
}
.note-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.note-title {
  font-size: 13.5px;
  font-weight: 500;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.note-star {
  color: var(--gold);
  flex: none;
  display: grid;
  place-items: center;
}
.note-excerpt {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.note-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted);
}
.note-tag {
  color: var(--celadon-deep);
}
.empty-list {
  padding: 56px 26px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.empty-list strong {
  display: block;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

/* --- 编辑器 --- */
.editor-pane {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  background: var(--sheet);
}
.empty-editor {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 40px;
  text-align: center;
  background-image: radial-gradient(var(--pattern-dot) 1px, transparent 1px);
  background-size: 22px 22px;
}
.empty-art {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--celadon);
  margin-bottom: 6px;
}
.empty-rule {
  width: 46px;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
}
.empty-char {
  font-family: var(--kai);
  font-size: 30px;
  color: var(--celadon-deep);
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(76, 106, 98, 0.35);
}
.empty-title {
  font-family: var(--display);
  font-size: 18px;
  margin: 0;
  color: var(--ink);
}
.empty-text {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 34em;
}

.editor {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  animation: sheet 0.35s var(--ease) both;
}
@keyframes sheet {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}
.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px 12px 28px;
  border-bottom: 1px solid var(--hair-soft);
  min-height: 54px;
}
.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
}
.crumb select {
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 12.5px;
  min-height: 32px;
  max-width: 160px;
  cursor: pointer;
  padding: 2px 0;
}
.crumb-sep {
  color: var(--hair);
}
.crumb-status {
  white-space: nowrap;
  font-size: 11.5px;
  transition: color 0.2s;
}
.crumb-status.is-dirty {
  color: var(--gold);
}
.crumb-status.is-error {
  color: var(--cinnabar);
}
.editor-tools {
  display: flex;
  align-items: center;
  gap: 2px;
}
.tool-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 2px;
  color: var(--muted);
  transition: background 0.14s, color 0.14s;
}
.tool-btn:hover {
  background: var(--paper-deep);
  color: var(--ink);
}
.tool-btn.is-on {
  color: var(--cinnabar);
}
.tool-btn.is-on .ico {
  fill: currentColor;
}
.tool-danger:hover {
  color: var(--cinnabar);
  background: var(--cinnabar-wash);
}
.net-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 20px;
  border: 1px solid var(--hair);
  background: var(--paper);
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-right: 8px;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.18s, background 0.18s;
}
.net-pill:hover {
  border-color: var(--celadon);
  background: var(--sheet);
}

.editor-scroll {
  overflow-y: auto;
  padding: 34px clamp(24px, 5vw, 76px) 120px;
  min-height: 0;
}
.note-title {
  width: 100%;
  border: 0;
  background: none;
  font-family: var(--display);
  font-size: clamp(24px, 2.4vw, 30px);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.01em;
  padding: 0;
  outline: none;
  color: var(--ink);
  max-width: 30em;
}
.note-title::placeholder {
  color: var(--placeholder-strong);
}
.note-meta {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.meta-dot {
  color: var(--hair);
}
.note-tags {
  margin: 14px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--hair-soft);
  max-width: 46em;
}
.note-tags input {
  border: 0;
  background: none;
  font-size: 12px;
  width: 132px;
  min-height: 28px;
  outline: none;
  color: var(--ink);
}
.note-tags input::placeholder {
  color: var(--placeholder);
}
.tag-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--celadon-deep);
  background: var(--tag-bg);
  padding: 1px 4px 1px 8px;
  border-radius: 20px;
}
.tag-chip button {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: inherit;
  opacity: 0.5;
}
.tag-chip button:hover {
  opacity: 1;
  background: rgba(76, 106, 98, 0.16);
}

.editor-body {
  margin-top: 22px;
  max-width: 46em;
}
.note-input {
  display: block;
  width: 100%;
  min-height: 52vh;
  border: 0;
  background: none;
  resize: none;
  outline: none;
  overflow: hidden;
  font-size: 15px;
  line-height: 2;
  color: var(--ink-soft);
  font-family: var(--sans);
  padding: 0;
}
.note-input::placeholder {
  color: var(--placeholder);
}

.preview {
  font-size: 15px;
  line-height: 2;
  color: var(--ink-soft);
  padding-bottom: 40px;
}
.preview h1,
.preview h2,
.preview h3,
.preview h4 {
  font-family: var(--display);
  color: var(--ink);
  line-height: 1.5;
  margin: 1.5em 0 0.55em;
  font-weight: 600;
}
.preview h1 {
  font-size: 23px;
}
.preview h2 {
  font-size: 19px;
}
.preview h3 {
  font-size: 16.5px;
}
.preview p {
  margin: 0 0 1em;
}
.preview ul,
.preview ol {
  margin: 0 0 1em;
  padding-left: 1.4em;
}
.preview li {
  margin-bottom: 0.3em;
}
.preview blockquote {
  margin: 0 0 1em;
  padding: 2px 0 2px 16px;
  border-left: 2px solid var(--celadon);
  color: var(--muted);
  font-family: var(--serif);
}
.preview code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 2px;
}
.preview pre {
  background: var(--pre-bg);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 1em;
}
.preview pre code {
  background: none;
  padding: 0;
  font-size: 12.5px;
  line-height: 1.75;
}
.preview a {
  color: var(--celadon-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.preview strong {
  color: var(--ink);
  font-weight: 600;
}
.preview hr {
  border: 0;
  border-top: 1px solid var(--hair);
  margin: 1.6em 0;
}
.preview table {
  border-collapse: collapse;
  margin: 0 0 1em;
  font-size: 13.5px;
}
.preview th,
.preview td {
  border: 1px solid var(--hair);
  padding: 5px 12px;
  text-align: left;
}
.preview th {
  background: var(--paper-deep);
  font-weight: 500;
}
.preview input[type="checkbox"] {
  margin-right: 6px;
  accent-color: var(--celadon-deep);
}
.preview ul.tasks {
  list-style: none;
  padding-left: 0;
}
.preview ul.tasks label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.preview ul.tasks input {
  margin-top: 8px;
  accent-color: var(--celadon-deep);
}
.preview-empty {
  color: var(--muted);
  font-family: var(--serif);
}

.editor-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px 8px 28px;
  border-top: 1px solid var(--hair-soft);
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  background: var(--foot-bg);
}
.foot-sep {
  color: var(--hair);
}
.foot-grow {
  flex: 1;
}
.engine-tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.latency {
  font-family: var(--mono);
  font-size: 11px;
  min-width: 52px;
  text-align: right;
  color: var(--celadon-deep);
}
.latency.is-bad {
  color: var(--cinnabar);
}

/* ============================ 抽屉 / 弹层 ============================ */
.sheet-scrim,
.modal-scrim {
  position: fixed;
  inset: 0;
  background: rgba(18, 27, 24, 0.32);
  backdrop-filter: blur(1.5px);
  z-index: 30;
  animation: fade 0.2s ease both;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.sheet {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(408px, 100vw);
  background: var(--sheet);
  border-left: 1px solid var(--hair);
  z-index: 31;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  box-shadow: -24px 0 60px -40px rgba(20, 30, 26, 0.7);
  animation: slidein 0.28s var(--ease) both;
}
@keyframes slidein {
  from {
    transform: translateX(16px);
    opacity: 0;
  }
}
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 18px 14px 24px;
  border-bottom: 1px solid var(--hair-soft);
}
.sheet-title {
  font-family: var(--display);
  font-size: 17px;
  margin: 0;
  letter-spacing: 0.04em;
}
.sheet-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.sheet-scroll {
  overflow-y: auto;
  padding: 18px 24px 32px;
}

.net-block {
  margin-bottom: 26px;
}
.net-block > h3 {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-weight: 500;
  margin: 0 0 10px;
}
.net-verdict {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--hair);
  background: var(--paper);
}
.net-verdict strong {
  font-family: var(--display);
  font-size: 15px;
  display: block;
}
.net-verdict span {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
}
.net-verdict.is-ok {
  border-color: var(--ok);
  background: var(--ok-wash);
}
.net-verdict.is-bad {
  border-color: rgba(188, 58, 38, 0.32);
  background: var(--cinnabar-wash);
}
.net-seal {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 2px;
  background: var(--ink);
  color: #f5f8f2;
  font-family: var(--kai);
  font-size: 17px;
  flex: none;
}
.net-verdict.is-ok .net-seal {
  background: var(--ok);
}
.net-verdict.is-bad .net-seal {
  background: var(--cinnabar);
}

.kv {
  margin: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0;
  border-top: 1px solid var(--hair-soft);
}
.kv div {
  display: contents;
}
.kv dt,
.kv dd {
  padding: 8px 0;
  border-bottom: 1px solid var(--hair-soft);
  font-size: 12.5px;
}
.kv dt {
  color: var(--muted);
  padding-right: 16px;
  white-space: nowrap;
}
.kv dd {
  margin: 0;
  text-align: right;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1px;
}
.check-list li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hair-soft);
  font-size: 12.5px;
}
.check-list .mark {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--hair);
  flex: none;
  color: var(--muted);
}
.check-list .mark.ok {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}
.check-list .mark.bad {
  background: var(--cinnabar);
  border-color: var(--cinnabar);
  color: #fff;
}
.check-list .mark.run {
  border-color: var(--celadon);
  border-top-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.check-list .txt {
  flex: 1;
  min-width: 0;
}
.check-list .val {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.url-list {
  display: grid;
  gap: 6px;
}
.url-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.url-row code {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--paper);
  border: 1px solid var(--hair);
  padding: 6px 9px;
  border-radius: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.url-row .btn {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}
.net-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.75;
  margin: 8px 0 0;
}
.net-note code {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--paper-deep);
  padding: 1px 4px;
  border-radius: 2px;
}

.visit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 11.5px;
  color: var(--muted);
  display: grid;
  gap: 5px;
}
.visit-list li {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  border-bottom: 1px dashed var(--hair);
  padding-bottom: 5px;
}
.visit-list .ip {
  font-family: var(--mono);
  color: var(--ink-soft);
}

/* 分享弹层 */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(468px, calc(100vw - 32px));
  background: var(--sheet);
  border: 1px solid var(--hair);
  border-radius: var(--radius-lg);
  padding: 24px 26px 20px;
  z-index: 31;
  box-shadow: var(--shadow-pop);
  animation: pop 0.24s var(--ease) both;
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translate(-50%, -48%) scale(0.985);
  }
}
.modal-title {
  font-family: var(--display);
  font-size: 18px;
  margin: 0 0 6px;
}
.modal-text {
  margin: 0 0 16px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
}
.share-row {
  display: flex;
  gap: 8px;
}
.share-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--hair);
  background: var(--paper);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
}
.share-hint {
  margin: 10px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--hair-soft);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 16px);
  background: var(--ink);
  color: #f4f7f1;
  font-size: 12.5px;
  padding: 9px 18px;
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s var(--ease);
  z-index: 50;
  max-width: calc(100vw - 40px);
}
.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.mobile-only {
  display: none;
}

/* ============================ 响应式 ============================ */
@media (max-width: 1180px) {
  :root {
    --side-w: 234px;
    --list-w: 288px;
  }
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: var(--rail-w) 1fr;
  }
  .sidebar {
    display: none;
  }
  .list-pane {
    grid-column: 2;
    border-right: 0;
  }
  .editor-pane {
    position: fixed;
    inset: 0 0 0 var(--rail-w);
    z-index: 20;
    transform: translateX(100%);
    transition: transform 0.28s var(--ease);
    border-left: 1px solid var(--hair);
  }
  .app.is-editing .editor-pane {
    transform: none;
  }
  .mobile-only {
    display: grid;
  }
  .editor-scroll {
    padding: 26px 22px 120px;
  }
}

@media (max-width: 820px) {
  .auth {
    grid-template-columns: 1fr;
  }
  .auth-brand {
    display: none;
  }
  .auth-form-wrap {
    padding: 32px 22px 48px;
    align-items: flex-start;
  }
  .auth-form {
    margin-top: 6vh;
  }
}

@media (max-width: 640px) {
  .app {
    grid-template-columns: 1fr;
  }
  .rail {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    height: 54px;
    flex-direction: row;
    justify-content: space-around;
    padding: 0 8px;
    z-index: 25;
    gap: 0;
  }
  .rail-brand,
  .rail-foot .ghost-icon {
    display: none;
  }
  .rail-nav {
    display: flex;
    width: auto;
    gap: 6px;
  }
  .rail-btn.is-on::before {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: -9px;
    width: auto;
    height: 2px;
  }
  .rail-foot {
    margin: 0;
  }
  .list-pane {
    grid-column: 1;
    padding-bottom: 54px;
  }
  .editor-pane {
    inset: 0 0 54px 0;
  }
  .editor-scroll {
    padding: 20px 18px 100px;
  }
  .editor-foot {
    padding-left: 18px;
  }
  .note-title {
    font-size: 22px;
  }
  .sheet {
    width: 100%;
    top: auto;
    max-height: 88vh;
    border-left: 0;
    border-top: 1px solid var(--hair);
    border-radius: 6px 6px 0 0;
  }
  .modal {
    top: auto;
    bottom: 0;
    transform: none;
    width: 100%;
    border-radius: 6px 6px 0 0;
  }
  .toast {
    bottom: 70px;
  }
}

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

/* 通用小对话框 */
.modal-sm {
  width: min(400px, calc(100vw - 32px));
}
.modal-sm .modal-text {
  margin-bottom: 14px;
}
.modal-field {
  margin-bottom: 4px;
}
.modal .kv {
  margin: 4px 0 2px;
}
.modal .kv dd {
  font-size: 11.5px;
}

/* 登录页：实时往返延迟脉冲 */
.brand-pulse {
  max-width: 24em;
}
.pulse-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.pulse-val {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--celadon-deep);
  font-variant-numeric: tabular-nums;
}
.pulse-track {
  margin-top: 12px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 26px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--hair);
}
.pulse-bar {
  flex: 1;
  height: 9px;
  border-radius: 1px;
  background: var(--celadon-deep);
  opacity: 0.55;
  transition: opacity 0.3s, height 0.3s var(--ease), background 0.3s;
}
.pulse-bar.is-fast {
  background: var(--celadon-deep);
}
.pulse-bar.is-mid {
  background: var(--gold);
}
.pulse-bar.is-slow {
  background: var(--cinnabar);
}
.pulse-bar.is-timeout {
  background: var(--cinnabar);
  opacity: 1;
}
.pulse-bar.is-new {
  height: 17px;
  opacity: 1;
}
.pulse-note {
  margin: 9px 0 0;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted);
}
.pulse-note code {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--code-bg);
  padding: 1px 4px;
  border-radius: 2px;
}


/* ==========================================================================
   主题系统
   默认（纸面）由 :root 定义；下面两套主题通过 data-theme 覆盖令牌。
   ========================================================================== */

/* ------------------------------ 墨夜 ------------------------------
   深夜写作：墨黑底 + 暖琥珀强调，降低蓝光，长时间阅读不刺眼。 */
[data-theme="ink"] {
  --paper: #14161a;
  --paper-deep: #101215;
  --sheet: #1b1e24;
  --ink: #e9e6df;
  --ink-soft: #b9b5ac;
  --muted: #8f8a81;
  --hair: #2a2e35;
  --hair-soft: #232730;
  --celadon: #c9a227;
  --celadon-deep: #d9b451;
  --cinnabar: #e0684b;
  --cinnabar-wash: rgba(224, 104, 75, 0.13);
  --gold: #d9b451;
  --ok: #6fbf8b;

  --hover: rgba(233, 230, 223, 0.06);
  --hover-strong: rgba(233, 230, 223, 0.1);
  --hover-note: rgba(233, 230, 223, 0.045);
  --hair-strong: #3a4049;
  --sheet-raised: #22262d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --focus-ring: 0 0 0 3px rgba(217, 180, 81, 0.22);
  --code-bg: rgba(233, 230, 223, 0.09);
  --pre-bg: #12151a;
  --foot-bg: rgba(16, 18, 21, 0.6);
  --tag-bg: rgba(217, 180, 81, 0.13);
  --tag-bg-hover: rgba(217, 180, 81, 0.22);
  --tag-border: rgba(217, 180, 81, 0.32);
  --on-accent: #1a1c20;
  --on-ink: #14161a;
  --on-cinnabar: #14161a;
  --placeholder: #7b756b;
  --placeholder-strong: #8a8479;
  --rail-bg: #0d0f12;
  --rail-fg: #a9a49b;
  --rail-fg-dim: #6d6a63;
  --rail-hover: rgba(233, 230, 223, 0.09);
  --rail-active: #e9e6df;
  --pattern-dot: rgba(217, 180, 81, 0.1);
  --ok-wash: rgba(111, 191, 139, 0.1);
  --ok-ring: rgba(111, 191, 139, 0.2);
  --bad-ring: rgba(224, 104, 75, 0.2);
  --shadow-pop: 0 30px 80px -40px rgba(0, 0, 0, 0.9);
  --brand-glow: #1d222a;

  color-scheme: dark;
}

/* ------------------------------ 潮汐 ------------------------------
   冷静克制：冷蓝灰底 + 大圆角 + 无衬线标题，偏现代效率工具。 */
[data-theme="tide"] {
  --paper: #eef2f7;
  --paper-deep: #e5ebf3;
  --sheet: #ffffff;
  --ink: #101828;
  --ink-soft: #44506a;
  --muted: #5b6884;
  --hair: #d6dfea;
  --hair-soft: #e3eaf3;
  --celadon: #2563eb;
  --celadon-deep: #1d4ed8;
  --cinnabar: #e11d48;
  --cinnabar-wash: rgba(225, 29, 72, 0.07);
  --gold: #b45309;
  --ok: #0f9d58;

  --hover: rgba(37, 99, 235, 0.07);
  --hover-strong: rgba(37, 99, 235, 0.12);
  --hover-note: rgba(37, 99, 235, 0.05);
  --hair-strong: #b9c8dc;
  --sheet-raised: #ffffff;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.08);
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.18);
  --code-bg: rgba(37, 99, 235, 0.08);
  --pre-bg: #f4f7fb;
  --foot-bg: rgba(238, 242, 247, 0.7);
  --tag-bg: rgba(37, 99, 235, 0.09);
  --tag-bg-hover: rgba(37, 99, 235, 0.16);
  --tag-border: rgba(37, 99, 235, 0.2);
  --on-accent: #ffffff;
  --on-ink: #ffffff;
  --on-cinnabar: #ffffff;
  --placeholder: #6b7891;
  --placeholder-strong: #7b88a1;
  --rail-bg: #101828;
  --rail-fg: #c3cfe2;
  --rail-fg-dim: #8194b0;
  --rail-hover: rgba(255, 255, 255, 0.1);
  --rail-active: #ffffff;
  --pattern-dot: rgba(37, 99, 235, 0.12);
  --ok-wash: rgba(15, 157, 88, 0.07);
  --ok-ring: rgba(15, 157, 88, 0.18);
  --bad-ring: rgba(225, 29, 72, 0.16);
  --shadow-pop: 0 30px 80px -40px rgba(16, 24, 40, 0.6);
  --brand-glow: #dfe9f7;

  /* 潮汐用无衬线做标题、更大圆角、更松弛的行距 */
  --display: var(--sans);
  --radius: 10px;
  --radius-lg: 16px;
  --ease: cubic-bezier(0.4, 0.14, 0.3, 1);
  color-scheme: light;
}

/* 潮汐：把方形元素统一成圆角，卡片加柔和投影 */
[data-theme="tide"] .seg {
  border-radius: 12px;
}
[data-theme="tide"] .seg-btn {
  border-radius: 10px;
}
[data-theme="tide"] .tool-btn,
[data-theme="tide"] .ghost-icon,
[data-theme="tide"] .folder-btn,
[data-theme="tide"] .search {
  border-radius: 8px;
}
[data-theme="tide"] .folder-btn.is-on {
  box-shadow: inset 3px 0 0 var(--celadon-deep);
}
[data-theme="tide"] .note-item.is-on::before {
  border-radius: 2px;
}
[data-theme="tide"] .editor-pane {
  background: var(--sheet);
}
[data-theme="tide"] .empty-char {
  border-radius: 14px;
}
[data-theme="tide"] .empty-rule {
  border-radius: 2px;
}
[data-theme="tide"] .tag-pill {
  border-radius: 999px;
}
[data-theme="tide"] .net-pill {
  border-radius: 999px;
}
[data-theme="tide"] .brand-seal,
[data-theme="tide"] .rail-char,
[data-theme="tide"] .boot-mark,
[data-theme="tide"] .share-mark {
  border-radius: 8px;
}
[data-theme="tide"] .note-title,
[data-theme="tide"] .list-title,
[data-theme="tide"] .auth-title,
[data-theme="tide"] .wordmark {
  letter-spacing: -0.01em;
}
[data-theme="tide"] .note-input,
[data-theme="tide"] .preview {
  line-height: 1.85;
}
[data-theme="tide"] .editor-head,
[data-theme="tide"] .list-head {
  border-bottom-color: var(--hair);
}
[data-theme="tide"] .note-item {
  border-bottom-color: var(--hair-soft);
}
[data-theme="tide"] .note-item:hover {
  background: var(--hover-note);
}
[data-theme="tide"] .sheet {
  border-radius: 16px 0 0 16px;
}
[data-theme="tide"] .modal {
  border-radius: var(--radius-lg);
}

/* 墨夜：夜间锐利细节 */
[data-theme="ink"] .editor-pane {
  background: var(--sheet);
}
[data-theme="ink"] .note-input {
  color: #d8d3ca;
}
[data-theme="ink"] .note-item:hover {
  background: var(--hover-note);
}
[data-theme="ink"] .empty-editor {
  background-image: none;
}
[data-theme="ink"] .seg-btn.is-on {
  box-shadow: var(--shadow-sm);
}
[data-theme="ink"] .boot-mark {
  box-shadow: 0 10px 26px -14px rgba(224, 104, 75, 0.8);
}

/* ------------------------------ 主题切换器 ------------------------------ */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius);
  background: var(--hover);
}
.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 9px;
  border-radius: calc(var(--radius) - 1px);
  font-size: 11.5px;
  color: var(--muted);
  transition: background 0.16s, color 0.16s;
  white-space: nowrap;
}
.theme-btn:hover {
  color: var(--ink);
}
.theme-btn.is-on {
  background: var(--sheet);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.theme-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
  border: 1px solid rgba(0, 0, 0, 0.12);
}
.theme-swatch[data-swatch="paper"] {
  background: #f3f5f0;
  border-color: #bc3a26;
}
.theme-swatch[data-swatch="ink"] {
  background: #14161a;
  border-color: #d9b451;
}
.theme-swatch[data-swatch="tide"] {
  background: #2563eb;
  border-color: #ffffff;
}

.theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0 2px;
}
.theme-row-label {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.auth-theme-row {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--hair);
  justify-content: center;
  gap: 12px;
}
.auth-theme-row .theme-row-label {
  letter-spacing: 0.14em;
}
@media (max-width: 640px) {
  .theme-btn {
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }
}

/* 分享弹层：状态徽标 */
.share-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  background: var(--tag-bg);
  color: var(--celadon-deep);
  border: 1px solid var(--tag-border);
}
.share-state-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
}
.share-state.is-off {
  background: var(--cinnabar-wash);
  color: var(--cinnabar);
  border-color: rgba(188, 58, 38, 0.22);
}
.share-state.is-off .share-state-dot {
  background: var(--cinnabar);
}
.share-row input:disabled {
  opacity: 0.6;
}

/* 分享弹层：双链接字段 */
.share-field {
  display: block;
  margin-bottom: 12px;
}
.share-field-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-bottom: 5px;
}
.share-field-label em {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}
.share-field .share-row {
  display: flex;
  gap: 8px;
}
.share-field input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--hair);
  background: var(--paper);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-soft);
}
.btn-tinted {
  border-color: var(--hair-strong);
  background: var(--tag-bg);
  color: var(--celadon-deep);
}
.btn-tinted:hover {
  background: var(--tag-bg-hover);
}
.share-hint code {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 2px;
  color: var(--celadon-deep);
  word-break: break-all;
}
#share-locked {
  margin: 12px 0 0;
}

/* ==========================================================================
   账号与设置：未验证提示条、设置抽屉、账号管理、插件与发信服务
   只使用语义 token，跟随三套主题；结构与 .sheet / .modal / .field / .btn 共用。
   ========================================================================== */

/* --- 未验证提示条 --- */
body.has-verify-banner {
  --banner-h: 38px;
}
body.has-verify-banner .app {
  height: calc(100vh - var(--banner-h));
  margin-top: var(--banner-h);
}
.verify-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 27;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 5px 12px 5px 18px;
  background: var(--tag-bg);
  color: var(--ink-soft);
  border-bottom: 1px solid var(--tag-border);
  font-size: 12.5px;
}
.verify-banner-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.verify-banner-text strong {
  font-weight: 500;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
}
.verify-banner .btn {
  flex: none;
  height: 28px;
  padding: 0 11px;
  font-size: 12px;
}
.verify-banner .ghost-icon {
  flex: none;
  width: 28px;
  height: 28px;
  color: var(--muted);
}
@media (max-width: 640px) {
  .verify-banner {
    padding-left: 14px;
  }
  .verify-banner-extra {
    display: none;
  }
  body.has-verify-banner .editor-pane {
    inset: var(--banner-h) 0 54px 0;
  }
}

/* --- 设置抽屉 --- */
.settings-tabs {
  display: flex;
  gap: 2px;
  margin: 0 0 20px;
  border-bottom: 1px solid var(--hair);
  overflow-x: auto;
  scrollbar-width: none;
}
.settings-tabs::-webkit-scrollbar {
  display: none;
}
.settings-tab {
  flex: none;
  padding: 8px 10px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  transition: color 0.16s, border-color 0.16s;
}
.settings-tab:hover {
  color: var(--ink);
}
.settings-tab.is-on {
  color: var(--ink);
  border-bottom-color: var(--cinnabar);
}
.settings-panel {
  animation: fade 0.2s ease both;
}
.settings-kv {
  margin: 0 0 16px;
}
.settings-h3 {
  margin: 22px 0 10px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.settings-panel > .settings-h3:first-child {
  margin-top: 2px;
}
.settings-h3-note {
  font-size: 11px;
  letter-spacing: 0;
  color: var(--muted);
}
.settings-note {
  margin: 8px 0 14px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}
.settings-note b {
  color: var(--cinnabar);
  font-weight: 500;
}
.settings-note strong {
  color: var(--ink-soft);
  font-weight: 500;
}
.settings-status.is-ok-text {
  color: var(--ok);
}
.is-bad-text {
  color: var(--cinnabar) !important;
}
.acc-expired {
  color: var(--cinnabar);
}

/* --- 我的账号：验证状态 --- */
.settings-verify {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin: 0 0 6px;
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  background: var(--paper);
}
.settings-verify-head {
  min-width: 0;
}
.settings-verify .settings-note {
  margin: 6px 0 0;
}
.settings-verify .btn {
  flex: none;
  height: 32px;
  font-size: 12px;
}
.settings-verify .badge {
  margin-bottom: 0;
}
@media (max-width: 480px) {
  .settings-verify {
    flex-direction: column;
    align-items: stretch;
  }
  .settings-verify .btn {
    width: 100%;
  }
}

/* --- 表单补充：下拉、日期、提示 --- */
.field select,
.field textarea {
  width: 100%;
  padding: 10px 13px;
  background: var(--sheet);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--ink);
  transition: border-color 0.16s, box-shadow 0.16s;
}
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--celadon);
  box-shadow: var(--focus-ring);
}
.field input[type="date"] {
  font-family: var(--sans);
}
.field input[type="number"] {
  font-family: var(--mono);
}
.field-hint {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  font-style: normal;
  color: var(--muted);
}
.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}
#mail-form .field-row {
  grid-template-columns: minmax(0, 1fr) 110px;
}
.modal .field {
  margin-bottom: 12px;
}

/* --- 开关 --- */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: none;
  cursor: pointer;
}
.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  margin: 0;
}
.switch-track {
  width: 40px;
  height: 23px;
  border-radius: 23px;
  background: var(--hair-strong);
  position: relative;
  transition: background 0.18s;
}
.switch-dot {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--sheet-raised);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s var(--ease);
}
.switch input:checked + .switch-track {
  background: var(--celadon-deep);
}
.switch input:checked + .switch-track .switch-dot {
  transform: translateX(17px);
}
.switch input:focus-visible + .switch-track {
  box-shadow: var(--focus-ring);
}
.switch input:disabled + .switch-track {
  opacity: 0.5;
  cursor: not-allowed;
}
.switch-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--hair-soft);
  border-bottom: 1px solid var(--hair-soft);
  margin-bottom: 14px;
}
.switch-row-main {
  min-width: 0;
}
.switch-row .settings-h3 {
  margin: 0 0 4px;
}
.switch-row .settings-note {
  margin: 0;
}

/* --- 徽标 --- */
.badge {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--tag-border);
  border-radius: 20px;
  background: var(--tag-bg);
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.7;
  white-space: nowrap;
}
.badge.is-ok {
  background: var(--ok-wash);
  border-color: var(--ok-ring);
  color: var(--ok);
}
.badge.is-bad {
  background: var(--cinnabar-wash);
  border-color: var(--bad-ring);
  color: var(--cinnabar);
}
.badge.is-owner {
  background: var(--cinnabar-wash);
  border-color: var(--bad-ring);
  color: var(--cinnabar);
}
.badge.is-admin {
  background: var(--tag-bg);
  border-color: var(--tag-border);
  color: var(--celadon-deep);
}

/* --- 一次性密码 --- */
.settings-secret {
  margin: 14px 0 18px;
  padding: 12px 14px;
  border: 1px dashed var(--tag-border);
  border-radius: var(--radius);
  background: var(--tag-bg);
}
.settings-secret .settings-note {
  margin: 0 0 10px;
}
.secret-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.secret-row code,
.secret-code {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  background: var(--sheet);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.08em;
  word-break: break-all;
}
.secret-row .btn {
  flex: none;
}
.secret-email {
  font-family: var(--mono);
  color: var(--ink-soft);
  word-break: break-all;
}

/* --- 账号表格 --- */
.account-table-wrap {
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  overflow-x: auto;
  background: var(--sheet);
}
.account-table {
  width: 100%;
  min-width: 660px;
  border-collapse: collapse;
  font-size: 12px;
}
.account-table th {
  position: sticky;
  top: 0;
  padding: 8px 10px;
  background: var(--paper);
  border-bottom: 1px solid var(--hair);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-align: left;
  white-space: nowrap;
}
.account-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--hair-soft);
  vertical-align: top;
}
.account-table tr:last-child td {
  border-bottom: 0;
}
.account-table tr.is-self td {
  background: var(--hover-note);
}
.acc-email {
  display: block;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink);
  word-break: break-all;
}
.acc-name {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  color: var(--muted);
}
.acc-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.acc-muted {
  color: var(--muted);
}
.account-empty {
  padding: 18px 10px !important;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.acc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.btn.btn-xs {
  height: 26px;
  padding: 0 8px;
  font-size: 11px;
  border-radius: 2px;
}
.acc-expiry-edit {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.acc-date {
  width: 116px;
  padding: 3px 6px;
  border: 1px solid var(--hair);
  border-radius: 2px;
  background: var(--sheet);
  color: var(--ink);
  font-size: 11px;
}
.acc-date:focus {
  outline: none;
  border-color: var(--celadon);
  box-shadow: var(--focus-ring);
}

/* --- 插件列表 --- */
.plugin-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.plugin-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--hair-soft);
}
.plugin-item:last-child {
  border-bottom: 1px solid var(--hair-soft);
}
.plugin-main {
  min-width: 0;
}
.plugin-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px;
}
.plugin-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.plugin-version {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
}
.plugin-pinned {
  padding: 0 7px;
  border: 1px solid var(--tag-border);
  border-radius: 20px;
  background: var(--tag-bg);
  color: var(--gold);
  font-size: 10.5px;
  line-height: 1.7;
  white-space: nowrap;
}
.plugin-desc {
  margin: 4px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
}
.plugin-empty {
  padding: 12px 0;
  color: var(--muted);
  font-size: 12px;
}

/* --- 表单操作行 --- */
.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--hair-soft);
}
@media (max-width: 480px) {
  .settings-actions {
    flex-direction: column-reverse;
  }
  .settings-actions .btn {
    width: 100%;
  }
}

/* --- 账号管理分页：桌面加宽抽屉，移动端表格改卡片 --- */
#settings-sheet {
  transition: width 0.22s var(--ease);
}
#settings-sheet.sheet-wide {
  width: min(960px, calc(100vw - 20px));
}
.account-table tr.is-self {
  background: var(--hover-note);
}
@media (max-width: 640px) {
  #settings-sheet.sheet-wide {
    width: 100%;
  }
  .account-table-wrap {
    border: 0;
    background: none;
  }
  .account-table {
    min-width: 0;
  }
  .account-table thead {
    display: none;
  }
  .account-table,
  .account-table tbody,
  .account-table tr,
  .account-table td {
    display: block;
    width: auto;
  }
  .account-table {
    font-size: 12px;
  }
  .account-table tr {
    padding: 10px 12px;
    border: 1px solid var(--hair);
    border-radius: var(--radius);
    background: var(--sheet);
    margin-bottom: 8px;
  }
  .account-table tr.is-self {
    background: var(--hover-note);
  }
  .account-table td {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 2px 0;
    border: 0;
  }
  .account-table td::before {
    content: attr(data-label);
    flex: none;
    width: 56px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.9;
  }
  .account-table td.acc-cell-main,
  .account-table td.acc-cell-actions {
    display: block;
    padding: 0;
  }
  .account-table td.acc-cell-main {
    padding-bottom: 5px;
    border-bottom: 1px dashed var(--hair-soft);
    margin-bottom: 5px;
  }
  .account-table td.acc-cell-main::before,
  .account-table td.acc-cell-actions::before {
    display: none;
  }
  .account-table td.acc-cell-actions {
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px dashed var(--hair-soft);
  }
  .account-table td.acc-time {
    white-space: normal;
  }
}

/* 表格列宽微调：到期不换行，身份信息可换行 */
.account-table td[data-label="到期"] {
  white-space: nowrap;
}
.account-table td[data-label="角色"],
.account-table td[data-label="状态"],
.account-table td[data-label="验证"] {
  white-space: nowrap;
}
