/* ============================================================
   我的日记 · 前端设计系统 v4
   原则：统一间距(4/8/12/16/24)、统一触控高度(42px)、
        移动端底部标签栏、桌面顶部导航、卡片式布局
   ============================================================ */
:root {
  --bg: #f7f5f1;
  --card: #ffffff;
  --ink: #26221c;
  --mut: #8d867a;
  --pri: #2f6b46;
  --pri-deep: #245239;
  --pri-soft: #e9f2ec;
  --line: #e9e3d8;
  --danger: #c62828;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(38, 34, 28, .04), 0 6px 20px rgba(38, 34, 28, .06);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* hidden 属性优先于任何 display 规则：避免 .card/.seg-bar/.manage-bar 等 flex 类把 hidden 盖住 */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;   /* 应用列：顶栏 → 内容 → 底部 tab 一体框 */
  /* 背景不做 fixed 附着：手机上会引发整页重绘卡顿 */
  background:
    radial-gradient(1100px 420px at 50% -120px, rgba(47, 107, 70, .12), transparent 62%),
    radial-gradient(760px 300px at 108% 6%, rgba(47, 107, 70, .06), transparent 60%),
    linear-gradient(180deg, #f2f3ec 0%, #f7f5f1 45%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.65;
}
a { color: var(--pri); }

/* 通用小头像圆 */
.u-ava {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 13px; font-style: normal; flex: none;
  margin-right: 6px; background: var(--pri-soft);
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: var(--safe-t);
}
.topbar-inner {
  max-width: 640px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; min-height: 52px;
}
.brand {
  display: inline-flex; align-items: center; gap: 7px;
  font-weight: 700; font-size: 16px; color: var(--ink); text-decoration: none;
}
.brand-ico { font-size: 19px; }

/* 顶栏右侧：桌面内联链接 / 移动端 ☰ 下拉 */
.topbar-right { display: flex; align-items: center; gap: 2px; min-width: 0; }
.topnav-links { display: none; }
.topnav-links a {
  padding: 8px 11px; border-radius: 10px;
  font-size: 13px; color: var(--mut); text-decoration: none; white-space: nowrap;
}
.topnav-links a:active { background: var(--pri-soft); }
.menu-btn {
  width: 38px; height: 38px; margin-left: 6px; flex: none;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); font-size: 17px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.menu-btn:active { background: var(--pri-soft); }
@media (min-width: 769px) {
  .topnav-links { display: flex; align-items: center; gap: 2px; }
  .menu-btn, .topmenu { display: none !important; }
}

/* 顶栏下拉菜单（移动端） */
.topmenu {
  position: absolute; top: calc(100% + 6px); right: 12px; z-index: 50;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 8px 30px rgba(38, 34, 28, .16);
  min-width: 190px; padding: 6px;
}
.topmenu a {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 12px; border-radius: 10px;
  font-size: 14px; color: var(--ink); text-decoration: none;
}
.topmenu a:active { background: var(--pri-soft); }
.topmenu .tm-logout { color: #b3261e; }
.topmenu-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px 9px; margin-bottom: 4px;
  border-bottom: 1px dashed var(--line);
  font-weight: 600; font-size: 14px;
}

/* ---------- 底部标签栏（白底全宽，与顶栏对称；按钮限制在 640px 列内） ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 3px 0 calc(3px + var(--safe-b));
}
.tabbar-in {
  width: 100%; max-width: 640px; margin: 0 auto;
  display: flex; padding: 0 8px;
}
.tabbar a {
  flex: 1; min-width: 0;
  display: flex; justify-content: center;
  padding: 2px 0; text-decoration: none;
}
.tabbar a .t-in {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 4px 14px; border-radius: 11px;
  font-size: 11px; color: var(--mut); white-space: nowrap;
}
.tabbar a .ico { font-size: 21px; line-height: 1.15; }
.tabbar a.on .t-in { color: var(--pri); font-weight: 600; background: var(--pri-soft); }

/* ---------- 主内容（与底部 tab 同一框体：两侧发丝线贯通到底） ---------- */
.page {
  flex: 1 0 auto;           /* 内容少时也把框撑到屏幕底 */
  width: 100%;
  max-width: 640px; margin: 0 auto;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 16px 16px calc(76px + var(--safe-b));
}
/* 窄屏（≤641px）时应用列即全屏：边缘线贴屏幕边，去掉更干净 */
@media (max-width: 641px) {
  .page { border-left: none; border-right: none; }
}

/* ---------- 卡片：横向出血贴合应用框两边缘线（页边留白只给标题/工具条） ---------- */
.card {
  background: var(--card);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-left: none; border-right: none;
  border-radius: 0;
  box-shadow: none;
  padding: 18px;
  margin: 0 -16px 14px;
}
/* 登录页居中小卡不参与出血 */
.login-card { margin: 0 auto; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card h1 { font-size: 20px; margin: 0 0 10px; color: var(--ink); }
.card h2 { font-size: 17px; margin: 0 0 8px; color: var(--ink); }
.card h3 { font-size: 15px; margin: 0; }

/* ---------- 按钮 / 输入 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink);
  font-size: 14px; font-family: inherit; cursor: pointer; text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--pri); border-color: var(--pri); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--pri-deep); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.mini { min-height: 30px; padding: 0 10px; font-size: 12px; border-radius: 9px; }

.btn-send {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 22px;
  border: none; border-radius: 12px;
  background: var(--pri); color: #fff;
  font-size: 15px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.btn-send:hover { background: var(--pri-deep); }
.btn-send:active { transform: scale(.98); }
.btn-send:disabled { opacity: .4; cursor: not-allowed; }

input { font: inherit; color: var(--ink); }
textarea {
  width: 100%; font: inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 12px; resize: vertical; background: var(--card);
}
textarea:focus, input:focus { outline: 2px solid rgba(181, 101, 29, .25); outline-offset: 0; }
input[type="text"], input[type="password"], input[type="date"] {
  min-height: 42px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
input[type="date"] { padding: 0 10px; }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* ---------- 提示 ---------- */
.alert { border-radius: 12px; padding: 10px 14px; font-size: 14px; margin: 10px 0; border: 1px solid transparent; }
.alert.error { background: #fdecea; color: #b3261e; border-color: #f3c4c0; }
.alert.ok { background: #e9f5eb; color: #1c6b2c; border-color: #c9e6cd; }
.muted { color: var(--mut); font-size: 13px; }
.toast {
  position: fixed; top: calc(var(--safe-t) + 14px); left: 50%; transform: translateX(-50%);
  z-index: 99; border-radius: 12px; padding: 10px 18px;
  font-size: 14px; max-width: 88vw; text-align: center;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .16);
}
.toast.ok { background: #2e7d32; color: #fff; }
.toast.error { background: var(--danger); color: #fff; }

.vh { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.backlink { display: inline-block; font-size: 13px; color: var(--mut); text-decoration: none; margin-bottom: 10px; }

/* ---------- 登录 ---------- */
.login-body {
  background:
    radial-gradient(900px 500px at 50% -80px, rgba(47, 107, 70, .22), transparent 65%),
    linear-gradient(180deg, #eef2e9 0%, #f7f5f1 50%);
}
.login-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 28px 16px;
}
.login-card { width: 100%; max-width: 360px; padding: 30px 26px; }
.login-logo { font-size: 42px; text-align: center; margin-bottom: 4px; }
.login-card h1 { text-align: center; margin: 0 0 18px; }
.login-card label { display: block; margin-top: 14px; font-size: 13px; color: var(--mut); }
.login-card input { width: 100%; margin-top: 6px; }
.login-card .btn { width: 100%; margin-top: 22px; }
.login-card .muted { text-align: center; margin: 16px 0 0; }
/* 记住的账号：一键切换卡片 */
.saved-accounts { margin: 0 0 16px; text-align: left; }
.sa-list { display: flex; flex-direction: column; gap: 8px; }
.sa-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); font: inherit; font-size: 14px; color: var(--ink);
  cursor: pointer; text-align: left;
}
.sa-item:active { background: var(--pri-soft); }
.sa-item .u-ava { width: 26px; height: 26px; font-size: 15px; }
.sa-item span { flex: 1; font-weight: 600; }
.sa-item .sa-del {
  flex: none; width: 26px; height: 26px; border-radius: 8px;
  color: #c9c2b4; font-size: 18px; font-style: normal; font-weight: 400;
  display: inline-flex; align-items: center; justify-content: center;
}
.sa-item .sa-del:active { color: var(--danger); background: #fdecea; }
.remember-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--mut); margin-top: 14px;
}
.remember-row input { width: auto; min-height: auto; margin: 0; }

/* ---------- 时间线 ---------- */
.toolbar { display: flex; flex-direction: column; gap: 10px; margin: 0 0 14px; }
.toolbar h1 { font-size: 21px; margin: 0; }
.toolbar-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-controls input[type="date"] { flex: 1; min-width: 130px; }
.timeline .card h2 { color: var(--pri); }
.body { line-height: 1.9; }
.body p { margin: 0 0 12px; }
.body p:last-child { margin-bottom: 0; }
.draft-card { border-top: 1.5px solid var(--pri); border-bottom: 1.5px solid var(--pri); background: linear-gradient(180deg, #fffdf7, #fff); }
.draft-card p { color: #7a5c34; margin: 0 0 4px; }
.empty-state { text-align: center; padding: 34px 20px; }
.empty-state h1 { color: var(--pri); }
.empty-state .actions { justify-content: center; }
.image-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 16px; }
.image-cards img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.image-cards figure { margin: 0; }
.image-cards figcaption { font-size: 12px; color: var(--mut); margin-top: 3px; text-align: center; }
.diary-body { line-height: 1.95; }

/* ---------- 搜索 ---------- */
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; min-width: 0; }
.hits { list-style: none; padding: 0; margin: 14px 0 0; }
.hits li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.hits li:last-child { border-bottom: none; }
.hits .date { font-weight: 600; color: var(--pri); text-decoration: none; }
.snip { color: var(--mut); font-size: 13px; white-space: pre-wrap; margin-top: 4px; }
mark { background: #ffe9a8; color: inherit; padding: 0 2px; border-radius: 3px; }
.snip.ctx {
  margin-top: 2px; padding-left: 10px;
  border-left: 2px solid var(--line);
}
/* 搜索深链定位：命中消息高亮渐隐 */
.bubble.hl { animation: bubble-hl 3s ease; }
@keyframes bubble-hl {
  0%, 55% { outline: 3px solid rgba(255, 199, 54, .95); outline-offset: 2px; }
  100% { outline: 3px solid rgba(255, 199, 54, 0); outline-offset: 2px; }
}

/* ---------- 记一笔 ---------- */
.rec-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 2px 0 12px; }
.rec-top h1 { font-size: 22px; margin: 0; color: var(--ink); }
.date-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--mut);
}
.date-chip input { border: none; background: transparent; font-size: 13px; width: auto; min-height: auto; padding: 0; }
.rec-card textarea { border: none; padding: 2px 0; background: transparent; min-height: 84px; }
.rec-card textarea:focus { outline: none; }
.rec-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.rec-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 4px; }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 20px 8px; min-height: 104px;
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  cursor: pointer; font-family: inherit;
}
.tile:active { transform: scale(.97); }
.tile .tile-ico { font-size: 28px; line-height: 1; }
.tile .tile-txt { font-size: 14px; color: var(--ink); font-weight: 500; }
.tile.rec { border-color: #e3b3a8; }
.tile.recording { background: var(--danger); border-color: var(--danger); animation: pulse 1s infinite; }
.tile.recording .tile-txt { color: #fff; }
@keyframes pulse { 50% { opacity: .6; } }
.rec-upload {
  display: block; margin: 4px auto 14px;
  background: none; border: none;
  color: var(--mut); font-size: 13px; cursor: pointer;
  text-decoration: underline; font-family: inherit; padding: 4px;
}
.rec-preview { width: 100%; max-height: 280px; object-fit: contain; border-radius: 12px; background: #000; margin-bottom: 10px; }
.media-actions { display: flex; gap: 8px; margin-left: auto; }
.rec-tip { font-size: 12px; color: var(--mut); text-align: center; margin: 0 0 14px; }
.rec-today { list-style: none; margin: 10px 0 0; padding: 0; }
.rec-today li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.rec-today li:last-child { border-bottom: none; }
.rec-today .t-ico { font-size: 16px; }
.rec-today .t-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-today .t-time { color: var(--mut); font-size: 12px; }

/* ---------- 预览 ---------- */
.preview-meta { font-size: 12px; color: var(--mut); margin: 8px 0 0; }
#content { min-height: 320px; line-height: 1.9; }

/* ---------- 图片灯箱 ---------- */
#lightbox {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(16, 13, 10, .93);
  display: none; align-items: center; justify-content: center;
  padding: 16px; touch-action: none; overflow: hidden;
}
#lightbox.on { display: flex; }
#lightbox img {
  max-width: 96vw; max-height: 92vh; border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .5); cursor: zoom-out;
  transform-origin: 0 0; will-change: transform;
  -webkit-user-select: none; user-select: none;
}
#lightbox .lb-prev, #lightbox .lb-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: rgba(255, 255, 255, .16); color: #fff;
  font-size: 26px; line-height: 1; cursor: pointer; z-index: 2;
  display: flex; align-items: center; justify-content: center;
}
#lightbox .lb-prev { left: 10px; }
#lightbox .lb-next { right: 10px; }
#lightbox .lb-close {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: rgba(255, 255, 255, .16); color: #fff;
  font-size: 15px; line-height: 1; cursor: pointer; z-index: 2;
}
#lightbox .lb-count {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  color: #fff; font-size: 13px; background: rgba(0, 0, 0, .4);
  padding: 3px 10px; border-radius: 12px; z-index: 2;
}

/* ---------- 原始记录页 ---------- */
.arch-ctrl { display: flex; align-items: center; gap: 8px; padding: 12px; }
.arch-ctrl input { flex: 1; min-width: 110px; }
.arch-item { padding: 14px 16px; }
.arch-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.arch-meta .t-time { color: var(--mut); font-size: 12px; }
.badge {
  display: inline-flex; align-items: center;
  font-size: 11px; color: var(--mut);
  background: var(--pri-soft); border-radius: 999px; padding: 2px 9px;
}
.badge.warn { background: #fdecea; color: #b3261e; }
.arch-img {
  width: 132px; height: 132px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line);
  cursor: zoom-in; display: block;
}
.arch-quote {
  background: var(--pri-soft); border-left: 3px solid var(--pri);
  padding: 8px 12px; border-radius: 0 10px 10px 0;
  margin-top: 8px; color: #5b4a33; font-size: 14px; line-height: 1.7;
}
.arch-text { white-space: pre-wrap; word-break: break-word; line-height: 1.75; }
/* 档案文件夹导航 */
.arch-pathbar { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.arch-folders {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px; margin: 0 0 14px;
}
.arch-folder {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); cursor: pointer; font-family: inherit;
}
.arch-folder:active { background: var(--pri-soft); }
.arch-folder .afo-ico { font-size: 22px; }
.arch-folder .afo-name { font-size: 14px; font-weight: 600; color: var(--ink); flex: 1; text-align: left; }
.arch-file {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink); font-size: 14px;
}
.arch-file .af-ico {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--pri-soft); font-size: 18px;
}
.arch-file .af-name { flex: 1; min-width: 0; word-break: break-all; line-height: 1.5; }
.arch-file .af-dl { flex: none; font-size: 12px; color: var(--pri); }
.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
  font-size: 12px; word-break: break-all;
}
/* 公开分享页 */
.share-full { max-width: 100%; max-height: 76vh; border-radius: 12px; display: block; margin: 0 auto; }
.share-full-video { max-width: 100%; max-height: 76vh; border-radius: 12px; display: block; margin: 0 auto; background: #000; }
/* 分享页视频卡片：点击全屏播放（不提供下载） */
.share-video {
  position: relative; display: block; width: 100%; padding: 0; margin: 0;
  border: none; background: #000; border-radius: 10px; overflow: hidden;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.share-vthumb { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; pointer-events: none; }
.share-vplay {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(0, 0, 0, .45); color: #fff; font-size: 19px;
  display: flex; align-items: center; justify-content: center; pointer-events: none;
}
.share-vplayer {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, .94); display: flex; align-items: center; justify-content: center;
  padding: 16px; touch-action: none;
}
.svp-video { width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; background: #000; }
.svp-close {
  position: absolute; top: 12px; right: 12px; width: 40px; height: 40px;
  border-radius: 50%; border: none; background: rgba(255, 255, 255, .18);
  color: #fff; font-size: 17px; cursor: pointer; z-index: 2;
}
@media (max-width: 480px) {
  .rec-top h1 { font-size: 18px; word-break: break-word; }
}
/* 档案条目分享按钮 */
.arch-cell { position: relative; }
.cell-share {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  border: none; border-radius: 999px; padding: 4px 10px;
  background: rgba(255, 255, 255, .82); color: var(--pri-deep);
  font-size: 11px; font-family: inherit; cursor: pointer;
  box-shadow: 0 1px 4px rgba(38, 34, 28, .18);
}
.cell-share:active { background: var(--pri-soft); }
.afo-share {
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); font-size: 12px; color: var(--pri);
  padding: 4px 10px; cursor: pointer; font-family: inherit; flex: none;
}
.afo-share:active { background: var(--pri-soft); }
/* 按目录视图：文件夹卡片动作 + 管理模式 */
.arch-folder.afo-card { cursor: pointer; flex-wrap: wrap; }
.arch-folder.afo-card .afo-name { min-width: 64px; }
.afo-actions { display: inline-flex; gap: 6px; flex: none; }
.afo-btn {
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); font-size: 11px; color: var(--pri);
  padding: 3px 9px; cursor: pointer; font-family: inherit;
}
.afo-btn:active { background: var(--pri-soft); }
.afo-btn.danger { color: #c0392b; }
.pick-ck {
  position: relative; z-index: 3; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; margin-right: 8px; vertical-align: middle; flex: none;
  border-radius: 8px; background: rgba(255, 255, 255, .88);
  box-shadow: 0 1px 4px rgba(38, 34, 28, .18); cursor: pointer;
}
.pick-ck input { width: 16px; height: 16px; margin: 0; accent-color: var(--pri); cursor: pointer; }
.arch-cell .pick-ck { position: absolute; top: 6px; left: 6px; margin: 0; }
.manage-bar {
  position: sticky; bottom: 12px; z-index: 40;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  max-width: 640px; margin: 14px auto 0; padding: 10px 16px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; box-shadow: var(--shadow);
}
/* 分享弹框里的链接行 */
.share-url-row { display: flex; gap: 8px; align-items: center; }
.share-url-row input { flex: 1; min-width: 0; }
.arch-file:active .af-ico { background: #dcebe1; }
.arch-audio { width: 100%; margin-top: 4px; height: 40px; }
/* 音频条目：播放器 + 下载行 */
.arch-item .arch-file { margin-top: 6px; }

/* ---------- 记一笔输入框加大 ---------- */
.rec-card textarea { min-height: 150px; font-size: 16px; resize: none; overflow: hidden; }

/* ---------- 移动端性能：去毛玻璃（低端机抗卡顿） ---------- */
@media (max-width: 768px) {
  .topbar, .tabbar {
    backdrop-filter: none; -webkit-backdrop-filter: none;
    background: #fff;
  }
}

/* ---------- 日记阅读排版 ---------- */
.diary-card h1 { letter-spacing: .5px; }
.diary-body p { margin: 0 0 14px; text-align: justify; }
.diary-body p:last-child { margin-bottom: 0; }

/* ---------- 「我说」小说栏目 ---------- */
.novel-toc h3 { margin: 0 0 6px; display: flex; align-items: baseline; gap: 8px; }
.novel-list { list-style: none; margin: 8px 0 0; padding: 0; }
.novel-list a {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 4px; border-bottom: 1px dashed var(--line);
  text-decoration: none; color: var(--ink);
}
.novel-list li:last-child a { border-bottom: none; }
.novel-list .n-idx { font-size: 13px; color: var(--mut); font-variant-numeric: tabular-nums; }
.novel-list .n-title { flex: 1; font-size: 15px; }
.novel-list .n-arrow { color: var(--mut); }
.novel-list a:active { background: var(--pri-soft); }

.novel-chapter { padding: 22px 20px; }
.novel-no { margin: 0 0 2px; font-size: 12px; }
.novel-chapter h1 { margin: 0 0 16px; }
.novel-body {
  font-family: "Noto Serif SC", "Songti SC", SimSun, Georgia, serif;
  font-size: 16.5px; line-height: 2.05; color: #33302a;
}
.novel-body p { margin: 0 0 18px; text-indent: 2em; text-align: justify; }
.novel-body p:last-child { margin-bottom: 0; }
.novel-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

/* ============ v7：多账号 / 档案分组 / 我说页新设计 ============ */
.user-chip {
  font-size: 12px; color: var(--pri); background: var(--pri-soft);
  border-radius: 999px; padding: 4px 11px; margin-right: 4px; font-weight: 600;
}

/* 账号管理 */
.acc-form { display: flex; gap: 8px; flex-wrap: wrap; }
.acc-form input { flex: 1; min-width: 140px; }
.acc-list { list-style: none; margin: 10px 0 0; padding: 0; }
.acc-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 2px; border-bottom: 1px dashed var(--line);
}
.acc-list li:last-child { border-bottom: none; }
.acc-list .a-name { font-weight: 600; display: flex; align-items: center; gap: 6px; flex: 1; }
.acc-list .a-time { font-size: 12px; }
.acc-list .a-actions { display: flex; gap: 6px; }
.btn.danger { border-color: #f3c4c0; color: #b3261e; }

/* 登录记录（仅管理员） */
.login-list { margin-top: 10px; overflow-x: auto; }
.login-list table { width: 100%; border-collapse: collapse; font-size: 13px; }
.login-list th, .login-list td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.login-list th { color: var(--mut); font-weight: 600; }
.login-list .ok { color: #2e7d32; font-weight: 600; }
.login-list .err { color: #b3261e; font-weight: 600; }

/* 「我说」朋友切换：头部下拉 + ＋添加 */
.chat-head { position: relative; }
.friend-pick {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start;
  gap: 1px; background: none; border: none; cursor: pointer; text-align: left;
  font-family: inherit; padding: 2px 4px; border-radius: 8px; color: #fff;
}
.friend-pick:active { background: rgba(255,255,255,.14); }
.friend-pick b { font-size: 15px; display: flex; align-items: center; gap: 4px; }
.friend-pick .muted { font-size: 11px; color: rgba(255,255,255,.78); max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-caret { font-size: 12px; color: rgba(255,255,255,.8); }
.friend-drop {
  position: absolute; top: calc(100% + 4px); left: 10px; right: 10px; z-index: 40;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px; max-height: 60vh; overflow-y: auto;
}
.friend-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; cursor: pointer; font-family: inherit; font-size: 14px;
  color: var(--ink); text-decoration: none; padding: 9px 10px; border-radius: 9px;
}
.friend-item:hover { background: rgba(0,0,0,.05); }
.friend-item.on { background: var(--pri-soft); color: var(--pri-deep); font-weight: 600; }
.friend-item .f-ava { font-size: 18px; }
.friend-item .f-name { flex: 1; text-align: left; }
.friend-item.friend-manage { color: var(--mut); font-size: 13px; border-top: 1px dashed var(--line); border-radius: 0; margin-top: 4px; padding-top: 10px; }
.head-actions { display: flex; align-items: center; gap: 6px; }
.chat-head .add-friend { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.25); color: #fff; flex: none; }
.add-friend { text-decoration: none; font-weight: 700; font-size: 18px; line-height: 1; }

/* 大模型 API Key 管理 */
.llm-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.llm-form input, .llm-form select { flex: 1; min-width: 150px; }
.llm-form select {
  min-height: 42px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); font: inherit; color: var(--ink);
}
#llmKeyList { margin-top: 10px; }
.lk-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lk-meta { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 管理页子菜单（下拉选择） */
.admin-seg { margin-bottom: 14px; }
.adm-nav { position: relative; display: inline-block; margin: 0 0 14px; }
.adm-pick {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  font: inherit; font-weight: 600; color: var(--ink); cursor: pointer;
}
.adm-pick:active { background: var(--pri-soft); }
.adm-pick .f-caret { color: var(--mut); font-size: 12px; }
.adm-drop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40;
  min-width: 176px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 6px;
}
.adm-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: none; cursor: pointer; font-family: inherit;
  font-size: 14px; color: var(--ink); text-align: left;
  padding: 10px 12px; border-radius: 9px; white-space: nowrap;
}
.adm-item:hover { background: rgba(0, 0, 0, .05); }
.adm-item.on { background: var(--pri-soft); color: var(--pri-deep); font-weight: 600; }

/* 通用弹框（居中卡片） */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(16, 13, 10, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
}
.modal-mask[hidden] { display: none; }
.modal-card {
  width: 100%; max-width: 420px; max-height: calc(100dvh - 36px);
  overflow-y: auto;
  background: var(--card); border-radius: 16px; box-shadow: 0 14px 44px rgba(38, 34, 28, .24);
  padding: 18px;
}
.modal-card h3 { margin: 0 0 12px; }
.modal-form { margin-top: 0; }
.modal-form input, .modal-form select { flex: none; width: 100%; min-width: 0; }
.modal-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.flex-gap { flex: 1; }

/* 朋友管理页 */
.ag-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ag-form input { flex: 1; min-width: 160px; }
.ag-model-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.ag-model-row span { flex: none; }
.ag-model-row select {
  flex: 1; min-width: 200px; min-height: 40px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); font: inherit; color: var(--ink);
}
.ag-presets { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
#agPersona { width: 100%; margin-top: 8px; }
.acc-list .a-sub { flex: 1; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-list .a-name { flex: 0 0 auto; }

/* 档案：日期/目录视图切换（标签栏） */
.arch-tabs {
  display: flex; gap: 4px; margin: 0 0 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 4px; box-shadow: var(--shadow);
}
.atab {
  flex: 1; min-height: 40px; border: none; background: transparent;
  border-radius: 9px; font-size: 14px; color: var(--mut);
  cursor: pointer; font-family: inherit; font-weight: 500; white-space: nowrap;
}
.atab.on { background: var(--pri); color: #fff; font-weight: 600; }
/* 档案：分段筛选 + 分组 + 折叠 */
.seg-bar {
  display: flex; gap: 6px; margin: 0 0 14px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px; box-shadow: var(--shadow);
}
.seg {
  flex: 1; min-height: 34px; border: none; background: transparent;
  border-radius: 999px; font-size: 13px; color: var(--mut);
  cursor: pointer; font-family: inherit; white-space: nowrap;
}
.seg.on { background: var(--pri); color: #fff; font-weight: 600; }
/* 分享弹框：有效期选择（胶囊单选组） */
.share-dur {
  display: flex; gap: 6px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px;
}
.share-dur .seg { flex: 1; min-width: 52px; }
.arch-group { padding: 16px; }
.arch-group-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.arch-group-head h3 { margin: 0; font-size: 15px; }
.arch-item { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.arch-item:last-child { border-bottom: none; }
.arch-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.arch-meta .t-time { color: var(--mut); font-size: 12px; }
.arch-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.arch-thumb {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; display: block;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.arch-text.clamp {
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.75; white-space: pre-wrap; word-break: break-word;
}
.arch-text { line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
.linkmore {
  background: none; border: none; color: var(--pri); font-size: 13px;
  cursor: pointer; padding: 4px 0; font-family: inherit;
}

/* ===== 档案：拖拽条目到文件夹 ===== */
.dragging, .dragging * {
  touch-action: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
}
[data-drag] {
  cursor: grab;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
/* 长按落在图片/视频子元素上：必须对元素本身禁用系统长按菜单（iOS 转发/存储、Android 分享） */
[data-drag] img,
[data-drag] video,
[data-drag] .arch-thumb {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
}
/* 禁用浏览器原生图片拖拽（拖出系统幽灵图会与我们的拖拽打架） */
[data-drag] img { -webkit-user-drag: none; user-drag: none; }
.drag-ghost {
  position: fixed; left: 0; top: 0; z-index: 1200; pointer-events: none;
  display: flex; align-items: center; gap: 8px; max-width: 230px;
  padding: 6px 12px 6px 6px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--pri);
  box-shadow: 0 10px 28px rgba(38, 34, 28, .22);
  font-size: 13px; color: var(--ink);
  transform: translate(-8px, -50%) rotate(-2deg);
}
.drag-ghost .dg-thumb { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; flex: none; background: var(--pri-soft); }
.drag-ghost .dg-ico { font-size: 22px; flex: none; line-height: 1; }
.drag-ghost .dg-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.drop-hover {
  border-color: var(--pri) !important;
  background: var(--pri-soft) !important;
  box-shadow: 0 0 0 3px rgba(47, 107, 70, .18) !important;
  transform: scale(1.02);
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.arch-folder.drop-hover .afo-name { color: var(--pri-deep); }
.btn.drop-hover { color: var(--pri-deep) !important; }

/* ===== 文件夹表单浮层（从按钮下方展开） ===== */
.dir-act-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex: none; padding: 0;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--card); color: var(--ink);
  font-size: 17px; line-height: 1; cursor: pointer;
  transition: transform .1s ease, background .1s ease;
}
.dir-act-btn:active { transform: scale(.94); background: var(--pri-soft); }
.dir-act-btn.primary { background: var(--pri); border-color: var(--pri); color: #fff; }
.dir-act-btn.primary:active { background: var(--pri-deep); }
.dir-pop {
  position: fixed; z-index: 110;
  width: min(320px, calc(100vw - 24px));
  padding: 14px 16px 16px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 16px 44px rgba(38, 34, 28, .22);
  animation: pop-in .16s ease;
}
.dir-pop::before {
  content: ''; position: absolute; top: -7px; left: 20px;
  width: 12px; height: 12px;
  background: var(--card); border-left: 1px solid var(--line); border-top: 1px solid var(--line);
  transform: rotate(45deg);
}
.dir-pop-title { font-size: 15px; font-weight: 700; color: var(--ink); margin: 0 0 4px; }
.dir-pop-hint { margin: 0 0 10px; font-size: 12px; line-height: 1.6; }
.dir-pop-form input {
  width: 100%; min-height: 42px; padding: 0 12px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.dir-pop-form input:focus { outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px rgba(47, 107, 70, .12); }
.dir-pop-actions { display: flex; gap: 8px; margin-top: 12px; }
.dir-pop-actions .btn { flex: 1; }
.form-err { margin: 8px 0 0; color: var(--danger); font-size: 13px; line-height: 1.5; }
/* 移动到：点选文件夹列表 */
.dir-pop-pick { margin-top: 2px; max-height: 40dvh; overflow-y: auto; }
.dpp-row {
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-height: 42px; padding: 6px 12px;
  border: none; border-radius: 10px; background: transparent;
  font: inherit; font-size: 14px; color: var(--ink); text-align: left; cursor: pointer;
}
.dpp-row:active { background: var(--pri-soft); }
/* 树形展开箭头（有子目录才显示；点击切换展开/折叠） */
.dpp-caret {
  flex: none; width: 24px; height: 24px; margin-left: -8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--mut);
  border-radius: 6px; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.dpp-caret:active { background: var(--pri-soft); color: var(--ink); }
.dpp-caret.ph { visibility: hidden; }
.dpp-row .dpp-folder { font-size: 16px; flex: none; }
.dpp-row .dpp-name { font-weight: 600; }
.dpp-row .dpp-sub { margin-left: auto; font-size: 11px; color: var(--mut); max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dpp-empty { margin: 6px 0 0; font-size: 13px; }
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-6px) scale(.97); }
  to { opacity: 1; transform: none; }
}

/* 我说（记录页）新设计 */
.rec-hero {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin: 4px 0 14px;
  background: linear-gradient(135deg, #2f6b46 0%, #1f4530 100%);
  border-radius: var(--radius); padding: 18px 18px;
  color: #fff; box-shadow: var(--shadow);
}
.rec-hero h1 { margin: 0; font-size: 20px; color: #fff; }
.rec-hero-sub { margin: 4px 0 0; font-size: 13px; color: rgba(255, 255, 255, .82); }
.rec-hero .date-chip { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .25); color: #fff; }
.rec-input-card { padding: 16px; }
.tile-ico-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 16px; font-size: 25px;
}
.tile-ico-chip.green { background: #e5f2e9; }
.tile-ico-chip.red { background: #fdecea; }
.tile { padding: 18px 8px; gap: 7px; min-height: 118px; }
.tile .tile-sub { font-size: 12px; color: var(--mut); }
.tile.recording .tile-sub { color: rgba(255, 255, 255, .85); }
.tile.recording .tile-ico-chip { background: rgba(255, 255, 255, .2); }
.rec-today-card { padding: 14px 16px; }

/* ============ v8：聊天模式（我说 × 倾听） ============ */

/* 聊天页全屏布局：页面不滚动，只有聊天列表内部滚动（保证 scrollTop 到底生效） */
body.chat-mode { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.chat-mode .topbar { flex: none; }
body.chat-mode .page {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  width: 100%; margin: 0 auto;
  padding: 0;   /* 聊天头/面板贴合应用框两边缘线与顶栏 */
  overflow: hidden;
}
/* 聊天页：tab 栏白底全宽、按钮限位列内（随内容列对齐） */
body.chat-mode .tabbar { position: static; flex: none; }
body.chat-mode .chat-wrap { flex: 1; min-height: 0; }

/* 聊天页贴合框线：头部方角贴顶栏与两侧，面板同样贴边 */
body.chat-mode .chat-head { border-radius: 0; margin-bottom: 0; box-shadow: none; }
body.chat-mode .chat-panel {
  border-radius: 0; border-left: none; border-right: none; border-bottom: none;
  box-shadow: none;
}

.chat-wrap {
  display: flex; flex-direction: column;
  min-height: 320px;
}
.chat-head {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, #2f6b46 0%, #1f4530 100%);
  border-radius: var(--radius); padding: 12px 14px;
  color: #fff; box-shadow: var(--shadow); margin-bottom: 12px;
}
.chat-head .chat-avatar { width: 40px; height: 40px; font-size: 22px; }
.chat-head-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-head-txt b { font-size: 15px; }
.chat-head-txt .muted { font-size: 11px; color: rgba(255,255,255,.78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .date-chip { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.25); color: #fff; flex: none; }

.chat-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  background: #e5f2e9; border-radius: 50%; flex: none;
}
.chat-avatar.sm { width: 32px; height: 32px; font-size: 17px; }

.chat-list {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 14px 12px 12px; display: flex; flex-direction: column; gap: 12px;
}
/* 消息不能被 flex 压扁：保留真实内容高度，让列表独立滚动。 */
.chat-list > * { flex-shrink: 0; }
.chat-head, .chat-inputbar { flex-shrink: 0; }
/* 聊天整体面板（边框 + 卡片化，视觉上成为一个整体） */
.chat-panel {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
  background: rgba(255, 255, 255, .72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.chat-time {
  align-self: center;
  font-size: 11px; color: var(--mut);
  background: rgba(141, 134, 122, .12);
  border-radius: 999px; padding: 2px 10px;
  margin: 2px 0 -4px;
}
.chat-loading { text-align: center; padding: 30px 0; }
.chat-row { display: flex; align-items: flex-end; gap: 8px; }
.chat-row.me { justify-content: flex-end; }
.bubble {
  max-width: 76%; padding: 10px 13px; border-radius: 16px;
  font-size: 15px; line-height: 1.65; word-break: break-word;
  box-shadow: 0 1px 2px rgba(38,34,28,.06);
}
.ai-bubble { background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.me-bubble { background: #2f6b46; color: #fff; border-bottom-right-radius: 4px; }
.chat-img { max-width: 200px; max-height: 220px; border-radius: 10px; display: block; cursor: zoom-in; }
.video-card { position: relative; display: block; overflow: hidden; padding: 0; border: 1px solid rgba(255,255,255,.15); border-radius: 14px; background: #17201e; color: #fff; cursor: pointer; font: inherit; isolation: isolate; }
.video-card--chat { width: 230px; max-width: 100%; aspect-ratio: 4 / 3; }
.video-card--archive { width: 100%; min-width: 0; aspect-ratio: 1; }
.video-preview { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.video-card-play { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.7); font-size: 20px; padding-left: 3px; }
.video-card-caption { position: absolute; bottom: 0; left: 0; right: 0; padding: 18px 8px 7px; background: linear-gradient(transparent, rgba(0,0,0,.8)); font-size: 11px; text-align: left; }
.video-card:hover .video-card-play { background: #294f40; }
.video-card:focus-visible, .video-dialog :focus-visible { outline: 3px solid #8bcca9; outline-offset: 3px; }
.bubble.video-bubble { padding: 0; background: transparent; box-shadow: none; color: var(--ink); }
.video-dialog { position: fixed; inset: 0; width: min(960px, calc(100% - 24px)); max-width: 960px; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); margin: auto; padding: 0; border: 1px solid #46514d; border-radius: 18px; background: #111815; color: #f2f6f3; box-shadow: 0 24px 100px #0008; z-index: 1000; overflow: auto; }
.video-dialog[open] { display: flex; flex-direction: column; }
.video-dialog[hidden] { display: none; }
.video-dialog::backdrop { background: rgba(7,14,10,.85); }
.video-dialog-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; flex-shrink: 0; }
.video-dialog h2 { font-size: 16px; margin: 0; color: inherit; }
.video-dialog button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 12px; border: 1px solid #64746b; border-radius: 10px; background: #25352d; color: #fff; font: inherit; font-size: 14px; cursor: pointer; }
.video-dialog-media { display: block; flex: 0 1 auto; min-height: 0; width: 100%; height: 60vh; height: 60dvh; object-fit: contain; background: #000; }
.video-dialog-status { margin: 0; padding: 0 16px 14px; color: #c1cec5; font-size: 12px; line-height: 1.6; }
@media (max-width: 600px) {
  .video-dialog { width: calc(100% - 12px); max-height: calc(100dvh - 12px); border-radius: 12px; }
  .video-dialog-bar { padding: 8px 10px; gap: 6px; }
  .video-dialog-media { height: 58vh; height: 58dvh; }
  .video-dialog-status { padding: 0 10px 10px; }
}
.voice-bubble {
  background: rgba(255,255,255,.18); border: none; color: #fff;
  border-radius: 999px; padding: 6px 14px; font-size: 14px; cursor: pointer; font-family: inherit;
}
.chat-asr { margin-top: 6px; font-size: 12px; opacity: .85; line-height: 1.5; }
.chat-asr.muted { color: var(--mut); opacity: 1; }

/* 正在输入动画 */
.typing-bubble { display: flex; gap: 4px; align-items: center; padding: 14px 16px; }
.typing-bubble i { width: 7px; height: 7px; border-radius: 50%; background: #9db8a6; animation: blink 1.2s infinite; }
.typing-bubble i:nth-child(2) { animation-delay: .2s; }
.typing-bubble i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

/* 输入栏 */
.chat-inputbar {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.96);
  border-top: 1px solid var(--line);
  padding: 10px 6px calc(10px + var(--safe-b));
}
.chat-tool {
  width: 42px; height: 42px; flex: none;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--card); font-size: 19px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.chat-tool:active { transform: scale(.94); }
.chat-tool.holding { background: var(--danger); border-color: var(--danger); animation: pulse 1s infinite; }
#chatText {
  flex: 1; min-width: 0; min-height: 42px;
  border: 1px solid var(--line); border-radius: 999px; padding: 0 16px; font-size: 15px;
}
.chat-send { flex: none; min-height: 40px; padding: 0 16px; border-radius: 999px; }
.plus-btn { font-weight: 700; font-size: 21px; line-height: 1; }

/* ＋ 展开面板（微信式：相册 / 文件） */
.chat-plus {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  padding: 12px 10px calc(12px + var(--safe-b));
  background: #f6f4ee; border-top: 1px solid var(--line);
}
.chat-plus[hidden] { display: none; }
.plus-act {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 13px 4px 10px; background: #fff; border: none; border-radius: 13px;
  cursor: pointer; font-family: inherit; font-size: 12px; color: var(--ink);
  box-shadow: 0 1px 2px rgba(38, 34, 28, .06);
}
.plus-act:active { background: var(--pri-soft); }
.plus-act .pa-ico { font-size: 25px; line-height: 1; }

/* 文件消息卡片（气泡内） */
.file-card {
  display: flex; align-items: center; gap: 10px;
  min-width: 170px; max-width: 230px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(255, 255, 255, .16);
  text-decoration: none;
}
.file-card .f-ico {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .25); font-size: 21px;
}
.file-card .f-name { color: #fff; font-size: 14px; line-height: 1.4; word-break: break-all; }
.ai-bubble .file-card { background: var(--pri-soft); }
.ai-bubble .file-card .f-ico { background: #fff; }
.ai-bubble .file-card .f-name { color: var(--ink); }

/* 长按删除菜单（仅当天消息） */
.chat-del-menu {
  position: fixed; z-index: 80;
  background: rgba(38, 34, 28, .9); border-radius: 11px; padding: 4px;
  box-shadow: 0 6px 22px rgba(38, 34, 28, .3);
}
.chat-del-menu[hidden] { display: none; }
.chat-del-menu .del-btn {
  display: block; border: none; background: transparent;
  color: #ff7a6b; font-size: 14px; padding: 9px 18px;
  border-radius: 8px; cursor: pointer; font-family: inherit; white-space: nowrap;
}
.chat-del-menu .del-btn:active { background: rgba(255, 255, 255, .14); }


.hold-tip {
  position: fixed; left: 50%; top: 42%; transform: translateX(-50%);
  background: rgba(16,13,10,.82); color: #fff; border-radius: 12px;
  padding: 14px 22px; font-size: 15px; z-index:  60; pointer-events: none;
}

/* 聊天里我的头像（比顶栏的大一号） */
.chat-row .u-ava { width: 32px; height: 32px; font-size: 17px; margin: 0; }

/* 上传状态留在本人消息中；进度条仅表示文件传输。 */
.upload-bubble { width: min(310px, 76%); min-width: 0; }
.upload-filename { font-weight: 600; overflow-wrap: anywhere; }
.upload-message { font-size: 12px; line-height: 1.6; margin-top: 6px; }
.upload-bubble progress { display: block; width: 100%; height: 9px; margin-top: 9px; accent-color: #bce3c5; }
.upload-bubble [hidden], .upload-status[hidden] { display: none; }
.upload-bubble button { margin-top: 8px; margin-right: 8px; padding: 4px 12px; border-radius: 12px; border: 1px solid currentColor; background: transparent; color: inherit; cursor: pointer; }
.upload-bubble button:disabled, .chat-inputbar button:disabled { opacity: .5; cursor: not-allowed; }
.chat-row.me[data-state="failed"] .upload-bubble { background: #8c2d32; }
.chat-row.me[data-state="saved"] .upload-message { color: #daf2df; }
.upload-bubble .chat-img { max-width: 100%; margin-top: 8px; }
.upload-bubble.video-bubble { width: 230px; }
.upload-bubble.video-bubble .video-card { padding: 0; margin: 0; border: 1px solid rgba(255,255,255,.15); background: #17201e; color: #fff; border-radius: 14px; }
.upload-bubble.video-bubble .upload-filename { font-size: 12px; color: var(--mut); margin-bottom: 5px; }
.chat-row.me[data-state="saved"] .video-bubble .upload-message { color: var(--mut); }
.upload-status { padding: 4px 12px; font-size: 12px; color: var(--mut); }

/* 账号头像选择器 */
.acc-avatar-pick { display: flex; align-items: center; gap: 14px; margin: 4px 0 12px; }
.acc-ava-preview {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 50%;
  background: #5a8a6a; font-size: 27px; flex: none;
}
.acc-ava-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.ava-opt {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1.5px solid transparent; background: var(--pri-soft);
  font-size: 20px; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center;
}
.ava-opt.on { border-color: var(--pri); background: #fff; box-shadow: 0 0 0 3px var(--pri-soft); }
.a-ava {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--pri-soft); font-size: 19px; flex: none;
}

/* ============ v9：时间线周视图 + 日期框日历标注 ============ */

/* 日期框容器（内嵌 📅 图标，点击弹出日历） */
.cal-box {
  position: relative;
  display: inline-flex; align-items: center;
  flex: 1; min-width: 130px;
}
.toolbar-controls .cal-box { flex: 1; min-width: 130px; }
.arch-ctrl .cal-box { flex: 1; min-width: 110px; }
.cal-ico {
  position: absolute; left: 11px; font-size: 15px;
  pointer-events: none; opacity: .85;
}
.cal-box .cal-input { flex: 1; min-width: 0; padding-left: 34px; background: var(--card); }
/* 聊天头部（绿底）里的日期框：保持药丸样式 */
.head-actions .cal-box { flex: none; }
.chat-head .date-chip .cal-ico { position: static; left: auto; }
.chat-head .date-chip .cal-input { padding-left: 0; background: transparent; color: #fff; }

/* 日历弹层 */
.cal-pop {
  position: fixed; z-index: 90;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 10px 34px rgba(38, 34, 28, .18);
  padding: 12px; user-select: none; -webkit-user-select: none;
}
.cal-pop[hidden] { display: none; }
.cal-pop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-pop-title { font-weight: 600; font-size: 14px; color: var(--ink); }
.cal-nav {
  width: 34px; height: 30px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--card); color: var(--ink); font-size: 16px; cursor: pointer;
  font-family: inherit; display: inline-flex; align-items: center; justify-content: center;
}
.cal-nav:active { background: var(--pri-soft); }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-week span { text-align: center; font-size: 11px; color: var(--mut); padding: 4px 0; }
.cal-day {
  display: flex; align-items: center; justify-content: center;
  height: 34px; border-radius: 9px; font-size: 13px; color: var(--mut);
  border: none; background: transparent; cursor: pointer; font-family: inherit;
}
.cal-day:hover { background: var(--pri-soft); }
.cal-day.blank { cursor: default; }
.cal-day.has-diary { background: var(--pri); color: #fff; font-weight: 600; }
.cal-day.has-draft { background: #f3e3b8; color: #6b4a16; font-weight: 600; }
.cal-day.has-record { background: var(--pri-soft); color: var(--pri-deep); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--pri); }
.cal-day.sel { box-shadow: inset 0 0 0 2px var(--pri-deep); }
.cal-day.today.sel { box-shadow: inset 0 0 0 2px var(--pri-deep); }
.cal-legend {
  display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed var(--line); font-size: 11px; color: var(--mut);
}
.cal-legend .lg { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 4px; vertical-align: -1px; }
.cal-legend .lg.diary { background: var(--pri); }
.cal-legend .lg.draft { background: #e6c878; }
.cal-legend .lg.record { background: var(--pri-soft); }
.cal-legend .lg.none { background: #ddd7cb; }

/* 时间线周视图：每天一张卡片，圆点标注状态 */
.tl-day h2 { color: var(--pri); }
.tl-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.tl-head h2 { font-size: 16px; margin: 0; }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.tl-dot.diary { background: var(--pri); }
.tl-dot.draft { background: #d9a441; }
.tl-dot.record { background: #7fb394; }
.tl-dot.none { background: #d8d2c6; }
.tl-preview { color: var(--ink); line-height: 1.75; margin: 0; }
.muted-day { opacity: .85; }
.tl-more { display: flex; justify-content: center; gap: 10px; margin-top: 2px; }

/* ============ v10：待办（iOS 提醒事项风） ============ */
.todo-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 6px 0 14px; }
.todo-top h1 { font-size: 28px; margin: 0; letter-spacing: -.5px; color: var(--ink); }
.todo-sub { margin: 2px 0 0; color: var(--mut); font-size: 13px; }

/* 进度圆环 */
.todo-ring {
  width: 54px; height: 54px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--pri) 0%, #e7e1d4 0);
  display: grid; place-items: center; position: relative;
}
.todo-ring::before {
  content: ''; position: absolute; inset: 5px; border-radius: 50%;
  background: #fbfaf7; box-shadow: inset 0 1px 2px rgba(38, 34, 28, .05);
}
.todo-ring b { position: relative; font-size: 12px; color: var(--pri-deep); font-variant-numeric: tabular-nums; }

/* 分段控制（毛玻璃滑块） */
.todo-seg {
  position: relative; display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(233, 227, 216, .55);
  border: 1px solid rgba(38, 34, 28, .05);
  border-radius: 13px; padding: 3px; margin-bottom: 14px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.tseg {
  position: relative; z-index: 1; min-height: 36px; border: none; background: transparent;
  border-radius: 10px; font-size: 14px; color: var(--mut); cursor: pointer; font-family: inherit;
  transition: color .2s;
}
.tseg.on { color: var(--ink); font-weight: 600; }
.tseg-pill {
  position: absolute; top: 3px; left: 0; z-index: 0; height: calc(100% - 6px); width: 0;
  border-radius: 10px; background: #fff;
  box-shadow: 0 1px 4px rgba(38, 34, 28, .14), 0 4px 12px rgba(38, 34, 28, .06);
  transition: transform .28s cubic-bezier(.22, 1, .36, 1), width .28s cubic-bezier(.22, 1, .36, 1);
}

/* 进度条卡片 */
.todo-progress { padding: 14px 16px; }
.tp-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.tp-row span { font-size: 14px; font-weight: 600; }
.tp-row b { font-size: 13px; color: var(--mut); font-variant-numeric: tabular-nums; }
.tp-bar { height: 7px; border-radius: 999px; background: #efe9dd; overflow: hidden; }
.tp-bar i {
  display: block; height: 100%; width: 0; border-radius: 999px; background: var(--pri);
  transition: width .35s cubic-bezier(.22, 1, .36, 1), background .2s;
}

/* 列表卡片 */
.todo-card { padding: 4px 0 0; overflow: hidden; }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  border-bottom: 1px solid rgba(233, 227, 216, .7); transition: background .15s;
}
.todo-item:last-child { border-bottom: none; }
.todo-item:active { background: rgba(233, 242, 236, .6); }
.todo-check {
  width: 24px; height: 24px; flex: none; border-radius: 50%; padding: 0;
  border: 1.8px solid #c9c2b4; background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .2s, background .2s, transform .1s;
}
.todo-check:active { transform: scale(.88); }
.todo-check svg {
  width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 2.6;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .25s ease .05s;
}
.todo-item.done .todo-check { border-color: var(--pri); background: var(--pri); }
.todo-item.done .todo-check svg { stroke-dashoffset: 0; }
.todo-title { flex: 1; min-width: 0; font-size: 15px; line-height: 1.5; word-break: break-word; transition: color .2s; }
.todo-roll {
  flex: none; font-size: 11px; color: #8a6d2f;
  background: #f6ecd4; border-radius: 999px; padding: 2px 8px; white-space: nowrap;
}
.todo-item.done .todo-title {
  color: var(--mut);
  text-decoration: line-through; text-decoration-color: rgba(141, 134, 122, .6);
}
.todo-del {
  width: 28px; height: 28px; flex: none; border: none; background: transparent;
  color: #c9c2b4; font-size: 20px; line-height: 1; cursor: pointer; border-radius: 8px;
  opacity: 0; transition: opacity .15s, color .15s;
}
.todo-item:hover .todo-del, .todo-item.done .todo-del { opacity: 1; }
.todo-del:active { color: var(--danger); }
@media (hover: none) { .todo-del { opacity: .55; } }
.todo-empty { padding: 26px 16px; text-align: center; }

/* 添加行 */
.todo-add { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: rgba(250, 249, 245, .7); }
.ta-circle { width: 24px; height: 24px; flex: none; border-radius: 50%; border: 1.8px dashed #c9c2b4; }
.todo-add input { flex: 1; min-width: 0; border: none; background: transparent; font-size: 15px; min-height: 24px; padding: 0; }
.todo-add input:focus { outline: none; }
.ta-btn {
  flex: none; min-height: 32px; padding: 0 14px; border: none; border-radius: 999px;
  background: var(--pri); color: #fff; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.ta-btn:active { transform: scale(.96); }
.todo-hint { text-align: center; margin: 14px 0 0; font-size: 12px; }
