:root {
  --yellow: #FFD93D;
  --yellow-deep: #F4C430;
  --yellow-soft: #FFF3C4;
  --card: #FFFFFF;
  --text: #4A3B00;
  --muted: #8A7A3A;
  --line: #FFE9A0;
  --accent: #FF8A00;
  --green: #2E9E5B;
  --red: #E0524D;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow-x: hidden; overscroll-behavior-x: none; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--yellow);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  width: 100%;
  position: relative;
  touch-action: pan-y;
}

.app { display: flex; min-height: 100vh; max-width: 100%; overflow-x: hidden; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 220px;
  background: var(--yellow-deep);
  display: flex;
  flex-direction: column;
  padding: 16px 10px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  transition: width .18s ease;
}
.sidebar-head { display: flex; align-items: center; gap: 4px; }
.brand {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  font-size: 20px;
  text-align: center;
  padding: 10px 0 16px;
  color: #5A4A00;
  letter-spacing: 1px;
}
.brand-logo { width: 32px; height: 32px; border-radius: 9px; object-fit: cover; }
.sidebar-collapse { width: 28px; height: 28px; border: 0; border-radius: 8px; background: rgba(255,255,255,.3); color: #5A4A00; cursor: pointer; font-size: 24px; line-height: 1; }
.sidebar-collapse:hover { background: rgba(255,255,255,.58); }
.sidebar-pin { display: none; width: 30px; height: 28px; border: 0; border-radius: 8px; background: rgba(255,255,255,.3); color: #5A4A00; cursor: pointer; font-size: 15px; line-height: 1; }
.sidebar-pin:hover, .sidebar-pin[aria-pressed="true"] { background: rgba(255,255,255,.65); }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-manage { margin: 12px 4px 0; padding: 9px 10px; border: 1px dashed rgba(90,74,0,.42); border-radius: 10px; background: transparent; color: #5A4A00; cursor: pointer; font-weight: 700; text-align: left; }
.nav-manage:hover { background: rgba(255,255,255,.35); }
.nav-item {
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: #5A4A00;
  background: var(--nav-tint, rgba(255, 255, 255, .22));
  border: 1px solid var(--nav-color, transparent);
  transition: .15s;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 9px;
}
.nav-item:hover { filter: brightness(.98); transform: translateX(1px); }
.nav-item.active {
  background: #fff;
  color: var(--nav-color, var(--accent));
  border-color: var(--nav-color, var(--accent));
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}
.nav-dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: var(--nav-color, var(--accent)); box-shadow: 0 0 0 3px rgba(255,255,255,.48); }
.side-foot {
  margin-top: auto;
  padding: 12px 6px 2px;
  font-size: 12px;
  color: #7a6a2a;
  text-align: center;
}
.side-version { margin-top: 5px; font-size: 11px; opacity: .7; }
.ver-history-toggle { background: none; border: none; color: var(--accent); font-size: 11px; padding: 2px 4px; cursor: pointer; opacity: .85; }
.ver-history-toggle:hover { opacity: 1; text-decoration: underline; }
.ver-history { margin-top: 6px; max-height: 200px; overflow-y: auto; border-top: 1px dashed #E7DAA8; padding-top: 6px; }
.ver-history ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ver-history li { display: flex; flex-direction: column; gap: 1px; font-size: 11px; line-height: 1.45; }
.ver-history .vh-v { font-weight: 700; color: #514400; }
.ver-history .vh-d { color: var(--muted); }
.field-row { margin: 14px 0; }
.timeline-more-wrap { display: flex; justify-content: center; margin-top: 12px; }
.sidebar.collapsed { width: 68px; padding-left: 8px; padding-right: 8px; }
.sidebar.collapsed .brand, .sidebar.collapsed .side-foot { display: none; }
.sidebar.collapsed .sidebar-head { justify-content: center; margin-bottom: 10px; }
.sidebar.collapsed .nav-item { padding: 12px 4px; text-align: center; font-size: 0; }
.sidebar.collapsed .nav-item::before { content: attr(data-short); font-size: 15px; }
.sidebar.collapsed .nav-dot { display: none; }
.sidebar.collapsed .nav-manage { margin-left: 0; margin-right: 0; padding: 9px 0; text-align: center; font-size: 0; }
.sidebar.collapsed .nav-manage span:first-child { font-size: 19px; }
.sidebar.collapsed .nav-manage-label { display: none; }
.sidebar.collapsed + .main { margin-left: 68px; }

/* ---------- Main ---------- */
.main {
  flex: 1;
  margin-left: 220px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left .18s ease;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--yellow-soft);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1 { margin: 0; font-size: 20px; }
.menu-btn { display: none; border: none; background: transparent; font-size: 22px; cursor: pointer; color: var(--text); }
.view { padding: 20px; max-width: 820px; width: 100%; margin: 0 auto; }
.view-loading { min-height: 180px; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.save-toast { position: fixed; z-index: 90; left: 50%; bottom: 22px; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 10px 14px; border-radius: 10px; background: #4E430F; color: #fff; box-shadow: 0 8px 24px rgba(50,40,0,.25); font-size: 14px; white-space: nowrap; }
.save-toast.success { background: #247847; }
.save-toast.error { background: #B64238; white-space: normal; }
.save-toast[hidden] { display: none; }

/* ---------- Top actions (workspace switch) ---------- */
.global-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.sync-status { font-size: 12px; padding: 5px 8px; border-radius: 999px; background: #F1E8BD; color: #7A6A2A; white-space: nowrap; }
.sync-status.online { background: #E5F6EA; color: #287D48; }
.sync-status.error { background: #FFF0E9; color: var(--red); }
.sync-status.offline { background: #F2F0E7; color: #746E59; }
.ws-switch {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--text);
  max-width: 200px;
}
.btn.sm { padding: 8px 12px; font-size: 14px; }
.link.sm { font-size: 14px; }
.account-wrap { position: relative; padding-bottom: 10px; margin-bottom: -10px; }
.account-trigger { border: 0; background: transparent; padding: 0; cursor: pointer; border-radius: 50%; display: grid; place-items: center; }
.account-trigger:focus-visible { outline: 3px solid rgba(255, 139, 0, .35); outline-offset: 3px; }
.avatar { flex: 0 0 auto; overflow: hidden; border-radius: 50%; display: inline-grid; place-items: center; background: #6A5A18; color: #fff; font-weight: 700; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-sm { width: 34px; height: 34px; font-size: 14px; }
.avatar-md { width: 42px; height: 42px; font-size: 17px; }
.avatar-lg { width: 72px; height: 72px; font-size: 28px; }
.account-menu { position: absolute; right: 0; top: 100%; z-index: 30; width: 220px; padding: 8px; border: 1px solid #E9D59C; border-radius: 14px; background: #fff; box-shadow: 0 12px 30px rgba(74, 59, 0, .2); }
.account-summary { display: flex; gap: 10px; align-items: center; padding: 8px; }
.account-summary strong, .account-summary small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-summary strong { color: #514400; font-size: 14px; }
.account-summary small { max-width: 145px; margin-top: 3px; color: var(--muted); font-size: 11px; }
.account-status { margin: 2px 8px 6px; padding-bottom: 7px; color: var(--muted); border-bottom: 1px solid #F0E5BF; font-size: 12px; }
.account-item { width: 100%; border: 0; border-radius: 8px; padding: 9px 10px; background: transparent; color: var(--text); text-align: left; cursor: pointer; font-size: 14px; }
.account-item:hover { background: #FFF7D6; }
.account-item.danger { color: var(--red); }
.link {
  border: none; background: transparent; cursor: pointer;
  color: var(--accent); font-weight: 600; text-decoration: underline;
  padding: 4px 6px;
}

/* ---------- Card / shared ---------- */
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 4px 14px rgba(120, 90, 0, .12);
  margin-bottom: 16px;
}
.sub { margin: 18px 0 10px; font-size: 16px; color: #6a5a18; }
.hint { color: var(--muted); font-size: 13px; margin: 10px 2px 0; }
.hint.center { text-align: center; margin-bottom: 14px; }
.auth-state { min-height: 16px; color: var(--muted); font-size: 13px; text-align: center; margin: 0; }

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.05); }
.btn.ghost { background: #fff; color: var(--accent); border: 1px solid var(--accent); }

input, textarea, select {
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  border: 1px solid #EAD79A;
  border-radius: 10px;
  padding: 10px 12px;
  background: #FFFBEF;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }

/* ---------- Daily Plan ---------- */
.add-row { display: flex; gap: 10px; margin-bottom: 14px; }
.add-row input { flex: 1; }
.plan-toolbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.plan-toolbar .btn.ghost { padding: 5px 12px; font-size: 13px; }
.task-add-bar { display: flex; gap: 8px; margin-bottom: 10px; }
.task-add-trigger { flex: 1; min-height: 40px; padding: 9px 12px; border: 1px solid var(--accent); border-radius: 10px; background: #fff; font-size: 14px; }
.task-add-trigger:focus { outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.task-add-advanced { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; }
.task-add-advanced[hidden] { display: none; }
.task-add-advanced > * { flex: 1 1 140px; }
.heading-actions { display: flex; align-items: center; gap: 8px; }
.tasks { display: flex; flex-direction: column; gap: 10px; }
.task {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #FFFBEF;
  border: 1px solid #F0DFA6;
  border-radius: 12px;
  padding: 12px 14px;
}
.task.done .task-text { text-decoration: line-through; color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
.task-text { font-size: 15px; }
.del {
  border: none;
  background: #FBE3E1;
  color: var(--red);
  width: 30px; height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
}
.del:hover { background: #F6CFCC; }
/* 编辑按钮：与删除按钮同型，主色为高亮黄 */
.edit {
  border: none;
  background: #FFF0C4;
  color: #7A5A00;
  width: 30px; height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
}
.edit:hover { background: #FFE08A; }

/* ---------- Inspiration ---------- */
.insp { display: flex; flex-direction: column; gap: 12px; }
.plat {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 14px;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
}
.plat.douyin { background: linear-gradient(135deg, #25F4EE, #FE2C55); }
.plat.xhs { background: linear-gradient(135deg, #FF6A6A, #FF2E4D); }
.plat-ic {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .25);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.plat-name { font-size: 17px; }
.plat-sub { font-size: 13px; opacity: .9; font-weight: 500; }
.plat .go { margin-left: auto; font-size: 22px; }

/* ---------- Weekly Review ---------- */
.week-head { font-weight: 700; font-size: 16px; margin-bottom: 12px; color: var(--accent); }
.zone { display: block; margin-bottom: 12px; }
.zone-label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.zone textarea { width: 100%; min-height: 80px; resize: vertical; }
.hist { padding: 0; }
.hist summary {
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.hist summary::-webkit-details-marker { display: none; }
.hist summary::before { content: "▸ "; }
.hist[open] summary::before { content: "▾ "; }
.hist-body { padding: 0 18px 16px; }
.hist-zone { margin-top: 10px; }
.hist-zone b { color: #6a5a18; font-size: 14px; }
.hist-zone p { margin: 4px 0 0; white-space: pre-wrap; }

/* ---------- Generic notes ---------- */
.note-form { flex-wrap: wrap; align-items: flex-end; }
.f { display: flex; flex-direction: column; gap: 6px; flex: 1 1 100%; }
.f span { font-size: 13px; font-weight: 600; color: #6a5a18; }
.notes { display: flex; flex-direction: column; gap: 10px; }
.note {
  position: relative;
  background: #FFFBEF;
  border: 1px solid #F0DFA6;
  border-radius: 12px;
  padding: 12px 14px;
}
.note-date { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.note-body p { margin: 4px 0; font-size: 14px; }
.note .del { position: absolute; top: 10px; right: 10px; }

/* ---------- 每日自动推文 ---------- */
.tweet-form { flex-direction: column; align-items: stretch; }
.tweet-form textarea { width: 100%; min-height: 38px; max-height: 240px; resize: none; overflow: hidden; line-height: 1.6; transition: min-height .15s ease; }
.tweet-form.expanded textarea { min-height: 120px; resize: vertical; overflow: auto; }
.tweet-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.count { color: var(--muted); font-size: 12px; }
.note-actions { display: flex; gap: 8px; margin-top: 8px; }
.copy {
  border: 1px solid var(--accent); background: #fff; color: var(--accent);
  border-radius: 8px; padding: 4px 12px; font-size: 13px; cursor: pointer; font-weight: 600;
}
.copy:hover { background: var(--accent); color: #fff; }
.note-actions .del { position: static; width: auto; height: auto; padding: 4px 12px; }
.note-actions .edit { position: static; width: auto; height: auto; padding: 4px 12px; }
/* 记录/笔记编辑弹窗字段与元数据 */
#noteEditFields .f { margin-bottom: 12px; }
#noteEditFields textarea,
#noteEditFields input,
#noteEditFields select { width: 100%; padding: 9px 10px; font-size: 14px; border: 1px solid #E6D58E; border-radius: 10px; background: #fff; color: #333; box-sizing: border-box; font-family: inherit; }
#noteEditFields textarea { min-height: 84px; resize: vertical; line-height: 1.6; }
.note-edit-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin: 6px 0 4px; padding-top: 10px; border-top: 1px dashed #EAE0B0; }
.note-edit-meta .f { flex: 0 0 auto; margin-bottom: 0; }
.note-edit-meta input[type="date"] { padding: 9px 10px; font-size: 14px; border: 1px solid #E6D58E; border-radius: 10px; background: #fff; }
#noteEditTags { width: 100%; margin-top: 4px; padding: 9px 10px; font-size: 14px; border: 1px solid #E6D58E; border-radius: 10px; background: #fff; box-sizing: border-box; }
.tweet-title { margin: 0 0 4px; font-size: 15px; font-weight: 700; color: #6a5a18; }
.tweet-schedule { margin: 0 0 4px; font-size: 13px; color: var(--muted); }

/* ---------- Auth screen ---------- */
.auth {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(74, 59, 0, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.auth[hidden] { display: none; }
.auth-card {
  background: var(--card);
  border-radius: 20px;
  padding: 26px 22px;
  width: 100%; max-width: 360px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
  display: flex; flex-direction: column; gap: 12px;
}
.auth-card .brand { padding: 0 0 4px; }
.auth-card input { width: 100%; }
.auth-msg { color: var(--red); font-size: 13px; min-height: 16px; margin: 2px 0 0; text-align: center; }
.field-label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.field-label input { width: 100%; padding: 9px 11px; border: 1px solid #E7DAA8; border-radius: 10px; font-size: 15px; }
.version { color: var(--muted); font-size: 11px; text-align: center; margin: 8px 0 0; opacity: 0.6; }

/* ---------- Share modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(74, 59, 0, .5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: none;
  -webkit-overflow-scrolling: touch;
}
.modal[hidden] { display: none; }
body.no-scroll { overflow: hidden; position: fixed; width: 100%; }
.modal-card {
  background: var(--card);
  border-radius: 18px;
  padding: 22px;
  width: 100%; max-width: 380px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
  display: flex; flex-direction: column; gap: 12px;
  margin: auto;
}
.modal-card h3 { margin: 0; }
.modal-card input { width: 100%; }
.modal-actions { display: flex; gap: 10px; align-items: center; }
.modal-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.share-search-row { display: flex; gap: 8px; align-items: center; }
.share-search-row input { flex: 1; min-width: 0; }
.user-search-list, .message-list { display: flex; flex-direction: column; gap: 8px; max-height: 38vh; overflow-y: auto; }
.user-search-item, .message-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #FFFBEF; border: 1px solid #F0DFA6; border-radius: 10px; padding: 9px 11px;
}
.share-avatar {
  flex-shrink: 0; border-radius: 50%; object-fit: cover;
}
.share-avatar-letter {
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; font-weight: 700; border-radius: 50%;
}
.today-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: linear-gradient(135deg, #fff 0%, #FFF5C9 100%); }
.today-hero h2 { margin: 2px 0 0; font-size: 23px; color: #514400; }
.eyebrow { margin: 0; color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: .5px; }
.progress-ring { --progress: 0%; width: 82px; height: 82px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--accent) var(--progress), #F3E8BC 0); flex: 0 0 auto; }
.progress-ring span { width: 62px; height: 62px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: #6A5A18; font-size: 14px; font-weight: 800; }
.focus-card { display: flex; flex-direction: column; gap: 7px; padding: 13px; border-radius: 14px; background: #fff; box-shadow: 0 3px 12px rgba(120,90,0,.1); font-size: 13px; color: var(--muted); }
.focus-card select { width: 100%; padding: 7px; font-size: 14px; }
.today-grid { display: block; }
.today-grid .card { margin-bottom: 0; }
.today-overdue { margin-top: 16px; }
.today-overdue .card { margin-bottom: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-heading h3 { margin: 0; color: #6A5A18; font-size: 16px; }
.task-rich { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 7px; }
.task-rich small { grid-column: 1 / 2; color: var(--muted); font-size: 11px; margin-left: 28px; }
.task-rich .task-actions { grid-column: 2; grid-row: 1 / 3; display: flex; align-items: center; gap: 6px; }
.compact .task { margin-bottom: 7px; }
.habit-chip { padding: 2px 6px; border-radius: 8px; color: #287D48; background: #E5F6EA; font-size: 11px; }
.repeat-chip { padding: 2px 6px; border-radius: 8px; color: #705400; background: #FFF0C0; font-size: 11px; }
.task-add-advanced { flex-wrap: wrap; }
.task-add-advanced #newTask { flex: 1 1 220px; }
.task-add-advanced #taskTags { flex: 1 1 150px; }
.task-add-advanced select, .task-add-advanced input[type="date"] { width: auto; }
.habit-toggle { font-size: 13px; white-space: nowrap; color: var(--muted); }
/* 本月任务日历 */
.cal-card { margin-top: 16px; }
.cal-card .hint { font-size: 12px; color: var(--muted); }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-wd { text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border-radius: 10px; background: #FFFBEF; border: 1px solid #F3E8BC; min-height: 66px; }
.cal-cell.empty { background: transparent; border-color: transparent; min-height: 0; }
.cal-cell.is-today { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(245,166,35,.25); }
.cal-day { font-size: 12px; color: #6A5A18; font-weight: 700; }
.cal-donut { width: 36px; height: 36px; }
.cal-donut svg { width: 100%; height: 100%; }
.cal-donut .ring-bg { fill: none; stroke: #EFE2B0; stroke-width: 4; }
.cal-donut .ring-fg { fill: none; stroke-width: 4; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 18px 18px; transition: stroke-dashoffset .4s ease; }
.cal-donut .donut-txt { fill: #6A5A18; font-size: 11px; font-weight: 800; text-anchor: middle; }
@media (max-width: 540px) {
  .cal-donut { width: 30px; height: 30px; }
  .cal-cell { min-height: 58px; padding: 4px 1px; }
  .cal-wd, .cal-day { font-size: 11px; }
}
.schedule-list { display: flex; flex-direction: column; gap: 6px; }
.schedule-list > div { display: grid; grid-template-columns: 52px 1fr auto; gap: 7px; align-items: center; font-size: 14px; }
.schedule-list b { color: var(--accent); }
.schedule-add { display: flex; gap: 6px; margin-top: 10px; }
.schedule-add input { min-width: 0; padding: 7px; }
.schedule-add input[type="time"] { width: 92px; }
.habit-list { display: flex; flex-direction: column; gap: 9px; font-size: 14px; }
.habit-list label { display: flex; gap: 8px; align-items: center; }
.note-tags, .timeline-item small { color: var(--accent); font-size: 12px; }
.timeline-list, .search-results { display: flex; flex-direction: column; gap: 9px; }
.timeline-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid #F0DFA6; border-radius: 12px; background: #FFFBEF; cursor: pointer; }
.timeline-item:hover { border-color: var(--accent); }
.timeline-item strong { display: block; margin: 5px 0; color: #514400; }
.timeline-item p { margin: 0; color: var(--muted); font-size: 13px; white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word; }
.timeline-item time { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.timeline-item .ti-main { min-width: 0; flex: 1 1 auto; }
.timeline-item .ti-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.timeline-item .ti-actions { display: flex; align-items: center; gap: 6px; }
/* 删除/编辑按钮默认低调，hover/focus 时显现；触摸设备常驻可见 */
.timeline-item .ti-side .del,
.timeline-item .ti-side .edit { width: 28px; height: 28px; font-size: 13px; opacity: 0; transition: opacity .15s ease; }
.timeline-item:hover .ti-side .del,
.timeline-item:hover .ti-side .edit,
.timeline-item .ti-side .del:focus-visible,
.timeline-item .ti-side .edit:focus-visible { opacity: 1; }
.timeline-item .ti-side .del:disabled { opacity: .45; cursor: default; }
@media (hover: none) {
  .timeline-item .ti-side .del,
  .timeline-item .ti-side .edit { opacity: 1; width: 32px; height: 32px; }
}
.record-type { display: inline-block; padding: 2px 6px; border-radius: 8px; background: #FFE5A0; color: #7A5A00; font-size: 11px; font-weight: 700; }
.quick-options, .search-controls { display: flex; gap: 8px; }
.quick-options > *, .search-controls > * { min-width: 0; flex: 1; }
.search-modal-card { max-width: 680px; }
.search-controls { margin-bottom: 12px; }
.user-search-item .hint, .message-item .hint { margin: 3px 0 0; }
.share-selected { min-height: 20px; color: var(--muted); font-size: 13px; }
.push-task-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.push-task-row input { flex: 1; min-width: 0; }
.message-modal-card { max-width: 520px; }
.message-item { align-items: flex-start; cursor: pointer; }
.message-item.unread { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(255, 139, 0, .18); }
.message-item strong { display: block; color: #514400; }
.message-item small { color: var(--muted); display: block; margin-top: 4px; }
.message-preview { white-space: pre-wrap; word-break: break-word; color: #514400; line-height: 1.6; }
.message-list { max-height: 62vh; }
.back-btn { align-self: flex-start; background: none; border: 1px solid var(--border, #e7d9a8); color: var(--accent, #c77b16); border-radius: 8px; padding: 6px 12px; font-size: 13px; cursor: pointer; margin-bottom: 12px; }
.back-btn:hover { background: #fff6e6; }
.shared-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; padding-bottom: 11px; margin-bottom: 12px; border-bottom: 1px solid var(--border, #f0e2b8); }
.shared-sender { font-weight: 700; color: #514400; }
.shared-section-tag { color: var(--accent, #c77b16); font-weight: 600; }
.shared-time { color: var(--muted, #8a8a8a); font-size: 12px; margin-left: auto; }
.shared-content { font-size: 14px; line-height: 1.6; }
.shared-summary { font-size: 12px; color: var(--muted, #8a8a8a); margin-bottom: 9px; }
.shared-task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.shared-task { display: flex; gap: 10px; align-items: flex-start; background: #fff7e6; border: 1px solid #ffe0a3; border-radius: 10px; padding: 9px 11px; }
.shared-task.done { background: #f3f4f6; border-color: #e2e5ea; }
.shared-task.done .shared-task-text { color: var(--muted, #8a8a8a); text-decoration: line-through; }
.shared-check { flex: 0 0 20px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--accent, #c77b16); display: grid; place-items: center; font-size: 12px; color: var(--accent, #c77b16); font-weight: 700; margin-top: 1px; }
.shared-task.done .shared-check { background: var(--accent, #c77b16); color: #fff; border-color: var(--accent, #c77b16); }
.shared-task-text { flex: 1; line-height: 1.55; overflow-wrap: break-word; word-break: break-word; }
.shared-task-date { display: block; color: var(--muted, #8a8a8a); font-size: 11px; margin-top: 3px; }
.shared-section { margin-bottom: 13px; }
.shared-section h4 { margin: 0 0 6px; font-size: 14px; color: #514400; }
.shared-card { background: #fff7e6; border: 1px solid #ffe0a3; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.shared-kv { display: flex; gap: 8px; padding: 3px 0; font-size: 14px; line-height: 1.5; }
.shared-kv .k { flex: 0 0 84px; color: var(--muted, #8a8a8a); }
.shared-kv .v { flex: 1; color: #514400; overflow-wrap: break-word; word-break: break-word; }
.shared-plain { white-space: pre-wrap; word-break: break-word; color: #514400; line-height: 1.6; }
.icon-btn {
  position: relative; width: 34px; height: 34px; border: 1px solid #F0DFA6; border-radius: 9px;
  background: #fff; color: #6a5a18; cursor: pointer; font-size: 17px;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn.has-update { color: #e53e3e; border-color: #f3b4b4; background: #fff0f0; }
.icon-btn.has-update::after { content: ''; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: #e53e3e; }
.icon-btn.spinning { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.count-badge {
  position: absolute; top: -7px; right: -7px; min-width: 18px; height: 18px; padding: 0 4px;
  display: grid; place-items: center; border-radius: 10px; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; border: 2px solid var(--card);
}
.share-item {
  display: flex; align-items: center; justify-content: space-between;
  background: #FFFBEF; border: 1px solid #F0DFA6;
  border-radius: 10px; padding: 8px 12px; font-size: 14px;
}
.share-item .del { position: static; }
.settings-card { max-width: 440px; }
.profile-head { display: flex; gap: 14px; align-items: center; }
.profile-head strong { color: #514400; }
.profile-head .hint { margin: 5px 0 0; }
.nav-modal-card { max-width: 560px; }
.nav-add-row { align-items: center; }
.nav-manager-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; }
.nav-manager-row { display: flex; align-items: center; gap: 7px; padding: 7px; border: 1px solid #F0DFA6; border-radius: 10px; background: #FFFBEF; flex-wrap: wrap; }
.nav-manager-row input { flex: 1; min-width: 100px; }
.nav-color-select { width: 74px; flex: 0 0 74px; padding: 7px 4px; font-size: 12px; }
.nav-manager-row.archived { opacity: .62; }
.nav-move-actions { display: flex; gap: 2px; }
.nav-row-btn { flex: 0 0 auto; font-size: 13px; padding: 4px; }
.nav-row-btn:disabled { cursor: not-allowed; opacity: .35; }
.danger-link { color: var(--red); }

/* ---------- 管理栏目（手机端优化） ---------- */
@media (max-width: 540px) {
  .nav-modal-card { max-width: calc(100vw - 24px); margin: 8px; }
  .nav-manager-list { max-height: 52vh; }
  .nav-manager-row { gap: 5px; padding: 6px; }
  .nav-manager-row input { min-width: 80px; font-size: 14px; }
  .nav-color-select { width: 64px; flex: 0 0 64px; font-size: 11px; padding: 6px 2px; }
  .nav-row-btn { font-size: 12px; padding: 3px 4px; }
}

/* ---------- Overlay (mobile) ---------- */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 15; }

/* ---------- Mobile Bottom Tab Nav（固定导航栏手机端） ---------- */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  touch-action: pan-x;
  z-index: 18;
  background: #fffdf5;
  border-top: 1px solid #f0e6b8;
  padding: 6px env(safe-area-inset-right, 0) calc(env(safe-area-inset-bottom, 0) + 6px) env(safe-area-inset-left, 0);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mobile-bottom-nav::-webkit-scrollbar { display: none; }
.mobile-bottom-nav:not([hidden]) { display: flex; gap: 2px; }
.mobile-bottom-tab {
  flex: 1 1 auto;
  min-width: 52px;
  max-width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px 5px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #998a3a;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  transition: color .15s, background .15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.mobile-bottom-tab:active { transform: scale(.94); }
.mobile-bottom-tab.active {
  color: var(--accent);
  background: rgba(245,166,35,.12);
}
.mobile-bottom-tab-manage {
  margin-left: auto;
  border-left: 1px solid rgba(90,74,0,.15);
}
.mobile-bottom-tab-icon {
  font-size: 20px;
  line-height: 1;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 8px;
}
.mobile-bottom-tab.active .mobile-bottom-tab-icon {
  background: rgba(245,166,35,.18);
}
/* 底部导航栏撑开时，主内容区留出底部空间 */
.main.has-bottom-nav { padding-bottom: 58px; }
@media (min-width: 761px) {
  .mobile-bottom-nav { display: none !important; }
  .main.has-bottom-nav { padding-bottom: 0; }
}

/* ---------- 桌面竖屏工作台 ---------- */
@media (min-width: 761px) {
  body { background: #F4EFD9; }
  .app { position: relative; width: min(100%, 480px); margin: 0 auto; background: var(--yellow); box-shadow: 0 0 0 1px rgba(115,88,0,.12), 0 12px 42px rgba(89,66,0,.18); }
  .sidebar { width: 184px; transform: translateX(-100%); transition: transform .2s ease; z-index: 20; left: calc(50% - 240px); }
  .sidebar.open { transform: translateX(0); }
  .sidebar.mobile-pinned { transform: translateX(0); box-shadow: 4px 0 18px rgba(0,0,0,.18); }
  .sidebar .nav-item { padding: 10px 11px; font-size: 14px; }
  .sidebar .nav-manage { padding: 8px 9px; }
  .sidebar.collapsed { width: 184px; padding: 16px 8px; }
  .sidebar.collapsed .brand, .sidebar.collapsed .side-foot { display: block; }
  .sidebar.collapsed .sidebar-head { justify-content: initial; margin-bottom: 0; }
  .sidebar.collapsed .nav-item { padding: 10px 11px; text-align: left; font-size: 14px; }
  .sidebar.collapsed .nav-item::before { content: none; }
  .sidebar.collapsed .nav-manage { margin-left: 4px; margin-right: 4px; padding: 8px 9px; text-align: left; font-size: inherit; }
  .sidebar.collapsed .nav-manage span:first-child { font-size: inherit; }
  .sidebar.collapsed .nav-manage-label { display: inline; }
  .sidebar-collapse { display: none; }
  .sidebar-pin { display: none; }
  .main, .sidebar.collapsed + .main { margin-left: 0; }
  .menu-btn { display: block; width: 34px; height: 34px; padding: 0; border-radius: 9px; background: rgba(255,255,255,.45); }
  .topbar { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; grid-template-areas: 'menu title global' 'actions actions actions'; gap: 9px 8px; padding: 10px 12px; }
  .topbar h1 { grid-area: title; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
  .global-actions { grid-area: global; margin-left: 0; gap: 5px; }
  .global-actions #quickBtn { padding: 7px 8px; font-size: 0; white-space: nowrap; }
  .global-actions #quickBtn::before { content: '＋记录'; font-size: 12px; }
  .global-actions .icon-btn { width: 34px; height: 34px; padding: 0; }
  .top-actions { grid-area: actions; display: grid; grid-template-columns: minmax(0, 1fr) 34px 34px 34px; width: 100%; gap: 6px; }
  .top-actions .btn, .top-actions .icon-btn, .account-trigger { width: 34px; height: 34px; padding: 0; }
  .top-actions #shareBtn { font-size: 0; }
  .top-actions #shareBtn::before { content: '↗'; font-size: 18px; }
  .account-wrap { padding-bottom: 0; margin-bottom: 0; }
  .sync-status { display: none; }
  .ws-switch { width: 100%; max-width: none; min-width: 0; height: 34px; padding: 6px 8px; font-size: 13px; }
  .view { padding: 16px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 20;
    width: 240px;
  }
  .sidebar.open { transform: translateX(0); }
  /* 手机固定导航栏：不显示左侧图标条，改为底部Tab栏 */
  .sidebar.mobile-pinned { transform: translateX(-100%) !important; box-shadow: none !important; }
  .sidebar.mobile-pinned.open { transform: translateX(0) !important; }
  .sidebar.mobile-pinned + .main { margin-left: 0 !important; }
  .sidebar.collapsed { width: 240px; padding: 16px 10px; }
  .sidebar.collapsed .brand, .sidebar.collapsed .side-foot { display: block; }
  .sidebar.collapsed .sidebar-head { justify-content: initial; margin-bottom: 0; }
  .sidebar.collapsed .nav-item { padding: 12px 14px; text-align: left; font-size: 15px; }
  .sidebar.collapsed .nav-item::before { content: none; }
  .sidebar.collapsed .nav-manage { margin-left: 4px; margin-right: 4px; padding: 9px 10px; text-align: left; font-size: inherit; }
  .sidebar.collapsed .nav-manage span:first-child { font-size: inherit; }
  .sidebar.collapsed .nav-manage-label { display: inline; }
  .sidebar-collapse { display: none; }
  .sidebar-pin { display: block; }
  .main,   .sidebar.collapsed + .main { margin-left: 0; }
  /* 手机端弹窗不溢出：限制最大宽度并居中 */
  .modal { padding: 14px; }
  .modal-card { max-width: calc(100vw - 28px); max-height: calc(100vh - 28px); padding: 18px; }
  .topbar { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; grid-template-areas: 'menu title global' 'actions actions actions'; gap: 9px 8px; padding: 10px 12px; }
  .menu-btn { display: block; grid-area: menu; width: 34px; height: 34px; padding: 0; border-radius: 9px; background: rgba(255,255,255,.45); }
  .topbar h1 { grid-area: title; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
  .global-actions { grid-area: global; margin-left: 0; gap: 5px; }
  .global-actions #quickBtn { padding: 7px 8px; font-size: 0; white-space: nowrap; }
  .global-actions #quickBtn::before { content: '＋记录'; font-size: 12px; }
  .global-actions .icon-btn { width: 34px; height: 34px; padding: 0; }
  .top-actions { grid-area: actions; display: grid; grid-template-columns: minmax(0, 1fr) 34px 34px 34px; width: 100%; gap: 6px; }
  .top-actions .btn, .top-actions .icon-btn, .account-trigger { width: 34px; height: 34px; padding: 0; }
  .top-actions #shareBtn { font-size: 0; }
  .top-actions #shareBtn::before { content: '↗'; font-size: 18px; }
  .account-wrap { padding-bottom: 0; margin-bottom: 0; }
  .view { padding: 16px; }
  .overlay.show { display: block; }
  .sync-status { display: none; }
  .ws-switch { width: 100%; max-width: none; min-width: 0; height: 34px; padding: 6px 8px; font-size: 13px; }
  .account-menu { right: -2px; }
  .today-grid { grid-template-columns: 1fr; }
  .today-hero h2 { font-size: 19px; }
  .task-add-advanced > * { width: 100% !important; }
  .search-controls, .quick-options { flex-direction: column; }
}

/* 手机固定导航栏：隐藏左侧图标条，改用底部Tab栏（见 .mobile-bottom-nav） */
@media (max-width: 760px) {
  .sidebar.mobile-pinned, .sidebar.mobile-pinned.collapsed { transform: translateX(-100%) !important; width: 240px; padding: 16px 10px; }
  .sidebar.mobile-pinned + .main, .sidebar.mobile-pinned.collapsed + .main { margin-left: 0 !important; }
}

@media (max-width: 360px) {
  .topbar { grid-template-columns: 34px minmax(0, 1fr) auto; padding-left: 8px; padding-right: 8px; }
  .global-actions #quickBtn::before { content: '＋'; font-size: 18px; }
  .global-actions #quickBtn { width: 34px; }
  .top-actions { grid-template-columns: minmax(0, 1fr) 32px 32px 32px; gap: 4px; }
  .top-actions .btn, .top-actions .icon-btn, .account-trigger { width: 32px; height: 32px; }
}

/* ===== 每日推文聚合 ===== */
.tweet-articles { display: flex; flex-direction: column; gap: 12px; }
/* 日期折叠组 */
.date-group { border: 1px solid #f0e6b8; border-radius: 14px; background: #fffdf5; overflow: hidden; }
.date-group-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; cursor: pointer; user-select: none;
  background: linear-gradient(135deg, #fff9e6, #fff3cc);
  font-weight: 700; color: #5a4a00; font-size: 14px;
  transition: background .2s;
}
.date-group-head:hover { background: linear-gradient(135deg, #fff5d1, #ffefb8); }
.date-group-head::marker { content: ''; display: none; }
.date-group-arrow { font-size: 12px; transition: transform .25s ease; color: #998a3a; }
.details[open] .date-group-arrow { transform: rotate(180deg); }
.date-group-label { display: flex; align-items: center; gap: 8px; }
.date-group-body { padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 12px; }
.tweet-article-card {
  border: 1px solid #f0e6b8; border-radius: 14px; background: #fffdf5;
  padding: 12px 14px; box-shadow: 0 1px 3px rgba(180,150,0,.06);
}
.ta-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.ta-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ta-theme { font-weight: 700; font-size: 15px; color: #5a4a00; }
.ta-date { font-size: 12px; color: #998a3a; background: #fff3c4; padding: 1px 7px; border-radius: 999px; }
.ta-time { font-size: 12px; color: #8a7a2a; }
.ta-badge { font-size: 11px; color: #b06a00; background: #ffe9c7; padding: 1px 7px; border-radius: 999px; }
.ta-actions { display: flex; gap: 6px; flex-shrink: 0; }
.ta-excerpt { margin: 8px 0 0; font-size: 13px; line-height: 1.6; color: #555; }
.ta-body { margin-top: 10px; }
.ta-body:not([hidden]) {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.45); display: flex;
  align-items: center; justify-content: center;
  padding: 16px; overflow: auto;
}
.ta-body:not([hidden]) .ta-frame {
  width: 100%; max-width: 900px; height: 85vh;
  border: none; border-radius: 12px; background: #fff;
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
}
