* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

/* 防止 iOS 横屏时系统擅自放大文字 */
html { -webkit-text-size-adjust: 100%; }

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1b1f2a;
  --text-2: #5a6275;
  --muted: #98a0b3;
  --line: #e9edf6;
  --line-2: #dfe4f0;
  --brand: #4f6ef7;
  --brand-2: #6b7cfa;
  --brand-soft: #eef1fe;
  --green: #22b573;
  --red: #ef4b5a;
  --shadow-1: 0 1px 2px rgba(27, 31, 42, .04), 0 4px 12px rgba(27, 31, 42, .05);
  --shadow-brand: 0 6px 20px rgba(79, 110, 247, .30);
  --radius: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --content-max: 1080px;
  --content-half: 540px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* 去掉双击缩放与点击延迟；禁止下拉回弹牵连整页 */
  touch-action: manipulation;
  overscroll-behavior-y: none;
}

.hidden { display: none !important; }
.err { color: var(--red); font-size: 13px; min-height: 20px; }

/* ---------- 通用按钮 ---------- */
.primary, .ghost {
  padding: 12px 18px; border-radius: 11px; font-size: 15px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent; font-family: inherit;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
}
.primary { width: 100%; margin-top: 8px; background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff; box-shadow: var(--shadow-brand); }
.primary:active { transform: scale(.98); }
.ghost { background: var(--bg); color: var(--text-2); }
.ghost:active { background: #e9edf6; }
.danger { color: var(--red); }

/* ---------- 登录页 ---------- */
#login-view {
  display: flex; align-items: center; justify-content: center; padding: 24px;
  min-height: 100vh; min-height: 100dvh;
}
.login-box {
  width: 100%; max-width: 344px; background: var(--card); border-radius: 18px;
  padding: 30px 22px 24px; box-shadow: var(--shadow-1);
}
.login-box h1 { font-size: 21px; font-weight: 700; letter-spacing: .5px; text-align: center; }
.login-box h1::after {
  content: ''; display: block; width: 34px; height: 3px; border-radius: 2px; margin: 12px auto 22px;
  background: linear-gradient(90deg, var(--brand-2), var(--brand));
}
/* 输入框字号不小于 16px：否则 iOS 聚焦时会把整页放大且不缩回 */
#token-input {
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--line-2); border-radius: 11px;
  font-size: 16px; font-family: inherit; background: #fbfcfe; color: var(--text);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
#token-input:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(79, 110, 247, .12); }
#token-input::placeholder { color: #b3bacb; }

/* ---------- 页面骨架 ---------- */
#app-view {
  padding-bottom: calc(92px + var(--safe-bottom));
  min-height: 100vh; min-height: 100dvh;
}
#app-title {
  position: sticky; top: 0; z-index: 20; padding: 16px 18px 14px;
  font-size: 18px; font-weight: 700; letter-spacing: .3px;
  background: rgba(255, 255, 255, .93); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
#app-title::before {
  content: ''; display: inline-block; width: 4px; height: 16px; border-radius: 2px; margin-right: 9px;
  vertical-align: -2px; background: linear-gradient(180deg, var(--brand-2), var(--brand));
}

/* 切换页签时筛选区淡入，列表本身另有卡片动画 */
.page { animation: fade .22s ease both; }

/* ---------- 筛选 / 排序按钮 ---------- */
.filter-row {
  display: flex; gap: 8px; padding: 14px 16px 0;
  max-width: var(--content-max); margin-left: auto; margin-right: auto;
}
.filter-row + .filter-row { padding-top: 8px; }
/* min-width:0 是关键：否则 flex 项不会被压缩到小于文字宽度，窄屏会把整页撑宽 */
.chip {
  flex: 1 1 0; min-width: 0; padding: 9px 2px; border: 1.5px solid var(--line-2); border-radius: 12px;
  background: #fff; color: var(--text-2); font-size: 13px; font-weight: 500; font-family: inherit;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; transition: all .18s ease;
}
.chip:active { transform: scale(.97); }
.chip.active {
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  border-color: transparent; color: #fff; font-weight: 600;
  box-shadow: 0 4px 14px rgba(79, 110, 247, .28);
}

/* ---------- 任务列表：12 列栅格，卡片按屏宽跨列合并 ---------- */
.list {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 10px;
  padding: 14px 14px 24px; align-items: start;
  max-width: var(--content-max); margin-left: auto; margin-right: auto;
}
.card {
  grid-column: span 12;
  position: relative; background: var(--card); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-1); animation: rise .26s ease both;
  transition: box-shadow .2s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.card:nth-child(2) { animation-delay: .03s; }
.card:nth-child(3) { animation-delay: .06s; }
.card::before {
  content: ''; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
}
/* 倒数日已过期：左侧条与标题一起灰化，不加删除线（记录还在用，只是超时） */
.card.overdue { box-shadow: 0 1px 2px rgba(27, 31, 42, .03); }
.card.overdue::before { background: var(--line-2); }

.card-row { display: flex; align-items: flex-start; gap: 11px; padding: 13px 15px; }
.task-main { flex: 1; min-width: 0; cursor: pointer; }
.task-title { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.card.overdue .task-title { color: var(--muted); }
.task-meta { margin-top: 3px; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
/* 第 2 行右侧：子项条数与分类标签并排（倒序/跌倒页），中间留固定间距 */
.meta-right { display: inline-flex; align-items: center; gap: 8px; }
.sub-count { white-space: nowrap; }

/* ---------- 展开详情 ---------- */
.detail { padding: 12px 15px 13px; background: #fcfdff; border-top: 1px solid var(--line); }
/* pre-wrap：描述按用户输入原样显示，保留换行与行首缩进空格（否则 \n 会被折叠成空格） */
.desc { margin-bottom: 10px; color: var(--text-2); font-size: 13.5px; overflow-wrap: anywhere; white-space: pre-wrap; }
.sub-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.sub-title { flex: 1; min-width: 0; font-size: 14px; cursor: pointer; overflow-wrap: anywhere; }
.sub-del {
  padding: 2px 6px; background: none; border: none; border-radius: 7px;
  color: #c3c9d8; font-size: 17px; line-height: 1; cursor: pointer; transition: background .2s ease;
}
.sub-del:active { background: var(--line); }
.sub-add {
  width: 100%; margin-top: 10px; padding: 10px 12px; border: 1.5px dashed var(--line-2); border-radius: 10px;
  background: #fff; color: var(--text); font-size: 16px; font-family: inherit;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.sub-add:focus { outline: none; border-style: solid; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(79, 110, 247, .10); }
.sub-add::placeholder { color: #b3bacb; }
/* 按钮行：修改在最左，保存与删除留在右侧 */
.detail-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.detail-actions button {
  padding: 6px 10px; background: none; border: none; border-radius: 8px;
  color: var(--brand); font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: background .2s ease;
}
.detail-actions button:active { background: var(--brand-soft); }
.detail-actions button[data-act="edit"] { margin-right: auto; }
/* 只读态下「保存」置灰不可点 */
.detail-actions button:disabled { color: var(--muted); cursor: default; }
.detail-actions button:disabled:active { background: none; }
/* 垃圾桶图标只挂给删除按钮，修改/保存不带 */
.detail-actions button[data-act="delete"] { color: var(--red); font-weight: 500; }
.detail-actions button[data-act="delete"]:active { background: #fdeef0; }
.detail-actions button[data-act="delete"]::before {
  content: ''; display: inline-block; width: 14px; height: 14px; margin-right: 5px; vertical-align: -2px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ef4b5a' stroke-width='1.9' stroke-linecap='round'%3E%3Cpath d='M4 7h16M9.5 7V4.6h5V7M6.6 7l1 12.4h8.8L18.4 7M10.2 11v5M13.8 11v5'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- 空状态 ---------- */
.empty { grid-column: span 12; padding: 46px 0 56px; text-align: center; color: var(--muted); font-size: 14px; }
.empty::before {
  content: ''; display: block; width: 92px; height: 92px; margin: 0 auto 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 96' fill='none'%3E%3Crect x='16' y='12' width='64' height='72' rx='14' stroke='%23ccd5e8' stroke-width='3'/%3E%3Cpath d='M30 38h36M30 52h26' stroke='%23dde4f2' stroke-width='3' stroke-linecap='round'/%3E%3Ccircle cx='66' cy='68' r='15' fill='%23eef1fe' stroke='%234f6ef7' stroke-width='3'/%3E%3Cpath d='M59.5 68.6l4.6 4.6L73 63.6' stroke='%234f6ef7' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- 悬浮新增按钮 ---------- */
.fab {
  position: fixed; bottom: calc(76px + var(--safe-bottom));
  right: max(18px, calc(50vw - var(--content-half) + 18px));
  width: 54px; height: 54px; border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff;
  box-shadow: var(--shadow-brand); cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease;
}
.fab svg { width: 24px; height: 24px; }
.fab:active { transform: scale(.9); box-shadow: 0 4px 12px rgba(79, 110, 247, .35); }

/* ---------- 底部导航 ---------- */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center;
  padding-bottom: var(--safe-bottom);
  background: rgba(255, 255, 255, .95); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); box-shadow: 0 -2px 14px rgba(27, 31, 42, .05);
}
.tab {
  flex: 1 1 0; max-width: 200px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 8px; background: none; border: none; font-family: inherit;
  font-size: 11px; color: var(--muted); cursor: pointer; transition: color .2s ease;
}
.tab svg { width: 21px; height: 21px; }
.tab:active { opacity: .65; }
.tab.active { color: var(--brand); font-weight: 600; }

/* ---------- 设置页 ---------- */
#page-settings { padding: 16px; max-width: var(--content-max); margin: 0 auto; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(23, 28, 45, .42); backdrop-filter: blur(2px);
  animation: fade .2s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.modal-box {
  width: 100%; max-width: 420px; padding: 20px 18px calc(20px + var(--safe-bottom));
  background: #fff; border-radius: 18px 18px 0 0;
  animation: slideUp .26s cubic-bezier(.2, .8, .2, 1) both;
}
.modal-box h2 { margin-bottom: 16px; font-size: 17px; font-weight: 700; }
/* 只针对文本输入框：长期任务复选框不套这套外观 */
.modal-box input[type="text"], .modal-box textarea {
  width: 100%; margin-bottom: 11px; padding: 12px 13px; border: 1.5px solid var(--line-2); border-radius: 11px;
  background: #fbfcfe; color: var(--text); font-size: 16px; font-family: inherit; resize: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.modal-box input[type="text"]:focus, .modal-box textarea:focus {
  outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(79, 110, 247, .12);
}
.modal-box input[type="text"]::placeholder, .modal-box textarea::placeholder { color: #b3bacb; }
.modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.modal-actions .primary { flex: 1; margin-top: 0; }
.modal-actions .ghost { flex: none; padding: 12px 22px; }

/* ---------- 断点 ---------- */
/* 小屏去掉竖排弹窗的内边距干扰，弹窗改为居中 */
@media (min-width: 520px) {
  .modal { align-items: center; padding: 20px; }
  .modal-box { border-radius: 18px; padding: 22px 20px; }
}

/* 平板：一行两张卡片，筛选按钮不再被拉得过宽 */
@media (min-width: 640px) {
  .card { grid-column: span 6; }
  .filter-row { justify-content: center; }
  .chip { flex: 0 1 170px; }
}

/* 桌面：一行三张卡片，标题居中 */
@media (min-width: 1024px) {
  .card { grid-column: span 4; }
  #app-title { text-align: center; }
}

/* 系统开启“减少动态效果”时全部关掉 */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* === DayLog 新增组件（参考实现里没有，本项目补齐） === */

/* 统一表单控件：文本框、多行文本、下拉、日期、数字都用 .field，弹窗与展开区通用 */
.field {
  width: 100%; margin-bottom: 11px; padding: 12px 13px; border: 1.5px solid var(--line-2); border-radius: 11px;
  background: #fbfcfe; color: var(--text); font-size: 16px; font-family: inherit;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.field:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(79, 110, 247, .12); }
.field::placeholder { color: #b3bacb; }
textarea.field { min-height: 90px; resize: vertical; }
/* 下拉：去掉系统箭头，换成品牌色自绘箭头 */
select.field {
  appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a6275' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}

/* 带左侧标题的表单行：标题固定不缩，控件占满余下宽度；行距由本行负责，控件自身不再留底距 */
.field-row { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.field-row .field-label { flex: none; font-size: 14px; font-weight: 500; color: var(--text-2); }
.field-row .field { flex: 1; width: auto; min-width: 0; margin-bottom: 0; }

/* 列表底部状态：加载中 / 没有更多了 */
.load-state { grid-column: span 12; padding: 14px 0 4px; text-align: center; font-size: 12px; color: var(--muted); }

/* 大号数值：倒数日剩余天数、计数器当前值 */
.day-num { font-size: 28px; font-weight: 700; letter-spacing: .3px; color: var(--brand); }
.day-num.overdue { color: var(--red); }
/* 计数器卡片单行：标签（左）+ 标题（中左对齐，过长省略）+ 数值（右）
   align-items 用 center：12px 标签与 15px 标题相对 28px 数值垂直居中，不用 baseline（会显得偏低） */
.counter-row { display: flex; align-items: center; gap: 8px; }
.counter-row .tag { flex: none; }
.counter-row .task-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.counter-row .day-num { flex: none; }
/* 倒数日首行：标题 + 天数 */
.head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
/* 长标题换行，不把天数挤出去；天数不被压缩，且字号降到与标题一致 */
.head-row .task-title { min-width: 0; overflow-wrap: anywhere; }
.head-row .day-num { flex: none; font-size: 15px; }
/* 日记首行右侧的心情标签：同样不被长标题压缩 */
.head-row .tag { flex: none; }

/* 卡片上的分类小标签 */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 8px;
  background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 500;
}
.tag + .tag { margin-left: 6px; }

/* 搜索行（仅日记页） */
.search-row {
  display: flex; gap: 8px; padding: 10px 16px 0;
  max-width: var(--content-max); margin-left: auto; margin-right: auto;
}
.search-row .field { flex: 1; min-width: 0; margin-bottom: 0; }
/* 搜索框内的清空按钮：有内容才显示，见 app.js */
.search-box { position: relative; flex: 1; min-width: 0; }
.search-box .field { width: 100%; padding-right: 34px; }
.clear-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; padding: 0; border: none; border-radius: 50%;
  background: none; color: var(--muted); font-size: 17px; line-height: 1; font-family: inherit;
  cursor: pointer; transition: background .2s ease;
}
/* 把点击热区扩到约 32px，手机上更好点 */
.clear-btn::after { content: ''; position: absolute; inset: -4px; }
.clear-btn:active { background: var(--line); }
.search-btn {
  flex: none; padding: 12px 18px; border: none; border-radius: 11px; font-family: inherit;
  font-size: 15px; font-weight: 600; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, var(--brand-2), var(--brand)); box-shadow: var(--shadow-brand);
  transition: transform .12s ease;
}
.search-btn:active { transform: scale(.98); }
/* 查询行最左的心情筛选下拉：常显（不套 .chip-select 的窄屏自适应隐藏），宽度按内容收窄，
   给搜索框留出空间；13px 字号与 .chip-select 一致，且下拉不触发 iOS 聚焦缩放 */
.search-row .mood-select {
  flex: none; width: auto; max-width: 96px; margin-bottom: 0;
  padding: 12px 28px 12px 10px; font-size: 13px;
  background-position: right 8px center;
}

/* 设置页 */
.setting-wrap { padding: 16px; max-width: var(--content-max); margin: 0 auto; }
.setting-group { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; margin-bottom: 14px; }
.setting-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); }
.setting-item:first-child { border-top: none; }
.setting-item .label { font-size: 15px; font-weight: 500; }
.setting-item .value { font-size: 15px; color: var(--text-2); }
.setting-item .field { width: 120px; margin-bottom: 0; text-align: right; }
.setting-danger {
  width: 100%; padding: 14px 16px; border: none; border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow-1); font-family: inherit;
  font-size: 15px; font-weight: 600; color: var(--red); text-align: left; cursor: pointer;
}
.setting-danger:active { background: #fdeef0; }

/* 二次确认 */
.confirm-text { margin-bottom: 18px; font-size: 15px; font-weight: 500; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }
.confirm-actions .primary { width: auto; margin-top: 0; padding: 10px 22px; }
.confirm-actions .ghost { padding: 10px 22px; }

/* 各页面描述的 Markdown 渲染（列表页 .desc 与钩子页 .hook-desc 共用此类）。
   MD 模式下必须解除 pre-wrap：块级换行改由 <p>/<br> 负责，
   留着 pre-wrap 会把块元素之间的换行也当字面换行显示，多出空行。
   钩子页 .hook-desc 的 pre-wrap 解除见 hook.css（加载顺序原因需双类选择器） */
.desc-md { white-space: normal; }
.desc-md > :first-child { margin-top: 0; }
.desc-md > :last-child { margin-bottom: 0; }
.desc-md p { margin: 0 0 8px; }
.desc-md h1, .desc-md h2, .desc-md h3,
.desc-md h4, .desc-md h5, .desc-md h6 {
  margin: 12px 0 6px; font-weight: 700; line-height: 1.35; color: var(--text);
}
.desc-md h1 { font-size: 18px; }
.desc-md h2 { font-size: 16px; }
.desc-md h3 { font-size: 15px; }
.desc-md h4, .desc-md h5, .desc-md h6 { font-size: 14px; }
.desc-md ul, .desc-md ol { margin: 0 0 8px; padding-left: 20px; }
.desc-md li { margin: 2px 0; }
.desc-md blockquote {
  margin: 0 0 8px; padding: 4px 0 4px 10px;
  border-left: 3px solid var(--line-2); color: var(--text-2);
}
.desc-md code {
  padding: 1px 5px; border-radius: 6px; background: var(--bg);
  font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 12.5px;
}
.desc-md pre { margin: 0 0 8px; padding: 10px 12px; border-radius: 10px; background: var(--bg); overflow-x: auto; }
.desc-md pre code { padding: 0; background: none; }
.desc-md hr { margin: 12px 0; border: none; border-top: 1px solid var(--line); }
.desc-md a { color: var(--brand); text-decoration: none; }
.desc-md a:active { text-decoration: underline; }
.desc-md strong { font-weight: 700; }
.desc-md em { font-style: italic; }
.desc-md del { color: var(--muted); }

/* 轻提示 */
.toast {
  position: fixed; left: 50%; bottom: calc(110px + var(--safe-bottom)); transform: translateX(-50%);
  z-index: 60; max-width: 80vw; padding: 10px 16px; border-radius: 11px;
  background: rgba(27, 31, 42, .88); color: #fff; font-size: 13px; text-align: center;
  animation: fade .22s ease both;
}

/* 时长统计页：三个统计框 */
.stat-row {
  display: flex; gap: 10px; padding: 10px 16px 0;
  max-width: var(--content-max); margin-left: auto; margin-right: auto;
}
.stat-box { flex: 1 1 0; min-width: 0; padding: 10px 6px; text-align: center; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.stat-label { display: block; margin-bottom: 2px; font-size: 11px; color: var(--muted); }
.stat-value { display: block; font-size: 15px; font-weight: 700; letter-spacing: .3px; color: var(--brand); overflow-wrap: anywhere; }

/* 设置页：分类管理行 */
.setting-item .field.grow { width: auto; flex: 1; min-width: 0; text-align: left; }
.class-del {
  flex: none; padding: 6px 10px; border: none; border-radius: 8px; background: none;
  color: var(--red); font-size: 13px; font-family: inherit; cursor: pointer;
  transition: background .2s ease;
}
.class-del:active { background: #fdeef0; }

/* 跌倒子项小标签（新增弹窗里已加入的项） */
.chip-mini {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 10px;
  background: var(--brand-soft); color: var(--brand); font-size: 12px;
}
.chip-mini button { background: none; border: none; color: var(--brand); font-size: 14px; line-height: 1; cursor: pointer; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 11px; }

/* 类级筛选自适应：PC 走 chip 横排，手机走"全部按钮 + 下拉"
   .chip-select 不是文本输入框，不触发 iOS 聚焦缩放，所以用 13px 字号与 .chip 对齐 */
.chip-select {
  display: none; flex: 1 1 auto; min-width: 0;
  padding: 8px 30px 8px 12px; border: 1.5px solid var(--line-2); border-radius: 12px;
  background-color: #fff; color: var(--text-2);
  font-size: 13px; font-weight: 500; font-family: inherit;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a6275' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 15px;
}
.chip-select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(79, 110, 247, .12); }

@media (max-width: 639.98px) {
  .filter-row.has-select .chip:not(:first-child) { display: none; }
  .filter-row.has-select .chip:first-child { flex: 0 0 84px; }
  .filter-row.has-select .chip-select { display: block; }
}

/* 倒数日日期行：左侧「农历」开关 + 右侧公历日期控件 / 农历月日下拉 */
.date-block { margin-bottom: 11px; }
.date-row { display: flex; align-items: stretch; gap: 8px; }
.date-row .chip { flex: 0 0 auto; padding: 9px 12px; }
.date-row .field { flex: 1 1 0; width: auto; min-width: 0; margin-bottom: 0; }
.date-part { display: flex; flex: 1 1 0; min-width: 0; gap: 8px; }
.field-hint { margin-top: 6px; font-size: 12px; color: var(--muted); }

/* 卡片第二行的日期文本：农历记录更长，允许折断，不挤压右侧标签 */
.date-text { overflow-wrap: anywhere; }
