/* 小组日常 — Memos 风格简洁配色 */

:root {
  --bg: #fdfaf6;              /* 清新自然的米白色 */
  --card: #ffffff;
  --border: #e8e4db;          /* 偏暖的浅灰边框 */
  --hair: #f5f3ee;            /* 极浅的暖灰色，用于次要背景/悬停 */
  --text: #3d3b38;            /* 深暖灰色，比纯黑更护眼 */
  --text-2: #6b6965;          /* 中暖灰 */
  --text-3: #a3a19d;          /* 浅暖灰 */
  --accent: #86a789;          /* 鼠尾草绿/森系绿 (Sage Green) */
  --accent-bg: #f2f7f4;       /* 极浅的森系绿背景 */
  --accent-ink: #4a6b52;      /* 深森系绿，用于文字 */
  --btn-bg: #52504c;          /* 主按钮: 暖深灰 */
  --btn-bg-hover: #3d3b38;
  --danger: #d95c5c;          /* 柔和一些的红色 */
  --shadow: 0 4px 20px rgba(0,0,0,.03), 0 2px 8px rgba(0,0,0,.02);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --radius: 12px;
  --radius-lg: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1e1d;            /* 带有微微绿意的深灰色，模拟暗夜森林 */
    --card: #252826;
    --border: #383c39;
    --hair: #2a2d2b;
    --text: #f0f2f0;
    --text-2: #9ba09c;
    --text-3: #6b706c;
    --accent: #86a789;        /* 暗色模式下依然保持鼠尾草绿 */
    --accent-bg: #22362b;     /* 深绿背景 */
    --accent-ink: #b1cfb5;    /* 亮绿文字 */
    --shadow: 0 8px 30px rgba(0,0,0,.25);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { color: var(--accent); }

button {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, transform .15s ease;
}
button:hover { border-color: var(--text-3); box-shadow: 0 2px 8px rgba(0,0,0,.04); transform: translateY(-1px); }
button.primary {
  background: var(--btn-bg);
  color: #fff;
  border-color: var(--btn-bg);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
button.primary:hover { background: var(--btn-bg-hover); border-color: var(--btn-bg-hover); color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.1); transform: translateY(-1px); }
button.primary:disabled { opacity: .55; cursor: wait; transform: none; box-shadow: none; }
.inline { display: inline; }

/* ---- 顶栏 ---- */
.page-header {
  position: sticky; top: 0;
  z-index: 10;
  background: rgba(253,250,246,.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex; align-items: center; gap: 16px;
}
@media (prefers-color-scheme: dark) {
  .page-header { background: rgba(28,30,29,.85); }
}
.page-header h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

/* 顶栏品牌区: 小鸟图标 + 名字 */
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}
.brand:hover { color: var(--text); }
.brand .logo-img {
  border-radius: 6px;
  flex-shrink: 0;
  display: block;
}
.brand-text { letter-spacing: 0.02em; }
.page-header .sub {
  font-size: 13px;
  color: var(--text-3);
}
.page-nav {
  margin-left: auto;
  display: flex; align-items: center; gap: 12px;
  font-size: 13px;
  color: var(--text-2);
}
.page-nav a { color: var(--text-2); }
.page-nav a:hover { color: var(--text); }
.page-nav button {
  padding: 4px 10px;
  font-size: 13px;
}
.user-chip {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-2);
}

/* ---- 顶栏 tab ---- */
.page-tabs {
  display: flex; align-items: center;
  gap: 2px;
  margin-left: 12px;
}
.tab {
  display: inline-flex; align-items: center;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-2);
  text-decoration: none;
}
.tab:hover { background: var(--hair); color: var(--text); }
.tab.active {
  background: var(--accent-bg);
  color: var(--accent-ink);
  font-weight: 500;
}
.tab-sep {
  color: var(--text-3);
  font-size: 14px;
  user-select: none;
  pointer-events: none;
  line-height: 1;
  opacity: 0.6;
}

/* ---- 主区 ---- */
.page-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px;
}
@media (max-width: 600px) {
  .page-main { padding: 16px; }
  .page-header {
    padding: 10px 12px;
    gap: 8px;
  }
  /* 顶栏在手机上要瘦身, 避免换行 */
  .brand-text { display: none; }       /* 只留小鸟 logo */
  .page-tabs { margin-left: 4px; gap: 0; }
  .tab { padding: 6px 10px; font-size: 15px; }
  .tab-sep { font-size: 14px; }
  .page-nav { gap: 6px; font-size: 14px; }
  .user-chip { display: none; }        /* 用户名隐去, 还能从退出按钮看出登录态 */
  .page-nav button { padding: 6px 10px; font-size: 14px; }

  /* 手机正文再加一点点 (桌面已经舒服, 手机稍微大一档便于阅读) */
  body { font-size: 17px; }
  .note-new-btn { font-size: 16px; padding: 16px 18px; }
  .notes-filter { font-size: 15px; }
  .note-card { font-size: 17px; padding: 18px; }
  .note-head { font-size: 13px; }
  .note-time { font-size: 13px; }
  .note-action { font-size: 13px; }
  .note-vis { font-size: 12px; padding: 2px 8px; }
  .note-pin { font-size: 14px; }
  .note-body { font-size: 17px; }
  .note-body h1 { font-size: 22px; }
  .note-body h2 { font-size: 19px; }
  .note-body h3 { font-size: 17px; }
  .note-file { font-size: 16px; }
  .note-editor-textarea { font-size: 18px; min-height: 280px; }
  .month-row .name { font-size: 18px; }
  .month-row .meta { font-size: 15px; }
  .month-row .count { font-size: 15px; }
  .album-entry-name { font-size: 19px; }
  .album-entry-count { font-size: 14px; }
  .album-title { font-size: 19px; }
  .album-count { font-size: 14px; }
  .album-bar .back { font-size: 15px; }
  .album-bar button.primary { font-size: 15px; padding: 8px 16px; }
  button { font-size: 16px; }
  button.primary { font-size: 17px; }
  /* iOS Safari 在 input 字号 <16 时会自动 zoom 进入表单, 把它顶到 16+ 防止 */
  input, textarea, select { font-size: 16px; }
}
/* 极窄屏 (老款 iPhone SE 等), 顶栏再紧凑一档 */
@media (max-width: 360px) {
  .tab { padding: 4px 7px; font-size: 14px; }
  .tab-sep { display: none; }          /* 三个 tab 紧挨, 不放分隔点 */
}

/* ---- 月份列表 ---- */
.month-list {
  display: flex; flex-direction: column;
  gap: 6px;
}
.month-row {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid transparent;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  color: var(--text);
  transition: transform .15s ease, box-shadow .15s ease;
}
.month-row:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,.05); color: var(--text); }
.month-row .name { font-size: 15px; font-weight: 500; }
.month-row .meta { font-size: 12.5px; color: var(--text-3); }
.month-row .count {
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* ---- 登录页 (跟 Memos /auth 视觉对齐) ---- */
.auth-page {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  justify-content: center;
  align-items: center;          /* 垂直居中 */
  padding: 16px;
  background: var(--bg);
}
.auth-wrap {
  width: 320px;
  max-width: 100%;
  display: flex; flex-direction: column;
  align-items: center;
}

/* 品牌行: logo + 标题横向并排 */
.auth-brand {
  width: 100%;
  display: flex; flex-direction: row;
  justify-content: center; align-items: center;
  margin-bottom: 24px;
}
.auth-logo {
  height: 56px; width: 56px;
  border-radius: 9999px;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);
  object-fit: cover;
}
.auth-title {
  margin: 0 0 0 8px;
  font-size: 48px;
  font-weight: 400;
  color: var(--text);
  line-height: 1;
  opacity: 0.8;
}

.auth-form { width: 100%; }

.auth-fields {
  display: flex; flex-direction: column;
  gap: 16px;
  width: 100%;
}
.auth-field {
  display: flex; flex-direction: column;
  width: 100%;
}
.auth-label {
  line-height: 32px;
  color: var(--text-2);
  font-size: 14px;
}
.auth-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color .12s ease;
}
.auth-input::placeholder { color: var(--text-3); }
.auth-input:focus {
  border-color: var(--text-2);
}

.auth-actions {
  display: flex; flex-direction: row;
  justify-content: flex-end; align-items: center;
  width: 100%;
  margin-top: 24px;
}
.auth-submit {
  width: 100%;
  height: 40px;
  font-size: 14px;
  font-weight: 500;
  background: var(--btn-bg);
  color: #fff;
  border: 1px solid var(--btn-bg);
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s ease;
}
.auth-submit:hover { background: var(--btn-bg-hover); border-color: var(--btn-bg-hover); }

.auth-err {
  color: var(--danger);
  font-size: 13px;
  margin-top: 14px;
  text-align: center;
}

/* ---- 聊天页 ---- */
.chat-app {
  display: flex; flex-direction: column;
  height: 100vh;
  height: 100dvh;
}
.chat-topbar {
  flex-shrink: 0;
  background: rgba(250,250,250,.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  display: flex; align-items: center; gap: 8px;
}
@media (prefers-color-scheme: dark) {
  .chat-topbar { background: rgba(24,24,27,.85); }
}
.icon-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-2);
  border-radius: var(--radius);
  font-size: 16px;
  padding: 0;
}
.icon-btn:hover { background: var(--hair); color: var(--text); }

.topbar-title-wrap {
  position: relative;
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  min-width: 0;
}
.topbar-title {
  background: transparent;
  border: 0;
  padding: 4px 8px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  border-radius: var(--radius);
}
.topbar-title:hover { background: var(--hair); }
.topbar-name {
  font-size: 14px; font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}
.topbar-sub {
  font-size: 11px;
  color: var(--text-3);
}

.month-picker {
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 6px;
  display: none;
  z-index: 100;
  width: 240px;
  max-height: 60vh;
  overflow-y: auto;
}
.month-picker.open { display: block; }
.month-picker-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.month-picker-item:hover { background: var(--hair); }
.month-picker-item.active {
  background: var(--accent-bg);
  color: var(--accent-ink);
  font-weight: 500;
}
.month-picker-item .c {
  color: var(--text-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ---- 滚动容器 ---- */
.scroller {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}
.thread {
  max-width: 720px;
  margin: 0 auto;
  display: flex; flex-direction: column;
  gap: 2px;
}

/* ---- 日期分隔 ---- */
.day-sep {
  text-align: center;
  margin: 24px 0 12px;
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: .04em;
}

.time-mark {
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
  padding: 6px 0 2px;
  font-variant-numeric: tabular-nums;
}

/* ---- 消息行 ---- */
.row {
  display: flex; align-items: flex-end;
  gap: 8px;
  margin: 1px 0;
}
.row.self { flex-direction: row-reverse; }
.row.system { justify-content: center; margin: 6px 0; }

.avatar {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--hair);
  align-self: flex-end;
  opacity: 0;
  transition: opacity .15s ease;
  border: 1px solid var(--border);
}
.avatar.fallback {
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  background: var(--hair);
  color: var(--text-2);
}
.row.show-avatar .avatar { opacity: 1; }

.bubble-col {
  display: flex; flex-direction: column;
  max-width: min(78%, 540px);
  min-width: 0;
}
.row.self .bubble-col { align-items: flex-end; }

.bubble {
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  background: var(--card);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  border: 1px solid transparent;
  box-shadow: 0 2px 10px rgba(0,0,0,.02);
  max-width: 100%;
}
.row.self .bubble {
  background: var(--accent-bg);
  color: var(--accent-ink);
  border-color: transparent;
}
.bubble.media-only { padding: 2px; background: transparent; border: none; }
.row.self .bubble.media-only { background: transparent; }

/* 连续合并的紧角 */
.row.cont:not(.self) .bubble { border-top-left-radius: 6px; }
.row.cont.self .bubble { border-top-right-radius: 6px; }
.row:not(.last):not(.self) .bubble { border-bottom-left-radius: 6px; }
.row:not(.last).self .bubble { border-bottom-right-radius: 6px; }

/* ---- 回复 ---- */
.reply-quote {
  background: var(--hair);
  border-left: 2px solid var(--text-3);
  padding: 6px 10px;
  margin-bottom: 6px;
  border-radius: 4px;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.4;
  max-height: 3.5em;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row.self .reply-quote {
  background: rgba(0,0,0,.05);
  border-left-color: var(--accent);
  color: var(--accent-ink);
  opacity: .75;
}
.reply-quote .who { font-size: 11px; opacity: .7; margin-right: 6px; }

/* ---- 媒体 ---- */
.media-row {
  display: flex; flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.media-row.plain { margin-top: 0; }

.bubble-img {
  display: block;
  max-width: min(70vw, 260px);
  max-height: 360px;
  border-radius: var(--radius);
  cursor: zoom-in;
  background: var(--hair);
  object-fit: cover;
}
.media-row .bubble-img + .bubble-img { max-width: 130px; max-height: 130px; }

.bubble-video {
  display: block;
  max-width: min(80vw, 320px);
  max-height: 420px;
  border-radius: var(--radius);
  background: #000;
}

.sticker-img {
  display: block;
  max-width: 140px;
  max-height: 140px;
  border-radius: var(--radius);
  background: transparent;
  cursor: zoom-in;
}

.face {
  display: inline-block;
  width: 20px; height: 20px;
  vertical-align: -4px;
  margin: 0 1px;
}
.face-uni {
  font-size: 16px;
  vertical-align: -2px;
  line-height: 1;
  margin: 0 1px;
}
.face-token {
  display: inline;
  color: var(--text-3);
  font-size: 12.5px;
  padding: 0 2px;
}

/* ---- 链接卡片 ---- */
.link-card {
  display: block;
  background: var(--card);
  border: 1px solid transparent;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 10px 12px;
  max-width: 320px;
  color: var(--text);
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.link-card:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,.05); color: var(--text); }
.link-card-title {
  font-size: 13.5px; font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.link-card-desc {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.45;
  margin-bottom: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.link-card-host {
  font-size: 11px;
  color: var(--text-3);
}

/* ---- 文件卡片 ---- */
.file-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid transparent;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  min-width: 200px; max-width: 320px;
  color: var(--text);
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.file-card:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,.05); color: var(--text); }
.file-icon {
  width: 32px; height: 32px;
  flex-shrink: 0;
  background: var(--hair);
  color: var(--text-2);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
}
.file-meta { min-width: 0; }
.file-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: 11px; color: var(--text-3); margin-top: 1px; }

/* ---- 系统消息 ---- */
.system-msg {
  font-size: 11.5px;
  color: var(--text-3);
  text-align: center;
  padding: 2px 10px;
}

/* ---- 灯箱 ---- */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.92);
  display: none; align-items: center; justify-content: center;
  z-index: 200;
  padding: 20px;
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img, .lightbox video {
  max-width: 100%; max-height: 100%;
  border-radius: var(--radius);
  object-fit: contain;
}
.lightbox-close {
  position: absolute;
  top: max(20px, env(safe-area-inset-top)); right: 20px;
  width: 36px; height: 36px;
  background: rgba(255,255,255,.15);
  border-radius: 50%;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

/* ---- 加载 / FAB ---- */
.loading {
  text-align: center;
  padding: 24px;
  color: var(--text-3);
  font-size: 13px;
}
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--hair);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.fab {
  position: fixed;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-2);
  display: none; align-items: center; justify-content: center;
  font-size: 16px;
  z-index: 50;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.fab.visible { display: inline-flex; }

@media (max-width: 480px) {
  .bubble { font-size: 17px; }        /* 手机字号 +20% */
  .bubble-col { max-width: 82%; }
  .avatar { width: 28px; height: 28px; }
}

/* ---- 笔记模块 ---- */
.notes-main { padding-top: 16px; }

.note-new-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-3);
  text-decoration: none;
  font-size: 15px;
  margin-bottom: 20px;
  transition: transform .15s, border-color .15s, color .15s, background .15s, box-shadow .15s;
}
.note-new-btn:hover {
  border-color: var(--accent);
  border-style: solid;
  color: var(--accent-ink);
  background: var(--accent-bg);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.04);
}
.note-new-icon { font-size: 16px; opacity: 0.7; }
.note-new-btn:hover .note-new-icon { opacity: 1; }

.notes-filter {
  background: var(--hair);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--text-2);
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.notes-filter .clear { color: var(--text-3); margin-left: auto; font-size: 14px; }

.notes-feed {
  display: flex; flex-direction: column;
  gap: 12px;
}

.note-card {
  background: var(--card);
  border: 1px solid transparent;
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  font-size: 16px;
  line-height: 1.75;
  /* 左侧留出 3px 给 pinned 标记, 不 pinned 时透明保持对齐 */
  border-left: 3px solid transparent;
  transition: transform .15s ease, box-shadow .15s ease;
}
.note-card.pinned {
  border-left-color: var(--accent);
}
/* 列表页整张卡可点 → cursor + hover 微微抬一下 */
.note-card[data-href] { cursor: pointer; }
.note-card[data-href]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .06), 0 4px 12px rgba(0,0,0,.04);
}
.note-card[data-href]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 详情页底部"编辑"链接 */
.note-foot {
  display: flex; justify-content: flex-end;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.note-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 10px;
}
.note-head .spacer { flex: 1; }
.note-time { font-variant-numeric: tabular-nums; }
.note-pin { font-size: 13px; opacity: 0.8; }
.note-vis {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  background: var(--hair);
}
.note-vis.public { background: var(--accent-bg); color: var(--accent-ink); }
.note-vis.protected { background: #fef3c7; color: #92400e; }
.note-action {
  color: var(--text-3);
  text-decoration: none;
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 4px;
  transition: background .12s, color .12s;
}
.note-action:hover { color: var(--accent-ink); background: var(--accent-bg); }

.note-body { color: var(--text); word-break: break-word; font-size: 16px; line-height: 1.75; }
.note-body p { margin: 0 0 10px; }
.note-body p:last-child { margin-bottom: 0; }
.note-body h1, .note-body h2, .note-body h3 {
  font-weight: 600; margin: 14px 0 8px; line-height: 1.35;
}
.note-body h1 { font-size: 20px; }
.note-body h2 { font-size: 18px; }
.note-body h3 { font-size: 16px; }
.note-body blockquote {
  margin: 10px 0;
  color: var(--text-2);
}
.note-body ul, .note-body ol { margin: 4px 0; padding-left: 24px; }
.note-body li { margin: 2px 0; }
.note-body pre {
  background: var(--hair);
  padding: 10px 12px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 13px;
}
.note-body code {
  background: var(--hair);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.92em;
  font-family: ui-monospace, SFMono-Regular, monospace;
}
.note-body pre code { padding: 0; background: transparent; }
.note-body blockquote {
  border-left: 3px solid var(--border);
  padding: 2px 12px;
  color: var(--text-2);
  margin: 8px 0;
}
.note-body a { color: var(--accent-ink); }
.note-body a:hover { color: var(--accent); text-decoration: underline; }
.note-body hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

.note-tag {
  display: inline-block;
  color: var(--accent-ink);
  background: var(--accent-bg);
  padding: 0 6px;
  border-radius: 4px;
  font-size: 0.92em;
  text-decoration: none;
  margin: 0 1px;
}
.note-tag:hover { background: var(--accent); color: #fff; }

.note-attach {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 10px;
}
.note-img-link { display: block; line-height: 0; }
.note-img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--hair);
  cursor: zoom-in;
}
.note-file {
  display: inline-flex;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
}

/* ---- 笔记编辑器 ---- */
.note-editor {
  display: flex; flex-direction: column;
  gap: 12px;
}
.note-editor-textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  resize: vertical;
  min-height: 240px;
  outline: none;
}
.note-editor-textarea:focus { border-color: var(--accent); }

/* .note-editor-row 已弃用 (visibility 选项删了, 置顶搬进 actions 行) */

.note-editor-existing {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px;
}
.file-chip {
  padding: 2px 8px;
  background: var(--hair);
  border-radius: 4px;
  color: var(--text-2);
}

.note-editor-actions {
  display: flex; align-items: center; gap: 12px;
  margin-top: 4px;
}
.note-editor-actions .spacer { flex: 1; }
.note-editor-actions button.primary { min-width: 96px; }
.note-editor-pin {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
}
.note-editor-pin input[type=checkbox] {
  /* 不让 ≤600px 全局 input{font-size:16px} 把 checkbox 撑大 */
  margin: 0;
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.note-delete-row {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  display: flex;
}
button.danger {
  color: var(--danger);
  background: var(--card);
  border-color: var(--border);
}
button.danger:hover { border-color: var(--danger); }

/* ---- 笔记编辑器: 工具栏 (加图 / 加链接) ---- */
.note-toolbar {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.note-tool-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text-2);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}
.note-tool-btn:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent-bg);
}
.note-tool-btn input[type=file] {
  /* file input 藏起来, label 当按钮 */
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.note-img-thumbs {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 8px;
  align-items: flex-start;
}
.note-img-thumb-wrap {
  position: relative;
  width: 84px; height: 84px;
}
.note-img-thumb {
  width: 84px; height: 84px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}
.note-img-thumb-wrap.uploading .note-img-thumb { opacity: 0.55; }
.note-img-thumb-wrap.error .note-img-thumb { opacity: 0.4; }
.note-img-thumb-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 11px;
  padding: 2px 4px;
  text-align: center;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
}
.note-img-thumb-overlay.err { background: rgba(220,38,38,.85); }
.note-img-thumb-del {
  position: absolute;
  top: -6px; right: -6px;
  width: 20px; height: 20px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.note-img-thumb-del:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.note-img-thumbs-sum {
  align-self: center;
  font-size: 13px;
  color: var(--text-3);
  margin-left: 4px;
}

/* ---- 笔记: AI 智能生成模式 (可折叠) ---- */
.note-ai-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 8px;
}
.note-ai-summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
  display: flex; align-items: center; gap: 6px;
  user-select: none;
}
.note-ai-summary::-webkit-details-marker { display: none; }
.note-ai-summary::before {
  content: "▸";
  color: var(--text-3);
  font-size: 12px;
  transition: transform .15s;
}
.note-ai-panel[open] > .note-ai-summary::before {
  transform: rotate(90deg);
}
.note-ai-summary-icon { font-size: 16px; }
.note-ai-summary-hint {
  color: var(--text-3);
  font-weight: 400;
  font-size: 13px;
  margin-left: 4px;
}
.note-ai-panel[open] {
  border-color: var(--accent);
}
.note-ai-body {
  padding: 4px 16px 16px;
  display: flex; flex-direction: column;
  gap: 12px;
}
.note-ai-files-label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 6px;
  font-weight: 500;
}
.note-ai-files input[type=file] {
  font-size: 13px;
}
.note-ai-thumbs {
  display: flex; flex-wrap: wrap; gap: 8px;
  align-items: flex-start;
}
.note-ai-thumb-wrap {
  position: relative;
  width: 72px; height: 72px;
}
.note-ai-thumb {
  width: 72px; height: 72px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}
.note-ai-thumb-del {
  position: absolute;
  top: -6px; right: -6px;
  width: 20px; height: 20px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.note-ai-thumb-del:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.note-ai-thumbs-sum {
  align-self: center;
  font-size: 12px;
  color: var(--text-3);
  margin-left: 4px;
}
.note-ai-prompt {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  resize: vertical;
  min-height: 60px;
  outline: none;
}
.note-ai-prompt:focus { border-color: var(--accent); }
.note-ai-actions {
  display: flex; align-items: center; gap: 12px;
}
.note-ai-status {
  font-size: 13px;
  color: var(--text-2);
}
.note-ai-status.wait { color: var(--text-2); }
.note-ai-status.ok   { color: var(--accent-ink); }
.note-ai-status.err  { color: var(--danger); }

/* ---- 相册: 入口页 ---- */
.album-entries {
  display: flex; flex-direction: column;
  gap: 12px;
}
.album-entry {
  display: flex; align-items: stretch; gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid transparent;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: box-shadow .15s ease, transform .15s ease;
}
.album-entry:hover { box-shadow: 0 8px 24px rgba(0,0,0,.06); color: var(--text); transform: translateY(-2px); }
.album-entry-info {
  display: flex; flex-direction: column; justify-content: center;
  min-width: 100px;
}
.album-entry-name { font-size: 16px; font-weight: 500; }
.album-entry-count {
  font-size: 12.5px; color: var(--text-3);
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}
.album-entry-covers {
  margin-left: auto;
  display: grid;
  grid-template-columns: repeat(4, 56px);
  gap: 2px;
}
.album-cover {
  display: block;
  width: 56px; height: 56px;
  border-radius: 4px;
  background-size: cover;
  background-position: center;
  background-color: var(--hair);
}
.album-cover.empty { background: var(--hair); }
@media (max-width: 480px) {
  .album-entry-covers { grid-template-columns: repeat(3, 44px); }
  .album-cover { width: 44px; height: 44px; }
  .album-entry-covers .album-cover:nth-child(4) { display: none; }
}

/* ---- 相册: 画廊 ---- */
.album-main { max-width: 960px; }

.album-bar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
}
.album-bar .back { color: var(--text-2); font-size: 13px; text-decoration: none; }
.album-bar .back:hover { color: var(--text); }
.album-title { margin: 0; font-size: 16px; font-weight: 600; }
.album-count { font-size: 12px; color: var(--text-3); font-weight: 400; margin-left: 6px; font-variant-numeric: tabular-nums; }
.album-bar button.primary { margin-left: auto; padding: 6px 14px; font-size: 13px; }

.album-upload-form { display: none; }

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 4px;
}
@media (min-width: 600px) {
  .album-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
.album-cell {
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--hair);
  border-radius: 8px;
  position: relative;
  box-shadow: var(--shadow);
  transition: box-shadow .15s ease, transform .15s ease;
}
.album-cell:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,.06);
  transform: translateY(-2px);
}
.album-cell img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .25s ease;
}
.album-cell:hover img { transform: scale(1.05); }

.album-paginate {
  display: flex; align-items: center; justify-content: center;
  gap: 18px;
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-2);
}
.album-paginate a { color: var(--accent-ink); text-decoration: none; }
.album-paginate a:hover { color: var(--accent); }
.album-page-num { font-variant-numeric: tabular-nums; }

/* ---- 通用图片 lightbox ---- */
.lb-overlay {
  position: fixed; inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  color: #fff;
  display: none;
  /* 长图按自然高度撑开, 蒙层自己滚 */
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  /* 双指 pinch-zoom 浏览器原生处理, 别拦 */
  touch-action: pinch-zoom;
}
.lb-overlay.open { display: block; }

/* 内层撑到至少 100vh 并 flex 居中 — 短图垂直居中, 长图自然向下溢出,
   overlay 的 overflow:auto 接管滚动 (从顶部开始, 不会被截掉头) */
.lb-inner {
  min-height: 100%;
  display: flex;
  align-items: center; justify-content: center;
  padding: 56px 0 56px;   /* 给上方关闭按钮和下方 caption 让位 */
  box-sizing: border-box;
}
.lb-img {
  display: block;
  max-width: 100vw;
  width: auto; height: auto;
  background: rgba(255, 255, 255, 0.04);
}

/* 按钮固定在视口, 不跟图一起滚 */
.lb-close, .lb-prev, .lb-next {
  position: fixed;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center; justify-content: center;
  padding: 0;
  transition: background .12s;
  font-family: inherit;
  z-index: 2;
}
.lb-overlay.open .lb-close,
.lb-overlay.open .lb-prev,
.lb-overlay.open .lb-next { display: flex; }
.lb-close:hover, .lb-prev:hover, .lb-next:hover {
  background: rgba(0, 0, 0, 0.8);
}
.lb-close {
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  font-size: 28px;
}
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }

.lb-meta {
  position: fixed;
  left: 0; right: 0;
  bottom: max(12px, env(safe-area-inset-bottom));
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  display: none;
  justify-content: center; gap: 12px;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
  z-index: 2;
}
.lb-overlay.open .lb-meta { display: flex; }
.lb-caption { max-width: 70vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-index { font-variant-numeric: tabular-nums; opacity: 0.85; }

/* 手机上按钮稍小一档 */
@media (max-width: 600px) {
  .lb-prev, .lb-next { width: 38px; height: 38px; font-size: 22px; }
  .lb-close { width: 38px; height: 38px; font-size: 24px; }
  .lb-img { margin: 48px auto 64px; }
}

/* ---- 笔记: 已有附件 (编辑时可删) ---- */
.note-existing-attach {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 12px;
  align-items: flex-start;
}
.note-existing-item { position: relative; }
.note-existing-thumb {
  width: 84px; height: 84px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}
.note-existing-file {
  display: inline-flex; align-items: center;
  padding: 8px 12px;
  background: var(--hair);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-2);
}
.note-existing-del {
  position: absolute;
  top: -6px; right: -6px;
  width: 20px; height: 20px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.note-existing-del:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

/* ---- 笔记: 链接编辑行 (无卡片包裹, 有行才占位) ---- */
.note-link-rows {
  display: flex; flex-direction: column;
  gap: 8px;
}
.note-link-rows:not(:empty) { margin-top: 12px; }
.note-link-row {
  display: flex; gap: 8px; align-items: center;
}
.note-link-text {
  flex: 0 0 30%;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  outline: none;
}
.note-link-url {
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  outline: none;
}
.note-link-text:focus, .note-link-url:focus { border-color: var(--accent); }
.note-link-del {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.note-link-del:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ---- 笔记: 渲染出来的链接 (列表/详情页) ---- */
.note-links {
  display: flex; flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.note-link {
  display: inline-flex; align-items: center; gap: 4px;
  max-width: 100%;
  padding: 4px 10px;
  background: var(--hair);
  color: var(--text-2);
  border-radius: 999px;
  font-size: 13px;
  text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background .12s, color .12s;
}
.note-link:hover { background: var(--accent-bg); color: var(--accent-ink); }
