/* 待办台 V1 · 方案 A 素白克制
   结构：桌面三栏（240 / 自适应 / 380），<1280 右栏改覆盖抽屉，<768 单栏 + 底部四 Tab。
   约定：所有横向容器用 minmax(0,1fr)，长文本一律 ellipsis，保证 390px 零横向溢出。 */

:root {
  --bg: #fbfbfa; --panel: #fff; --panel2: #f6f6f4; --ink: #1b1c1e; --ink2: #5b6068;
  --ink3: #8d939c; --line: #e7e6e3; --line2: #f1f0ed; --accent: #2f5bd0; --accent-soft: #eef2fb;
  --p1: #cf3b2e; --p2: #bf7411; --p3: #2f5bd0; --p4: #8d939c; --ok: #12784a;
  --danger: #cf3b2e; --shadow: 0 1px 2px rgba(20,22,26,.05), 0 8px 24px rgba(20,22,26,.06);
  --r: 10px; --r2: 14px; --tab-h: 52px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
          "Noto Sans CJK SC", "Source Han Sans SC", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
[data-theme="dark"] {
  --bg: #16181c; --panel: #1d2025; --panel2: #23272d; --ink: #e9eaec; --ink2: #a7adb6;
  --ink3: #7c838d; --line: #2c3138; --line2: #24282e; --accent: #6f9bff; --accent-soft: #222c40;
  --p1: #ff6b5e; --p2: #e5a54a; --p3: #6f9bff; --p4: #7c838d; --ok: #4ac08a;
  --danger: #ff6b5e; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
}
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --bg: #16181c; --panel: #1d2025; --panel2: #23272d; --ink: #e9eaec; --ink2: #a7adb6;
    --ink3: #7c838d; --line: #2c3138; --line2: #24282e; --accent: #6f9bff; --accent-soft: #222c40;
    --p1: #ff6b5e; --p2: #e5a54a; --p3: #6f9bff; --p4: #7c838d; --ok: #4ac08a;
    --danger: #ff6b5e; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); font: 14px/1.55 var(--font);
  -webkit-text-size-adjust: 100%; overflow: hidden;
  font-feature-settings: "tnum" 1;
}
body.locked { overflow: hidden; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--ink3); background-clip: content-box; }

/* ---------------- 通用控件 ---------------- */
.inp {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--ink); outline: none; transition: border-color .12s, box-shadow .12s;
}
.inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inp::placeholder { color: var(--ink3); }
textarea.inp { resize: vertical; min-height: 62px; line-height: 1.6; }
.sel {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  color: var(--ink); outline: none; max-width: 100%;
}
.sel:focus { border-color: var(--accent); }
.btn {
  padding: 7px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--panel2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink2); }
.btn.ghost:hover { background: var(--panel2); color: var(--ink); }
.btn.compact { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.ico {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 8px; background: transparent; cursor: pointer; color: var(--ink2);
  flex: none;
}
.ico:hover { background: var(--panel2); color: var(--ink); }
.fld { display: block; margin: 10px 0; }
.fl { display: block; font-size: 12px; color: var(--ink3); margin-bottom: 4px; letter-spacing: .02em; }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1 1 auto; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  background: var(--panel2); color: var(--ink2); font-size: 12px; border: 1px solid var(--line2);
  white-space: nowrap;
}
.chip.hit { cursor: pointer; }
.chip.hit:hover { border-color: var(--line); color: var(--ink); }
.chip.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip .cx { font-style: normal; margin-left: 2px; color: var(--ink3); cursor: pointer; }
.chip .cx:hover { color: var(--danger); }
.pill {
  font-size: 12px; color: var(--ink3); padding: 3px 9px; border-radius: 999px; background: var(--panel2);
  white-space: nowrap;
}
.pill.warn { color: var(--p2); background: #fdf3e3; }
.pill.err { color: var(--danger); background: #fdecea; }
.pill.ok { color: var(--ok); }
@media (prefers-color-scheme: dark) { [data-theme="auto"] .pill.warn { background: #332a17; } [data-theme="auto"] .pill.err { background: #3a221f; } }
[data-theme="dark"] .pill.warn { background: #332a17; }
[data-theme="dark"] .pill.err { background: #3a221f; }
.sec-title { font-size: 11px; color: var(--ink3); letter-spacing: .08em; margin: 14px 0 6px; padding: 0 10px; }
.hr { height: 1px; background: var(--line2); margin: 12px 0; }
.tiny { font-size: 12px; color: var(--ink3); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- 登录 ---------------- */
.auth { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); padding: 20px; z-index: 40; }
.auth-card {
  width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r2); padding: 26px 24px 22px; box-shadow: var(--shadow);
}
.auth-logo { font-size: 22px; font-weight: 650; letter-spacing: .04em; }
.auth-sub { margin: 4px 0 18px; color: var(--ink3); font-size: 12.5px; }
.tabs2 { display: flex; gap: 6px; background: var(--panel2); padding: 4px; border-radius: 9px; margin-bottom: 6px; }
.t2 { flex: 1; padding: 6px 0; border: 0; border-radius: 6px; background: transparent; color: var(--ink2); cursor: pointer; }
.t2.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
.auth-err { margin: 8px 0 0; color: var(--danger); font-size: 12.5px; }
.auth-tip { margin: 14px 0 0; font-size: 12px; color: var(--ink3); text-align: center; }
.auth .btn.block { margin-top: 14px; }

/* ---------------- 布局 ---------------- */
.app {
  display: grid; height: 100dvh;
  grid-template-columns: 240px minmax(0, 1fr) 380px;
  grid-template-rows: 52px minmax(0, 1fr);
  grid-template-areas: "top top top" "side main detail";
}
body.no-detail .app { grid-template-columns: 240px minmax(0, 1fr) 0; }
.top {
  grid-area: top; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  border-bottom: 1px solid var(--line); background: var(--panel); min-width: 0;
}
.brand { font-weight: 650; letter-spacing: .04em; flex: none; }
.searchbox { flex: 1 1 auto; min-width: 0; max-width: 420px; margin-left: 6px; }
.searchbox .inp { padding: 5px 10px; background: var(--panel2); border-color: transparent; }
.searchbox .inp:focus { background: var(--panel); border-color: var(--accent); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
#menuBtn { display: none; }

.side {
  grid-area: side; overflow-y: auto; border-right: 1px solid var(--line); background: var(--panel);
  padding: 6px 0 18px; min-width: 0;
}
.main { grid-area: main; display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--bg); }
.detail {
  grid-area: detail; overflow-y: auto; border-left: 1px solid var(--line); background: var(--panel);
  min-width: 0; padding: 4px 0 24px;
}

/* ---------------- 侧栏条目 ---------------- */
.nav-i {
  display: flex; align-items: center; gap: 9px; padding: 7px 12px; margin: 1px 8px; border-radius: 8px;
  cursor: pointer; color: var(--ink2); user-select: none; min-width: 0;
}
.nav-i:hover { background: var(--panel2); color: var(--ink); }
.nav-i.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-i .ni { width: 16px; text-align: center; flex: none; font-size: 13px; opacity: .9; }
.nav-i .nl { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-i .nc { font-size: 12px; color: var(--ink3); font-variant-numeric: tabular-nums; flex: none; }
.nav-i.on .nc { color: var(--accent); }
.nav-i .dot { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.nav-i.sub { padding-left: 26px; }
.nav-i.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.nav-fold { display: flex; align-items: center; gap: 6px; }
.nav-fold .caret { cursor: pointer; color: var(--ink3); width: 14px; text-align: center; }
.side-foot { margin-top: 10px; padding: 8px 12px 0; border-top: 1px solid var(--line2); }
.side-foot .row { margin: 5px 0; }

/* ---------------- 快速添加 ---------------- */
.qa { padding: 12px 16px 10px; background: var(--bg); }
.qa-inp { padding: 10px 12px; font-size: 15px; background: var(--panel); box-shadow: var(--shadow); border-color: transparent; }
.qa-inp:focus { border-color: var(--accent); }
.qa-prev {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 2px 0; align-items: center;
  font-size: 12.5px; color: var(--ink2);
}
.qa-prev .qt { color: var(--ink); font-weight: 600; }
.qa-prev .qtitle-raw { color: var(--ink3); }

/* ---------------- 列表 ---------------- */
.list-head {
  display: flex; align-items: center; gap: 8px; padding: 6px 16px 8px; min-height: 30px; flex: none; flex-wrap: wrap;
}
.list-head h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: .01em; }
.list-head .sub { color: var(--ink3); font-size: 12.5px; }
.list-head .sp { margin-left: auto; }
.list { flex: 1 1 auto; overflow-y: auto; padding: 0 12px 24px; min-width: 0; overscroll-behavior: contain; }
.grp { margin: 10px 0 0; }
.grp-h {
  display: flex; align-items: center; gap: 8px; padding: 5px 6px; cursor: pointer; color: var(--ink2);
  font-size: 12.5px; font-weight: 600; letter-spacing: .02em; user-select: none; position: sticky; top: 0;
  background: linear-gradient(var(--bg) 70%, rgba(251,251,250,0)); z-index: 1;
}
.grp-h .caret { width: 12px; color: var(--ink3); }
.grp-h .gn { flex: none; }
.grp-h .gc { color: var(--ink3); font-weight: 400; }
.grp-h .ln { flex: 1 1 auto; height: 1px; background: var(--line2); }
.grp-h .duejump { color: var(--accent); font-weight: 600; cursor: pointer; }

.task {
  display: flex; align-items: flex-start; gap: 9px; padding: 8px 8px; border-radius: var(--r);
  cursor: default; min-width: 0; position: relative; border: 1px solid transparent;
}
.task + .task { margin-top: 1px; }
.task:hover { background: var(--panel); }
.task.sel { background: var(--panel); border-color: var(--line); box-shadow: var(--shadow); }
.task.p1 { box-shadow: inset 3px 0 0 var(--p1); }
.task.p2 { box-shadow: inset 3px 0 0 var(--p2); }
.task.done .ttl { color: var(--ink3); text-decoration: line-through; }
.task.trashed .ttl { color: var(--ink3); }
.cbx {
  width: 18px; height: 18px; border: 1.5px solid var(--ink3); border-radius: 50%; flex: none; cursor: pointer;
  margin-top: 2px; display: grid; place-items: center; background: transparent; transition: border-color .12s, background .12s;
}
.cbx:hover { border-color: var(--ok); background: var(--ok); }
.cbx:hover::after { content: ""; width: 6px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(42deg) translateY(-1px); }
.cbx.on { border-color: var(--ok); background: var(--ok); }
.cbx.on::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(42deg) translateY(-1px); }
.cbx.sub-c { border-radius: 5px; width: 16px; height: 16px; }
.tb { flex: 1 1 auto; min-width: 0; }
.ttl { font-size: 14.5px; line-height: 1.45; word-break: break-word; }
.meta { display: flex; flex-wrap: wrap; gap: 5px 7px; margin-top: 4px; align-items: center; font-size: 12px; color: var(--ink3); }
.meta .m { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.meta .due-over { color: var(--danger); font-weight: 600; }
.meta .due-today { color: var(--accent); font-weight: 600; }
.meta .lv { color: var(--ink3); }
.meta .pips { letter-spacing: -1px; }
.meta .prio-1 { color: var(--p1); } .meta .prio-2 { color: var(--p2); } .meta .prio-3 { color: var(--p3); }
.badge {
  font-size: 11px; padding: 1px 6px; border-radius: 999px; background: var(--panel2); color: var(--ink2);
  border: 1px solid var(--line2);
}
.task .acts { display: flex; gap: 2px; flex: none; opacity: 0; transition: opacity .12s; }
.task:hover .acts, .task.sel .acts { opacity: 1; }
.task .acts .ico { width: 26px; height: 26px; font-size: 13px; }
.task.dragging { opacity: .4; }
.task.drop-before::before, .task.drop-after::after {
  content: ""; position: absolute; left: 8px; right: 8px; height: 2px; background: var(--accent); border-radius: 2px;
}
.task.drop-before::before { top: -1px; }
.task.drop-after::after { bottom: -1px; }
.subs { margin: 6px 0 0 2px; display: flex; flex-direction: column; gap: 2px; }
.sub {
  display: flex; align-items: center; gap: 8px; padding: 3px 4px; border-radius: 7px; min-width: 0; font-size: 13px;
}
.sub:hover { background: var(--panel2); }
.sub .ttl { font-size: 13px; }
.sub-add { display: flex; align-items: center; gap: 8px; padding: 3px 4px; }
.sub-add input { flex: 1; padding: 4px 8px; border: 1px dashed var(--line); border-radius: 7px; background: transparent; }
.sub-add input:focus { border-style: solid; border-color: var(--accent); outline: none; }
.progress { height: 3px; background: var(--line2); border-radius: 3px; width: 46px; overflow: hidden; flex: none; }
.progress > i { display: block; height: 100%; background: var(--ok); }

.empty { padding: 40px 24px; text-align: center; color: var(--ink3); }
.empty .big { font-size: 30px; opacity: .35; margin-bottom: 8px; }

/* ---------------- 详情 ---------------- */
.d-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line2); position: sticky; top: 0; background: var(--panel); z-index: 2; }
.d-body { padding: 12px 16px 0; }
.d-title { border: 0; outline: none; width: 100%; font-size: 17px; font-weight: 600; line-height: 1.45; background: transparent; resize: none; overflow: hidden; padding: 0; }
.d-note { border: 0; outline: none; width: 100%; font-size: 13.5px; line-height: 1.65; background: transparent; min-height: 44px; resize: none; color: var(--ink2); padding: 0; margin-top: 6px; }
.d-sec { margin: 14px 0; }
.d-sec > .sh { font-size: 11px; color: var(--ink3); letter-spacing: .08em; margin-bottom: 6px; }
.kv { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 6px 10px; align-items: center; }
.kv .k { color: var(--ink3); font-size: 12.5px; }
.kv .v { min-width: 0; }
.kv .v .sel, .kv .v .inp { width: 100%; }
.tag-box { display: flex; flex-wrap: wrap; gap: 5px; }
.timeline { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; color: var(--ink2); }
.timeline .tl { display: flex; gap: 8px; align-items: baseline; }
.timeline .td { color: var(--ink3); font-variant-numeric: tabular-nums; flex: none; }
.attach { display: flex; align-items: center; gap: 8px; padding: 4px 0; min-width: 0; }
.attach a { color: var(--accent); text-decoration: none; }
.attach a:hover { text-decoration: underline; }
.rule-prev { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.d-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 16px 6px; border-top: 1px solid var(--line2); margin-top: 12px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { width: 34px; height: 20px; appearance: none; background: var(--line); border-radius: 999px; position: relative; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }

/* ---------------- 弹层 ---------------- */
.mask { position: fixed; inset: 0; background: rgba(18,20,24,.36); display: grid; place-items: center; z-index: 60; padding: 18px; animation: fade .12s ease-out; }
.panel {
  width: 100%; max-width: 480px; max-height: min(84vh, 760px); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); box-shadow: var(--shadow); overflow: hidden;
  animation: pop .14s ease-out;
}
.panel.wide { max-width: 720px; }
.panel.small { max-width: 380px; }
.ph { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line2); flex: none; }
.ph h3 { margin: 0; font-size: 15px; font-weight: 650; flex: 1; }
.ph .x { border: 0; background: transparent; font-size: 19px; line-height: 1; color: var(--ink3); cursor: pointer; }
.ph .x:hover { color: var(--ink); }
.pb { padding: 14px; overflow-y: auto; flex: 1 1 auto; }
.pb .say { margin: 0; color: var(--ink2); line-height: 1.7; }
.pf { display: flex; gap: 8px; justify-content: flex-end; padding: 11px 14px; border-top: 1px solid var(--line2); flex: none; }
.pf .left { margin-right: auto; }
.cond { display: grid; grid-template-columns: 116px minmax(0, 1fr) 30px; gap: 8px; align-items: center; margin-bottom: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.99); } }

/* ---------------- 吐司 / 横幅 ---------------- */
.toasts {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; display: flex; flex-direction: column;
  gap: 8px; z-index: 80; align-items: center; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px 9px 14px; border-radius: 999px;
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow); pointer-events: auto; animation: rise .16s ease-out;
  max-width: min(92vw, 560px);
}
[data-theme="dark"] .toast, [data-theme="auto"] .toast { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.toast .tm { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast .ta {
  border: 0; background: transparent; color: var(--accent); font-weight: 600; cursor: pointer;
  padding: 2px 8px; border-radius: 6px; flex: none;
}
.toast .ta:hover { background: var(--accent-soft); }
.toast.err .tm { color: var(--p1); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.banner {
  position: fixed; top: 0; left: 0; right: 0; padding: 8px 14px; text-align: center; z-index: 70;
  background: #fdf3e3; color: #7a5312; border-bottom: 1px solid #f0e2c4; font-size: 12.5px;
}
.banner:empty { display: none; }

/* ---------------- 手机端 ---------------- */
.tabs { display: none; }
.fab {
  position: fixed; right: 18px; bottom: calc(18px + var(--tab-h)); width: 50px; height: 50px; border-radius: 50%;
  border: 0; background: var(--accent); color: #fff; font-size: 26px; line-height: 1; box-shadow: var(--shadow); z-index: 55; cursor: pointer;
}
.drawer { position: fixed; inset: 0; background: rgba(18,20,24,.36); z-index: 58; display: none; }
.drawer.on { display: block; animation: fade .12s; }

@media (max-width: 1279px) {
  .app { grid-template-columns: 240px minmax(0, 1fr); grid-template-areas: "top top" "side main"; }
  body.no-detail .app { grid-template-columns: 240px minmax(0, 1fr); }
  .detail {
    position: fixed; top: 52px; right: 0; bottom: 0; width: min(400px, 92vw); z-index: 59;
    box-shadow: var(--shadow); border-left: 1px solid var(--line); animation: slide .16s ease-out;
  }
  @keyframes slide { from { transform: translateX(18px); opacity: .5; } }
}
@media (max-width: 899px) {
  #menuBtn { display: inline-flex; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; }
  body.no-detail .app { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; top: 52px; bottom: 0; left: 0; width: min(280px, 84vw); z-index: 59;
    transform: translateX(-102%); transition: transform .18s ease-out; box-shadow: var(--shadow);
  }
  .side.on { transform: none; }
}
@media (max-width: 767px) {
  .app { grid-template-rows: 50px minmax(0, 1fr); grid-template-areas: "top" "main"; }
  .brand { display: none; }
  .searchbox { max-width: none; }
  #newBtn { display: none; }
  #gearBtn { display: none; }
  .top { padding: 0 8px; }
  .qa { padding: 10px 12px 8px; }
  .qa-inp { font-size: 16px; }        /* <16px 在 iOS 聚焦会放大页面 */
  .list { padding: 0 6px 92px; }
  .list-head { padding: 4px 12px 6px; }
  .task { padding: 10px 6px; }
  .task .acts { display: none; }
  .tabs {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--panel); border-top: 1px solid var(--line); z-index: 56;
  }
  .tab-b { border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--ink3); font-size: 11px; cursor: pointer; }
  .tab-b.on { color: var(--accent); font-weight: 600; }
  .tab-b .ti { font-size: 17px; line-height: 1; }
  .detail {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 86dvh; border-left: 0;
    border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; animation: sheet .2s ease-out;
  }
  @keyframes sheet { from { transform: translateY(24px); } }
  .d-head { border-radius: 16px 16px 0 0; }
  .d-actions { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .panel { max-width: none; max-height: 88dvh; }
  .mask { padding: 0; align-items: flex-end; }
  .panel.small, .panel.wide { max-width: none; }
  .cond { grid-template-columns: 96px minmax(0, 1fr) 30px; }
  .toasts { bottom: calc(var(--tab-h) + 14px); }
}
@media (max-width: 380px) {
  .kv { grid-template-columns: 68px minmax(0, 1fr); }
  .meta { font-size: 11.5px; }
}
@media (hover: none) {
  .task .acts { display: none; }
}

/* 侧栏在「清单」页时铺满（手机端） */
body.side-page .side {
  position: static; transform: none; display: block; width: auto; z-index: auto; box-shadow: none;
  border-right: 0; height: 100%; overflow-y: auto;
}
@media (max-width: 899px) {
  body.side-page .app { grid-template-areas: "top" "main"; }
  body.side-page .main { display: none; }
  body.side-page .side { position: fixed; top: 50px; left: 0; right: 0; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); width: auto; height: auto; background: var(--bg); }
}
@media (max-width: 767px) {
  .detail { height: 82dvh; }
}
