* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --line: #e4e9f0;
  --text: #1f2933;
  --muted: #6b7785;
  --primary: #2563eb;
  --primary-d: #1d4ed8;
  --primary-bg: #eef4ff;
  --ok: #16a34a;
  --ok-bg: #e8f5ec;
  --warn: #d97706;
  --warn-bg: #fdf2e3;
  --danger: #dc2626;
  --danger-bg: #fdecec;
  --purple: #7c3aed;
  --purple-bg: #f1ebfe;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
  --shadow-lg: 0 6px 24px rgba(16,24,40,.10);
  --radius: 11px;
}
/* ---------- 深色模式 ---------- */
:root[data-theme="dark"] {
  --bg: #0f172a;
  --panel: #1e293b;
  --line: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --primary-d: #2563eb;
  --primary-bg: #1e3a5f;
  --ok: #4ade80;
  --ok-bg: #14321f;
  --warn: #fbbf24;
  --warn-bg: #3a2c0a;
  --danger: #f87171;
  --danger-bg: #3a1717;
  --purple: #a78bfa;
  --purple-bg: #2a2350;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
  --shadow-lg: 0 6px 24px rgba(0,0,0,.5);
}
:root[data-theme="dark"] body { background: var(--bg); }
:root[data-theme="dark"] .login-wrap { background: linear-gradient(135deg,#0f172a,#1e293b); }
:root[data-theme="dark"] .btn:hover { background: #2a3a4f; }
:root[data-theme="dark"] .nav a:hover { background: #2a3a4f; color: var(--text); }
:root[data-theme="dark"] .list li:hover { background: #243044; }
:root[data-theme="dark"] table.tbl th,
:root[data-theme="dark"] .acct-table th { background: #243044; }
:root[data-theme="dark"] .list li.active { background: var(--primary-bg); }
:root[data-theme="dark"] .field input:disabled,
:root[data-theme="dark"] table.tbl input:disabled,
:root[data-theme="dark"] table.tbl textarea:disabled { background: #16202e; }
.theme-toggle { min-width: 74px; }
body { font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#eef3fb,#dde7f3); }
.login-card { background: var(--panel); padding: 34px 38px; border-radius: 16px; box-shadow: var(--shadow-lg); width: 350px; }
.login-card h1 { font-size: 21px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); margin-bottom: 22px; font-size: 13px; }
.login-card label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 4px; }
.login-card input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.login-card input:focus { outline: 2px solid var(--primary); border-color: var(--primary); }

/* ---------- 按钮 ---------- */
.btn { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); cursor: pointer; font-size: 13px; transition: .15s; white-space: nowrap; }
.btn:hover { background: #f0f3f7; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-d); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-danger { color: var(--danger); border-color: #f0c4bf; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-ok { color: var(--ok); border-color: #bfe3c8; }
.btn-ok:hover { background: var(--ok-bg); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; margin-top: 18px; padding: 11px; font-size: 15px; }
.err { color: var(--danger); font-size: 12px; margin-top: 10px; min-height: 16px; }

/* ---------- 顶栏 + 导航 ---------- */
.topbar { height: 54px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 16px; gap: 14px; position: sticky; top: 0; z-index: 20; }
.topbar .title { font-weight: 700; font-size: 16px; letter-spacing: .3px; }
.topbar .spacer { flex: 1; }
.tb-actions { display: flex; gap: 8px; align-items: center; }
.tb-right { display: flex; gap: 10px; align-items: center; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 7px 14px; border-radius: 8px; color: var(--muted); cursor: pointer; font-size: 13.5px; text-decoration: none; transition: .15s; }
.nav a:hover { background: #f0f3f7; color: var(--text); }
.nav a.active { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.badge { padding: 3px 10px; border-radius: 11px; font-size: 12px; background: #eef2f7; color: var(--muted); }
.badge.admin { background: var(--primary-bg); color: var(--primary); }
.badge.editor { background: var(--ok-bg); color: var(--ok); }
.badge.viewer { background: var(--warn-bg); color: var(--warn); }
.badge.guest { background: #f0eef0; color: #777; }

/* ---------- 筛选栏 ---------- */
.filterbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; box-shadow: var(--shadow); }
.filterbar .f { display: flex; flex-direction: column; gap: 3px; }
.filterbar .f label { font-size: 11.5px; color: var(--muted); }
.filterbar input, .filterbar select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; background: #fff; min-width: 130px; }
.filterbar input:focus, .filterbar select:focus { outline: 2px solid var(--primary); border-color: var(--primary); }
.filterbar .count { margin-left: auto; color: var(--muted); font-size: 12.5px; align-self: center; }
.filterbar .reset { align-self: center; }

/* ---------- 项目多选（筛选栏下拉 + 已选标签行） ---------- */
.f-multi { position: relative; }
.ms { position: relative; }
.ms-btn { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--text); font-size: 13px; min-width: 130px; max-width: 220px; cursor: pointer; font-family: inherit; }
.ms-btn:hover { border-color: var(--primary); }
.ms-btn.on { border-color: var(--primary); background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.ms-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.ms-caret { color: var(--muted); font-size: 11px; }
.ms-panel { position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; width: min(320px, 82vw); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 8px; }
.ms-tools { display: flex; align-items: center; gap: 12px; padding: 2px 4px 8px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.ms-tools a { color: var(--primary); text-decoration: none; }
.ms-tools a:hover { text-decoration: underline; }
.ms-hint { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.ms-list { list-style: none; max-height: 260px; overflow-y: auto; margin: 0; padding: 0; }
.ms-item { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 7px; cursor: pointer; }
.ms-item:hover { background: var(--primary-bg); }
.ms-item input { width: 16px; height: 16px; min-width: 0; padding: 0; border: none; background: transparent; accent-color: var(--primary); cursor: pointer; }
.ms-name { font-size: 13px; word-break: break-all; }
.ms-empty { padding: 10px 8px; color: var(--muted); font-size: 12.5px; }
.picked { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: -6px 0 14px; padding: 0 2px; }
.picked-l { color: var(--muted); font-size: 12.5px; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--primary-bg); color: var(--primary); border: 1px solid transparent; border-radius: 20px; padding: 3px 8px 3px 10px; font-size: 12.5px; max-width: 260px; }
.chip a { color: inherit; text-decoration: none; font-size: 15px; line-height: 1; opacity: .75; }
.chip a:hover { opacity: 1; }
.picked-clear { color: var(--muted); font-size: 12.5px; text-decoration: none; margin-left: 2px; }
.picked-clear:hover { color: var(--danger); }

/* ---------- 列表布局 ---------- */
.layout { display: flex; height: calc(100vh - 54px - 0px); }
.sidebar { width: 320px; min-width: 280px; border-right: 1px solid var(--line); overflow-y: auto; background: var(--panel); }
.sidebar .shead { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; position: sticky; top: 0; background: var(--panel); z-index: 2; }
.sidebar .shead .count { color: var(--muted); font-size: 12px; }
.list { list-style: none; }
.list li { padding: 11px 14px; border-bottom: 1px solid #f0f3f6; cursor: pointer; }
.list li:hover { background: #f7f9fb; }
.list li.active { background: var(--primary-bg); border-left: 3px solid var(--primary); padding-left: 11px; }
.list .t { font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.list .m { color: var(--muted); font-size: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.main { flex: 1; overflow-y: auto; padding: 18px 22px; }
.empty { color: var(--muted); padding: 60px; text-align: center; }

/* ---------- 详情/表单 ---------- */
.section-title { font-size: 14px; font-weight: 700; margin: 18px 0 8px; padding-left: 9px; border-left: 3px solid var(--primary); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.head-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; }
.field { display: flex; flex-direction: column; gap: 3px; }
.field label { font-size: 12px; color: var(--muted); }
.field input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; background: var(--panel); color: var(--text); }
.field input:disabled { background: #f5f7f9; color: var(--text); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { border: 1px solid var(--line); padding: 7px 9px; vertical-align: top; text-align: left; }
table.tbl th { background: #f5f8fb; font-weight: 600; width: 16%; white-space: nowrap; }
table.tbl th.spec { width: 40%; }
table.tbl th.std { width: 22%; color: var(--muted); font-weight: 500; font-size: 12px; }
table.tbl td .std { color: var(--muted); font-size: 11.5px; margin-top: 4px; line-height: 1.4; }
table.tbl input.res, table.tbl textarea.rem { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 5px; font-size: 13px; font-family: inherit; }
table.tbl textarea.rem { resize: vertical; min-height: 38px; }
table.tbl input:disabled, table.tbl textarea:disabled { background: #f5f7f9; }
.res-pass { color: var(--ok); font-weight: 600; }
.res-fail { color: var(--danger); font-weight: 600; }
.res-na { color: #94a3b8; font-weight: 600; }
.actions { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; flex-wrap: wrap; }
.meta { color: var(--muted); font-size: 12px; }
.quick { display: inline-flex; gap: 4px; margin-top: 4px; }
.quick button { padding: 2px 8px; font-size: 12px; border: 1px solid var(--line); border-radius: 5px; background: #fff; cursor: pointer; }
.quick button:hover { background: #f0f3f7; }

/* ---------- 统计看板 ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .v { font-size: 26px; font-weight: 700; line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.kpi.green .v { color: var(--ok); }
.kpi.blue .v { color: var(--primary); }
.kpi.purple .v { color: var(--purple); }
.kpi.orange .v { color: var(--warn); }
.kpi.red .v { color: var(--danger); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.chart-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.chart-card h3 { font-size: 14px; margin-bottom: 10px; }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 320px; }

/* ---------- 项目视图 ---------- */
.projects-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.proj-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.proj-card h3 { font-size: 15px; margin-bottom: 4px; word-break: break-all; }
.proj-card .pc-meta { color: var(--muted); font-size: 12px; margin-bottom: 10px; display: flex; gap: 10px; flex-wrap: wrap; }
.proj-card .pc-stats { display: flex; gap: 14px; margin-bottom: 10px; }
.proj-card .pc-stats div { font-size: 12px; color: var(--muted); }
.proj-card .pc-stats b { display: block; font-size: 18px; color: var(--text); }
.proj-card ul { list-style: none; margin-top: 6px; border-top: 1px solid var(--line); padding-top: 8px; }
.proj-card li { padding: 6px 0; font-size: 13px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.proj-card li:hover { color: var(--primary); }
.proj-card li .tag { font-size: 11px; color: var(--muted); }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,35,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: var(--panel); border-radius: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.2); width: 580px; max-width: 92vw; max-height: 86vh; overflow-y: auto; padding: 22px 24px; }
.modal h2 { font-size: 16px; margin-bottom: 14px; }
.modal .row { display: flex; gap: 10px; margin: 8px 0; align-items: center; }
.modal .row label { width: 80px; color: var(--muted); font-size: 13px; }
.modal input, .modal select { flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; background: var(--panel); color: var(--text); }

/* 管理检查项（模板编辑器） */
.tpl-modal { width: 760px; max-width: 96vw; }
.tpl-body { margin: 8px 0; }
.tpl-sec { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 10px 0; }
.tpl-sec-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.tpl-sec-title { flex: 1; font-weight: 600; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; background: var(--panel); color: var(--text); }
.tpl-items { display: flex; flex-direction: column; gap: 8px; }
.tpl-item { border: 1px dashed var(--line); border-radius: 6px; padding: 8px; }
.tpl-item-row { display: flex; gap: 8px; align-items: center; }
.tpl-item-name { flex: 1; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); }
.tpl-item-id { font-size: 12px; color: var(--muted); min-width: 44px; text-align: center; font-family: ui-monospace, Menlo, Consolas, monospace; }
.tpl-item-spec { width: 100%; margin-top: 6px; min-height: 42px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; resize: vertical; font-family: inherit; background: var(--panel); color: var(--text); }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
/* 导出格式选择 */
.fmt-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.fmt-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; font-size: 15px; text-align: left; }
.fmt-btn > span { display: flex; flex-direction: column; gap: 2px; font-weight: 600; }
.fmt-btn small { font-weight: 400; font-size: 12px; color: var(--muted); }
.acct-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.acct-table th, .acct-table td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; }
.acct-table th { background: #f5f8fb; }
.role-tag { font-size: 12px; padding: 1px 8px; border-radius: 9px; background: #eef2f7; color: var(--muted); }
.note { background: var(--warn-bg); color: var(--warn); padding: 8px 11px; border-radius: 6px; font-size: 12.5px; margin: 6px 0 12px; line-height: 1.5; }

.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: #1f2933; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; z-index: 99; box-shadow: 0 4px 14px rgba(0,0,0,.25); }

/* ---------- PDF 离屏渲染（供 html2canvas 截图） ---------- */
.pdf-render { position: fixed; left: -10000px; top: 0; width: 760px; background: #fff; padding: 28px 30px; color: #1f2933; font-family: "Microsoft YaHei", "Segoe UI", sans-serif; font-size: 13px; }
.pdf-render h1 { font-size: 20px; text-align: center; margin-bottom: 4px; }
.pdf-render .sub { text-align: center; color: #6b7785; font-size: 12px; margin-bottom: 16px; }
.pdf-render table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.pdf-render th, .pdf-render td { border: 1px solid #cfd8e3; padding: 6px 8px; vertical-align: top; text-align: left; }
.pdf-render th { background: #eef3f8; font-weight: 600; }
.pdf-render .sec { font-weight: 700; margin: 12px 0 4px; padding-left: 8px; border-left: 3px solid #2563eb; }
.pdf-render .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; margin-bottom: 8px; }
.pdf-render .grid div { font-size: 12.5px; }
.pdf-render .grid b { color: #6b7785; font-weight: 500; }

/* ---------- 首页 / 待办提醒 ---------- */
.rem-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.rem-card { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.rem-card.rem-danger { border-left-color: var(--danger); }
.rem-card.rem-warn { border-left-color: var(--warn); }
.rem-card.rem-purple { border-left-color: var(--purple); }
.rem-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; }
.rem-title { font-weight: 600; font-size: 13.5px; }
.rem-badge { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 1px 11px; font-size: 13px; font-weight: 700; }
.rem-danger .rem-badge { color: var(--danger); border-color: var(--danger); }
.rem-warn .rem-badge { color: var(--warn); border-color: var(--warn); }
.rem-purple .rem-badge { color: var(--purple); border-color: var(--purple); }
.rem-list { list-style: none; margin-top: 2px; }
.rem-list li { padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.rem-list li:first-child { border-top: none; }
.rem-list li:hover { color: var(--primary); }
.rem-list .tag { font-size: 11px; color: var(--muted); white-space: nowrap; }
.rem-list li.static { cursor: default; color: var(--muted); }
.rem-list li.static:hover { color: var(--muted); }

/* 待办提醒（按项目分组） */
.rem-card.rem-prj { border-left-color: var(--primary); }
.prj-counts { color: var(--muted); font-size: 12px; margin: -2px 0 6px; }
.rtag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 9px; margin-right: 6px; white-space: nowrap; }
.rtag-bad { background: var(--danger-bg); color: var(--danger); }
.rtag-warn { background: var(--warn-bg); color: var(--warn); }
.rtag-purple { background: var(--purple-bg); color: var(--purple); }
.ri-main { flex: 1 1 auto; min-width: 0; }
.ri-sub { color: var(--muted); font-size: 11.5px; white-space: nowrap; }

/* ---------- 附件（每项检查） ---------- */
.att-th, .att-cell { text-align: center; width: 64px; }
.att-btn {
  border: 1px solid var(--line); background: var(--bg);
  border-radius: 6px; padding: 3px 8px; cursor: pointer; font-size: 13px; color: var(--text);
}
.att-btn:hover { border-color: var(--primary); color: var(--primary); }
.att-list { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.att-item {
  display: flex; gap: 12px; align-items: center;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--panel);
}
.att-prev { flex: 0 0 auto; }
.att-thumb { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.att-video { width: 220px; max-height: 150px; border-radius: 6px; border: 1px solid var(--line); background: #000; }
.att-file { display: inline-block; padding: 6px 10px; }
.att-info { flex: 1 1 auto; min-width: 0; }
.att-meta { font-size: 12.5px; color: var(--muted); word-break: break-all; margin-bottom: 6px; }
.att-actions { display: flex; gap: 6px; }
.att-upload input[type=file] { flex: 1; padding: 6px; }

/* ---------- 打印 ---------- */
@media print {
  body * { visibility: hidden; }
  #printArea, #printArea * { visibility: visible; }
  #printArea { position: absolute; left: 0; top: 0; width: 100%; }
}

/* ============================================================
   移动端适配（手机 / 竖屏平板，≤720px）
   目标：窄屏下不挤压、不横向溢出；顶栏分三行（标题 / 操作 / 页签）
   ============================================================ */
@media screen and (max-width: 720px) {
  html { -webkit-text-size-adjust: 100%; }

  /* ---- 顶栏：自动换行，操作按钮单行横滑，页签独立一行 ---- */
  .topbar {
    height: auto; min-height: 50px;
    flex-wrap: wrap; padding: 8px 10px; gap: 8px;
  }
  .topbar .title { font-size: 15px; }
  .topbar .spacer { display: none; }
  .tb-right { order: 1; margin-left: auto; gap: 6px; }
  .tb-actions {
    order: 2; width: 100%;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .tb-actions .btn { flex: 0 0 auto; }
  .nav {
    order: 3; width: 100%;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    gap: 2px; border-top: 1px solid var(--line); padding-top: 6px;
  }
  .nav a { padding: 8px 14px; font-size: 13.5px; white-space: nowrap; }
  .theme-toggle { min-width: 0; }
  .badge { font-size: 11px; padding: 2px 8px; }

  /* ---- 主体：不再用内部滚动区域，改由整页滚动 ---- */
  .layout { flex-direction: column; height: auto; }
  .sidebar {
    width: 100%; min-width: 0; max-height: 42vh;
    border-right: none; border-bottom: 1px solid var(--line);
  }
  .main { padding: 12px 12px 32px; overflow: visible; }

  /* ---- 筛选栏：两列自适应，按钮整行 ---- */
  .filterbar { padding: 10px; gap: 8px; }
  .filterbar .f { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .filterbar input, .filterbar select { min-width: 0; width: 100%; }
  .filterbar .reset { flex: 1 1 100%; }
  .filterbar .reset.btn { width: 100%; }
  .filterbar .count { flex: 1 1 100%; margin-left: 0; text-align: center; }
  /* ---- 项目多选：手机端按钮占满一列，复选框不被拉伸 ---- */
  .ms-btn { width: 100%; max-width: none; }
  .ms-panel { width: min(320px, 92vw); left: 0; right: auto; }
  .ms-item input { width: 16px; height: 16px; min-width: 16px; padding: 0; }
  .picked { margin-top: -4px; }

  /* ---- 表单与表格 ---- */
  .head-grid { grid-template-columns: 1fr; gap: 10px; }
  .card { padding: 12px; overflow-x: auto; }
  table.tbl { min-width: 620px; }
  table.tbl th { width: auto; }
  table.tbl th.spec { width: 42%; }
  table.tbl th.std { width: 24%; }

  /* ---- 统计 / 项目 / 待办卡片：窄屏单列 ---- */
  .kpis { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi .v { font-size: 22px; }
  .charts { grid-template-columns: 1fr; }
  .chart-box { height: 230px; }
  .chart-box.tall { height: 280px; }
  .projects-wrap { grid-template-columns: 1fr; }
  .rem-grid { grid-template-columns: 1fr; }

  /* ---- 弹窗 / 附件 ---- */
  .modal { width: 94vw; max-width: 94vw; padding: 16px; }
  .modal .row { flex-wrap: wrap; gap: 6px; }
  .modal .row label { width: 100%; }
  .att-item { flex-wrap: wrap; }
  .att-thumb { width: 100%; height: auto; max-height: 220px; }
  .att-video { width: 100%; }

  /* ---- iOS 上聚焦输入框不再自动放大页面 ---- */
  .field input, table.tbl input.res, table.tbl textarea.rem,
  .filterbar input, .filterbar select, .login-card input,
  .modal input, .modal select { font-size: 16px; }

  .login-card { width: min(350px, 92vw); padding: 26px 20px; }
  .actions { gap: 6px; }
  .section-title { margin: 14px 0 8px; }
  .toast { bottom: 16px; max-width: 90vw; text-align: center; }
}

/* ---------- 首页「项目进度」 ---------- */
.prog-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.prog-item {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow); cursor: pointer; transition: .15s;
}
.prog-item:hover { border-color: var(--primary); }
/* 被选中的项目（多选） */
.prog-item.on { border-color: var(--primary); background: var(--primary-bg); box-shadow: 0 0 0 2px var(--primary-bg); }
.prog-pick { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex: 0 0 18px; border: 1.5px solid var(--line); border-radius: 5px; background: var(--panel); color: #fff; font-size: 12px; font-weight: 700; }
.prog-item.on .prog-pick { background: var(--primary); border-color: var(--primary); }
.prog-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.prog-name { font-weight: 600; font-size: 13.5px; word-break: break-all; }
.prog-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.prog-bar { height: 8px; border-radius: 5px; background: var(--line); overflow: hidden; }
.prog-bar > i { display: block; height: 100%; border-radius: 5px; background: var(--ok); transition: width .3s; }
.prog-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 7px; color: var(--muted); font-size: 12px; flex-wrap: wrap; align-items: center; }
.btn-xs { padding: 3px 9px; font-size: 11.5px; border-radius: 6px; }
/* 区块标题右侧的「全选 / 清空」 */
.sec-flex { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sec-acts { display: flex; gap: 12px; font-weight: 400; }
.sec-acts a { color: var(--primary); font-size: 12.5px; text-decoration: none; }
.sec-acts a:hover { text-decoration: underline; }
.prog-tip { font-size: 12.5px; color: var(--muted); margin: -2px 0 10px 2px; }

/* ---------- 安装引导弹窗 ---------- */
.install-steps { display: grid; gap: 10px; }
.is-block { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--bg); }
.is-block h3 { font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.is-block ol { margin-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.75; }

/* ============================================================
   PWA：添加到手机主屏后全屏运行 —— 适配 iPhone 刘海 / 底部横条安全区
   env() 在不支持的环境下会被忽略，不影响普通浏览器
   ============================================================ */
@media screen and (max-width: 720px) {
  .topbar { padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
  .main { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); }
  .modal { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .login-wrap { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
}
/* 更像原生 App：去掉点按时的蓝色高亮方块 */
.nav a, .btn, .list li, .rem-list li, .proj-card li, .att-btn { -webkit-tap-highlight-color: transparent; }
/* 全屏（独立窗口）模式下给顶栏加一层细阴影，视觉上更像 App 头部 */
@media (display-mode: standalone) {
  .topbar { box-shadow: 0 1px 6px rgba(16, 24, 40, .08); }
}
