/* 小绩原型样式：参数照仓库 docs/design/小绩-视觉规范与前端开发计划.md */
:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --pri: #6355d9;
  --pri-c: #ffffff;
  --sel: #eeebff;
  --tx: #252334;
  --mu: #78768a;
  --line: rgba(37, 35, 52, 0.08);
  --soft: #f4f3fa;
  --r-card: 23px;
  --r-input: 30px;
  --r-nav: 27px;
  --r-btn: 25px;
  --shadow: 0 1px 3px rgba(37, 35, 52, 0.05);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  color: var(--tx);
  background: linear-gradient(180deg, #f1effb 0, var(--bg) 220px) no-repeat, var(--bg);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
svg { display: block; flex: none; }
.app { max-width: 480px; margin: 0 auto; min-height: 100dvh; position: relative; }
.view { padding: calc(var(--sat) + 10px) 16px 0; }
.view.has-input { padding-bottom: calc(var(--sab) + 150px); }
.view.no-input { padding-bottom: calc(var(--sab) + 96px); }
.mu { color: var(--mu); }
.tnum { font-variant-numeric: tabular-nums; }

/* 页头 */
.topbar { display: flex; align-items: center; gap: 10px; padding: 6px 4px 12px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; object-position: 50% 12%; background: var(--sel); flex: none; }
.topbar .name { font-size: 17px; font-weight: 600; line-height: 24px; }
.topbar .status { font-size: 12px; color: var(--mu); line-height: 16px; }
.page-head { padding: 10px 4px 16px; }
.page-head h1 { margin: 0; font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: 0.2px; }
.page-head .sub { margin-top: 4px; font-size: 13px; line-height: 18px; color: var(--mu); }

/* 聊天 */
.msgs { display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 8px; align-items: flex-start; }
.msg.me { justify-content: flex-end; }
.msg .avatar { width: 30px; height: 30px; margin-top: 2px; }
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 20px; font-size: 15px; line-height: 22px; white-space: pre-wrap; word-break: break-word; }
.msg.xj .bubble { background: var(--card); border: 1px solid var(--line); border-top-left-radius: 8px; }
.msg.me .bubble { background: var(--sel); border-top-right-radius: 8px; }
.msg .voice-tag { display: inline-flex; vertical-align: -2px; margin-right: 4px; color: var(--pri); }
.msg-col { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.examples { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 0 38px; }
.example { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 9px 12px; font-size: 14px; line-height: 20px; color: var(--tx); }
.example:active { background: var(--sel); }

/* 卡片 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 16px 14px 14px; }
.plan-head { display: flex; align-items: flex-start; gap: 10px; padding: 0 4px 6px; }
.plan-title { font-size: 17px; line-height: 24px; font-weight: 600; flex: 1; min-width: 0; }
.plan-meta { font-size: 12px; line-height: 18px; color: var(--mu); margin-top: 2px; }
.ver { flex: none; font-size: 12px; line-height: 18px; color: var(--pri); background: var(--sel); border-radius: 10px; padding: 1px 8px; margin-top: 3px; }
.plan-note { margin: 2px 4px 8px; font-size: 13px; line-height: 19px; color: var(--pri); }
.skeleton { height: 14px; border-radius: 7px; background: linear-gradient(90deg, #f0eff6 0, #f7f6fb 50%, #f0eff6 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* 步骤行 */
.steps { display: flex; flex-direction: column; }
.step { display: grid; grid-template-columns: 40px 30px 1fr auto; gap: 8px; align-items: start; padding: 9px 4px; border-radius: 14px; position: relative; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.step + .step { border-top: 1px solid rgba(37, 35, 52, 0.05); }
.step:active { background: #faf9fe; }
.st-time { font-size: 12px; line-height: 30px; color: var(--mu); font-variant-numeric: tabular-nums; }
.st-time .d { display: block; font-size: 10px; line-height: 10px; margin-top: -4px; }
.st-ico { width: 30px; height: 30px; border-radius: 50%; background: var(--soft); color: var(--pri); display: grid; place-items: center; }
.st-body { min-width: 0; padding-top: 4px; }
.st-act { font-size: 15px; line-height: 22px; font-weight: 500; word-break: break-word; }
.st-why { font-size: 13px; line-height: 18px; color: var(--mu); margin-top: 2px; }
.st-old { font-size: 12px; line-height: 17px; color: var(--mu); text-decoration: line-through; margin-top: 2px; }
.st-min { font-size: 12px; line-height: 30px; color: var(--mu); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; font-size: 11px; line-height: 16px; font-weight: 500; padding: 0 6px; border-radius: 8px; margin-left: 6px; vertical-align: 2px; background: var(--sel); color: var(--pri); }
.tag.del { background: #f3f2f6; color: var(--mu); }
.tag.lock { background: #f3f2f6; color: var(--mu); }
.step.diff-add, .step.diff-edit { background: #f8f7ff; }
.step.diff-del { opacity: 0.55; }
.step.diff-del .st-act { text-decoration: line-through; }
.step.sel { background: var(--sel); box-shadow: inset 0 0 0 1.5px var(--pri); }
.step.s-done .st-act, .step.s-skipped .st-act { color: var(--mu); }
.step.s-done .st-ico { background: var(--pri); color: #fff; }
.step.s-skipped .st-act { text-decoration: line-through; }
.step.s-doing .st-ico { background: var(--pri); color: #fff; }
.step.s-doing .st-act { color: var(--pri); }
.tip { display: flex; gap: 8px; align-items: flex-start; margin: 8px 4px 0; padding: 10px 12px; border-radius: 14px; background: var(--soft); font-size: 13px; line-height: 19px; color: var(--mu); }
.tip svg { color: var(--pri); margin-top: 1px; }
.plan-bar { display: flex; gap: 10px; margin-top: 12px; }
.plan-bar .btn { flex: 1; }
.plan-bar .btn.grow { flex: 1.6; }
.plan-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 4px 0; font-size: 12px; color: var(--mu); }
.link { color: var(--pri); font-size: 13px; font-weight: 500; }
.done-line { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--mu); }
.done-line svg { color: var(--pri); }

/* 按钮 */
.btn { height: 48px; border-radius: var(--r-btn); font-size: 16px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 18px; transition: transform 0.12s, opacity 0.12s; }
.btn:active { transform: scale(0.98); opacity: 0.9; }
.btn.primary { background: var(--pri); color: var(--pri-c); }
.btn.ghost { background: var(--card); border: 1px solid var(--line); color: var(--tx); }
.btn.soft { background: var(--sel); color: var(--pri); }
.btn.sm { height: 36px; border-radius: 18px; font-size: 14px; padding: 0 14px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; display: grid; place-items: center; color: var(--tx); }
.icon-btn:active { background: rgba(37, 35, 52, 0.06); }

/* 底部：输入栏 + 导航 */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; max-width: 480px; margin: 0 auto; padding: 0 12px calc(var(--sab) + 8px); background: linear-gradient(180deg, rgba(247, 248, 250, 0) 0, rgba(247, 248, 250, 0.96) 26px); }
.ctx-chip { display: inline-flex; align-items: center; gap: 4px; max-width: calc(100% - 16px); margin: 0 0 6px 8px; padding: 3px 4px 3px 10px; border-radius: 14px; background: var(--sel); color: var(--pri); font-size: 13px; line-height: 20px; }
.ctx-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-chip button { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 11px; color: var(--pri); }
.inputbar { display: flex; align-items: flex-end; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-input); box-shadow: 0 2px 10px rgba(37, 35, 52, 0.05); padding: 5px 5px 5px 16px; margin-bottom: 8px; min-height: 52px; }
.inputbar textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; font-size: 15px; line-height: 22px; padding: 9px 0; max-height: 110px; min-height: 40px; }
.inputbar textarea::placeholder { color: #a3a1b3; }
.in-btn { width: 40px; height: 40px; border-radius: 20px; display: grid; place-items: center; color: var(--tx); flex: none; }
.in-btn.send { background: var(--pri); color: #fff; }
.in-btn.send[disabled] { background: #e7e6ef; color: #fff; }
.rec { flex: 1; display: flex; align-items: center; gap: 10px; height: 40px; font-size: 15px; color: var(--tx); }
.rec .dot { width: 8px; height: 8px; border-radius: 4px; background: #e5484d; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.rec .secs { color: var(--mu); font-size: 13px; font-variant-numeric: tabular-nums; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--sel); border-top-color: var(--pri); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.nav { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-nav); box-shadow: 0 2px 12px rgba(37, 35, 52, 0.06); height: 60px; padding: 0 6px; }
.nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; line-height: 14px; color: var(--mu); }
.nav button .pill { width: 46px; height: 28px; border-radius: 14px; display: grid; place-items: center; }
.nav button.on { color: var(--pri); }
.nav button.on .pill { background: var(--sel); }

/* 今天 */
.day-plan { margin-bottom: 16px; }
.dp-head { display: flex; align-items: center; gap: 10px; padding: 0 4px 8px; }
.dp-head .grow { flex: 1; min-width: 0; }
.tl { position: relative; }
.tl .step { grid-template-columns: 40px 30px 1fr auto; }
.fold { display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px 4px; font-size: 13px; color: var(--mu); }
.empty { text-align: center; padding: 48px 20px; color: var(--mu); font-size: 14px; }
.empty .btn { margin-top: 16px; }
.reflow { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: 16px; background: var(--sel); margin: 4px 0 10px; font-size: 14px; line-height: 20px; }
.reflow .row { display: flex; gap: 8px; flex-wrap: wrap; }

/* 记忆、我的 */
.list { display: flex; flex-direction: column; gap: 10px; }
.mem { display: flex; gap: 10px; align-items: flex-start; }
.mem .grow { flex: 1; min-width: 0; font-size: 15px; line-height: 22px; }
.mem .src { font-size: 12px; color: var(--mu); margin-top: 2px; }
.add-row { display: flex; gap: 8px; margin-top: 12px; }
.add-row .btn { flex: none; white-space: nowrap; }
.field { width: 100%; border: 1px solid var(--line); border-radius: 16px; background: var(--card); padding: 11px 14px; font-size: 15px; outline: 0; }
.field:focus { border-color: rgba(99, 85, 217, 0.5); }
textarea.field { resize: none; line-height: 22px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px; }
.set-row + .set-row { border-top: 1px solid rgba(37, 35, 52, 0.06); }
.set-row .lbl { font-size: 15px; line-height: 22px; }
.set-row .hint { font-size: 12px; line-height: 17px; color: var(--mu); margin-top: 2px; }
.seg { display: inline-flex; background: var(--soft); border-radius: 14px; padding: 3px; flex: none; }
.seg button { height: 30px; padding: 0 10px; border-radius: 11px; font-size: 13px; color: var(--mu); white-space: nowrap; }
.seg button.on { background: var(--card); color: var(--pri); font-weight: 600; box-shadow: 0 1px 2px rgba(37, 35, 52, 0.08); }
.section-title { font-size: 13px; color: var(--mu); margin: 18px 6px 8px; }
.about { font-size: 13px; line-height: 20px; color: var(--mu); }

/* 轨迹卡 */
.traj-sum { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 2px 4px 10px; font-size: 13px; color: var(--mu); }
.traj-sum b { color: var(--tx); font-weight: 600; font-size: 15px; }
.traj { position: relative; margin: 6px 4px 0; }
.traj::before { content: ""; position: absolute; left: 43px; top: 8px; bottom: 8px; width: 1px; background: rgba(99, 85, 217, 0.2); }
.tr { display: grid; grid-template-columns: 38px 12px 1fr; gap: 8px; align-items: start; padding: 5px 0; }
.tr .t { font-size: 12px; line-height: 20px; color: var(--mu); font-variant-numeric: tabular-nums; }
.tr .n { width: 9px; height: 9px; border-radius: 50%; background: #fff; border: 2px solid var(--pri); margin: 6px 0 0 1px; position: relative; z-index: 1; }
.tr .n.f { background: var(--pri); }
.tr .n.g { border-color: #c9c6dc; }
.tr .x { font-size: 14px; line-height: 20px; }
.tr .x small { display: block; color: var(--mu); font-size: 12px; line-height: 17px; }
.traj-line { margin: 10px 4px 0; font-size: 14px; line-height: 21px; }
.reflect { margin-top: 12px; display: flex; gap: 8px; align-items: flex-end; }
.reflect textarea { flex: 1; min-height: 44px; }
.reflected { margin: 12px 4px 0; padding: 10px 12px; border-radius: 14px; background: var(--soft); font-size: 14px; line-height: 21px; }

/* 弹层 */
.mask { position: fixed; inset: 0; background: rgba(37, 35, 52, 0.28); z-index: 60; animation: fade 0.2s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-width: 480px; margin: 0 auto; background: var(--card); border-radius: 24px 24px 0 0; padding: 8px 16px calc(var(--sab) + 16px); max-height: 86dvh; overflow-y: auto; animation: up 0.2s ease-out; }
.sheet .grab { width: 36px; height: 4px; border-radius: 2px; background: #dddbe6; margin: 2px auto 10px; }
.sheet h3 { margin: 0 4px 4px; font-size: 17px; line-height: 24px; font-weight: 600; }
.sheet .sub { margin: 0 4px 10px; font-size: 13px; line-height: 19px; color: var(--mu); }
.sheet .menu { display: flex; flex-direction: column; margin-top: 6px; }
.sheet .menu button { display: flex; align-items: center; gap: 12px; padding: 13px 6px; font-size: 16px; line-height: 22px; text-align: left; border-radius: 12px; }
.sheet .menu button:active { background: var(--soft); }
.sheet .menu button svg { color: var(--pri); }
.sheet .menu button.danger svg, .sheet .menu button.danger { color: #c4373c; }
.sheet .explain { font-size: 15px; line-height: 24px; padding: 4px 4px 2px; min-height: 48px; }
.sheet .row { display: flex; gap: 10px; margin-top: 14px; }
.sheet .row .btn { flex: 1; }
.sheet label { display: block; font-size: 13px; color: var(--mu); margin: 10px 4px 6px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }

.toast { position: fixed; left: 50%; top: calc(var(--sat) + 12px); transform: translate(-50%, -12px); z-index: 90; max-width: min(440px, calc(100vw - 32px)); background: rgba(37, 35, 52, 0.94); color: #fff; font-size: 14px; line-height: 20px; padding: 10px 16px; border-radius: 22px; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; display: flex; align-items: center; gap: 8px; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* 专注全屏 */
.focus { position: fixed; inset: 0; z-index: 50; background: #fff; display: flex; flex-direction: column; padding: calc(var(--sat) + 6px) 20px calc(var(--sab) + 16px); animation: fade 0.2s; }
.focus .f-top { display: flex; align-items: center; gap: 4px; margin: 0 -10px; }
.focus .f-top .mid { flex: 1; text-align: center; font-size: 13px; line-height: 18px; color: var(--mu); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus .f-dots { display: flex; gap: 4px; justify-content: center; margin-top: 4px; }
.focus .f-dots i { width: 18px; height: 3px; border-radius: 2px; background: #e7e5f1; }
.focus .f-dots i.d { background: var(--pri); }
.focus .f-dots i.c { background: #b9b2f0; }
.f-banner:empty { display: none; }
.f-banner { margin-top: 10px; }
.f-main { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 8px 4px; min-height: 0; }
.f-ico { width: 44px; height: 44px; border-radius: 50%; background: var(--sel); color: var(--pri); display: grid; place-items: center; margin-bottom: 18px; }
.f-action { margin: 0; font-size: 30px; line-height: 40px; font-weight: 600; letter-spacing: 0.2px; word-break: break-word; }
.f-reason { margin: 10px 0 0; font-size: 15px; line-height: 22px; color: var(--mu); }
.f-timer { margin-top: 34px; display: flex; align-items: baseline; gap: 10px; }
.f-timer .big { font-size: 56px; line-height: 60px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.f-timer .big.over { color: var(--mu); }
.f-timer .est { font-size: 14px; color: var(--mu); }
.bar { height: 3px; border-radius: 2px; background: var(--sel); margin-top: 14px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--pri); border-radius: 2px; transition: width 0.4s linear; }
.f-next { margin-top: 18px; font-size: 13px; line-height: 19px; color: var(--mu); }
.f-paused { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 13px; color: var(--pri); }
.f-actions { display: flex; justify-content: space-around; margin: 8px 0 12px; }
.f-actions button { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--mu); min-width: 64px; padding: 6px; border-radius: 14px; }
.f-actions button .c { width: 46px; height: 46px; border-radius: 23px; display: grid; place-items: center; background: var(--soft); color: var(--tx); }
.f-actions button:active .c { background: var(--sel); }
.f-done { width: 100%; height: 56px; border-radius: 28px; font-size: 17px; }
.f-fb { position: absolute; inset: 0; background: rgba(255, 255, 255, 0.97); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 0 32px; animation: fade 0.15s; z-index: 3; }
.f-fb .ok { width: 64px; height: 64px; border-radius: 32px; background: var(--pri); color: #fff; display: grid; place-items: center; animation: pop 0.3s ease-out; }
.f-fb .l1 { font-size: 22px; line-height: 30px; font-weight: 600; }
.f-fb .l2 { font-size: 15px; line-height: 22px; color: var(--mu); }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }
.focus.rest { background: #f4f2ff; }
.focus.rest .f-ico { background: #fff; }
.f-end { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 12px; }
.f-end .ok { width: 72px; height: 72px; border-radius: 36px; background: var(--pri); color: #fff; display: grid; place-items: center; }
.f-end h2 { margin: 6px 0 0; font-size: 26px; line-height: 34px; }
.f-end p { margin: 0; color: var(--mu); font-size: 15px; line-height: 22px; }
@media (orientation: landscape) and (max-height: 520px) {
  .focus { padding-left: calc(env(safe-area-inset-left, 0px) + 28px); padding-right: calc(env(safe-area-inset-right, 0px) + 28px); }
  .f-main { padding-top: 0; }
  .f-action { font-size: 36px; line-height: 46px; }
  .f-ico, .f-reason, .f-next { display: none; }
  .f-timer { margin-top: 16px; }
  .f-actions { margin: 0; }
  .f-done { height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 600px) {
  body { background: #eceaf3; }
  .app { background: linear-gradient(180deg, #f1effb 0, var(--bg) 220px) no-repeat, var(--bg); box-shadow: 0 0 0 1px var(--line); }
}

.msg-col .examples { margin: 0; }
.kb .nav { display: none; }
.kb .view.has-input { padding-bottom: 96px; }
