/* 隐患闭环（web/hazards.js；hzd 线）。
   ★ 每条规则都以 `html.sh-on .hzd` 开头，只作用在容器 .hzd 内；壳关（?shell=0）一条都不命中（tests/test_hazards_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 .hzd { padding: 16px; max-width: 960px; color: var(--sh-ink); font-size: 16px; line-height: 24px; }
html.sh-on .hzd * { box-sizing: border-box; }
html.sh-on .hzd :where(h2, h3, h4, p, ul, ol, li) { margin: 0; padding: 0; }
html.sh-on .hzd :where(ul, ol) { list-style: none; }
html.sh-on .hzd .hzd-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html.sh-on .hzd .hzd-dim { font-size: 13px; line-height: 20px; color: var(--sh-ink2); overflow-wrap: anywhere; }
html.sh-on .hzd .hzd-dim b { font-weight: 600; color: var(--sh-ink); }

/* 头：标题 + 登记按钮；计数只显示接口 counts 的数字 */
html.sh-on .hzd .hzd-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
html.sh-on .hzd .hzd-head h2 { font-size: 20px; line-height: 28px; font-weight: 600; outline: none; }
html.sh-on .hzd .hzd-counts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
html.sh-on .hzd .hzd-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 .hzd .hzd-chip b { font-weight: 600; color: var(--sh-ink); }

/* 筛选行 */
html.sh-on .hzd .hzd-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin-top: 16px; }
html.sh-on .hzd .hzd-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; line-height: 20px; color: var(--sh-ink2); min-width: 0; }
html.sh-on .hzd .hzd-field i { font-style: normal; color: var(--sk-bad-fg); }
html.sh-on .hzd .hzd-field input, html.sh-on .hzd .hzd-field select, html.sh-on .hzd .hzd-field textarea { min-height: 32px; padding: 4px 8px; border: 1px solid var(--sk-line-ctl); border-radius: 8px; background: var(--sh-content); color: var(--sh-ink); font-size: 16px; line-height: 24px; }
html.sh-on .hzd .hzd-field textarea { min-height: 64px; resize: vertical; }

/* 列表行：左 标题 + 摘要 + 依据；右 状态 + 期限 */
html.sh-on .hzd .hzd-list { display: grid; gap: 8px; margin-top: 12px; }
html.sh-on .hzd .hzd-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); cursor: pointer; }
html.sh-on .hzd .hzd-item:hover { border-color: var(--sh-ink2); }
html.sh-on .hzd .hzd-main { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
html.sh-on .hzd .hzd-title-t { font-size: 16px; line-height: 24px; font-weight: 600; overflow-wrap: anywhere; }
html.sh-on .hzd .hzd-line { font-size: 16px; line-height: 24px; color: var(--sh-ink); overflow-wrap: anywhere; }
html.sh-on .hzd .hzd-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
html.sh-on .hzd .hzd-due { font-size: 13px; line-height: 20px; color: var(--sh-ink2); white-space: nowrap; }
html.sh-on .hzd .hzd-due.late { color: var(--sk-bad-fg); font-weight: 600; }

/* 状态胶囊：圆角 999、高 24、浅底 + 深字 + 细边，只用 绿 / 琥珀 / 红 / 灰 四色族 */
html.sh-on .hzd .hzd-pill { 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 .hzd .hzd-pill.ok { background: var(--sk-ok-bg); border-color: var(--sk-ok-bd); color: var(--sk-ok-fg); }
html.sh-on .hzd .hzd-pill.warn { background: var(--sk-warn-bg); border-color: var(--sk-warn-bd); color: var(--sk-warn-fg); }
html.sh-on .hzd .hzd-pill.bad { background: var(--sk-bad-bg); border-color: var(--sk-bad-bd); color: var(--sk-bad-fg); }

/* 分页 / 空态 / 错误 */
html.sh-on .hzd .hzd-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 16px; }
html.sh-on .hzd .hzd-empty { padding: 16px; color: var(--sh-ink2); }
html.sh-on .hzd .hzd-errbox { 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 .hzd .hzd-ok { padding: 8px 12px; border: 1px solid var(--sk-ok-bd); border-radius: 8px; background: var(--sk-ok-bg); color: var(--sk-ok-fg); font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }
html.sh-on .hzd .hzd-note { padding: 16px; border: 1px solid var(--sk-warn-bd); border-radius: 8px; background: var(--sk-warn-bg); color: var(--sk-warn-fg); font-size: 16px; line-height: 24px; overflow-wrap: anywhere; }

/* 详情：字段行 + 照片 + 动作 + 时间线 */
html.sh-on .hzd .hzd-back { margin-top: 12px; }
html.sh-on .hzd .hzd-detail { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }
html.sh-on .hzd .hzd-detail h3 { font-size: 20px; line-height: 28px; font-weight: 600; overflow-wrap: anywhere; }
html.sh-on .hzd .hzd-detail h4 { font-size: 16px; line-height: 24px; font-weight: 600; margin-top: 12px; }
html.sh-on .hzd .hzd-kv { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
html.sh-on .hzd .hzd-photos { display: flex; flex-wrap: wrap; gap: 8px; }
html.sh-on .hzd .hzd-photo { display: block; border: 1px solid var(--sh-line); border-radius: 8px; overflow: hidden; }
html.sh-on .hzd .hzd-photo img { display: block; width: 120px; height: 120px; object-fit: cover; }
html.sh-on .hzd .hzd-acts { display: flex; flex-wrap: wrap; gap: 8px; }
html.sh-on .hzd .hzd-events { display: grid; gap: 8px; }
html.sh-on .hzd .hzd-events li { padding: 12px 16px; border: 1px solid var(--sh-line); border-radius: 12px; background: var(--sh-content); display: flex; flex-direction: column; gap: 4px; }
html.sh-on .hzd .hzd-ev-t { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }

/* 表单（登记／动作共用） */
html.sh-on .hzd .hzd-form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; padding: 16px; border: 1px solid var(--sh-line); border-radius: 12px; background: var(--sh-content); }
html.sh-on .hzd .hzd-form h3, html.sh-on .hzd .hzd-form h4 { font-size: 20px; line-height: 28px; font-weight: 600; }
html.sh-on .hzd .hzd-form h4 { font-size: 16px; line-height: 24px; }
html.sh-on .hzd .hzd-uploads { display: grid; gap: 4px; }
html.sh-on .hzd .hzd-up { font-size: 13px; line-height: 20px; color: var(--sh-ink2); overflow-wrap: anywhere; }

/* 按钮：次按钮（白底描边）/ 主按钮（品牌蓝实心）/ 行内动作；危险 = 红描边 + 二次确认，不用红实心 */
html.sh-on .hzd .hzd-btn, html.sh-on .hzd .hzd-act { font: inherit; cursor: pointer; white-space: nowrap; }
html.sh-on .hzd:is(#extApp .hzd) button.hzd-btn, html.sh-on .hzd:is(#extApp .hzd) button.hzd-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 .hzd:is(#extApp .hzd) button.hzd-btn.main { min-height: 40px; border-color: var(--sh-blue); background: var(--sh-blue); color: var(--sh-content); }
html.sh-on .hzd:is(#extApp .hzd) button.hzd-btn.main:hover:not(:disabled) { border-color: var(--sh-blue); background: var(--sh-blue); filter: brightness(.92); }
html.sh-on .hzd:is(#extApp .hzd) button.hzd-act.neg { border-color: var(--sk-bad-bd); background: var(--sh-content); color: var(--sk-bad-fg); }
html.sh-on .hzd:is(#extApp .hzd) button.hzd-btn:hover:not(:disabled), html.sh-on .hzd:is(#extApp .hzd) button.hzd-act:hover:not(:disabled) { border-color: var(--sh-ink2); background: var(--sk-wash); }
html.sh-on .hzd:is(#extApp .hzd) button.hzd-btn:disabled, html.sh-on .hzd:is(#extApp .hzd) button.hzd-act:disabled { background: var(--sk-wash); color: var(--sh-ink2); cursor: not-allowed; }

/* 窄屏：点击区 ≥44；照片一排两张 */
@media (max-width: 900px) {
  html.sh-on .hzd:is(#extApp .hzd) button.hzd-btn, html.sh-on .hzd:is(#extApp .hzd) button.hzd-act { min-height: 44px; }
  html.sh-on .hzd .hzd-item { grid-template-columns: minmax(0, 1fr); }
  html.sh-on .hzd .hzd-side { flex-direction: row; align-items: center; }
  html.sh-on .hzd .hzd-photo img { width: 96px; height: 96px; }
}
