:root {
  --brand: #0b5fbe;
  --brand-2: #1a7fd4;
  --brand-soft: #eaf3fd;
  --teal: #0f9488;
  --ink: #1b2434;
  --muted: #6b7789;
  --line: #e2e8f2;
  --bg: #f3f6fb;
  --card: #fff;
  --red: #d92d20;
  --red-soft: #fef3f2;
  --amber: #b54708;
  --amber-soft: #fffaeb;
  --green: #067647;
  --green-soft: #ecfdf3;
  --chart-df: #2563eb;
  --chart-jk: #f59e0b;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: clip; /* 防止宽表/长内容撑出横向溢出导致整页缩放 */
}

a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ============ 顶栏 ============ */
.topbar {
  background: linear-gradient(100deg, #0a4f9e 0%, #0b5fbe 45%, #1180c9 100%);
  color: #fff;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 10px rgba(11, 95, 190, .25);
}
.topbar-inner { max-width: 1440px; margin: 0 auto; display: flex; align-items: center; gap: 18px; height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; letter-spacing: .5px; white-space: nowrap; }
.logo .mark {
  width: 30px; height: 30px; border-radius: 8px; background: rgba(255, 255, 255, .18);
  display: grid; place-items: center; font-size: 16px;
}
.logo small { display: block; font-size: 11px; font-weight: 400; opacity: .8; letter-spacing: 0; }
.nav { display: flex; gap: 4px; margin-left: 10px; flex: 1; }
.nav button {
  background: transparent; border: 0; color: rgba(255, 255, 255, .82); padding: 8px 14px;
  border-radius: 8px; font-size: 14px; position: relative;
}
.nav button:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.nav button.on { background: rgba(255, 255, 255, .95); color: var(--brand); font-weight: 600; }
.nav .dot {
  position: absolute; top: 3px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px;
  background: #ff4d4f; color: #fff; border-radius: 9px; font-size: 11px; line-height: 16px; font-weight: 600;
}

.role-switch { display: flex; align-items: center; gap: 8px; }
.role-switch .lbl { font-size: 12px; opacity: .85; }
.role-pills { display: flex; background: rgba(0, 0, 0, .16); border-radius: 8px; padding: 3px; gap: 2px; }
.role-pills button {
  border: 0; background: transparent; color: rgba(255, 255, 255, .85); padding: 5px 12px;
  border-radius: 6px; font-size: 13px;
}
.role-pills button.on { background: #fff; color: var(--brand); font-weight: 600; }

/* ============ 布局 ============ */
.wrap { max-width: 1440px; margin: 0 auto; padding: 18px 20px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 19px; }
.page-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }

/* ============ 统计（紧凑、单行、可点击过滤） ============ */
.stats { display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto; margin-bottom: 14px; -webkit-overflow-scrolling: touch; }
.stat {
  flex: 1 1 0; min-width: 116px; cursor: pointer; user-select: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: .15s; display: flex; flex-direction: column; justify-content: center;
}
.stat:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(16, 24, 40, .10); border-color: #c9dcf5; }
.stat:active { transform: translateY(0); }
.stat:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.stat b { display: block; font-size: 21px; line-height: 1.15; font-weight: 700; }
.stat span { color: var(--muted); font-size: 12px; }
.stat.on { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(11, 95, 190, .30), var(--shadow); }
.stat.red b { color: var(--red); }
.stat.green b { color: var(--green); }
.stat.blue b { color: var(--brand); }
.stat.amber b { color: var(--amber); }
.stat::after { content: ''; position: absolute; right: -14px; top: -14px; width: 46px; height: 46px; border-radius: 50%; background: var(--brand-soft); opacity: .5; }
.stat.red::after { background: var(--red-soft); }
.stat.green::after { background: var(--green-soft); }
.stat.amber::after { background: var(--amber-soft); }

/* ============ 工具条 ============ */
.toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.toolbar input[type=search], .toolbar select {
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; font-size: 13.5px; background: #fff; color: var(--ink);
}
.toolbar input[type=search] { min-width: 230px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; padding: 6px 12px; border-radius: 20px; font-size: 13px; color: var(--muted);
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500; }
.chip.alert.on { background: var(--red); border-color: var(--red); }
.chip.ct-chip { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; }
.chip.ct-WB.on { background: #d92d20; border-color: #d92d20; }
.chip.ct-FW.on { background: #f79009; border-color: #f79009; }
.chip.ct-ZC.on { background: #12b76a; border-color: #12b76a; }
.spacer { flex: 1; }

/* 筛选栏 */
.filter-bar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 8px 12px; margin-bottom: 14px;
}
.filter-bar label {
  display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); white-space: nowrap;
}
.filter-bar select {
  border: 1px solid var(--line); border-radius: 7px; padding: 5px 24px 5px 8px;
  font-size: 13px; background: #fff; color: var(--ink); cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7789'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 10px;
}
.filter-bar select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }

/* ============ 按钮 ============ */
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px; transition: .15s;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #0a54a8; color: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger:hover { background: #b42318; color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============ 卡片列表 ============ */
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
/* 三列分组布局：WB（含 WB（副） 小节）| FW | ZC */
.card-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.card-col { border: 1px solid var(--line); border-radius: var(--radius); background: #fafbfd; overflow: hidden; }
.card-col-hd { padding: 9px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; font-weight: 600; }
.card-col-hd .col-cnt { font-size: 12px; font-weight: 400; color: var(--muted); background: #eef1f5; padding: 1px 8px; border-radius: 10px; }
.card-col-bd { display: flex; flex-direction: column; gap: 10px; padding: 10px; min-height: 60px; }
.card-col-bd .col-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 0; }
/* 各列标题色带 */
.col-wb .card-col-hd { background: #fef3f2; color: #b42318; border-bottom-color: #fecdca; }
.col-fw .card-col-hd { background: #fffaeb; color: #b54708; border-bottom-color: #fec84b; }
.col-zc .card-col-hd { background: #ecfdf3; color: #067647; border-bottom-color: #abefc6; }
/* WB 列内 WB（副）小节（浅蓝样式，带独立计数；WB（副）为空时整节不渲染） */
.card-col-subhd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px; margin: 2px 0 -2px; border-radius: 8px;
  background: #e0f2fe; color: #1d4ed8;
  font-size: 12.5px; font-weight: 700;
}
.card-col-subhd .col-cnt { font-size: 11.5px; font-weight: 600; background: rgba(255,255,255,.7); padding: 0 8px; border-radius: 10px; }
.card-col-subhd .col-title { letter-spacing: .5px; }
.card-col-subbd { display: flex; flex-direction: column; gap: 10px; }
.col-actions { display: flex; align-items: center; gap: 8px; }
.col-sort-btn { background: none; border: 1px solid rgba(0,0,0,.12); border-radius: 6px; padding: 2px 8px; font-size: 12px; cursor: pointer; color: inherit; opacity: .7; transition: all .15s; font-family: inherit; }
.col-sort-btn:hover { opacity: 1; background: rgba(255,255,255,.6); border-color: rgba(0,0,0,.22); }
.ccard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; cursor: pointer; transition: .18s; position: relative;
}
.ccard:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(16, 24, 40, .10); border-color: #c9dcf5; }
.ccard.alert { border-color: #fda29b; }
.ccard.alert::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--red); }
.ccard-head { padding: 12px 14px; border-bottom: 1px dashed var(--line); display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.ccard-head-side { display: flex; align-items: flex-start; gap: 6px; flex: 0 0 auto; }
.ccard-del { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: #fff; color: #98a2b3; border-radius: 6px; cursor: pointer; padding: 0; flex: 0 0 auto; transition: all .15s; }
.ccard-del:hover { color: #d92d20; border-color: #fda29b; background: #fef3f2; }
.ccard-share { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: #fff; color: #98a2b3; border-radius: 6px; cursor: pointer; padding: 0; flex: 0 0 auto; transition: all .15s; }
.ccard-share:hover { color: #0b5fbe; border-color: #bcd8f7; background: #eef4ff; }
.ccard-no { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--muted); }
.ccard-name { font-size: 16px; font-weight: 700; margin-top: 2px; }
.ccard-name small { font-weight: 400; color: var(--muted); font-size: 12.5px; margin-left: 6px; }
.ccard-body { padding: 10px 14px 12px; }
.ccard-row { display: flex; gap: 6px; font-size: 13px; color: #46526a; margin-bottom: 4px; }
.ccard-row .k { color: var(--muted); flex: 0 0 62px; }
.ccard-row .v { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ccard-foot { padding: 9px 14px; background: #fafbfd; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted); }

/* ---------- 长条型紧凑卡片：两行（姓名/性别/年龄 + 病种/居委/发布日期），宽度约原 1/3 ---------- */
.ccard.strip { padding: 0; }
.ccard.strip.has-side .cs-l1, .ccard.strip.has-side .cs-l2 { padding-right: 50px; }
.ccard.strip .cs-side { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; z-index: 2; }
.ccard.strip .cs-side .ccard-del, .ccard.strip .cs-side .ccard-share { width: 20px; height: 20px; }
.ccard.strip .cs-l1 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 9px 10px 7px; border-bottom: 1px dashed var(--line); }
.ccard.strip .cs-l2 { display: flex; gap: 8px 16px; flex-wrap: wrap; padding: 7px 10px 9px; font-size: 12.5px; color: #46526a; }
.ccard.strip .cs-f { display: inline-flex; align-items: baseline; gap: 4px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ccard.strip .cs-f i { color: var(--muted); font-style: normal; font-size: 11.5px; flex: 0 0 auto; }
.ccard.strip .cs-f b { font-weight: 600; color: #344054; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ccard.strip .ccard-name { font-size: 15px; }
.ccard.strip .ccard-name small { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 4px; }
.ccard.strip .ccard-no { flex: 0 0 auto; cursor: pointer; }
.ccard.strip .ccard-no .no-input {
  width: 58px; border: none; background: transparent; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-weight: 700; font-size: 14px; color: inherit; padding: 0; margin: 0; outline: none; cursor: pointer;
}
.ccard.strip .ccard-no:hover .no-input { background: rgba(0,0,0,.04); border-radius: 4px; }
.ccard.strip .ccard-no .no-input:focus,
.ccard.strip .ccard-no .no-input:not([readonly]) {
  background: #fff; border: 1px solid var(--primary); border-radius: 4px; padding: 2px 4px; cursor: text;
  box-shadow: 0 0 0 3px rgba(47, 128, 237, .15);
}

/* ============ 病例分类底色皮肤 WB=红 / FW=黄 / ZC=绿 ============ */
:root {
  --wb: #d92d20; --wb-bg: #fef3f2; --wb-hd: #fee4e2; --wb-bd: #fda29b;
  --fw: #dc6803; --fw-bg: #fffaeb; --fw-hd: #fef0c7; --fw-bd: #fec84b;
  --zc: #067647; --zc-bg: #ecfdf3; --zc-hd: #d1fadf; --zc-bd: #6ce9a6;
  --fd: #1d4ed8; --fd-bg: #e0f2fe; --fd-hd: #c8e6fc; --fd-bd: #93c5fd;
}
.ccard.skin-WB { background: linear-gradient(180deg, var(--wb-bg) 0%, #fff 76%); border-color: var(--wb-bd); }
.ccard.skin-WB（副） { background: linear-gradient(180deg, var(--fd-bg) 0%, #fff 76%); border-color: var(--fd-bd); }
.ccard.skin-FW { background: linear-gradient(180deg, var(--fw-bg) 0%, #fff 76%); border-color: var(--fw-bd); }
.ccard.skin-ZC { background: linear-gradient(180deg, var(--zc-bg) 0%, #fff 76%); border-color: var(--zc-bd); }
.ccard.skin-WB .ccard-head { background: var(--wb-hd); border-bottom-color: var(--wb-bd); }
.ccard.skin-WB（副） .ccard-head { background: var(--fd-hd); border-bottom-color: var(--fd-bd); }
.ccard.skin-FW .ccard-head { background: var(--fw-hd); border-bottom-color: var(--fw-bd); }
.ccard.skin-ZC .ccard-head { background: var(--zc-hd); border-bottom-color: var(--zc-bd); }
.ccard.skin-WB .ccard-foot { background: #fff7f6; border-top-color: #fecdca; }
.ccard.skin-WB（副） .ccard-foot { background: #f4faff; border-top-color: #b2d8fd; }
.ccard.skin-FW .ccard-foot { background: #fffcf2; border-top-color: #fedf89; }
.ccard.skin-ZC .ccard-foot { background: #f4fdf7; border-top-color: #a6f4c5; }
.ccard.skin-WB::after, .ccard.skin-WB（副）::after, .ccard.skin-FW::after, .ccard.skin-ZC::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
}
.ccard.skin-WB::after { background: var(--wb); }
.ccard.skin-WB（副）::after { background: var(--fd); }
.ccard.skin-FW::after { background: #f79009; }
.ccard.skin-ZC::after { background: #12b76a; }
.ccard.skin-WB:hover { border-color: var(--wb); }
.ccard.skin-WB（副）:hover { border-color: var(--fd); }
.ccard.skin-FW:hover { border-color: #f79009; }
.ccard.skin-ZC:hover { border-color: #12b76a; }

/* 详情页 / 新建页 卡片底色 */
.case-skin.skin-WB { background: linear-gradient(180deg, var(--wb-bg) 0%, #fff 66%); border-color: var(--wb-bd); }
.case-skin.skin-WB（副） { background: linear-gradient(180deg, var(--fd-bg) 0%, #fff 66%); border-color: var(--fd-bd); }
.case-skin.skin-FW { background: linear-gradient(180deg, var(--fw-bg) 0%, #fff 66%); border-color: var(--fw-bd); }
.case-skin.skin-ZC { background: linear-gradient(180deg, var(--zc-bg) 0%, #fff 66%); border-color: var(--zc-bd); }
.case-skin.skin-WB .panel-hd { background: var(--wb-hd); border-bottom-color: var(--wb-bd); }
.case-skin.skin-WB（副） .panel-hd { background: var(--fd-hd); border-bottom-color: var(--fd-bd); }
.case-skin.skin-FW .panel-hd { background: var(--fw-hd); border-bottom-color: var(--fw-bd); }
.case-skin.skin-ZC .panel-hd { background: var(--zc-hd); border-bottom-color: var(--zc-bd); }
.case-skin.step-panel.skin-WB { border-left-color: var(--wb); }
.case-skin.step-panel.skin-WB（副） { border-left-color: var(--fd); }
.case-skin.step-panel.skin-FW { border-left-color: #f79009; }
.case-skin.step-panel.skin-ZC { border-left-color: #12b76a; }
.case-skin { transition: background .25s, border-color .25s; }

/* 分类标签 */
.ct-tag {
  display: inline-block; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-weight: 800; font-size: 11px; letter-spacing: .6px; line-height: 1.6;
  padding: 1px 7px; border-radius: 5px; margin-right: 6px; color: #fff; vertical-align: middle;
}
.ct-tag.ct-WB { background: var(--wb); }
.ct-tag.ct-WB（副） { background: var(--fd); }
.ct-tag.ct-FW { background: #f79009; }
.ct-tag.ct-ZC { background: #12b76a; }
.ct-tag.lg { font-size: 14px; padding: 3px 11px; border-radius: 8px; margin-right: 2px; }

/* 分类单选（带色块） */
.radio-row.ct-row label { padding-left: 26px; position: relative; }
.radio-row.ct-row label::before {
  content: ''; position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  width: 11px; height: 11px; border-radius: 3px;
}
.radio-row.ct-row label.ct-WB::before { background: var(--wb); }
.radio-row.ct-row label.ct-WB（副）::before { background: var(--fd); }
.radio-row.ct-row label.ct-FW::before { background: #f79009; }
.radio-row.ct-row label.ct-ZC::before { background: #12b76a; }
.radio-row.ct-row label em { font-style: normal; color: var(--muted); font-size: 11.5px; margin-left: 5px; }
.radio-row.ct-row label.ct-WB.on { border-color: var(--wb); background: var(--wb-bg); color: var(--wb); }
.radio-row.ct-row label.ct-FW.on { border-color: #f79009; background: var(--fw-bg); color: #b54708; }
.radio-row.ct-row label.ct-ZC.on { border-color: #12b76a; background: var(--zc-bg); color: var(--zc); }
.radio-row.ct-row label.on em { color: inherit; opacity: .75; }
.ct-hint { font-weight: 400; color: var(--muted); font-size: 11.5px; margin-left: 8px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.b1 { background: var(--brand-soft); color: var(--brand); }
.badge.b2 { background: #f0f4ff; color: #3538cd; }
.badge.b3 { background: #f4f3ff; color: #6941c6; }
.badge.b4 { background: var(--amber-soft); color: var(--amber); }
.badge.done { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.gray { background: #f2f4f7; color: #667085; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.orange { background: var(--amber-soft, #fde8d7); color: var(--amber, #b54708); }

/* 漏随访行标红（详情页随访表用） */
.missed-row { background: #fef2f2; }
/* 异常症状行标红：该随访发热/关节痛/肌肉痛/皮疹任一异常时整行提示（与漏随访行可叠加） */
.abnormal-row { background: #fef3f2; }
.abnormal-row > td:first-child { border-left: 3px solid var(--red); }
/* 发热列温度值小标签 */
.fu-fever-val { color: var(--red); font-weight: 600; font-size: 12.5px; white-space: nowrap; }

/* 拒检人员「已结束管理」：随访任一条拒绝随访即结束，行降透明 + 患者姓名格「已结束」徽章 */
.ended-row { opacity: 0.55; }
.ended-badge {
  display: inline-block; padding: 1px 6px; margin-right: 4px;
  font-size: 11px; color: #fff; background: #8a94a6;
  border-radius: 8px; vertical-align: middle; line-height: 1.5;
}

/* ---------- 今日需上门随访名单 ---------- */
/* 随访筛选标签栏 */
.followup-filter-bar {
  display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap;
}
.fu-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: #46526a; font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: .15s;
}
.fu-tab:hover { border-color: #c9dcf5; background: #f5f8ff; }
.fu-tab.on {
  background: var(--brand); color: #fff; border-color: var(--brand);
  box-shadow: 0 2px 8px rgba(37, 99, 235, .22);
}

.tv-list { display: flex; flex-direction: column; gap: 8px; }
.tv-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 16px; box-shadow: var(--shadow); cursor: pointer; transition: .15s;
}
.tv-row:hover { border-color: #c9dcf5; transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 24, 40, .10); }
.tv-no { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--muted); }
.tv-name { font-size: 15px; font-weight: 700; }
.tv-name small { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; }
.tv-tags { display: flex; gap: 6px; align-items: center; }
.tv-info { color: var(--muted); font-size: 12.5px; }
.tv-go { margin-left: auto; color: var(--brand); font-weight: 600; font-size: 13px; }

/* 迷你进度 */
.mini-steps { display: flex; gap: 4px; margin-top: 10px; }
.mini-steps i {
  flex: 1; height: 5px; border-radius: 3px; background: #e6ebf3; display: block;
}
.mini-steps i.ok { background: var(--teal); }
.mini-steps i.cur { background: var(--brand); }
.mini-steps i.bad { background: var(--red); }

/* ============ 病例卡详情 ============ */
.detail { display: grid; grid-template-columns: 1fr; gap: 14px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-hd { padding: 13px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-hd h3 { margin: 0; font-size: 15.5px; }
.panel-bd { padding: 16px 18px; }

/* 精简病例卡（hero）冻结在顶栏下方：top 必须等于顶栏实际高度。
   窄屏顶栏会 flex-wrap 换行、高度随内容变化，无法写死，
   由 app.js 的 syncHeroTop() 实测顶栏高度写入 --topbar-h；
   写死会导致 hero 钉进顶栏背后（topbar z-index 50 > hero 48）视觉上等于没钉住 */
.case-hero { background: linear-gradient(180deg, #fff 0%, #fbfdff 100%); }
.case-hero.sticky-hero {
  position: sticky;
  top: var(--topbar-h, 60px);
  z-index: 48;
  box-shadow: 0 4px 12px rgba(11, 95, 190, .08);
}
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; padding: 16px 18px 8px; }
.hero-title { font-size: 21px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero-sub { color: var(--muted); font-size: 13px; margin-top: 4px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 步骤条 */
.stepbar { display: flex; padding: 6px 18px 18px; gap: 0; overflow-x: auto; }
.stepbar .st { flex: 1; min-width: 150px; position: relative; padding-top: 26px; text-align: center; }
.stepbar .st::before {
  content: ''; position: absolute; top: 12px; left: 0; right: 0; height: 3px; background: #e6ebf3;
}
.stepbar .st:first-child::before { left: 50%; }
.stepbar .st:last-child::before { right: 50%; }
.stepbar .st.ok::before, .stepbar .st.cur::before { background: linear-gradient(90deg, var(--teal), var(--teal)); }
.stepbar .st .num {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 3px solid #e6ebf3;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); z-index: 2;
}
.stepbar .st.ok .num { background: var(--teal); border-color: var(--teal); color: #fff; }
.stepbar .st.cur .num { background: #fff; border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 4px rgba(11, 95, 190, .14); }
.stepbar .st.bad .num { background: var(--red); border-color: var(--red); color: #fff; }
.stepbar .st .tt { font-size: 13.5px; font-weight: 600; }
.stepbar .st .dd { font-size: 12px; color: var(--muted); }
.stepbar .st.cur .tt { color: var(--brand); }
.stepbar .st.bad .tt { color: var(--red); }

/* 环节区块 */
.step-panel { border-left: 4px solid transparent; }
.step-panel.active { border-left-color: var(--brand); }
.step-panel.done { border-left-color: var(--teal); }
.step-panel.locked { border-left-color: #dfe5ee; background: #fcfdfe; }
.step-panel.warn { border-left-color: var(--red); }
.step-no {
  width: 24px; height: 24px; border-radius: 6px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 12.5px; font-weight: 700; flex: none;
}
.step-panel.done .step-no { background: var(--teal); }
.step-panel.locked .step-no { background: #b7c1d1; }
.step-panel.warn .step-no { background: var(--red); }
.dept-tag { background: #eef2f7; color: #475467; border-radius: 5px; padding: 2px 8px; font-size: 12px; font-weight: 600; }
.dept-tag.shewei { background: #e7f0fb; color: #0b5fbe; }
.dept-tag.juwei { background: #fdf2e0; color: #b06f00; }

.locked-tip, .role-tip {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 8px;
  background: #f7f9fc; color: var(--muted); font-size: 13px; border: 1px dashed var(--line);
}
.role-tip { background: var(--brand-soft); border-color: #bcd8f7; color: #0a4f9e; }
.role-tip .btn { margin-left: auto; }

/* 只读摘要 */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 20px; }
.kv .item { border-bottom: 1px dotted #e8edf5; padding-bottom: 6px; }
.kv .item.full { grid-column: 1 / -1; }
.kv .k { color: var(--muted); font-size: 12px; display: block; }
.kv .v { font-size: 13.5px; word-break: break-all; }
.kv .v.em { font-weight: 600; }
.kv .v.red { color: var(--red); font-weight: 700; }
.kv .v.green { color: var(--green); font-weight: 600; }
.kv .item.inline-group { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px 24px; border-bottom: none; padding-bottom: 0; }
.kv .kv-pair { display: flex; flex-direction: column; gap: 2px; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.fld { display: flex; flex-direction: column; gap: 5px; }
.fld.full { grid-column: 1 / -1; }
.fld > span.lb { font-size: 12.5px; color: #475467; font-weight: 500; }
.fld > span.lb i { color: var(--red); font-style: normal; margin-left: 2px; }
.fld input, .fld select, .fld textarea {
  border: 1px solid #d5dce7; border-radius: 7px; padding: 8px 10px; font-size: 13.5px;
  font-family: inherit; background: #fff; color: var(--ink); width: 100%;
}
.fld input:focus, .fld select:focus, .fld textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 95, 190, .12);
}
.fld textarea { resize: vertical; min-height: 62px; }
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-row label {
  border: 1px solid #d5dce7; border-radius: 7px; padding: 7px 13px; font-size: 13.5px; cursor: pointer; background: #fff;
  display: inline-flex; align-items: center; gap: 6px; user-select: none;
}
.radio-row label:hover { border-color: var(--brand); }
.radio-row input { display: none; }
.radio-row label.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.radio-row label.on.no { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.form-actions { display: flex; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; align-items: center; }

/* 智能识别录入 */
.paste-panel {
  background: linear-gradient(180deg, #eff7ff 0%, #fbfdff 100%);
  border: 1px dashed #9cc4ee; border-radius: 10px; padding: 14px 16px; margin-bottom: 18px;
}
.paste-panel .pp-hd { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.paste-panel .pp-ico { font-size: 20px; line-height: 1.2; }
.paste-panel .pp-hd b { font-size: 14.5px; color: #0a4f9e; }
.paste-panel .pp-hd small { display: block; color: #547296; font-size: 12.5px; margin-top: 2px; }
.paste-panel textarea {
  width: 100%; border: 1px solid #bdd6f2; border-radius: 8px; padding: 10px 12px;
  font-size: 13.5px; font-family: inherit; line-height: 1.7; background: #fff; color: var(--ink); resize: vertical;
}
.paste-panel textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 95, 190, .12); }
.paste-panel .pp-actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.paste-panel .pp-tip { color: #6b7789; font-size: 12px; }
.paste-panel .pp-tip.ok { color: var(--green); font-weight: 600; }
.paste-panel .pp-tip.err { color: var(--red); font-weight: 600; }

/* ---------- 批量导入 CSV 面板 ---------- */
.batch-panel {
  background: linear-gradient(180deg, #f2fbf5 0%, #fbfefc 100%);
  border: 1px dashed #8fcba3; border-radius: 10px; padding: 12px 16px; margin-bottom: 18px;
}
.batch-panel .bp-hd { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; user-select: none; }
.batch-panel .bp-ico { font-size: 20px; line-height: 1.2; }
.batch-panel .bp-hd b { font-size: 14.5px; color: #0b6e3a; }
.batch-panel .bp-hd small { display: block; color: #4e7a5f; font-size: 12.5px; margin-top: 2px; }
.batch-panel .bp-arrow { margin-left: auto; color: #4e7a5f; font-size: 14px; line-height: 1.6; }
.batch-panel .bp-bd { margin-top: 10px; }
.batch-panel .bp-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.batch-panel .bp-file-btn { position: relative; overflow: hidden; cursor: pointer; margin: 0; }
.batch-panel .bp-file-name { color: #6b7789; font-size: 12.5px; word-break: break-all; }
.batch-panel .bp-result { margin-top: 10px; padding: 10px 12px; border-radius: 8px; font-size: 13px; line-height: 1.6; }
.batch-panel .bp-result.ok { background: #ecf8f0; border: 1px solid #b5dfc4; color: #0b6e3a; }
.batch-panel .bp-result.err { background: #fef3f2; border: 1px solid #f1b8b4; color: #b42318; }
.batch-panel .bp-result b { display: block; font-size: 13.5px; }
.batch-panel .bp-result small { display: block; color: inherit; opacity: .85; margin-top: 2px; word-break: break-all; }
.batch-panel .bp-errs { margin: 8px 0 0; padding-left: 18px; }
.batch-panel .bp-errs li { margin: 2px 0; }
.batch-panel .bp-go { margin-top: 8px; }

/* 拒检编辑框：个人信息可折叠区（与批量导入面板同语言，独立类名避免污染） */
.rf-collapse { margin-bottom: 4px; }
.rf-collapse-hd {
  display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: #f8fafc; font-size: 13.5px; transition: background .12s;
}
.rf-collapse-hd:hover { background: var(--brand-soft); border-color: #c7d7fe; }
.rf-collapse-bar { width: 3px; height: 14px; background: var(--brand); border-radius: 2px; flex: 0 0 auto; }
.rf-collapse-hd b { font-weight: 600; color: #0a3a73; }
.rf-collapse-summary { font-weight: 400; color: var(--muted); font-size: 12px; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rf-collapse-arrow { color: var(--muted); font-size: 12px; line-height: 1; flex: 0 0 auto; }
.rf-collapse-bd { padding: 14px 2px 4px; }

@keyframes fillFlash {
  0% { background: #fff3c4; box-shadow: 0 0 0 3px rgba(240, 180, 41, .25); }
  100% { background: #fff; box-shadow: none; }
}
.fld.just-filled input, .fld.just-filled select, .fld.just-filled textarea { animation: fillFlash 1.8s ease-out; border-color: #f0b429; }
.fld.just-filled > span.lb::after { content: ' ✓ 已识别'; color: var(--teal); font-size: 11px; font-weight: 600; }
.m-row.just-filled td { animation: fillFlash 1.8s ease-out; }

/* 原文留档卡片 */
.raw-card {
  position: relative; background: #fbfcfe; border: 1px solid var(--line); border-left: 4px solid var(--brand);
  border-radius: 8px; padding: 12px 14px;
}
.raw-head { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 8px; }
.raw-card .raw-text { white-space: pre-wrap; word-break: break-word; font-size: 13.5px; line-height: 1.85; color: #2b3648; max-height: 5.2em; overflow: hidden; position: relative; transition: max-height .2s ease; }
.raw-card.open .raw-text { max-height: 60vh; overflow: auto; }
.raw-card .raw-text::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2.2em; background: linear-gradient(180deg, rgba(251,252,254,0), #fbfcfe); pointer-events: none; }
.raw-card.open .raw-text::after { display: none; }
.raw-card .raw-copy, .raw-card .raw-toggle { position: static; }

/* 电脑端：核心信息 / 居委核实情况 两卡并排等高，各自缩短；窄屏回退单列 */
.raw-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.raw-wrap { display: flex; flex-direction: column; min-width: 0; }
.raw-wrap > .sec-title { margin: 14px 0 4px; flex-wrap: wrap; }
/* 两卡列宽较窄时，居委核实卡的描述文本会折行——强制描述独占一行，标题与描述严格对齐 */
.raw-wrap > .sec-title small { flex: 1 1 100%; }
.raw-wrap > .raw-card { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.raw-wrap .raw-head { margin-bottom: 6px; }
.raw-cols .raw-text { max-height: 4.8em; font-size: 13px; line-height: 1.8; }
@media (max-width: 900px) { .raw-cols { grid-template-columns: 1fr; } }

/* 同住人表 */
.mtable-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 6px; }
.mtable-wrap .mtable { min-width: 620px !important; }
.mtable { width: 100%; border-collapse: collapse; margin-top: 6px; }
.mtable th { white-space: nowrap; }
.mtable-wrap .mtable th { min-width: 72px; }
.mtable-wrap .mtable th:first-child { min-width: 64px; }
.mtable-wrap .mtable th:last-child { min-width: 40px; }
.mtable th, .mtable td { border: 1px solid var(--line); padding: 6px 8px; font-size: 13px; text-align: left; }
.mtable th { background: #f7f9fc; color: #475467; font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.mtable td input, .mtable td select { border: 1px solid #dde3ec; border-radius: 6px; padding: 5px 7px; font-size: 13px; width: 100%; font-family: inherit; }
.mtable .nm { font-weight: 600; }
/* 表头排序钮（随访日期）：外观与 th 一致，可点击，占满整格保证命中区 */
.mtable th .th-sort { background: none; border: 0; padding: 0; margin: -6px -8px; padding: 6px 8px; display: block; width: calc(100% + 16px); font: inherit; color: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.mtable th .th-sort:hover { color: var(--brand, #2f6feb); }
.mtable th .th-sort .dir { display: inline-block; margin-left: 4px; font-size: 11px; opacity: .8; }
.sec-title { font-size: 13.5px; font-weight: 700; margin: 18px 0 4px; display: flex; align-items: center; gap: 8px; }
.sec-title::before { content: ''; width: 3px; height: 14px; background: var(--brand); border-radius: 2px; }
.sec-title small { font-weight: 400; color: var(--muted); font-size: 12px; }

/* 预警横幅 */
.alert-banner {
  background: linear-gradient(92deg, #fff1f0 0%, #fff6f5 100%); border: 1px solid #fda29b;
  border-left: 5px solid var(--red); border-radius: var(--radius); padding: 14px 18px;
  display: flex; gap: 14px; align-items: flex-start;
}
.alert-banner .ico { font-size: 22px; line-height: 1; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(.92); } }
.alert-banner h4 { margin: 0 0 4px; color: var(--red); font-size: 15px; }
.alert-banner p { margin: 0; font-size: 13px; color: #7a271a; }
.alert-banner .who { font-weight: 700; }

/* 时间线 */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 14px; }
.tl-item::before {
  content: ''; position: absolute; left: -18px; top: 6px; width: 9px; height: 9px; border-radius: 50%;
  background: #fff; border: 2px solid var(--brand);
}
.tl-item.sys::before { border-color: var(--red); background: var(--red); }
.tl-item .t { font-size: 12px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
.tl-item .c { font-size: 13.5px; }
.tl-item .c b { color: var(--ink); }

.mob-item { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; background: #fcfdff; }
.mob-item .hd { display: flex; gap: 10px; align-items: center; font-size: 13px; margin-bottom: 4px; flex-wrap: wrap; }
.mob-item .hd b { font-size: 13.5px; }

/* ============ 台账 ============ */
.ledger-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.ledger-scroll { overflow: auto; max-height: calc(100vh - 300px); position: relative; }
/* max-content 必须保留：fixed 布局下 width:auto 会被 Chrome 压缩到容器宽并等比压缩列宽，
   导致每列只剩一两字；max-content 让表格宽度 = 各列之和，超出容器横向滚动 */
table.ledger { border-collapse: separate; border-spacing: 0; font-size: 12.5px; table-layout: fixed; width: max-content; min-width: 100%; }
table.ledger th, table.ledger td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; line-height: 1.5; }
/* 列宽由 JS 按内容自适应（th 内联 style）；此处 13.3em 为兜底封顶值：12em 内容 + 左右各 8px 内边距 */
table.ledger th { padding: 3px 8px; width: 13.3em; }
table.ledger th.sticky { width: 5em; }
table.ledger td { padding: 0; vertical-align: top; }
/* 单元格最多显示 3 行（1.5 行高 × 3），超出内部滚动 */
table.ledger td .cell-body {
  max-height: 4.5em; overflow-y: auto; padding: 3px 8px;
  white-space: pre-wrap; word-break: break-word;
}
table.ledger thead th {
  position: sticky; top: 0; z-index: 3; background: #f1f5fb; color: #344054; font-weight: 600;
  border-bottom: 2px solid #d8e2f0;
}
table.ledger tbody tr:hover td { background: #f8fbff; }
table.ledger tbody tr.alert td { background: var(--red-soft); }
table.ledger tbody tr.alert:hover td { background: #fee9e7; }
table.ledger td.sticky, table.ledger th.sticky {
  /* 序号列 sticky 起点右移 2.2em 给勾选列让位（勾选复制功能占用 left:0），避免横滚时序号遮蔽勾选列 */
  position: sticky; left: 2.2em; z-index: 2; background: #fff; font-family: ui-monospace, Menlo, monospace; font-weight: 600;
}
table.ledger thead th.sticky { z-index: 4; background: #f1f5fb; }
table.ledger tbody tr.alert td.sticky { background: #fee4e2; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; opacity: .5; }

/* toast */
#toast {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%) translateY(-16px);
  background: #1b2434; color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 999; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--red); }
#toast.ok { background: #067647; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 200;
  display: grid; place-items: center; padding: 20px;
}
.modal { background: #fff; border-radius: 12px; width: min(520px, 100%); box-shadow: 0 20px 40px rgba(0, 0, 0, .2); overflow: hidden; max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal .mbd { overflow-y: auto; }
.modal h3 { margin: 0; padding: 15px 18px; border-bottom: 1px solid var(--line); font-size: 16px; }
.modal .mbd { padding: 16px 18px; }
.modal .mft { padding: 12px 18px; background: #fafbfd; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
/* 拒检编辑/新增弹窗：含 19 字段表单 + 7 天随访宽表（13 列），电脑端放宽以容纳整张随访表；窄屏回退 100% */
.modal[data-refusal-form] { width: min(1280px, 100%); }
/* 分享填写链接弹窗 */
.share-row { padding: 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfd; }
.share-row .sr-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.share-row .sr-desc { color: #6b7789; font-size: 12.5px; }
.share-row .sr-link { display: flex; margin-bottom: 8px; }
.share-row .sr-input { flex: 1; width: 100%; font-size: 12px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: #46526a; }

/* ============ 移动端适配 ============ */
@media (max-width: 900px) {
  .wrap { padding: 12px 12px 56px; }
  .stats { gap: 8px; }
  .stat { padding: 8px 10px; min-width: 104px; }
  .stat b { font-size: 19px; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

  /* 顶栏：logo 与身份药丸同行自适应，导航独占一行并可横向滚动 */
  .topbar { padding: 4px 12px; }
  .topbar-inner { height: auto; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 0; }
  .logo { flex: 1 1 auto; min-width: 0; font-size: 15px; }
  .logo small { display: none; }
  .role-switch { order: 2; flex: 0 0 auto; max-width: 100%; }
  .role-switch .lbl { display: none; }
  .role-pills { padding: 2px; gap: 2px; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .role-pills button { padding: 5px 10px; font-size: 12.5px; flex: 0 0 auto; }
  .nav { order: 3; flex: 0 0 100%; min-width: 100%; width: 100%; margin-left: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .nav button { white-space: nowrap; }

  .toolbar { gap: 8px; }
  .toolbar input[type=search], .toolbar select { flex: 1 1 100%; min-width: 0; }
  .toolbar .chips { width: 100%; }
  .toolbar .spacer { display: none; }
  .filter-bar { gap: 8px; }
  .filter-bar label { flex: 1 1 calc(50% - 8px); min-width: 120px; }
  .filter-bar select { flex: 1; min-width: 0; }
  .panel-hd { padding: 11px 13px; }
  .panel-bd { padding: 13px 14px; }
  .hero-top { padding: 12px 14px 6px; }
  .stepbar { padding: 6px 14px 16px; }
  .ccard-row .v { white-space: normal; }
}

@media (max-width: 600px) {
  body { font-size: 13.5px; }
  .card-grid { grid-template-columns: 1fr; }
  .card-cols { grid-template-columns: 1fr; }
  .page-head { display: block; }
  .page-head .btn.primary { width: 100%; margin-top: 10px; justify-content: center; }
  .page-head h2 { font-size: 17px; }
  .stats { gap: 6px; }
  .ccard-head { padding: 11px 12px; }
  .ccard-body { padding: 9px 12px 11px; }
  .ccard-row { font-size: 12.5px; }
  .ccard-row .k { flex-basis: 56px; }
  .hero-title { font-size: 18px; }
  .hero-sub { font-size: 12px; }
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }
  .alert-banner { flex-wrap: wrap; }
  .alert-banner .btn { width: 100%; }
  .role-tip { flex-wrap: wrap; }
  .role-tip .btn { margin-left: 0; width: 100%; }
  .modal .mbd { padding: 14px; }
  .ledger-scroll { max-height: calc(100vh - 250px); -webkit-overflow-scrolling: touch; }
  .share-row .sr-link { flex-wrap: wrap; }
  .share-row .sr-input { width: 100%; }
}

@media (max-width: 480px) {
  /* 极窄屏：顶栏纵向堆叠，导航与身份药丸居中并可滚动 */
  .topbar-inner { flex-direction: column; align-items: stretch; gap: 6px; }
  .logo { justify-content: center; font-size: 14px; }
  .role-switch { justify-content: center; order: 2; }
  .role-pills { justify-content: center; }
  .nav { justify-content: flex-start; }
  .stat b { font-size: 20px; }
  .stats { gap: 6px; }
  .ccard-name { font-size: 15px; }
  .sec-title { font-size: 13px; }
  .form-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* ---------- 独立随访页联系栏 + 电话操作气泡 ---------- */
.fu-contact { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; padding: 10px 12px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; }
.fu-contact-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fu-lbl { color: var(--muted); font-size: 12.5px; flex: none; min-width: 3em; }
.fu-addr { flex: 1 1 auto; word-break: break-all; font-size: 13.5px; }
.fu-empty { color: #98a2b3; font-size: 13px; }
.fu-phone {
  border: 0; background: transparent; color: var(--brand);
  font: inherit; font-size: 16px; font-weight: 600; padding: 2px 4px;
  border-radius: 6px; cursor: pointer;
}
.fu-phone:hover { background: var(--brand-soft); text-decoration: underline; }
/* 底部操作面板：遮罩 + 底部卡片，亮色系与全局风格一致。 */
.fu-sheet-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 25, 45, .4);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0 12px 14px;
  animation: fuSheetFade .15s ease-out;
}
@keyframes fuSheetFade { from { opacity: 0 } to { opacity: 1 } }
.fu-sheet {
  width: 100%; max-width: 460px;
  transform: translateY(0); animation: fuSheetUp .18s ease-out;
}
@keyframes fuSheetUp { from { transform: translateY(20px); } to { transform: translateY(0); } }
.fu-sheet-main { overflow: hidden; border-radius: 14px; margin-bottom: 10px; }
.fu-sheet-item {
  display: block; width: 100%; padding: 15px 12px; font-size: 16px;
  background: #fff; color: var(--ink); text-align: center;
  border: 0; border-top: 1px solid var(--line);
  cursor: pointer; transition: background .12s;
}
a.fu-sheet-item { color: var(--brand); font-weight: 700; }
.fu-sheet-item:active { background: var(--brand-soft); }
.fu-sheet-item.cancel { border-radius: 14px; border-top: 0; }
@media print {
  .fu-sheet-mask { display: none !important; }
  .topbar, .toolbar, .hero-actions, .form-actions, .no-print { display: none !important; }
  body { background: #fff; }
  .panel { box-shadow: none; border: 1px solid #ccc; page-break-inside: avoid; }
  .ledger-scroll { max-height: none; overflow: visible; }
  table.ledger td .cell-body { max-height: none; overflow: visible; }
  /* 病例分类底色需要跟着打印出来 */
  .ccard, .case-skin, .case-skin .panel-hd, .ct-tag, .ccard-head, .ccard-foot {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
}

/* ============ 登录层 ============ */
/* 未登录时锁定主界面：隐藏顶栏与正文，只留登录卡片 */
body.locked > .topbar, body.locked > .wrap { visibility: hidden; }

/* display:flex 会覆盖 [hidden] 的默认 display:none，须显式保证可隐藏 */
[hidden] { display: none !important; }

.login-mask {
  position: fixed; inset: 0; z-index: 100;
  background: linear-gradient(120deg, #0a4f9e 0%, #0b5fbe 45%, #1180c9 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--card); border-radius: 14px;
  padding: 30px 28px 22px; box-shadow: 0 12px 40px rgba(6, 34, 69, .35); text-align: center;
}
.login-logo span {
  display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 14px;
  background: var(--brand-soft); font-size: 26px; margin-bottom: 10px;
}
.login-card h2 { margin: 0; font-size: 18px; letter-spacing: .5px; }
.login-sub { margin: 6px 0 18px; color: var(--muted); font-size: 13px; }
.login-pwd {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; outline: none; background: #fff; color: var(--ink); margin-bottom: 10px;
}
.login-pwd:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 95, 190, .12); }
.login-btn { width: 100%; margin-top: 14px; justify-content: center; }
.login-tip { margin: 14px 0 0; color: var(--muted); font-size: 12px; }

/* 顶栏退出按钮 */
.logout-btn {
  border: 1px solid rgba(255, 255, 255, .45); background: transparent; color: rgba(255, 255, 255, .9);
  border-radius: 7px; padding: 4px 10px; font-size: 12.5px; margin-left: 2px;
}
.logout-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }

/* 顶栏立即备份按钮（管理员可见，视觉对齐 logout-btn） */
.backup-btn {
  border: 1px solid rgba(255, 255, 255, .45); background: transparent; color: rgba(255, 255, 255, .9);
  border-radius: 7px; padding: 4px 10px; font-size: 12.5px; margin-left: 2px;
}
.backup-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }

/* ---------- 台账列筛选 / 排序 ---------- */
/* 表头单元格内：文字 + 漏斗按钮（仅非长文本列有按钮） */
table.ledger thead th .ledger-th-label { display: inline-block; }
table.ledger thead th button.ledger-th-btn {
  float: right; margin-left: 4px; border: 0; background: transparent; color: #98a2b3;
  font-size: 11px; padding: 0 2px; cursor: pointer; line-height: 1.4;
}
table.ledger thead th button.ledger-th-btn:hover { color: var(--brand); }
table.ledger thead th button.ledger-th-btn.on { color: var(--brand); font-weight: 700; }

/* ---------- 台账勾选复制 ---------- */
table.ledger th.ledger-sel-col,
table.ledger td.ledger-sel-col {
  position: sticky; left: 0; z-index: 3; background: #f1f5fb;
  width: 2.2em; text-align: center; vertical-align: middle;
}
table.ledger td.ledger-sel-col { background: #fff; z-index: 3; }
table.ledger td.ledger-sel-col input,
table.ledger th.ledger-sel-col input { vertical-align: middle; cursor: pointer; }
/* 行 / 列选中高亮（淡蓝，与 --brand-soft 同色系） */
table.ledger tbody tr.sel td { background: #eaf3fd; }
table.ledger tbody tr.sel td.sticky { background: #eaf3fd; }/* 序号 sticky 也要变 */
table.ledger tbody tr.sel:hover td { background: #dbeafe; }
table.ledger thead th.sel,
table.ledger tbody td.sel { background: #dbeafe; }

/* 长文本列头独立 ☑ 按钮（与 ledger-th-btn 视觉一致，颜色用品牌蓝） */
table.ledger thead th button.ledger-th-selbtn {
  float: right; margin-left: 4px; border: 0; background: transparent; color: #98a2b3;
  font-size: 12px; padding: 0 2px; cursor: pointer; line-height: 1.4;
}
table.ledger thead th button.ledger-th-selbtn:hover { color: var(--brand); }
table.ledger thead th button.ledger-th-selbtn.on { color: var(--brand); }

/* 底部工具条 */
.ledger-sel-bar {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 900;
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: rgba(27, 36, 52, .92); color: #fff; border-radius: 999px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .22); backdrop-filter: blur(6px);
  max-width: 92vw; white-space: nowrap; flex-wrap: nowrap; overflow-x: auto;
}
.ledger-sel-bar .sel-count { font-size: 12.5px; padding: 0 2px; }
.ledger-sel-bar .btn.sm {
  border: 0; background: rgba(255, 255, 255, .14); color: #fff; padding: 5px 10px;
}
.ledger-sel-bar .btn.sm:hover { background: rgba(255, 255, 255, .22); }
.ledger-sel-bar .btn.sm:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 600px) {
  .ledger-sel-bar { bottom: 8px; padding: 6px 10px; gap: 6px; }
  .ledger-sel-bar .sel-count { font-size: 11.5px; }
}

/* 弹层：挂在 .ledger-scroll（relative + auto）内，随表格一起横向滚动 */
.ledger-filter-panel {
  position: absolute; z-index: 20; width: 240px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(15, 35, 80, .16);
  font-size: 12.5px; color: #344054;
}
.ledger-filter-panel .lf-sec { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.ledger-filter-panel .lf-sec:last-child { border-bottom: 0; }
.ledger-filter-panel .lf-sec .btn { margin-right: 6px; }
.ledger-filter-panel .lf-q { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; font-size: 12.5px; }
.ledger-filter-panel .lf-list { max-height: 200px; overflow-y: auto; }
.ledger-filter-panel .lf-item { display: flex; align-items: center; gap: 6px; padding: 2px 0; cursor: pointer; user-select: none; }
.ledger-filter-panel .lf-item:hover { background: #f6f9fe; }
.ledger-filter-panel .lf-item i { color: #98a2b3; font-style: normal; }
.ledger-filter-panel .lf-item i.cnt { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger-filter-panel .lf-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ============ 分析报告（/analytics） ============ */
/* 工具条：日期 chip + 管理员重算钮 */
.ana-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ana-bar .ana-bar-hint { color: var(--muted); font-size: 12.5px; }
/* 报告卡：上下两块，白底圆角 */
.ana-report-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px;
}
/* 同一日两份报告并排两列：左病例、右随访；窄屏回落单列 */
.ana-day-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; margin-bottom: 20px; }
.ana-day-row > .ana-report-card { margin-bottom: 0; }
@media (max-width: 900px) { .ana-day-row { grid-template-columns: 1fr; } }
.ana-report-card h3 { margin: 0 0 10px; font-size: 16px; color: var(--ink); }
.ana-report-card .ana-meta { margin: 0 0 10px; color: var(--muted); font-size: 12.5px; }
/* 报告卡内内容块：整段内容同框单列 */
.ana-section {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; font-size: 13.5px; line-height: 1.8;
}
.ana-section p { margin: 0 0 6px; }
.ana-section p:last-child { margin-bottom: 0; }
/* 历史日期选择框（原生日历，选中态由控件自身呈现） */
.ana-date-input {
  padding: 4px 10px; border-radius: 8px; border: 1px solid #bae6fd;
  background: #f0f9ff; color: #0369a1; font-size: 13px; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.ana-date-input:hover { border-color: #38bdf8; }
.ana-date-input:focus { outline: none; border-color: #0284c7; box-shadow: 0 0 0 3px rgba(2,132,199,0.15); }
.ana-date-input:disabled { color: #94a3b8; background: #f1f5f9; cursor: not-allowed; }
/* 实时数据标签 & 按钮 */
.ana-realtime-tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  background: #dcfce7; color: #15803d; font-size: 12px; font-weight: 600;
  vertical-align: middle; letter-spacing: 0.3px;
}
.ana-realtime-btn { border-color: #86efac !important; color: #15803d !important; background: #f0fdf4 !important; }
.ana-realtime-btn:hover { background: #dcfce7 !important; }

/* === 三间分布图表 + 风险评估卡 === */
.ana-dist-block { margin-top: 14px; display: flex; flex-direction: column; gap: 14px; }
.ana-dist-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ana-dist-head h3 { margin: 0; font-size: 15px; }
.ana-disease-switch { display: inline-flex; gap: 4px; background: var(--bg); padding: 3px; border-radius: 8px; border: 1px solid var(--line); }
.ana-disease-pill { border: none; background: transparent; padding: 4px 12px; border-radius: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.ana-disease-pill.on { background: var(--card); color: var(--brand); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.ana-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ana-chart { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.ana-chart h4 { margin: 0 0 6px; font-size: 13px; color: var(--ink); }
.ana-chart svg { width: 100%; height: auto; display: block; }
.ana-chart-scroll { overflow-x: auto; }
.ana-chart-empty { margin: 0; color: var(--muted); font-size: 13px; text-align: center; padding: 30px 0; }
.ana-risk-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.ana-risk-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.ana-risk-head h3 { margin: 0; font-size: 15px; }
.ana-risk-badge { padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid; background: var(--card); white-space: nowrap; }
.ana-risk-badge.low { background: var(--green-soft); }
.ana-risk-badge.warn { background: var(--amber-soft); }
.ana-risk-badge.high { background: var(--red-soft); }
/* 公文式文本框：白底浅描边，正文仿公文排版（首行缩进两字符、中文序号分点） */
.gw-body { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.gw-body p { margin: 0; font-size: 13.5px; line-height: 1.85; color: var(--ink); }
.gw-summary { text-indent: 2em; margin-bottom: 10px; }
.gw-pt { text-indent: 2em; margin-top: 6px; }
.gw-num { font-weight: 600; }
@media (max-width: 900px) {
  .ana-charts { grid-template-columns: 1fr; }
}

/* ============ 地址定位与导航 ============ */
.addr-loc-wrap { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.loc-btn { font-size: 12px !important; padding: 4px 10px !important; border: 1px solid #c7d7fe !important; color: var(--brand) !important; background: var(--brand-soft) !important; border-radius: 6px !important; }
.loc-btn:hover { background: #dbe9fe !important; }
/* 地图选点弹窗 */
.loc-modal { width: min(620px, 95vw) !important; }
.loc-map { width: 100%; height: 50vh; min-height: 280px; background: #f0f4f8; }
.loc-info { padding: 10px 16px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
/* 摘要导航链接 */
.addr-nav { color: var(--brand); text-decoration: none; border-bottom: 1px dashed var(--brand); }
.addr-nav:hover { border-bottom-style: solid; }
.nav-icon-btn { margin-left: 6px; font-size: 14px; text-decoration: none !important; border-bottom: none !important; vertical-align: middle; }
@media (max-width: 600px) {
  .loc-map { height: 40vh; min-height: 220px; }
}
