/* ============ 设计令牌 ============ */
:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --sunken: #eef0f6;
  --line: #e6e8f0;
  --line-2: #d9dce7;
  --ink: #1d2133;
  --ink-2: #4a5068;
  --muted: #7a8095;
  --faint: #a7acbd;
  --brand: #5b5bd6;
  --brand-ink: #3f3fb0;
  --brand-wash: #ececfd;
  --danger: #d93b3f;
  --danger-wash: #fdecec;
  --warn: #c26a00;
  --warn-wash: #fff3e0;
  --ok: #2f9e55;
  --event: #8a90a8;
  --shadow: 0 1px 2px rgba(20, 24, 50, .04), 0 4px 18px rgba(20, 24, 50, .05);
  --shadow-pop: 0 2px 6px rgba(20, 24, 50, .06), 0 20px 48px rgba(20, 24, 50, .16);
  --r-panel: 16px;
  --r-row: 10px;
  --r-ctl: 8px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Segoe UI", "Microsoft YaHei", sans-serif;
  --display: "Bricolage Grotesque", var(--font);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117;
    --surface: #171a23;
    --surface-2: #1b1f2a;
    --sunken: #13161e;
    --line: #262b38;
    --line-2: #323848;
    --ink: #e8eaf2;
    --ink-2: #b9bdcc;
    --muted: #8c93a8;
    --faint: #5d6377;
    --brand: #8b8bf0;
    --brand-ink: #b4b4ff;
    --brand-wash: #23244a;
    --danger: #ff6b6e;
    --danger-wash: #2a1a1f;
    --warn: #f5a524;
    --warn-wash: #262014;
    --event: #6f7690;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 22px rgba(0, 0, 0, .3);
    --shadow-pop: 0 2px 6px rgba(0, 0, 0, .4), 0 24px 56px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; }
.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small-pad { padding: 8px 4px; font-size: 13px; }
h2 { font-size: 15px; font-weight: 650; letter-spacing: .1px; }

/* ============ 顶栏 ============ */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px;
  padding: 12px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px);
}
.tb-left { display: flex; align-items: center; gap: 14px; }
.mark { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; flex-shrink: 0; }
.mark svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs { display: flex; gap: 2px; background: var(--sunken); padding: 3px; border-radius: 10px; }
.tabs a { padding: 6px 14px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 550; font-size: 13.5px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 24, 50, .08); }

.quick { position: relative; flex: 1; max-width: 640px; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; height: 42px; transition: border-color .15s, box-shadow .15s; }
.quick:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-wash); }
.quick .ic { color: var(--brand); width: 18px; height: 18px; }
.quick input { flex: 1; border: 0; background: none; outline: none; height: 100%; min-width: 0; font-size: 14px; }
.quick input::placeholder { color: var(--faint); }
.quick kbd { font: 11px var(--font); color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }
.quick:focus-within kbd { display: none; }
.quick-preview {
  position: absolute; left: -1px; right: -1px; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-pop); padding: 12px 14px; display: none; z-index: 40;
}
.quick-preview.on { display: block; }
.pv-title { font-weight: 600; margin-bottom: 8px; }
.pv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pv { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; padding: 3px 9px; border-radius: 999px; background: var(--sunken); color: var(--ink-2); }
.pv .ic { width: 13px; height: 13px; }
.pv.cat i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.pv.cat { background: color-mix(in srgb, var(--c) 13%, transparent); color: color-mix(in srgb, var(--c) 75%, var(--ink)); }
.pv.due { background: var(--warn-wash); color: var(--warn); }
.pv.muted { background: none; padding-left: 2px; }
.pv-help { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted); line-height: 1.9; }
.pv-help code { font: 11.5px var(--font); background: var(--sunken); border-radius: 4px; padding: 1px 5px; color: var(--ink-2); }

.tb-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tb-btn { height: 36px; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; border-radius: 10px; color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.tb-btn:hover { background: var(--surface); color: var(--ink); }
.tb-btn.icon-only { width: 36px; padding: 0; justify-content: center; }
.tb-btn .ic { width: 18px; height: 18px; }
#inbox-count { display: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
#inbox-count.on { display: inline-block; }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 0 6px; }
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.sync.synced i { background: var(--ok); }
.sync.offline i { background: var(--warn); }
.sync.demo i { background: var(--brand); }

/* 分类筛选 */
.filters { display: flex; gap: 6px; padding: 0 24px 12px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.fchip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px; font-size: 12.5px; color: var(--ink-2);
  border: 1px solid var(--line); background: var(--surface); white-space: nowrap; transition: background .15s, border-color .15s; }
.fchip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.fchip span { color: var(--faint); font-variant-numeric: tabular-nums; }
.fchip:hover { border-color: var(--line-2); }
.fchip.on { background: color-mix(in srgb, var(--c, var(--brand)) 13%, var(--surface)); border-color: color-mix(in srgb, var(--c, var(--brand)) 45%, transparent); color: var(--ink); }
.fchip.all.on { --c: var(--ink); background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* ============ 通用 ============ */
.view { padding: 4px 24px 48px; max-width: 1560px; margin: 0 auto; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); box-shadow: var(--shadow); padding: 18px 18px 16px; }
.panel-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.panel-head .sub { font-size: 12px; color: var(--muted); }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--r-ctl); font-size: 13px; font-weight: 550; white-space: nowrap; }
.btn .ic { width: 15px; height: 15px; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); }
.btn.ghost { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.btn.ghost:hover { border-color: var(--line-2); color: var(--ink); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.danger { color: var(--danger); }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 8px; color: var(--muted); flex-shrink: 0; }
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.icon-btn.small { width: 26px; height: 26px; }
.icon-btn.small .ic { width: 14px; height: 14px; }
.link { color: var(--brand); font-size: 12.5px; font-weight: 550; }
.link:hover { text-decoration: underline; }
.seg { display: inline-flex; background: var(--sunken); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { padding: 4px 11px; border-radius: 7px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(20, 24, 50, .08); }
.seg.big button { padding: 6px 16px; font-size: 13.5px; }
.empty-list { padding: 22px 14px; text-align: center; color: var(--muted); font-size: 13px; border: 1px dashed var(--line-2); border-radius: var(--r-row); }

/* ============ 任务行 ============ */
.task {
  position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px 9px 13px; border-radius: var(--r-row);
  background: var(--surface); transition: background .12s;
}
.task::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--c); }
.task:hover { background: var(--surface-2); }
.task[draggable="true"] { cursor: grab; }
.task.dragging { opacity: .4; }
.check {
  width: 18px; height: 18px; margin-top: 1px; border-radius: 6px; border: 1.6px solid var(--line-2); display: grid; place-items: center;
  flex-shrink: 0; color: transparent; transition: all .15s;
}
.check .ic { width: 12px; height: 12px; stroke-width: 3; }
.check:hover { border-color: var(--c); color: color-mix(in srgb, var(--c) 60%, transparent); }
.task.done .check { background: var(--c); border-color: var(--c); color: #fff; }
.t-body { flex: 1; min-width: 0; cursor: pointer; }
.t-title { font-size: 14px; line-height: 1.45; word-break: break-word; }
.task.done .t-title { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--line-2); }
.t-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 3px; font-size: 12px; color: var(--muted); }
.t-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.t-meta .ic { width: 12px; height: 12px; }
.m-cat { color: color-mix(in srgb, var(--c) 70%, var(--muted)); }
.m-cat i { font-style: normal; margin: 0 3px; color: var(--faint); }
.badge { font-size: 11px; padding: 0 6px; border-radius: 5px; line-height: 17px; }
.badge.main { background: var(--brand-wash); color: var(--brand-ink); font-weight: 600; }
.m-due.near { color: var(--ink-2); }
.m-due.soon { color: var(--warn); font-weight: 600; }
.m-due.over { color: var(--danger); font-weight: 600; }
.task.done .m-due { display: none; }
.prio { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); margin-top: 7px; flex-shrink: 0; }
.task.compact { padding: 6px 8px 6px 11px; gap: 8px; }
.task.compact::before { top: 7px; bottom: 7px; }
.task.compact .t-title { font-size: 13px; }
.task.compact .check { width: 16px; height: 16px; border-radius: 5px; }
.task.compact .t-meta { font-size: 11.5px; margin-top: 1px; }
.task.compact .prio { margin-top: 6px; }

/* ============ 今天 ============ */
.day-hero { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: end; padding: 8px 4px 20px; }
.dh-date { display: flex; align-items: center; gap: 14px; }
.dh-num { font-family: var(--display); font-size: 84px; line-height: .82; font-weight: 600; letter-spacing: -3px; color: var(--ink); font-variant-numeric: tabular-nums;
  font-variation-settings: "opsz" 96; }
.dh-side { display: flex; flex-direction: column; gap: 4px; }
.dh-wd { font-size: 20px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.dh-wd em { font-style: normal; font-size: 12px; font-weight: 600; color: var(--brand-ink); background: var(--brand-wash); padding: 2px 8px; border-radius: 999px; }
.dh-ym { font-family: var(--display); color: var(--muted); font-size: 14px; }
.dh-nav { display: flex; align-items: center; gap: 2px; margin-left: 8px; align-self: center; }
.dh-summary { justify-self: end; width: min(520px, 100%); }
.dh-summary p { color: var(--ink-2); font-size: 14.5px; margin-bottom: 10px; }
.cap-bar { height: 8px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.cap-bar span { display: block; height: 100%; border-radius: 99px; background: var(--brand); transition: width .4s ease; }
.cap.tight .cap-bar span { background: var(--warn); }
.cap.over .cap-bar span { background: var(--danger); }
.cap-legend { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cap.over .cap-legend span:first-child { color: var(--danger); font-weight: 600; }

/* 截止雷达 */
.radar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-panel); box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.rg { padding: 14px 16px 12px; border-left: 1px solid var(--line); min-width: 0; }
.rg:first-child { border-left: 0; }
.rg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.rg-n { font-family: var(--display); font-size: 30px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.rg-label { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.rg.r-over:not(.empty) { background: linear-gradient(var(--danger-wash), var(--danger-wash)); }
.rg.r-over:not(.empty) .rg-n, .rg.r-over:not(.empty) .rg-label { color: var(--danger); }
.rg.r-today:not(.empty) .rg-n, .rg.r-today:not(.empty) .rg-label { color: var(--warn); }
.rg.empty .rg-n { color: var(--faint); }
.rg ul { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.rg li { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 6px; margin: 0 -6px; border-radius: 6px; cursor: pointer; min-width: 0; }
.rg li:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.rg li .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.rg li .rt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg li .rw { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.rg li.more { color: var(--brand); font-size: 12.5px; }
.rg li.none { color: var(--faint); cursor: default; }
.rg li.none:hover { background: none; }

.day-grid { display: grid; grid-template-columns: minmax(320px, 5fr) minmax(0, 7fr); gap: 18px; align-items: start; }

/* 时间轴 */
.timeline-panel { position: sticky; top: 78px; max-height: calc(100vh - 96px); overflow-y: auto; scrollbar-width: thin; }
.allday { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; padding-left: 46px; }
.ad { font-size: 12px; padding: 3px 9px; border-radius: 6px; background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: color-mix(in srgb, var(--c) 70%, var(--ink)); }
.timeline { position: relative; margin-left: 46px; margin-top: 6px; }
.hr { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.hr span { position: absolute; left: -46px; top: -8px; width: 38px; text-align: right; font-size: 11px; color: var(--faint); font-family: var(--display); font-variant-numeric: tabular-nums; }
.gap { position: absolute; left: 2px; right: 2px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(-45deg, transparent 0 6px, color-mix(in srgb, var(--brand) 5%, transparent) 6px 12px); pointer-events: none; }
.gap span { font-size: 11.5px; color: color-mix(in srgb, var(--brand) 55%, var(--muted)); background: var(--surface); padding: 1px 8px; border-radius: 99px; }
.blk { position: absolute; border-radius: 8px; padding: 4px 8px; overflow: hidden; display: flex; flex-direction: column; font-size: 12px; line-height: 1.35; z-index: 2; }
.blk .bt { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blk .bm { font-size: 11px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.blk.ev { background: color-mix(in srgb, var(--c) 16%, var(--surface)); color: color-mix(in srgb, var(--c) 72%, var(--ink)); border-left: 3px solid var(--c); border-radius: 0 8px 8px 0; }
.blk.ev.plain { background: var(--sunken); color: var(--ink-2); border-left-color: var(--event); }
.blk.tk { background: var(--surface); border: 1.5px dashed color-mix(in srgb, var(--c) 70%, transparent); color: var(--ink); cursor: grab; }
.blk.tk::before { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--c) 7%, transparent); pointer-events: none; }
.blk.tk.done { opacity: .5; }
.blk.tk.done .bt { text-decoration: line-through; }
.blk .unpin { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 5px; display: none; place-items: center; color: var(--muted); background: var(--surface); }
.blk .unpin .ic { width: 11px; height: 11px; }
.blk.tk:hover .unpin { display: grid; }
.now { position: absolute; left: -6px; right: 0; height: 0; border-top: 2px solid var(--danger); z-index: 3; pointer-events: none; }
.now::before { content: ""; position: absolute; left: -4px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.now span { position: absolute; right: 0; top: -19px; font-size: 11px; font-weight: 600; color: var(--danger); font-variant-numeric: tabular-nums; background: var(--surface); padding: 0 4px; border-radius: 4px; }
.timeline.drop-over { background: color-mix(in srgb, var(--brand) 4%, transparent); border-radius: 8px; }
.drop-line { position: absolute; left: 0; right: 0; border-top: 2px solid var(--brand); z-index: 5; pointer-events: none; }
.drop-line::after { content: attr(data-label); position: absolute; left: 6px; top: -10px; background: var(--brand); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 4px; font-weight: 600; }

/* 今日任务 */
.progress-pill { margin-left: auto; font-family: var(--display); font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--sunken); padding: 2px 10px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.day-list { display: flex; flex-direction: column; gap: 2px; min-height: 48px; border-radius: var(--r-row); }
.day-list.drop-over { background: color-mix(in srgb, var(--brand) 5%, transparent); outline: 1.5px dashed color-mix(in srgb, var(--brand) 45%, transparent); }
.inline-add { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 0 12px; height: 40px; border-radius: var(--r-row); color: var(--muted); }
.inline-add:focus-within { background: var(--surface-2); color: var(--brand); }
.inline-add input { flex: 1; border: 0; background: none; outline: none; font-size: 13.5px; color: var(--ink); min-width: 0; }
.inline-add input::placeholder { color: var(--faint); }
.group { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.g-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-size: 12.5px; font-weight: 650; color: var(--ink-2); padding: 0 4px; }
.group.rolled { margin-top: 0; padding: 10px 10px 8px; border: 0; background: var(--warn-wash); border-radius: 12px; margin-bottom: 12px; }
.group.rolled .g-head { color: var(--warn); }
.group.rolled .task { background: transparent; }
.pick-row { display: flex; align-items: center; gap: 8px; }
.pick-row .task { flex: 1; min-width: 0; }
.pick-row .btn { opacity: 0; transition: opacity .15s; }
.pick-row:hover .btn, .pick-row:focus-within .btn { opacity: 1; }

/* ============ 计划 ============ */
.plan-bar { display: flex; align-items: center; gap: 18px; margin: 4px 0 16px; flex-wrap: wrap; }
.pb-nav { display: flex; align-items: center; gap: 6px; }
.pb-nav h2 { font-family: var(--display); font-size: 22px; font-weight: 600; min-width: 168px; text-align: center; letter-spacing: -.2px; }
.pb-stats { margin-left: auto; display: flex; gap: 18px; color: var(--muted); font-size: 13px; }
.pb-stats b { font-family: var(--display); font-size: 18px; color: var(--ink); margin-right: 2px; font-weight: 600; }
.plan-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.plan-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.week { display: grid; grid-template-columns: repeat(7, minmax(132px, 1fr)); gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.wcol { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; min-height: 380px; display: flex; flex-direction: column; padding: 8px 6px 8px; transition: border-color .15s, background .15s; }
.wcol.past { background: var(--surface-2); }
.wcol.past .wcol-head .dn { color: var(--faint); }
.wcol.is-today { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-wash); }
.wcol.drop-over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 5%, var(--surface)); }
.wcol-head { display: flex; align-items: baseline; justify-content: space-between; padding: 2px 6px 8px; border-radius: 8px; text-align: left; }
.wcol-head:hover .dn { color: var(--brand); }
.wcol-head .wd { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.wcol-head .dn { font-family: var(--display); font-size: 24px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.wcol.is-today .wcol-head .wd, .wcol.is-today .wcol-head .dn { color: var(--brand); }
.wdues { display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; }
.due-chip { display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 4px 7px; border-radius: 7px; cursor: pointer;
  background: color-mix(in srgb, var(--c) 12%, var(--surface)); color: color-mix(in srgb, var(--c) 75%, var(--ink)); }
.due-chip .ic { width: 12px; height: 12px; }
.due-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wevents { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px dashed var(--line); }
.wev { display: flex; gap: 6px; font-size: 11.5px; padding: 2px 6px; color: var(--ink-2); min-width: 0; }
.wev .wt { color: color-mix(in srgb, var(--c) 70%, var(--muted)); font-variant-numeric: tabular-nums; flex-shrink: 0; font-weight: 600; }
.wev .wn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wtasks { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.wtasks .task { background: transparent; }
.wtasks .task:hover { background: var(--surface-2); }
.wfoot { display: flex; flex-direction: column; gap: 0; font-size: 11px; color: var(--faint); padding: 6px 6px 0; font-variant-numeric: tabular-nums; }

.dist-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--sunken); }
.dist-bar span { background: var(--c); min-width: 4px; }
.dist-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.dist-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dist-legend i { width: 9px; height: 9px; border-radius: 3px; background: var(--c); }
.dist-legend b { font-family: var(--display); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.dist-legend em { font-style: normal; color: var(--faint); font-variant-numeric: tabular-nums; }

.pools { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 78px; max-height: calc(100vh - 96px); overflow-y: auto; scrollbar-width: thin; }
.pool { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 10px 10px; transition: border-color .15s, background .15s; }
.pool.drop-over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 5%, var(--surface)); }
.pool-head { display: flex; justify-content: space-between; align-items: center; padding: 0 4px 8px; font-size: 13px; font-weight: 650; }
.pool-head .count { font-family: var(--display); color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.pool-list { display: flex; flex-direction: column; gap: 1px; }
.pool.collapsed .pool-list { max-height: 220px; overflow-y: auto; }
.pool-empty { font-size: 12.5px; color: var(--faint); padding: 10px 6px 4px; line-height: 1.6; }
.ring-wrap { display: flex; align-items: center; gap: 12px; padding: 2px 4px 12px; }
.ring { width: 54px; height: 54px; transform: rotate(-90deg); flex-shrink: 0; }
.ring circle { fill: none; stroke-width: 4; }
.ring .track { stroke: var(--sunken); }
.ring .val { stroke: var(--brand); stroke-linecap: round; transition: stroke-dasharray .5s; }
.ring-wrap b { display: block; font-family: var(--display); font-size: 22px; font-weight: 600; line-height: 1.1; }
.ring-wrap span { font-size: 12px; color: var(--muted); }
.due-list { display: flex; flex-direction: column; gap: 1px; }
.dl-row { display: grid; grid-template-columns: 38px 1fr auto; gap: 8px; align-items: center; padding: 6px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.dl-row:hover { background: var(--surface-2); }
.dl-date { font-family: var(--display); font-weight: 600; color: color-mix(in srgb, var(--c) 75%, var(--ink)); font-variant-numeric: tabular-nums; }
.dl-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-c { font-size: 11.5px; color: var(--muted); }
.dl-row.soon .dl-c { color: var(--warn); font-weight: 600; }
.dl-row.over .dl-c { color: var(--danger); font-weight: 600; }

/* 月视图 */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; box-shadow: var(--shadow); }
.mwd { padding: 10px 10px 8px; font-size: 12px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
.mcell { min-height: 118px; padding: 6px 6px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; transition: background .15s; min-width: 0; }
.mcell:nth-child(7n + 7) { border-right: 0; }
.mcell.out { background: var(--surface-2); }
.mcell.out .mnum { color: var(--faint); }
.mcell.drop-over { background: color-mix(in srgb, var(--brand) 7%, var(--surface)); }
.mnum { align-self: flex-start; font-family: var(--display); font-size: 14px; font-weight: 600; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.mnum:hover { background: var(--sunken); }
.mcell.is-today .mnum { background: var(--brand); color: #fff; }
.mcell.past:not(.is-today) .mnum { color: var(--muted); }
.mdues { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.mdue { font-size: 11.5px; padding: 2px 6px; border-radius: 5px; cursor: pointer; background: color-mix(in srgb, var(--c) 13%, var(--surface)); color: color-mix(in srgb, var(--c) 75%, var(--ink));
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; border-left: 2.5px solid var(--c); }
.mdue.done { opacity: .5; text-decoration: line-through; }
.mmore { font-size: 11px; color: var(--muted); padding-left: 4px; }
.mfoot { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 12px; }
.mtasks { display: flex; gap: 3px; flex-wrap: wrap; font-size: 10px; color: var(--muted); align-items: center; }
.mtasks i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.mtasks i.d { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c); }
.mev { font-size: 10.5px; color: var(--faint); white-space: nowrap; }

/* ============ 全部任务 ============ */
.all-bar { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; width: 280px; color: var(--muted); }
.search:focus-within { border-color: var(--brand); }
.search input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; color: var(--ink); }
.comp { display: flex; gap: 3px; height: 30px; margin-bottom: 18px; }
.comp button { background: color-mix(in srgb, var(--c) 18%, var(--surface)); border-radius: 7px; min-width: 52px; overflow: hidden; display: flex; align-items: center; padding: 0 10px;
  color: color-mix(in srgb, var(--c) 75%, var(--ink)); font-size: 12px; font-weight: 600; transition: background .15s; }
.comp button:first-child { border-radius: 10px 7px 7px 10px; }
.comp button:last-child { border-radius: 7px 10px 10px 7px; }
.comp button:hover, .comp button.on { background: var(--c); color: #fff; }
.comp button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; }
.cat-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-left: 4px solid var(--c); }
.cat-head h2 { font-size: 17px; }
.cat-count { font-size: 12.5px; color: var(--muted); }
.cat-toggle { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); }
.cat-toggle:hover { background: var(--sunken); }
.cat-toggle .ic { transition: transform .2s; }
.cat-sec.collapsed .cat-toggle .ic { transform: rotate(-90deg); }
.cat-sec.collapsed .cat-body { display: none; }
.cat-body { padding: 0 16px 14px 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 12px; }
.proj { border: 1px solid var(--line); border-radius: 12px; padding: 10px 8px 6px; background: var(--surface); min-width: 0; }
.proj.loose { border-style: dashed; }
.proj-head { display: flex; align-items: center; gap: 10px; padding: 0 4px 8px; }
.pname { font-weight: 650; font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbar { width: 64px; height: 5px; border-radius: 99px; background: var(--sunken); overflow: hidden; flex-shrink: 0; }
.pbar span { display: block; height: 100%; background: var(--c); border-radius: 99px; }
.pmeta { font-family: var(--display); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 28px; }
.pdue { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); min-width: 48px; }
.pdue .ic { width: 12px; height: 12px; }
.pdue.soon { color: var(--warn); font-weight: 600; }
.proj-head .icon-btn { opacity: 0; }
.proj:hover .proj-head .icon-btn, .proj-head .icon-btn:focus-visible { opacity: 1; }
.proj-tasks { display: flex; flex-direction: column; gap: 1px; }

/* ============ 收件箱抽屉 ============ */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 400px; max-width: 100vw; background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-pop); z-index: 50; transform: translateX(105%); transition: transform .25s ease; display: flex; flex-direction: column; padding: 18px 16px; }
.drawer.on { transform: none; }
.dr-head { display: flex; align-items: center; gap: 10px; }
.dr-head h2 { font-size: 18px; }
.dr-head .icon-btn { margin-left: auto; }
.dr-hint { font-size: 12.5px; color: var(--muted); margin: 8px 0 14px; line-height: 1.6; }
.dr-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.dr-item { border: 1px solid var(--line); border-radius: 12px; padding: 4px 4px 8px; }
.dr-actions { display: flex; gap: 4px; padding: 2px 8px 0 36px; flex-wrap: wrap; }
.dr-actions button { font-size: 12px; padding: 3px 9px; border-radius: 6px; background: var(--sunken); color: var(--ink-2); }
.dr-actions button:hover { background: var(--brand-wash); color: var(--brand-ink); }

/* ============ 弹窗 ============ */
.modal-root { position: fixed; inset: 0; z-index: 60; display: none; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; overflow-y: auto; }
.modal-root.on { display: flex; }
.scrim { position: fixed; inset: 0; background: rgba(15, 17, 30, .38); backdrop-filter: blur(2px); }
.modal { position: relative; width: 600px; max-width: 100%; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-pop); padding: 20px 22px; animation: pop .18s ease; }
.modal.wide { width: 720px; }
@keyframes pop { from { transform: translateY(8px) scale(.985); opacity: 0; } }
.ed-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.ed-head h2 { font-size: 18px; flex: 1; }
.ed-title { flex: 1; font-size: 18px; font-weight: 600; border: 0; outline: 0; background: none; padding: 4px 0; border-bottom: 1.5px solid var(--line); min-width: 0; }
.ed-title:focus { border-bottom-color: var(--brand); }
.small-form .ed-title { width: 100%; margin-bottom: 8px; }
.ed-grid { display: grid; grid-template-columns: 88px 1fr; gap: 14px 14px; align-items: start; }
.ed-grid > .seg, .row-inline .seg { justify-self: start; }
.ed-grid > label { font-size: 13px; color: var(--muted); padding-top: 6px; }
.cat-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-pick button { padding: 4px 11px; border-radius: 999px; font-size: 12.5px; border: 1px solid var(--line); color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.cat-pick button::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.cat-pick button.on { background: color-mix(in srgb, var(--c) 14%, var(--surface)); border-color: var(--c); color: var(--ink); font-weight: 600; }
.row-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
input[type=date], input[type=time], input[type=month], input[type=number], select, textarea, .row-inline input:not([type]), .cat-row input, .rule input {
  height: 32px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); padding: 0 9px; outline: none; font-size: 13px; }
textarea { height: auto; width: 100%; padding: 8px 10px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
.num { width: 76px; }
.row-inline input.grow { flex: 1; min-width: 120px; }
.scope-extra { display: none; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.scope-extra.on { display: flex; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.6; }
.days { display: flex; gap: 4px; }
.days button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.days button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.quick-dates { display: inline-flex; gap: 4px; }
.quick-dates button { font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--sunken); color: var(--ink-2); }
.quick-dates button:hover { color: var(--ink); }
.ed-foot { display: flex; align-items: center; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }

.settings section { padding: 14px 0; border-top: 1px solid var(--line); }
.settings section:first-of-type { border-top: 0; padding-top: 0; }
.settings h3 { font-size: 14px; margin-bottom: 4px; }
.settings .hint { margin-bottom: 10px; }
.cat-edit, .rules { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.cat-row { display: grid; grid-template-columns: 36px 120px 1fr; gap: 8px; }
.cat-row input[type=color] { padding: 2px; width: 36px; cursor: pointer; }
.rule { display: grid; grid-template-columns: 1fr 140px 32px; gap: 8px; }
.hours { margin-top: 12px; font-size: 13px; color: var(--ink-2); }

/* ============ 提示条 ============ */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--surface); padding: 10px 14px 10px 16px; border-radius: 12px;
  font-size: 13.5px; display: flex; align-items: center; gap: 14px; opacity: 0; pointer-events: none; transition: all .22s ease; z-index: 70; box-shadow: var(--shadow-pop); max-width: calc(100vw - 32px); }
.toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { color: var(--brand-wash); font-weight: 650; font-size: 13px; flex-shrink: 0; }

/* ============ 响应式 ============ */
@media (max-width: 1180px) {
  .plan-grid { grid-template-columns: 1fr; }
  .pools { position: static; max-height: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .day-hero { grid-template-columns: 1fr; gap: 14px; }
  .dh-summary { justify-self: stretch; width: 100%; }
}
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .quick { order: 3; flex-basis: 100%; max-width: none; }
  .tb-btn span { display: none; }
  .filters { padding: 0 14px 10px; }
  .view { padding: 4px 14px 40px; }
  .day-grid { grid-template-columns: 1fr; }
  .tasks-panel { order: -1; }
  .timeline-panel { position: static; max-height: none; }
  .radar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rg:nth-child(3) { border-left: 0; }
  .rg:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .week { grid-template-columns: repeat(7, 150px); }
  .cat-body { grid-template-columns: 1fr; padding: 0 10px 12px; }
  .mcell { min-height: 84px; padding: 4px; }
  .mdue { font-size: 10.5px; padding: 1px 4px; }
  .mev { display: none; }
  .search { width: 100%; }
  .pick-row .btn { opacity: 1; }
  .proj-head .icon-btn { opacity: 1; }
  .ed-grid { grid-template-columns: 1fr; gap: 6px; }
  .ed-grid > label { padding-top: 8px; }
  .cat-row { grid-template-columns: 36px 1fr; }
  .cat-row .kw { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .dh-num { font-size: 64px; }
  .tabs a { padding: 6px 10px; }
  .pb-nav h2 { min-width: 0; font-size: 18px; }
  .pb-stats { margin-left: 0; width: 100%; }
  .drawer { width: 100vw; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
