/* 小芽 · 极简待办 */
:root{
  --bg:#FBFBFA;
  --surface:#FFFFFF;
  --text:#17181A;
  --text-2:#6B6F76;
  --text-3:#A3A7AE;
  --line:#EDEDEA;
  --line-soft:#F4F4F1;
  --accent:#2B6BE6;
  --accent-soft:#EEF3FE;
  --danger:#E5484D;
  --p3:#E5484D;
  --p2:#E8A33D;
  --p1:#8FA0B8;
  --r:16px;
  --shadow:0 1px 2px rgba(23,24,26,.04), 0 8px 24px rgba(23,24,26,.04);
  --font:-apple-system,BlinkMacSystemFont,"SF Pro SC","PingFang SC","HarmonyOS Sans SC","Noto Sans SC","Microsoft YaHei",system-ui,sans-serif;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;padding:0}
body{
  background:var(--bg);color:var(--text);font-family:var(--font);
  font-size:16px;line-height:1.5;-webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}
button{font-family:inherit;font-size:inherit;color:inherit;background:none;border:0;cursor:pointer}
input,textarea{font-family:inherit;font-size:inherit;color:inherit}
input:focus,textarea:focus,button:focus{outline:none}
input:focus-visible,button:focus-visible,textarea:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

.app{
  max-width:540px;margin:0 auto;min-height:100dvh;
  padding:0 20px calc(40px + env(safe-area-inset-bottom));
  display:flex;flex-direction:column;
}

/* ---------- 顶部 ---------- */
.topbar{
  display:flex;align-items:flex-end;justify-content:space-between;gap:12px;
  padding:calc(28px + env(safe-area-inset-top)) 0 14px;
}
.date-line{margin:0 0 2px;font-size:13px;color:var(--text-3);letter-spacing:.02em}
.topbar h1{margin:0;font-size:29px;line-height:1.15;font-weight:600;letter-spacing:-.02em}
.top-actions{display:flex;gap:2px;padding-bottom:4px}
.icon-btn{
  width:38px;height:38px;border-radius:12px;display:grid;place-items:center;
  color:var(--text-2);transition:background .18s ease,color .18s ease;
}
.icon-btn svg{width:20px;height:20px}
.icon-btn:hover{background:var(--line-soft);color:var(--text)}
.icon-btn.small{width:32px;height:32px;border-radius:10px}

/* ---------- 搜索 ---------- */
.search-wrap{
  display:flex;align-items:center;gap:10px;
  background:var(--surface);border:1px solid var(--line);border-radius:14px;
  padding:0 12px;height:46px;margin-bottom:12px;
}
.search-wrap svg{width:18px;height:18px;color:var(--text-3);flex:none}
.search-wrap input{flex:1;border:0;background:none;height:100%;font-size:15px}
.search-wrap input::-webkit-search-cancel-button{display:none}
.text-btn{color:var(--accent);font-size:14px;padding:4px}

/* ---------- 分段导航 ---------- */
.segments{display:flex;gap:22px;border-bottom:1px solid var(--line);margin-bottom:2px}
.seg{
  position:relative;padding:8px 0 12px;font-size:15px;color:var(--text-3);
  transition:color .2s ease;font-weight:450;
}
.seg.active{color:var(--text);font-weight:600}
.seg.active::after{
  content:"";position:absolute;left:0;right:0;bottom:-1px;height:2px;
  background:var(--text);border-radius:2px;
}
.seg .badge{
  display:inline-block;margin-left:5px;font-size:11px;color:var(--text-3);
  font-variant-numeric:tabular-nums;
}

/* ---------- 快速添加 ---------- */
.quickadd{padding:14px 0 4px}
.quickadd-inner{
  display:flex;align-items:center;gap:10px;
  background:var(--surface);border:1px solid var(--line);border-radius:14px;
  height:48px;padding:0 8px 0 14px;
  transition:border-color .2s ease, box-shadow .2s ease;
}
.quickadd-inner:focus-within{border-color:#D4D4CE;box-shadow:var(--shadow)}
.quickadd-inner .plus{color:var(--text-3);font-size:20px;line-height:1;font-weight:300}
.quickadd-inner input{flex:1;border:0;background:none;height:100%;font-size:15px;min-width:0}
.quickadd-inner input::placeholder{color:var(--text-3)}
.quick-submit{
  width:32px;height:32px;border-radius:10px;display:grid;place-items:center;
  background:var(--text);color:#fff;flex:none;opacity:.16;transition:opacity .2s ease,transform .12s ease;
}
.quick-submit svg{width:16px;height:16px}
.quickadd-inner.is-active .quick-submit{opacity:1}
.quick-submit:active{transform:scale(.92)}
.hint{
  margin:8px 2px 0;font-size:12px;color:var(--text-3);
  opacity:.85;transition:opacity .2s ease;
}
.hint b{font-weight:500;color:var(--text-2);background:var(--line-soft);border-radius:5px;padding:1px 4px;margin:0 1px}
.hint.hide{display:none}

/* ---------- 列表 ---------- */
.list{flex:1;padding-top:6px}
.group{margin-top:20px}
.group-head{
  display:flex;align-items:center;justify-content:space-between;
  padding:0 2px 8px;
}
.group-title{
  font-size:12px;font-weight:600;letter-spacing:.06em;color:var(--text-3);
  text-transform:uppercase;
}
.group-title.is-danger{color:var(--danger)}
.group-count{font-size:12px;color:var(--text-3);font-variant-numeric:tabular-nums}
.tasks{display:flex;flex-direction:column}

.task{
  display:flex;align-items:flex-start;gap:12px;
  padding:13px 2px;border-bottom:1px solid var(--line-soft);
  transition:opacity .25s ease, transform .25s ease;
}
.task:last-child{border-bottom:0}
.task-main{flex:1;min-width:0;cursor:pointer}
.task-title{
  font-size:15.5px;line-height:1.45;word-break:break-word;
  transition:color .2s ease;
}
.task-meta{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:4px}
.meta-item{font-size:12px;color:var(--text-3);display:inline-flex;align-items:center;gap:4px;white-space:nowrap}
.meta-item.due-today{color:var(--accent)}
.meta-item.overdue{color:var(--danger)}
.meta-dot{width:5px;height:5px;border-radius:50%;background:currentColor;opacity:.85}
.list-tag{display:inline-flex;align-items:center;gap:4px}
.list-tag i{width:6px;height:6px;border-radius:2px;display:block}
.note-flag{color:var(--text-3)}

/* 勾选圈 */
.check{
  flex:none;width:22px;height:22px;margin-top:1px;border-radius:50%;
  border:1.6px solid #D6D6D1;background:transparent;
  display:grid;place-items:center;transition:all .2s ease;position:relative;
}
.check svg{width:12px;height:12px;stroke:#fff;stroke-width:2.4;fill:none;opacity:0;transform:scale(.6);transition:all .2s ease}
.check:hover{border-color:var(--text-3)}
.check.p3{border-color:#F0B4B6}
.check.p2{border-color:#F2D3A6}
.check.on{background:var(--text);border-color:var(--text)}
.check.on svg{opacity:1;transform:scale(1)}

.task.completing{opacity:0;transform:translateX(6px)}
.task.done .task-title{color:var(--text-3);text-decoration:line-through;text-decoration-color:#D6D6D1}

/* 空状态 */
.empty{
  padding:64px 20px;text-align:center;color:var(--text-3);
}
.empty-mark{
  width:52px;height:52px;margin:0 auto 16px;border-radius:50%;
  border:1.4px dashed #DEDED8;display:grid;place-items:center;color:#CFCFC8;
}
.empty-mark svg{width:22px;height:22px}
.empty p{margin:0;font-size:14.5px;line-height:1.7}
.empty small{display:block;margin-top:6px;font-size:12.5px;opacity:.75}

/* 今日进度 */
.today-progress{
  display:flex;align-items:center;gap:12px;margin:18px 2px 0;
  font-size:12.5px;color:var(--text-3);
}
.today-progress .track{flex:1;height:3px;border-radius:3px;background:var(--line-soft);overflow:hidden}
.today-progress .fill{height:100%;background:var(--text);border-radius:3px;transition:width .4s cubic-bezier(.2,.8,.2,1)}

.footer-note{margin:36px 0 0;text-align:center;font-size:11.5px;color:#C4C4BD;letter-spacing:.02em}

/* ---------- 遮罩 & 抽屉 ---------- */
.backdrop{
  position:fixed;inset:0;background:rgba(23,24,26,.28);
  backdrop-filter:blur(2px);z-index:40;animation:fade .22s ease;
}
@keyframes fade{from{opacity:0}to{opacity:1}}
.sheet{
  position:fixed;left:0;right:0;bottom:0;z-index:41;
  max-width:540px;margin:0 auto;
  background:var(--surface);border-radius:22px 22px 0 0;
  padding:10px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow:0 -8px 40px rgba(23,24,26,.12);
  animation:slideUp .28s cubic-bezier(.2,.8,.2,1);
  max-height:88dvh;overflow-y:auto;
}
@keyframes slideUp{from{transform:translateY(100%)}to{transform:translateY(0)}}
.sheet.closing{animation:slideDown .2s ease forwards}
@keyframes slideDown{to{transform:translateY(100%);opacity:.6}}
.sheet-grip{width:36px;height:4px;border-radius:4px;background:#E4E4DE;margin:0 auto 14px}
.detail-head{display:flex;align-items:flex-start;gap:8px;margin-bottom:6px}
.sheet-title{margin:0;font-size:17px;font-weight:600;flex:1}
.d-title{
  flex:1;border:0;background:none;font-size:18px;font-weight:600;line-height:1.4;
  padding:4px 0;min-width:0;
}
.d-title::placeholder{color:#C9C9C2;font-weight:500}
.d-note{
  width:100%;border:0;background:var(--line-soft);border-radius:12px;
  padding:11px 13px;font-size:14.5px;line-height:1.6;resize:none;margin:6px 0 4px;
}
.d-note::placeholder{color:var(--text-3)}

.field{padding:14px 0;border-top:1px solid var(--line-soft);margin-top:8px}
.field label{display:block;font-size:12px;font-weight:600;letter-spacing:.05em;color:var(--text-3);margin-bottom:10px}
.chips{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.chip{
  display:inline-flex;align-items:center;gap:6px;
  padding:7px 13px;border-radius:10px;background:var(--line-soft);
  font-size:14px;color:var(--text-2);transition:all .16s ease;
}
.chip:hover{background:#EFEFEA}
.chip.on{background:var(--text);color:#fff}
.chip .dot{width:7px;height:7px;border-radius:50%;display:block}
.chip .dot.p3{background:var(--p3)}
.chip .dot.p2{background:var(--p2)}
.chip .dot.p1{background:var(--p1)}
.chip-date,.chip-time{
  border:1px solid var(--line);border-radius:10px;padding:6px 10px;
  font-size:13.5px;color:var(--text-2);background:var(--surface);height:36px;
}
.chip-date.has,.chip-time.has{border-color:var(--text);color:var(--text)}

.sheet-actions{display:flex;gap:10px;margin-top:20px}
.btn{
  flex:1;height:46px;border-radius:13px;font-size:15px;font-weight:500;
  display:grid;place-items:center;transition:all .16s ease;
}
.btn.primary{background:var(--text);color:#fff}
.btn.primary:active{transform:scale(.99);opacity:.9}
.btn.ghost{background:var(--line-soft);color:var(--text-2)}
.btn.ghost:hover{background:#EFEFEA}
.btn.danger{color:var(--danger);background:#FDF0F0}
.btn.danger:hover{background:#FBE6E6}

/* ---------- 统计 ---------- */
.stat-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:8px 0 4px}
.stat{background:var(--bg);border-radius:14px;padding:14px 12px}
.stat b{display:block;font-size:24px;font-weight:600;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
.stat span{font-size:12px;color:var(--text-3)}
.section-label{font-size:12px;font-weight:600;letter-spacing:.05em;color:var(--text-3);margin:20px 0 10px}
.chart{display:flex;align-items:flex-end;gap:8px;height:96px;padding:0 2px}
.chart .col{flex:1;display:flex;flex-direction:column;align-items:center;gap:6px;height:100%;justify-content:flex-end}
.chart .bar{width:100%;max-width:26px;background:var(--line-soft);border-radius:6px 6px 3px 3px;transition:height .5s cubic-bezier(.2,.8,.2,1);position:relative}
.chart .bar.has{background:var(--text)}
.chart .bar.today{background:var(--accent)}
.chart .lab{font-size:11px;color:var(--text-3)}
.chart .val{position:absolute;top:-16px;left:0;right:0;text-align:center;font-size:10.5px;color:var(--text-3);font-variant-numeric:tabular-nums}
.bars{display:flex;flex-direction:column;gap:12px}
.bar-row{display:flex;flex-direction:column;gap:6px}
.bar-row .bl{display:flex;justify-content:space-between;font-size:13px;color:var(--text-2)}
.bar-row .bt{height:5px;border-radius:5px;background:var(--line-soft);overflow:hidden}
.bar-row .bf{height:100%;border-radius:5px;transition:width .5s ease}

/* ---------- Toast ---------- */
.toast{
  position:fixed;left:50%;bottom:calc(26px + env(safe-area-inset-bottom));
  transform:translate(-50%,8px);z-index:60;
  display:flex;align-items:center;gap:14px;
  background:#22242A;color:#fff;border-radius:12px;
  padding:11px 16px;font-size:13.5px;
  box-shadow:0 8px 28px rgba(0,0,0,.18);opacity:0;
  transition:opacity .22s ease, transform .22s ease;
  max-width:calc(100vw - 40px);
}
.toast.show{opacity:1;transform:translate(-50%,0)}
.toast button{color:#8FB2FF;font-size:13.5px;font-weight:500;flex:none}

/* ---------- 同步 ---------- */
.sync-dot{
  position:absolute;top:8px;right:8px;width:6px;height:6px;border-radius:50%;
  background:transparent;transition:background .25s ease,box-shadow .25s ease;
}
#syncBtn{position:relative}
.sync-dot[data-state="syncing"]{background:var(--accent);animation:pulse 1.1s infinite ease-in-out}
.sync-dot[data-state="ok"]{background:#2FBF9B}
.sync-dot[data-state="error"]{background:var(--danger)}
.sync-dot[data-state="off"]{display:none}
@keyframes pulse{0%,100%{opacity:.35;transform:scale(.85)}50%{opacity:1;transform:scale(1.15)}}

.sheet-desc{margin:2px 0 18px;font-size:14px;line-height:1.7;color:var(--text-2)}
.sheet-desc.small{font-size:12.5px;color:var(--text-3);margin:10px 0 0}
.sheet-label{font-size:12px;font-weight:600;letter-spacing:.05em;color:var(--text-3);margin:6px 0 8px}
.code-box{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  background:var(--bg);border:1px dashed #DCDCD6;border-radius:14px;
  padding:14px 16px;
}
.code{
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:19px;letter-spacing:.12em;font-weight:600;color:var(--text);
}
.input-line{
  width:100%;height:46px;border:1px solid var(--line);border-radius:12px;
  padding:0 13px;font-size:15px;background:var(--surface);
  transition:border-color .18s ease;
}
.input-line:focus{border-color:#D4D4CE}
.field-hint{margin:7px 2px 0;font-size:11.5px;line-height:1.5;color:var(--text-3)}
.warn-note{
  margin:18px 0 0;padding:11px 13px;border-radius:11px;
  background:#FDF7EC;color:#8A6A2F;font-size:12px;line-height:1.65;
}
.sync-actions{display:flex;gap:10px;margin-top:18px}
#syncJoinBox .input-line{margin-bottom:4px}

/* ---------- 账号 ---------- */
.account{margin-bottom:4px}
.account-row{display:flex;align-items:center;gap:12px;padding:12px;border:1px solid var(--line);border-radius:14px;background:var(--surface)}
.avatar{
  width:40px;height:40px;flex:0 0 40px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  background:var(--accent-soft);color:var(--accent);
  font-size:17px;font-weight:500;text-transform:uppercase;
}
.account-meta{flex:1;min-width:0}
.account-name{margin:0;font-size:14px;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.account-sub{margin:2px 0 0;font-size:12px;color:var(--text-3)}
.small-btn{margin-top:10px;width:100%;font-size:13px;padding:9px 12px}
.divider{
  display:flex;align-items:center;gap:10px;
  margin:18px 0 14px;color:var(--text-3);font-size:12px;
}
.divider::before,.divider::after{content:"";flex:1;height:1px;background:var(--line)}

@media (max-width:360px){
  .app{padding:0 16px 40px}
  .topbar h1{font-size:26px}
  .segments{gap:16px}
}
@media (prefers-reduced-motion:reduce){
  *{animation-duration:.01ms!important;transition-duration:.01ms!important}
}
