/* ==========================================================================
   lxj.中国 · 个人全记录　样式表
   设计原则：极简、无干扰、移动优先、深浅双色
   ========================================================================== */

/* ---------- 颜色令牌 ---------- */
:root {
  --bg:        #fbfbfa;
  --bg-soft:   #f3f3f1;
  --card:      #ffffff;
  --card-2:    #fafafa;
  --line:      #e6e6e3;
  --line-soft: #eeeeeb;
  --text:      #1b1b1d;
  --text-2:    #5c5c63;
  --text-3:    #9a9aa1;
  --accent:    #4f46e5;
  --accent-2:  #6d66ea;
  --accent-bg: #eef0fe;
  --danger:    #d94a4a;
  --ok:        #1f9d63;
  --shadow:    0 1px 2px rgba(20,20,24,.04), 0 6px 20px rgba(20,20,24,.05);
  --shadow-lg: 0 10px 40px rgba(20,20,24,.12);
  --radius:    14px;
  --radius-sm: 9px;
  --topbar-h:  56px;   /* 顶栏第一行（品牌/搜索/操作）固定高度 */
  --header-h:  56px;   /* 整个顶栏真实高度，由 JS 写入（含实时信息条折行） */
  --ease:      cubic-bezier(.22,.61,.36,1);
}

html[data-theme="dark"] {
  --bg:        #101012;
  --bg-soft:   #17171a;
  --card:      #1a1a1d;
  --card-2:    #202024;
  --line:      #2a2a2f;
  --line-soft: #242428;
  --text:      #ececed;
  --text-2:    #a0a0a8;
  --text-3:    #6e6e77;
  --accent:    #8b85f5;
  --accent-2:  #a29df8;
  --accent-bg: #23223a;
  --danger:    #ef6b6b;
  --ok:        #46c98b;
  --shadow:    0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.28);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg:#101012; --bg-soft:#17171a; --card:#1a1a1d; --card-2:#202024;
    --line:#2a2a2f; --line-soft:#242428; --text:#ececed; --text-2:#a0a0a8;
    --text-3:#6e6e77; --accent:#8b85f5; --accent-2:#a29df8; --accent-bg:#23223a;
    --danger:#ef6b6b; --ok:#46c98b;
    --shadow:0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.28);
    --shadow-lg:0 10px 40px rgba(0,0,0,.5);
  }
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto,
               "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

button, input, textarea, select {
  font: inherit; color: inherit; background: none; border: none; outline: none;
}
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }

/* hidden 属性必须一律生效：
   组件自身的 display（如 .search-clear{display:flex}、.menu-item{display:block}）
   会盖掉 hidden 的默认 display:none，导致元素该藏却一直露出来。 */
[hidden] { display: none !important; }

::selection { background: var(--accent); color: #fff; }

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

/* 滚动条（桌面） */
@media (hover: hover) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-thumb {
    background: var(--line); border-radius: 8px;
    border: 3px solid var(--bg);
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
}

/* ==========================================================================
   登录闸门
   ========================================================================== */
.gate {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: var(--bg);
  z-index: 100;
}
.gate[hidden] { display: none; }

.gate-box {
  width: 100%; max-width: 340px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}

.gate-logo {
  width: 46px; height: 46px; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px rgba(79,70,229,.28);
  margin-bottom: 18px;
}
.gate-title { margin: 0 0 6px; font-size: 21px; font-weight: 600; letter-spacing: .02em; }
.gate-sub   { margin: 0 0 24px; font-size: 13.5px; color: var(--text-3); }

.gate-input {
  width: 100%; height: 46px; padding: 0 16px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-align: center; letter-spacing: .12em;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.gate-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.gate-btn {
  width: 100%; height: 46px; margin-top: 12px;
  background: var(--accent); color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600; letter-spacing: .04em;
  transition: filter .18s var(--ease), transform .12s var(--ease);
}
.gate-btn:hover  { filter: brightness(1.08); }
.gate-btn:active { transform: scale(.985); }
.gate-btn[disabled] { opacity: .55; cursor: default; }
.gate-err {
  min-height: 18px; margin: 12px 0 0; font-size: 12.5px; color: var(--danger);
}

/* ==========================================================================
   顶栏
   ========================================================================== */
.app[hidden] { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: auto;                     /* 两行，高度由内容决定 */
  display: flex; flex-direction: column;
  padding: 0 max(14px, env(safe-area-inset-left)) 0 max(14px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

/* 第一行：品牌 / 搜索 / 操作 */
.tb-main {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
}

/* 第二行：日期（含农历）+ 到秒时间 + 近三天天气 + 中英切换 */
.tb-live {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 3px 10px;
  padding-bottom: 7px;
  min-width: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-2);
}

.tb-clock {
  display: flex; align-items: baseline; gap: 7px;
  flex-shrink: 0; min-width: 0;
}
.tb-date { color: var(--text-2); white-space: nowrap; }
.tb-date .d-mid, .tb-date .d-tiny { display: none; }

.tb-time {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  font-size: 12.5px;
  color: var(--text);
  letter-spacing: .01em;
  white-space: nowrap;
}

/* --- 天气 --- */
.tb-weather {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 3px 9px; min-width: 0;
}
.tb-weather[hidden] { display: none; }

.tb-wnow {
  display: inline-flex; align-items: center; gap: 4px;
  white-space: nowrap;
}
.tb-wico { display: inline-flex; width: 15px; height: 15px; color: var(--accent); }
.tb-wico svg { width: 15px; height: 15px; }
.tb-wcity { color: var(--text-2); }
.tb-wtemp {
  font-weight: 650; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.tb-wtext { color: var(--text-3); }

.tb-wfcast { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 3px 9px; min-width: 0; }
.tb-fday {
  display: inline-flex; align-items: center; gap: 3px;
  white-space: nowrap; color: var(--text-3);
}
.tb-fday b { font-weight: 500; color: var(--text-2); }
.tb-fday i { display: inline-flex; width: 13px; height: 13px; }
.tb-fday i svg { width: 13px; height: 13px; }
.tb-fday em { font-style: normal; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tb-fday u { text-decoration: none; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* --- 语言切换（跟主题/更多同属第一行操作簇） --- */
.lang-btn {
  flex-shrink: 0;
  min-width: 34px; height: 24px;
  padding: 0 8px;
  margin-right: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text-2);
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  transition: border-color .18s var(--ease), color .18s var(--ease), transform .12s var(--ease);
}
.lang-btn:hover { border-color: var(--accent); color: var(--accent); }
.lang-btn:active { transform: scale(.95); }

.brand {
  display: flex; align-items: center; gap: 8px;
  color: var(--text); flex-shrink: 0;
  padding: 4px 2px; border-radius: 8px;
}
.brand-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.brand-text { font-weight: 650; font-size: 15px; letter-spacing: .02em; }

.search-wrap {
  position: relative; flex: 1; min-width: 0;
  display: flex; align-items: center;
}
.search-ico {
  position: absolute; left: 10px; width: 17px; height: 17px;
  color: var(--text-3); pointer-events: none;
}
.search {
  width: 100%; height: 36px;
  padding: 0 30px 0 33px;
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 14px;
  transition: background .18s var(--ease), border-color .18s var(--ease);
}
.search::-webkit-search-cancel-button { display: none; }
.search:focus {
  background: var(--card);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.search-clear {
  position: absolute; right: 7px;
  width: 22px; height: 22px; border-radius: 50%;
  color: var(--text-3); font-size: 17px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.search-clear:hover { background: var(--bg-soft); color: var(--text); }

.top-actions { display: flex; align-items: center; gap: 2px; position: relative; flex-shrink: 0; }

.ic-btn {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  transition: background .16s var(--ease), color .16s var(--ease);
}
.ic-btn:hover { background: var(--bg-soft); color: var(--text); }
.ic-btn svg { width: 19px; height: 19px; }
.ic-btn .ico-moon { display: none; }
html[data-theme="dark"]  .ic-btn .ico-sun  { display: none; }
html[data-theme="dark"]  .ic-btn .ico-moon { display: block; }
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .ic-btn .ico-sun  { display: none; }
  html[data-theme="auto"] .ic-btn .ico-moon { display: block; }
}

.menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 178px; padding: 5px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 40;
  animation: pop .14s var(--ease);
}
.menu[hidden] { display: none; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98);} to { opacity:1; transform:none; } }

.menu-item {
  display: block; width: 100%; text-align: left;
  padding: 9px 11px; border-radius: 8px;
  font-size: 14px; color: var(--text);
  transition: background .14s var(--ease);
}
.menu-item:hover { background: var(--bg-soft); }
.menu-item.danger { color: var(--danger); }
.menu-sep { height: 1px; margin: 5px 8px; background: var(--line-soft); }

/* ==========================================================================
   主体容器
   ========================================================================== */
.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px max(14px, env(safe-area-inset-left)) calc(40px + env(safe-area-inset-bottom));
}

/* ==========================================================================
   录入卡片
   ========================================================================== */
.composer {
  position: sticky; top: calc(var(--header-h) + 8px); z-index: 20;
  margin-bottom: 16px;
}
.composer-inner {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 13px 10px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.composer-inner:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 3.5px var(--accent-bg), var(--shadow);
}

.composer-input {
  display: block; width: 100%;
  min-height: 26px; max-height: 42vh;
  resize: none; overflow-y: auto;
  font-size: 15.5px; line-height: 1.7;
  color: var(--text);
  background: transparent;
}
.composer-input::placeholder { color: var(--text-3); }

/* --- 链接 / 网页：网址行 --- */
.url-row {
  display: flex; align-items: center; gap: 7px;
  margin-bottom: 10px; padding: 5px 6px 5px 9px;
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: 10px;
  transition: background .18s var(--ease), border-color .18s var(--ease);
}
.url-row[hidden] { display: none; }
.url-row:focus-within {
  background: var(--card);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}
.url-ico { display: flex; flex-shrink: 0; color: var(--text-3); }
.url-ico svg { width: 16px; height: 16px; }
.url-input {
  flex: 1; min-width: 0;
  height: 26px;
  font-size: 14px;
  color: var(--text);
}
.url-input::placeholder { color: var(--text-3); }
.url-fetch {
  flex-shrink: 0;
  height: 26px; padding: 0 11px;
  border-radius: 7px;
  background: var(--accent-bg); color: var(--accent);
  font-size: 12.5px; font-weight: 600;
  transition: filter .16s var(--ease), opacity .16s;
}
.url-fetch:hover { filter: brightness(.96); }
.url-fetch[disabled] { opacity: .55; cursor: default; }
.url-fetch.busy::after {
  content: ""; display: inline-block;
  width: 9px; height: 9px; margin-left: 6px;
  border: 1.6px solid currentColor; border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.url-hint {
  margin: -4px 0 10px;
  font-size: 12px; line-height: 1.6;
  color: var(--text-3);
  padding-left: 2px;
}
.url-hint[hidden] { display: none; }
.url-hint.ok   { color: var(--ok); }
.url-hint.err  { color: var(--danger); }

.composer-preview {
  display: flex; flex-wrap: wrap; gap: 7px;
  margin-top: 10px;
}
.composer-preview[hidden] { display: none; }
.pv-item {
  position: relative; width: 62px; height: 62px;
  border-radius: 9px; overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  animation: pop .16s var(--ease);
}
.pv-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 文档附件：不做缩略图，用「扩展名 + 文件名」的方块表示 */
.pv-item.doc {
  width: auto; min-width: 108px; max-width: 190px;
  height: 62px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 20px 0 9px;
  overflow: visible;
}
.pv-ext {
  flex-shrink: 0;
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-bg); color: var(--accent);
  font-size: 10px; font-weight: 700; letter-spacing: .02em;
  text-transform: uppercase;
}
.pv-name {
  min-width: 0;
  font-size: 12px; line-height: 1.35; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; overflow-wrap: anywhere;
}
.pv-item.doc .pv-del { top: 50%; right: 3px; transform: translateY(-50%); }

.pv-del {
  position: absolute; top: 2px; right: 2px;
  width: 17px; height: 17px; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff;
  font-size: 12px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}

.composer-tools {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 11px;
  padding-top: 10px; border-top: 1px solid var(--line-soft);
}

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 4.5px 11px; border-radius: 999px;
  font-size: 13px; color: var(--text-2);
  background: var(--bg-soft);
  border: 1px solid transparent;
  transition: all .16s var(--ease);
  white-space: nowrap;
}
.chip:hover { color: var(--text); }
.chip.on {
  background: var(--accent-bg); color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  font-weight: 550;
}

.tools-right { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.tool-btn {
  width: 32px; height: 32px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  transition: background .16s var(--ease), color .16s var(--ease);
}
.tool-btn:hover { background: var(--bg-soft); color: var(--text); }
.tool-btn svg { width: 18px; height: 18px; }

.save-btn {
  height: 32px; padding: 0 16px;
  background: var(--accent); color: #fff;
  border-radius: 9px;
  font-size: 13.5px; font-weight: 600;
  transition: filter .16s var(--ease), transform .12s var(--ease), opacity .16s;
}
.save-btn:hover  { filter: brightness(1.08); }
.save-btn:active { transform: scale(.97); }
.save-btn[disabled] { opacity: .5; cursor: default; }

.composer-more {
  display: flex; gap: 14px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed var(--line-soft);
}
.composer-more:empty { display: none; }

.mini-field {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-3);
  flex: 1; min-width: 150px;
}
.mini-field[hidden] { display: none; }
.mini-field > span { flex-shrink: 0; }
.mini-field input {
  flex: 1; min-width: 0;
  padding: 5px 0;
  font-size: 13.5px; color: var(--text);
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: border-color .18s var(--ease);
}
.mini-field input:focus { border-bottom-color: var(--accent); }
.mini-field input::placeholder { color: var(--text-3); }

/* ==========================================================================
   筛选
   ========================================================================== */
.filters { margin-bottom: 14px; }

.filter-row { display: flex; align-items: center; gap: 10px; }

.seg {
  display: flex; gap: 2px; flex: 1;
  overflow-x: auto; scrollbar-width: none;
  padding: 3px;
  background: var(--bg-soft);
  border-radius: 10px;
}
.seg::-webkit-scrollbar { display: none; }
.seg-item {
  flex: 0 0 auto;
  padding: 5px 12px; border-radius: 7.5px;
  font-size: 13px; color: var(--text-2);
  white-space: nowrap;
  transition: all .16s var(--ease);
}
.seg-item:hover { color: var(--text); }
.seg-item.on {
  background: var(--card); color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
}

.adv-toggle {
  display: flex; align-items: center; gap: 3px;
  padding: 6px 9px; border-radius: 9px;
  font-size: 12.5px; color: var(--text-2);
  flex-shrink: 0;
  transition: background .16s var(--ease);
}
.adv-toggle:hover { background: var(--bg-soft); color: var(--text); }
.adv-toggle svg { width: 11px; height: 11px; transition: transform .2s var(--ease); }
.adv-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.adv-toggle.act { color: var(--accent); background: var(--accent-bg); }

.adv {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 10px; padding: 10px 12px;
  background: var(--card-2);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  animation: pop .16s var(--ease);
}
.adv[hidden] { display: none; }
.adv .mini-field { min-width: 0; flex: 0 0 auto; }
.adv input[type="date"] {
  font-size: 13px; color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 4px 8px;
}
.mini-clear {
  font-size: 12.5px; color: var(--text-3);
  padding: 4px 8px; border-radius: 7px;
}
.mini-clear:hover { background: var(--bg-soft); color: var(--text); }

.tagbar {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 11px;
}
.tagbar[hidden] { display: none; }
.tag-pill {
  padding: 3.5px 9px; border-radius: 999px;
  font-size: 12.5px; color: var(--text-2);
  background: var(--card);
  border: 1px solid var(--line);
  transition: all .16s var(--ease);
}
.tag-pill:hover { border-color: var(--accent); color: var(--accent); }
.tag-pill.on {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.tag-pill i { font-style: normal; opacity: .55; margin-left: 4px; font-size: 11px; }
.tag-pill.more {
  border-style: dashed;
  color: var(--text-3);
}
.tag-pill.more:hover { border-color: var(--accent); color: var(--accent); }

/* ==========================================================================
   时间流
   ========================================================================== */
.stream { display: flex; flex-direction: column; gap: 6px; }

.day {
  position: sticky; top: calc(var(--header-h) + 1px); z-index: 10;
  display: flex; align-items: center; gap: 9px;
  padding: 9px 2px 7px;
  margin-top: 6px;
  background: linear-gradient(var(--bg) 72%, transparent);
  font-size: 12.5px; color: var(--text-3);
  letter-spacing: .02em;
}
.day::after {
  content: ""; flex: 1; height: 1px; background: var(--line-soft);
}
.day b { color: var(--text-2); font-weight: 600; }
.day em { font-style: normal; }

.item {
  position: relative;
  display: flex; gap: 11px;
  padding: 11px 12px;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
.item:hover { border-color: var(--line); box-shadow: var(--shadow); }
.item.editing {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.item.done .it-text { color: var(--text-3); text-decoration: line-through; }

.it-time {
  flex: 0 0 40px;
  padding-top: 1px;
  font-size: 12px; color: var(--text-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}

.it-body { flex: 1; min-width: 0; }

.it-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-bottom: 4px;
}
.badge {
  padding: 1.5px 7px; border-radius: 5px;
  font-size: 11.5px; font-weight: 550;
  background: var(--bg-soft); color: var(--text-2);
}
.badge.mood  { background: color-mix(in srgb, #f59e0b 16%, transparent); color: #b45309; }
.badge.todo  { background: color-mix(in srgb, #0ea5e9 15%, transparent); color: #0369a1; }
.badge.diary { background: color-mix(in srgb, #8b5cf6 15%, transparent); color: #6d28d9; }
.badge.link  { background: color-mix(in srgb, #10b981 15%, transparent); color: #047857; }
.badge.image { background: color-mix(in srgb, #ec4899 15%, transparent); color: #be185d; }
.badge.webpage { background: color-mix(in srgb, #6366f1 15%, transparent); color: #4338ca; }
.badge.file    { background: color-mix(in srgb, #f97316 15%, transparent); color: #c2410c; }
html[data-theme="dark"] .badge { color: var(--text-2); }
@media (prefers-color-scheme: dark) { html[data-theme="auto"] .badge { color: var(--text-2); } }

.it-mood { font-size: 12px; color: var(--text-3); }

/* 网页/文档标题（抓取回来的原标题） */
.it-title {
  margin: 0 0 3px;
  font-size: 15px; font-weight: 600; line-height: 1.5;
  color: var(--text);
  overflow-wrap: anywhere;
}

.it-text {
  margin: 0;
  font-size: 15px; line-height: 1.68;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.it-text a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px;
             text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.it-text a:hover { text-decoration-color: var(--accent); }

/* 网页正文很长，列表里先折起来，避免一条记录占满整屏 */
.it-text.clamped {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.it-more {
  display: block;
  margin-top: 3px;
  padding: 1px 0;
  font-size: 12.5px;
  color: var(--accent);
}
.it-more:hover { text-decoration: underline; }

.it-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.it-tag {
  font-size: 11.5px; color: var(--accent);
  background: var(--accent-bg);
  padding: 1.5px 7px; border-radius: 5px;
}
.it-tag:hover { filter: brightness(.95); }
html[data-theme="dark"] .it-tag { color: var(--accent-2); }
@media (prefers-color-scheme: dark) { html[data-theme="auto"] .it-tag { color: var(--accent-2); } }

.it-imgs {
  display: grid; gap: 5px; margin-top: 8px;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  max-width: 460px;
}
.it-imgs img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 9px; border: 1px solid var(--line-soft);
  cursor: zoom-in;
  transition: transform .18s var(--ease);
}
.it-imgs img:hover { transform: scale(1.015); }

/* 文档附件列表 */
.it-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.it-file {
  display: flex; align-items: center; gap: 7px;
  max-width: 100%;
  padding: 5px 11px 5px 6px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 12.5px; color: var(--text-2);
  transition: border-color .16s var(--ease), color .16s var(--ease);
}
.it-file:hover { border-color: var(--accent); color: var(--accent); }
.it-file i {
  flex-shrink: 0;
  width: 26px; height: 26px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-bg); color: var(--accent);
  font-size: 9px; font-weight: 700; font-style: normal;
  text-transform: uppercase;
}
.it-file span {
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 网页来源行 */
.it-src {
  display: flex; align-items: center; gap: 5px;
  margin-top: 6px;
  font-size: 12px; color: var(--text-3);
  min-width: 0;
}
.it-src svg { width: 13px; height: 13px; flex-shrink: 0; }
.it-src a {
  color: var(--text-2);
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.it-src a:hover { color: var(--accent); text-decoration: underline; }
.it-src em {
  font-style: normal; flex-shrink: 0;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.it-acts {
  display: flex; flex-direction: column; gap: 3px;
  opacity: 0; transition: opacity .18s var(--ease);
  flex-shrink: 0;
}
.item:hover .it-acts,
.item:focus-within .it-acts { opacity: 1; }
@media (hover: none) { .it-acts { opacity: 1; } }

.act {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  transition: background .14s var(--ease), color .14s var(--ease);
}
.act:hover { background: var(--bg-soft); color: var(--text); }
.act.del:hover { color: var(--danger); }
.act svg { width: 15px; height: 15px; }

/* 内联编辑 */
.edit-box { display: flex; flex-direction: column; gap: 9px; }
.edit-input {
  width: 100%; min-height: 62px; max-height: 40vh;
  padding: 9px 11px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 15px; line-height: 1.68;
  resize: vertical;
}
.edit-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.edit-row .mini-field { min-width: 130px; }
.edit-url { width: 100%; min-width: 0; margin-bottom: 2px; }
.edit-url input { font-size: 12.5px; color: var(--text-2); }
.edit-acts { display: flex; gap: 8px; margin-left: auto; }
.btn-sm {
  height: 30px; padding: 0 14px; border-radius: 8px;
  font-size: 13px;
}
.btn-sm.primary { background: var(--accent); color: #fff; font-weight: 600; }
.btn-sm.primary:hover { filter: brightness(1.08); }
.btn-sm.ghost { color: var(--text-2); }
.btn-sm.ghost:hover { background: var(--bg-soft); color: var(--text); }
.btn-sm.danger { color: var(--danger); }
.btn-sm.danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }

/* 待办勾选 */
.it-check {
  flex: 0 0 auto; width: 18px; height: 18px; margin-top: 2px;
  border: 1.8px solid var(--line); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: transparent;
  transition: all .18s var(--ease);
}
.it-check:hover { border-color: var(--accent); }
.item.done .it-check {
  background: var(--ok); border-color: var(--ok); color: #fff;
}
.it-check svg { width: 11px; height: 11px; }

/* 空状态 */
.empty { padding: 54px 20px; text-align: center; }
.empty[hidden] { display: none; }
.empty-art { width: 92px; height: 92px; margin: 0 auto 14px; color: var(--text-3); }
.empty-art svg { width: 100%; height: 100%; }
.empty-title { margin: 0 0 6px; font-size: 15.5px; font-weight: 600; color: var(--text-2); }
.empty-sub   { margin: 0; font-size: 13.5px; color: var(--text-3); }

.more-btn {
  display: block; width: 100%; margin: 16px 0 0;
  padding: 10px; border-radius: 10px;
  font-size: 13.5px; color: var(--text-2);
  background: var(--card); border: 1px solid var(--line-soft);
  transition: all .16s var(--ease);
}
.more-btn:hover { border-color: var(--line); color: var(--text); }
.more-btn[hidden] { display: none; }

.foot {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  margin-top: 26px; padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px; color: var(--text-3);
}
.foot-sep { opacity: .5; }
.net.off { color: var(--danger); }

/* 回到顶部 */
.to-top {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  z-index: 25;
  animation: pop .18s var(--ease);
}
.to-top[hidden] { display: none; }
.to-top:hover { color: var(--accent); border-color: var(--accent); }
.to-top svg { width: 19px; height: 19px; }

/* 轻提示 */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translate(-50%, 14px);
  padding: 9px 17px; border-radius: 10px;
  background: var(--text); color: var(--bg);
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity .22s var(--ease), transform .22s var(--ease);
  z-index: 90; max-width: 86vw; text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* 图片查看 */
.lightbox {
  position: fixed; inset: 0; z-index: 95;
  display: flex; align-items: center; justify-content: center;
  padding: 26px;
  background: rgba(0,0,0,.86);
  backdrop-filter: blur(6px);
  animation: fade .18s var(--ease);
  cursor: zoom-out;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.lightbox img {
  max-width: 100%; max-height: 100%;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

/* ==========================================================================
   顶栏实时信息条：按宽度分档，靠 CSS 切换而非 JS 重排
   ========================================================================== */
@media (max-width: 700px) {
  /* 天气折到第二行，日期用中档写法 */
  .tb-weather { flex-basis: 100%; }
  .tb-date .d-long { display: none; }
  .tb-date .d-mid  { display: inline; }
}

@media (max-width: 480px) {
  .tb-live { font-size: 11.5px; }
  .tb-time { font-size: 12px; }
}

@media (max-width: 420px) {
  .tb-date .d-mid  { display: none; }
  .tb-date .d-tiny { display: inline; }
  /* 窄屏优先保住「近三天」：只收掉天气文案（图标已表达天气），温度仍保留 */
  .tb-wtext { display: none; }
  .tb-live { gap: 2px 8px; padding-bottom: 6px; line-height: 1.45; }
}

@media (max-width: 380px) {
  /* 375px 及更窄：温度也让位，保证三天预报始终一行、顶栏只有两行 */
  .tb-wtemp { display: none; }
}

@media (max-width: 330px) {
  /* 极窄屏（如 320px）：城市名与当前天气图标都收起来，
     只留「近三天预报」，保证不折成三行 */
  .tb-wcity, .tb-wnow { display: none; }
  .tb-weather { gap: 0; }
}

/* ==========================================================================
   移动端微调
   ========================================================================== */
@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .main { padding-top: 14px; }
  .brand-text { display: none; }
  .it-time { flex: 0 0 34px; font-size: 11.5px; }
  .it-acts { opacity: 1; flex-direction: row; position: absolute; top: 8px; right: 8px; }
  .item { padding-right: 12px; }
  .item .it-body { padding-right: 54px; }
  .composer { position: static; }
  .day { top: var(--header-h); }
  .foot { flex-wrap: wrap; }
}

@media (max-width: 380px) {
  .chip { padding: 4px 9px; font-size: 12.5px; }
  .save-btn { padding: 0 12px; }
}

/* 打印 */
@media print {
  .topbar, .composer, .filters, .it-acts, .to-top, .toast, .more-btn, .foot { display: none !important; }
  body { background: #fff; color: #000; }
  .item { break-inside: avoid; border-color: #ddd; }
}

/* 无障碍：减少动效 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
