/* 待我处理（web/mytodo.js；mtdo 线）。
   ★ 每条规则都以 `html.sh-on .mtdo` 开头，只作用在容器 .mtdo 内；壳关（?shell=0）一条都不命中（tests/test_mytodo_css_scoping.py 锁死）。
   ★ 只用现有设计令牌，不新增颜色 / 字号常量：颜色取 shell.css 的 --sh-*（ink/ink2/line/blue/blue-soft/content）与 skin.css 的 --sk-*（wash/line-ctl/ok·warn·bad 的 bg/bd/fg）；
     字阶 13/16/20、字重 400/600、间距 4 的倍数、圆角 8/12/999（设计总纲 §3）；点击区桌面 ≥32、≤900 宽 ≥44。
   ★ 不用 <section>：外壳 skin.css 会把 #extApp 里所有 section 画成白卡片；按钮要用带 #extApp 的选择器压住 skin.css 对 #extApp button 的一刀切（高 40 / 600 字重 / .primary·.danger 实心）。 */

html.sh-on .mtdo { padding: 16px; max-width: 960px; color: var(--sh-ink); font-size: 16px; line-height: 24px; }
html.sh-on .mtdo * { box-sizing: border-box; }
html.sh-on .mtdo :where(h2, h3, p, ul, li) { margin: 0; padding: 0; }
html.sh-on .mtdo :where(ul) { list-style: none; }
html.sh-on .mtdo .mtdo-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html.sh-on .mtdo .mtdo-dim { font-size: 13px; line-height: 20px; color: var(--sh-ink2); overflow-wrap: anywhere; }
html.sh-on .mtdo .mtdo-dim b { font-weight: 600; color: var(--sh-ink); }

/* 结论带：一句话 + 至多一个主按钮（从第一件开始）+ 一个次按钮（刷新）；没取到的类写在带子里（一级区块只有 带子 / 我的 / 团队队列 三块） */
html.sh-on .mtdo .mtdo-concl { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 12px; background: var(--sh-blue-soft); }
html.sh-on .mtdo .mtdo-concl-r { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
html.sh-on .mtdo .mtdo-concl h2 { font-size: 20px; line-height: 28px; font-weight: 600; outline: none; }
html.sh-on .mtdo .mtdo-concl-b { display: flex; flex-wrap: wrap; gap: 8px; }

/* 区块（我的 / 团队队列）：块间 ≥24，块内 8–12 */
html.sh-on .mtdo .mtdo-sec { margin-top: 24px; }
html.sh-on .mtdo .mtdo-sec > h3 { font-size: 20px; line-height: 28px; font-weight: 600; margin-bottom: 4px; }
html.sh-on .mtdo .mtdo-group { margin-top: 16px; }
html.sh-on .mtdo .mtdo-sec > .mtdo-dim + .mtdo-list, html.sh-on .mtdo .mtdo-sec > .mtdo-dim + .mtdo-group { margin-top: 12px; }
html.sh-on .mtdo .mtdo-ghead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 8px; }
html.sh-on .mtdo .mtdo-gtitle { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
html.sh-on .mtdo .mtdo-gname { font-size: 16px; line-height: 24px; font-weight: 600; overflow-wrap: anywhere; }
html.sh-on .mtdo .mtdo-list { display: grid; gap: 8px; margin-top: 12px; }
html.sh-on .mtdo .mtdo-ghead + .mtdo-list, html.sh-on .mtdo .mtdo-err + .mtdo-list { margin-top: 0; }

/* item 行（我的）：左 标题 + 一句摘要 + 依据；右 标记（AI / 到期）+ 行内动作 */
html.sh-on .mtdo .mtdo-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; padding: 12px 16px; border: 1px solid var(--sh-line); border-radius: 12px; background: var(--sh-content); }
html.sh-on .mtdo .mtdo-item[aria-busy="true"] { background: var(--sk-wash); }
html.sh-on .mtdo .mtdo-main { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
html.sh-on .mtdo .mtdo-title-t { font-size: 16px; line-height: 24px; font-weight: 600; overflow-wrap: anywhere; }
html.sh-on .mtdo .mtdo-line { font-size: 16px; line-height: 24px; color: var(--sh-ink); overflow-wrap: anywhere; }
html.sh-on .mtdo .mtdo-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
html.sh-on .mtdo .mtdo-tags, html.sh-on .mtdo .mtdo-acts, html.sh-on .mtdo .mtdo-chips { display: flex; flex-wrap: wrap; gap: 8px; }
html.sh-on .mtdo .mtdo-tags, html.sh-on .mtdo .mtdo-acts { justify-content: flex-end; }
html.sh-on .mtdo .mtdo-err { grid-column: 1 / -1; padding: 8px 12px; border: 1px solid var(--sk-bad-bd); border-radius: 8px; background: var(--sk-bad-bg); color: var(--sk-bad-fg); font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }
html.sh-on .mtdo .mtdo-ghead + .mtdo-err { margin-bottom: 8px; }

/* group 行（团队队列）：标签 + 计数 + AI 分布 + scope 标注 + 「去处理」 */
html.sh-on .mtdo .mtdo-grow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding: 16px; border: 1px solid var(--sh-line); border-radius: 12px; background: var(--sh-content); }   /* 内边距 16 > 圆角 12：里面的按钮（圆角 8）不触发「嵌套圆角 = 外圆角 − 内边距」那条闸 */
html.sh-on .mtdo .mtdo-gmain { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
html.sh-on .mtdo .mtdo-gn { font-size: 13px; line-height: 20px; color: var(--sh-ink2); }
html.sh-on .mtdo .mtdo-gn b { font-size: 20px; line-height: 28px; font-weight: 600; color: var(--sh-ink); }
html.sh-on .mtdo .mtdo-dist { display: flex; flex-direction: column; gap: 8px; }
html.sh-on .mtdo .mtdo-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--sk-wash); max-width: 480px; }
html.sh-on .mtdo .mtdo-seg { display: block; flex-basis: 0; min-width: 4px; }
html.sh-on .mtdo .mtdo-seg.ok { background: var(--sk-ok-fg); }
html.sh-on .mtdo .mtdo-seg.bad { background: var(--sk-bad-fg); }
html.sh-on .mtdo .mtdo-seg.warn { background: var(--sk-warn-fg); }
html.sh-on .mtdo .mtdo-seg.mute { background: var(--sk-line-ctl); }

/* 状态胶囊：圆角 999、高 24、浅底 + 深字 + 细边，只用 绿 / 琥珀 / 红 / 灰 四色族 */
html.sh-on .mtdo .mtdo-pill, html.sh-on .mtdo .mtdo-chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border: 1px solid var(--sh-line); border-radius: 999px; background: var(--sk-wash); color: var(--sh-ink2); font-size: 13px; line-height: 20px; font-weight: 600; white-space: nowrap; }
html.sh-on .mtdo .mtdo-chip b { font-weight: 600; }
html.sh-on .mtdo .mtdo-pill.ok, html.sh-on .mtdo .mtdo-chip.ok { background: var(--sk-ok-bg); border-color: var(--sk-ok-bd); color: var(--sk-ok-fg); }
html.sh-on .mtdo .mtdo-pill.warn, html.sh-on .mtdo .mtdo-chip.warn { background: var(--sk-warn-bg); border-color: var(--sk-warn-bd); color: var(--sk-warn-fg); }
html.sh-on .mtdo .mtdo-pill.bad, html.sh-on .mtdo .mtdo-chip.bad { background: var(--sk-bad-bg); border-color: var(--sk-bad-bd); color: var(--sk-bad-fg); }

/* 没取到的类（带子里）：每类一行 + 重试 */
html.sh-on .mtdo .mtdo-notes { display: grid; gap: 8px; margin-top: 4px; }
html.sh-on .mtdo .mtdo-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px 16px; border: 1px solid var(--sk-warn-bd); border-radius: 8px; background: var(--sk-warn-bg); }
html.sh-on .mtdo .mtdo-note-t { display: flex; flex-direction: column; min-width: 0; flex: 1 1 240px; }
html.sh-on .mtdo .mtdo-note-t b { font-size: 16px; line-height: 24px; font-weight: 600; color: var(--sk-warn-fg); }

/* 按钮：次按钮（白底描边）/ 主按钮（品牌蓝实心，结论带里至多一个）/ 行内动作 / 去处理 / 标题 */
html.sh-on .mtdo .mtdo-btn, html.sh-on .mtdo .mtdo-act, html.sh-on .mtdo .mtdo-go, html.sh-on .mtdo .mtdo-title { font: inherit; cursor: pointer; white-space: nowrap; }
html.sh-on .mtdo:is(#extApp .mtdo) button.mtdo-btn, html.sh-on .mtdo:is(#extApp .mtdo) button.mtdo-act { height: auto; min-height: 32px; padding: 4px 16px; border: 1px solid var(--sk-line-ctl); border-radius: 8px; background: var(--sh-content); color: var(--sh-ink); font-size: 16px; line-height: 24px; font-weight: 600; }
html.sh-on .mtdo:is(#extApp .mtdo) button.mtdo-btn.main { min-height: 40px; border-color: var(--sh-blue); background: var(--sh-blue); color: var(--sh-content); }
html.sh-on .mtdo:is(#extApp .mtdo) button.mtdo-btn.main:hover:not(:disabled) { border-color: var(--sh-blue); background: var(--sh-blue); filter: brightness(.92); }
html.sh-on .mtdo:is(#extApp .mtdo) button.mtdo-act.neg { border-color: var(--sk-bad-bd); background: var(--sh-content); color: var(--sk-bad-fg); }   /* 危险 = 红描边 + 二次确认，不用红实心（F1） */
html.sh-on .mtdo:is(#extApp .mtdo) button.mtdo-btn:hover:not(:disabled), html.sh-on .mtdo:is(#extApp .mtdo) button.mtdo-act:hover:not(:disabled) { border-color: var(--sh-ink2); background: var(--sk-wash); }
html.sh-on .mtdo:is(#extApp .mtdo) button.mtdo-btn:disabled, html.sh-on .mtdo:is(#extApp .mtdo) button.mtdo-act:disabled { background: var(--sk-wash); color: var(--sh-ink2); cursor: not-allowed; }
html.sh-on .mtdo:is(#extApp .mtdo) button.mtdo-go { height: auto; min-height: 32px; padding: 4px 8px; border: 0; background: none; color: var(--sh-blue); font-size: 16px; line-height: 24px; font-weight: 600; }
html.sh-on .mtdo:is(#extApp .mtdo) button.mtdo-go:hover:not(:disabled) { border-color: transparent; background: var(--sh-blue-soft); }
html.sh-on .mtdo:is(#extApp .mtdo) button.mtdo-title { height: auto; min-height: 32px; max-width: 100%; padding: 4px 0; border: 0; background: none; color: var(--sh-ink); font-size: 16px; line-height: 24px; font-weight: 600; text-align: left; white-space: normal; overflow-wrap: anywhere; }
html.sh-on .mtdo:is(#extApp .mtdo) button.mtdo-title:hover:not(:disabled) { border-color: transparent; background: none; color: var(--sh-blue); text-decoration: underline; }

/* 空 / 没加载出来 / 还没开通：一句大白话 + 至多一个动作 */
html.sh-on .mtdo .mtdo-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 24px; border: 1px solid var(--sh-line); border-radius: 12px; background: var(--sh-content); }
html.sh-on .mtdo .mtdo-empty b { font-size: 20px; line-height: 28px; font-weight: 600; }
html.sh-on .mtdo .mtdo-empty span { font-size: 16px; line-height: 24px; color: var(--sh-ink2); }

/* 加载骨架（结构同终态） */
html.sh-on .mtdo .mtdo-skel { display: grid; gap: 12px; }
html.sh-on .mtdo .mtdo-skel i { display: block; border-radius: 12px; background: var(--sk-wash); border: 1px solid var(--sh-line); animation: mtdo-pulse 1.4s ease-in-out infinite; }
html.sh-on .mtdo .mtdo-sk-concl { height: 96px; }
html.sh-on .mtdo .mtdo-sk-row { height: 72px; }
html.sh-on .mtdo .mtdo-slow { margin-top: 12px; }
@keyframes mtdo-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }
@media (prefers-reduced-motion: reduce) { html.sh-on .mtdo .mtdo-skel i { animation: none; } }

/* 手机（≤900，壳切手机版式）：单列、点击区 ≥44、按钮不压窄不折行 */
@media (max-width: 900px) {
  html.sh-on .mtdo { padding: 12px; }
  html.sh-on .mtdo .mtdo-concl-r { align-items: flex-start; }
  html.sh-on .mtdo .mtdo-concl h2 { flex: 1 1 100%; }
  html.sh-on .mtdo .mtdo-concl-b { flex: 1 1 100%; }
  html.sh-on .mtdo .mtdo-concl-b .mtdo-btn { flex: 1 1 auto; }
  html.sh-on .mtdo .mtdo-item { grid-template-columns: minmax(0, 1fr); }
  html.sh-on .mtdo .mtdo-side { align-items: stretch; }
  html.sh-on .mtdo .mtdo-tags { justify-content: flex-start; }
  html.sh-on .mtdo .mtdo-acts { justify-content: stretch; }
  html.sh-on .mtdo .mtdo-acts .mtdo-act { flex: 1 1 auto; }
  html.sh-on .mtdo .mtdo-grow { flex-direction: column; align-items: stretch; }
  html.sh-on .mtdo .mtdo-gmain { flex: 0 0 auto; }   /* 单列时 flex-basis 会变成「高」：桌面的 280 要收回，否则每行下面空一大块 */
  html.sh-on .mtdo .mtdo-note .mtdo-btn { flex: 1 1 100%; }
  html.sh-on .mtdo:is(#extApp .mtdo) button.mtdo-btn, html.sh-on .mtdo:is(#extApp .mtdo) button.mtdo-act, html.sh-on .mtdo:is(#extApp .mtdo) button.mtdo-go, html.sh-on .mtdo:is(#extApp .mtdo) button.mtdo-title { min-height: 44px; }
  html.sh-on .mtdo:is(#extApp .mtdo) button.mtdo-title { min-width: 44px; }   /* 标题很短（如「审批」）时按钮只有 32 宽，手机点击区要 44×44（走查设计闸） */
  html.sh-on .mtdo:is(#extApp .mtdo) button.mtdo-btn.main { min-height: 44px; }   /* 桌面主按钮 40 高的规则权重更高，手机要单独压回 44 */
  html.sh-on .mtdo:is(#extApp .mtdo) button.mtdo-go { align-self: flex-start; }
  html.sh-on .mtdo .mtdo-empty { padding: 16px; }
}
