/* ============================================================
   CDIO 鼻炎慢病管理 · 包豪斯视觉系统
   ------------------------------------------------------------
   设计原则（Bauhaus，魏玛—德绍）：
     · 形：只用方、圆、三角；直角优先，全站零圆角（照片标记除外）
     · 色：纸底 + 黑骨架 + 红/黄/蓝三原色，色块必须有功能含义
     · 线：2px 实线黑框代替柔和投影；需要层次时用硬阴影（offset shadow）
     · 字：几何无衬线，字重分明，数字等宽对齐
     · 构：网格外露（极淡方格底纹），信息块用粗线分区
     · 动：只做功能性过渡，不做装饰动画

   临床约束（不让步）：
     · 正文对比度 ≥ 4.5:1；字号不小于原版
     · 红/黄只做小面积强调，不做大面积底色（避免警报色滥用）
     · 状态语义保留：绿=正常、黄=注意、红=危险、蓝=信息
   ============================================================ */

:root {
  /* 三原色（略压暗，保证白字对比度 ≥4.5:1） */
  --red:       #d62828;
  --red-dark:  #a81c1c;
  --blue:      #1d4e89;
  --blue-dark: #153a66;
  --yellow:    #f2b705;

  /* 中性 */
  --ink:       #111111;
  --ink-2:     #333333;
  --grey:      #5a5a5a;
  --paper:     #f7f4ee;
  --white:     #ffffff;
  --line:      #111111;
  --line-soft: #d8d2c6;

  /* 语义色 */
  --ok:        #1b7a3d;
  --ok-bg:     #e8f5ec;
  --warn:      #8a5a00;
  --warn-bg:   #fdf3d9;
  --danger:    #b81d1d;
  --danger-bg: #fbe9e9;

  --bw: 2px;
  --shadow: 4px 4px 0 var(--ink);
  --shadow-sm: 2px 2px 0 var(--ink);

  /* 兼容旧变量名（防止遗留引用失效） */
  --teal: var(--blue);
  --teal-2: var(--blue);
  --teal-soft: #e9eff6;
  --ink2: var(--ink-2);
  --muted: var(--grey);
  --bg: var(--paper);
  --card: var(--white);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }

body {
  font-family: "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, rgba(17,17,17,.045) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(90deg, rgba(17,17,17,.045) 0 1px, transparent 1px 24px);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0 0 .5em; line-height: 1.3; letter-spacing: .01em; }
h1 { font-size: 1.5rem; font-weight: 800; }
h2 { font-size: 1.02rem; font-weight: 800; color: var(--ink); }
h3 { font-size: .95rem; font-weight: 800; color: var(--ink-2); }
p  { margin: .3em 0; }

a { color: var(--blue); text-decoration: none; border-bottom: 2px solid transparent; }
a:hover { border-bottom-color: var(--blue); }

.muted { color: var(--grey); }
.small { font-size: .85em; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.mt4 { margin-top: 4px; } .mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 0 18px; min-height: 58px;
  background: var(--white);
  border-bottom: 3px solid var(--ink);
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: .95rem; letter-spacing: .02em; color: var(--ink);
}
.brand .dot {
  width: 20px; height: 20px; border-radius: 0;
  background: var(--red); border: var(--bw) solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}
.nav { display: flex; gap: 0; flex: 1; flex-wrap: wrap; }
.nav a {
  display: block; padding: 8px 14px; margin-right: -2px;
  border: var(--bw) solid transparent;
  color: var(--ink-2); font-size: .9rem; font-weight: 700; letter-spacing: .02em;
}
.nav a:hover { background: rgba(29,78,137,.08); border-bottom-color: var(--blue); }
.nav a.on { background: var(--ink); color: var(--white); border-color: var(--ink); }
.badge {
  font-style: normal; display: inline-block; min-width: 18px;
  padding: 0 5px; margin-left: 5px;
  background: var(--red); color: var(--white);
  border: 1.5px solid var(--white);
  font-size: .68rem; font-weight: 800; line-height: 16px; text-align: center;
  vertical-align: middle;
}
.who { display: flex; align-items: center; gap: 10px; font-size: .86rem; font-weight: 600; }
.who .quit { color: var(--grey); font-weight: 700; font-size: .82rem; }

/* ---------- 布局 ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 22px 18px 56px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- 卡片 ---------- */
.card {
  position: relative;
  background: var(--white); border: var(--bw) solid var(--line);
  border-radius: 0; padding: 18px 18px 20px; margin-bottom: 18px;
}
.card h2 { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.card h2::before { content: ""; display: block; width: 10px; height: 10px; background: var(--red); flex: none; }
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.card-head h2 { margin-bottom: 0; }
.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 16px; flex-wrap: wrap;
}
.page-head h2 { margin: 0; }
.back { font-size: .85rem; font-weight: 700; color: var(--grey); }
.flags { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-block; padding: 1px 8px;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  background: var(--white); color: var(--ink-2);
  border: 1.5px solid var(--ink); border-radius: 0; white-space: nowrap;
}
.tag.ok     { background: var(--ok-bg);     color: var(--ok);     border-color: var(--ok); }
.tag.warn   { background: var(--warn-bg);   color: var(--warn);   border-color: var(--warn); }
.tag.danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.tag.role   { background: var(--yellow);    color: var(--ink);    border-color: var(--ink); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; background: var(--white); color: var(--ink);
  border: var(--bw) solid var(--ink); border-radius: 0;
  font-family: inherit; font-size: .88rem; font-weight: 800;
  letter-spacing: .02em; cursor: pointer; text-align: center;
  transition: transform .08s linear, box-shadow .08s linear, background .12s linear;
}
.btn:hover  { box-shadow: var(--shadow-sm); transform: translate(-1px,-1px); }
.btn:active { box-shadow: none; transform: translate(1px,1px); }
.btn.primary { background: var(--blue); color: var(--white); }
.btn.primary:hover { background: var(--blue-dark); }
.btn.danger { background: var(--red); color: var(--white); }
.btn.sm { padding: 5px 10px; font-size: .8rem; border-width: 1.5px; }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }
.btn.on { background: var(--yellow); }
form.inline { display: inline; }

/* ---------- 表单 ---------- */
label {
  display: block; margin-bottom: 12px;
  font-size: .82rem; font-weight: 700; color: var(--ink-2); letter-spacing: .02em;
}
input, select, textarea {
  width: 100%; margin-top: 6px; padding: 9px 11px;
  font-family: inherit; font-size: 14px; color: var(--ink);
  background: var(--white); border: var(--bw) solid var(--ink); border-radius: 0;
  transition: box-shadow .08s linear, background .12s linear;
}
input:focus, select:focus, textarea:focus { outline: none; box-shadow: var(--shadow-sm); background: #fffdf7; }
textarea { resize: vertical; }

.row3 { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 12px; align-items: end; }
.row5 { display: grid; grid-template-columns: repeat(6, 1fr) auto; gap: 12px; align-items: end; }
@media (max-width: 820px) {
  .row3, .row5 { grid-template-columns: 1fr 1fr; }
  .row3 .btn, .row5 .btn { grid-column: 1 / -1; }
}

.seg-radio { display: flex; gap: 0; margin-top: 6px; }
.seg-radio label {
  flex: 1; margin: 0 0 0 0; padding: 8px 4px; text-align: center;
  border: var(--bw) solid var(--ink); margin-right: -2px;
  background: var(--white); font-weight: 700; font-size: .82rem; cursor: pointer;
}
.seg-radio label:last-child { margin-right: 0; }
.seg-radio label:has(input:checked) { background: var(--yellow); color: var(--ink); }
.seg-radio input { display: none; }
.chk { display: flex; align-items: center; gap: 6px; margin: 0; font-size: .82rem; white-space: nowrap; }
.chk input { width: auto; margin: 0; }

/* ---------- 提示 ---------- */
.flash {
  padding: 10px 14px; margin-bottom: 16px;
  font-size: .88rem; font-weight: 700;
  background: var(--white); border: var(--bw) solid var(--ink); border-left-width: 8px;
}
.flash.ok     { border-left-color: var(--ok);     color: var(--ok); }
.flash.danger { border-left-color: var(--danger); color: var(--danger); }
.hint { font-size: .8rem; color: var(--grey); margin-top: 10px; }
.danger-text { color: var(--danger); font-weight: 700; }
.ok-text { color: var(--ok); font-weight: 700; }
.code { font-size: 2.6rem; font-weight: 800; margin: 0; color: var(--blue); }

/* ---------- 进度 ---------- */
.progress {
  height: 14px; margin: 12px 0 8px;
  background: var(--white); border: var(--bw) solid var(--ink);
  border-radius: 0; overflow: hidden;
}
.progress .bar { height: 100%; background: var(--blue); }
.progress-line { display: flex; justify-content: space-between; align-items: center; font-size: .86rem; font-weight: 700; }

.bar-mini {
  display: inline-block; width: 76px; height: 10px; margin-right: 8px;
  vertical-align: middle; background: var(--white);
  border: 1.5px solid var(--ink); overflow: hidden;
}
.bar-mini .bar { height: 100%; }
.bar-mini .bar.ok { background: var(--ok); }
.bar-mini .bar.warn { background: var(--yellow); }
.bar-mini .bar.danger { background: var(--red); }

/* ---------- 键值 ---------- */
.kv { display: flex; flex-direction: column; gap: 0; margin: 10px 0; }
.kv > div {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 7px 0; font-size: .9rem; border-bottom: 1px dashed var(--line-soft);
}
.kv .k { color: var(--grey); font-weight: 700; }

/* ---------- 今日待办 ---------- */
.todo-list { display: flex; flex-direction: column; gap: 10px; }
.todo {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--white); border: var(--bw) solid var(--ink);
}
.todo .ico {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  background: var(--yellow); color: var(--ink); border: 1.5px solid var(--ink);
  font-size: .8rem; font-weight: 800;
}
.todo .ti { flex: 1; min-width: 0; }
.todo .tn { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .92rem; font-weight: 700; }
.todo .ts { font-size: .78rem; color: var(--grey); }
.todo.done { background: var(--ok-bg); border-color: var(--ok); }
.todo.done .ico { background: var(--ok); color: var(--white); border-color: var(--ok); }
.todo.overdue { background: var(--danger-bg); border-color: var(--danger); }
.todo.overdue .ico { background: var(--red); color: var(--white); border-color: var(--danger); }

/* ---------- 提醒设置 ---------- */
.rem-list { display: flex; flex-direction: column; gap: 10px; }
.rem-row {
  display: flex; align-items: center; gap: 12px; padding: 9px 11px;
  background: var(--white); border: var(--bw) solid var(--ink);
}
.rem-row .rt { flex: 1; font-size: .88rem; }
.rem-row input[type=time] { width: auto; margin: 0; }

/* ---------- 统计 ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-row.big { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 820px) { .stat-row, .stat-row.big { grid-template-columns: repeat(2, 1fr); } }
.stat {
  padding: 14px 12px; text-align: left;
  background: var(--white); border: var(--bw) solid var(--ink); border-top-width: 8px;
}
.stat .n { font-size: 1.5rem; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat .n.ok { color: var(--ok); }
.stat .n.warn { color: var(--warn); }
.stat .n.danger { color: var(--danger); }
.stat .l { font-size: .76rem; font-weight: 700; color: var(--grey); margin-top: 4px; letter-spacing: .03em; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; margin-top: 10px; border: var(--bw) solid var(--ink); }
table { width: 100%; border-collapse: collapse; font-size: .84rem; background: var(--white); }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line-soft); }
th {
  background: #efeae0; color: var(--ink); font-weight: 800;
  font-size: .76rem; letter-spacing: .03em; white-space: nowrap;
  border-bottom: var(--bw) solid var(--ink);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fdfcf8; }

/* ---------- 图表 ---------- */
.chart { width: 100%; height: auto; display: block; margin: 8px 0; }

/* ---------- 消息 ---------- */
.msg-list { display: flex; flex-direction: column; gap: 12px; margin: 10px 0; }
.msg { max-width: 86%; padding: 10px 13px; background: var(--white); border: var(--bw) solid var(--ink); }
.msg.mine { margin-left: auto; background: #eaf0f7; border-color: var(--blue); }
.msg-head { display: flex; justify-content: space-between; gap: 10px; font-size: .76rem; margin-bottom: 5px; }
.msg-body { font-size: .9rem; white-space: pre-wrap; }
.msg-attach {
  margin-top: 7px; padding: 6px 9px; font-size: .78rem; color: var(--ink-2);
  background: var(--paper); border: 1px dashed var(--line-soft);
}
.mini-msg { display: flex; gap: 8px; align-items: baseline; padding: 8px 0; font-size: .86rem; border-bottom: 1px solid var(--line-soft); }
.mini-msg .tx { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-row { display: block; color: inherit; }
.msg-row:hover { background: #fdfcf8; }

/* ---------- 列表卡片 ---------- */
.card-list { display: flex; flex-direction: column; gap: 14px; }
.patient-card { display: block; color: inherit; margin: 0; transition: box-shadow .1s linear, transform .1s linear; }
.patient-card:hover { box-shadow: var(--shadow); transform: translate(-2px,-2px); }
.pc-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.pc-head b { font-size: 1.02rem; }
.pc-body { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 10px; font-size: .85rem; color: var(--ink-2); }
.pc-metric .k { color: var(--grey); font-size: .78rem; margin-right: 6px; font-weight: 700; }
.pc-flags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- 特殊卡片 ---------- */
.card.env { border-left-width: 10px; border-left-color: var(--blue); }
.card.env.high { border-left-color: var(--red); background: var(--danger-bg); }
.card.env.mid  { border-left-color: var(--yellow); background: var(--warn-bg); }
.card.stage { border-left-width: 10px; border-left-color: var(--blue); background: #eef2f8; }
.card.notice { border-left-width: 10px; border-left-color: var(--red); }

.steps { margin: 8px 0 0 20px; padding: 0; font-size: .9rem; }
.steps li { margin-bottom: 6px; }

/* ---------- 筛选 ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 5px 12px; font-size: .8rem; font-weight: 700; background: var(--white); color: var(--ink-2); border: var(--bw) solid var(--ink); }
.chip.on { background: var(--ink); color: var(--white); }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 74vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px 16px;
}
.bh-shapes { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.bh-shapes i { display: block; }
.bh-circle { width: 34px; height: 34px; background: var(--red); border: var(--bw) solid var(--ink); border-radius: 50%; }
.bh-square { width: 30px; height: 30px; background: var(--blue); border: var(--bw) solid var(--ink); }
.bh-tri {
  width: 0; height: 0;
  border-left: 19px solid transparent; border-right: 19px solid transparent;
  border-bottom: 33px solid var(--yellow);
}
.login-card {
  width: 100%; max-width: 420px; padding: 26px 24px 22px;
  background: var(--white); border: 3px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink); text-align: left;
}
.login-logo {
  width: 54px; height: 54px; margin: 0 0 14px;
  display: grid; place-items: center;
  background: var(--red); color: var(--white); border: var(--bw) solid var(--ink);
  font-size: 26px; font-weight: 800; box-shadow: var(--shadow-sm);
}
.login-card h1 { font-size: 1.35rem; margin-bottom: 4px; letter-spacing: .01em; }
.login-card .sub { color: var(--grey); font-size: .82rem; margin: 0 0 18px; }
.login-card form { margin-top: 4px; }
.demo-accounts { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft); font-size: .8rem; }
.demo-accounts .dt { color: var(--grey); font-weight: 700; margin-bottom: 8px; letter-spacing: .02em; }
.demo-accounts .da { margin-bottom: 6px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.foot-note { font-size: .74rem; color: var(--grey); margin-top: 16px; line-height: 1.6; }

/* ============================================================
   拍照定穴
   ============================================================ */
.steps-bar { display: flex; gap: 0; margin-bottom: 18px; flex-wrap: wrap; }
.steps-bar .s {
  flex: 1; min-width: 96px; display: flex; align-items: center; gap: 8px;
  padding: 9px 11px; margin-right: -2px;
  background: var(--white); color: var(--grey);
  border: var(--bw) solid var(--ink);
  font-size: .8rem; font-weight: 700;
}
.steps-bar .s:last-child { margin-right: 0; }
.steps-bar .s b {
  width: 22px; height: 22px; flex: none; display: grid; place-items: center;
  background: var(--line-soft); color: var(--ink); font-size: .74rem; font-weight: 800;
}
.steps-bar .s.on { background: var(--ink); color: var(--white); }
.steps-bar .s.on b { background: var(--yellow); color: var(--ink); }
.steps-bar .s.done b { background: var(--ok); color: var(--white); }

.pick-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.file-btn { position: relative; overflow: hidden; cursor: pointer; margin: 0; }

.drop-zone {
  margin-top: 12px; padding: 16px; text-align: center;
  font-size: .84rem; color: var(--grey);
  background: var(--white); border: 2px dashed var(--line);
  transition: background .12s linear;
}
.drop-zone.on { background: var(--warn-bg); border-color: var(--ink); color: var(--ink-2); }
.drop-zone b { color: var(--ink); }

#camBox video { display: block; width: 100%; max-width: 520px; background: #000; border: var(--bw) solid var(--ink); }

.face-stage {
  position: relative; display: inline-block; max-width: 100%;
  line-height: 0; background: var(--ink); border: var(--bw) solid var(--ink);
}
.face-stage img {
  display: block; max-width: 100%; height: auto;
  user-select: none; -webkit-user-drag: none; touch-action: manipulation;
}
.overlay { position: absolute; inset: 0; pointer-events: none; }
.face-stage .pin { position: absolute; transform: translate(-50%,-50%); pointer-events: auto; cursor: grab; touch-action: none; }
.face-stage .pin:active { cursor: grabbing; }
.face-stage .pin i {
  display: block; width: 15px; height: 15px; margin: 0 auto;
  border: 2px solid var(--white); border-radius: 50%; box-shadow: 0 0 0 2px var(--ink);
}
.face-stage .pin em {
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%);
  padding: 0 5px; font-style: normal; font-size: 10.5px; font-weight: 700;
  line-height: 1.5; white-space: nowrap; background: var(--ink); color: var(--white);
}
.face-stage .pin.lm i { background: var(--yellow); }
.face-stage .pin.ap i { background: var(--red); }
.face-stage .pin.ap em { background: var(--red); }

.loupe {
  position: fixed; width: 132px; height: 132px; overflow: hidden;
  border: 3px solid var(--ink); border-radius: 50%; background: #000;
  pointer-events: none; z-index: 9999; box-shadow: 0 0 0 3px var(--white);
}
.loupe::before, .loupe::after { content: ""; position: absolute; left: 50%; top: 50%; background: rgba(255,255,255,.9); }
.loupe::before { width: 1px; height: 18px; transform: translate(-50%,-50%); }
.loupe::after  { width: 18px; height: 1px; transform: translate(-50%,-50%); }
.loupe-inner { width: 100%; height: 100%; background-repeat: no-repeat; }

.lm-prompt {
  margin: 0 0 12px; padding: 10px 12px; font-size: .86rem; color: var(--ink-2);
  background: var(--warn-bg); border: var(--bw) solid var(--ink);
  border-left-width: 8px; border-left-color: var(--yellow);
}
.mark-quality {
  margin-top: 12px; padding: 12px; font-size: .84rem;
  background: var(--white); border: var(--bw) solid var(--ink);
  border-left-width: 8px; border-left-color: var(--blue);
}
.mark-quality .q-head { font-weight: 800; margin-bottom: 6px; }
.mark-quality .q-head.ok { color: var(--ok); }
.mark-quality .q-head.warn { color: var(--warn); }
.mark-quality .q-list { margin: 6px 0 8px 18px; padding: 0; color: var(--warn); }
.mark-quality .q-list li { margin-bottom: 3px; }
.mark-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.massage-item { padding: 9px 0; font-size: .87rem; border-bottom: 1px solid var(--line-soft); }
.massage-item:last-child { border-bottom: none; }
.massage-item b { display: block; color: var(--blue); margin-bottom: 3px; }
.massage-item span { color: var(--ink-2); }

.face-view { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 18px; align-items: start; }
@media (max-width: 820px) { .face-view { grid-template-columns: 1fr; } }
.face-side .steps { font-size: .86rem; }
.thumb-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.thumb { flex: none; width: 112px; text-align: center; }
.thumb img { width: 112px; height: 84px; object-fit: cover; border: var(--bw) solid var(--ink); }

/* ============================================================
   接入信息页
   ============================================================ */
.url-box {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; margin: 10px 0;
  background: var(--paper); border: var(--bw) solid var(--ink);
}
.url-box code { flex: 1; font-size: .82rem; word-break: break-all; font-family: ui-monospace, Consolas, monospace; }
.url-box .btn { flex: none; margin: 0; }
.qr-wrap { text-align: center; margin-top: 12px; }
.qr-wrap img { background: var(--white); border: var(--bw) solid var(--ink); padding: 6px; }
.codeblock {
  padding: 10px 12px; margin: 10px 0; background: var(--ink); color: #f2f2f2;
  font-size: .78rem; font-family: ui-monospace, Consolas, monospace;
  overflow-x: auto; white-space: pre-wrap; word-break: break-all;
}

/* ---------- 错误页 ---------- */
.card .code { font-size: 3rem; color: var(--red); }

/* ============================================================
   响应式修正（依据 430px 真机截图）
   ============================================================ */

/* 手机端顶栏：品牌 + 用户信息一行，导航单独一行可横向滚动 */
@media (max-width: 820px) {
  .topbar {
    padding: 0 12px; gap: 6px 10px; min-height: 0;
  }
  .brand { flex: 1 1 auto; min-width: 0; font-size: .9rem; }
  .brand .dot { width: 16px; height: 16px; box-shadow: 1px 1px 0 var(--ink); }
  .who { flex: none; font-size: .8rem; gap: 8px; }
  .who .tag { padding: 0 6px; }

  .nav {
    order: 3; flex: 1 1 100%;
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    margin: 0 -12px; padding: 0 12px;
    border-top: 2px solid var(--ink);
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a {
    flex: 0 0 auto; white-space: nowrap;
    padding: 10px 12px; font-size: .86rem;
  }
}

/* 步骤条：窄屏改 4 等分网格，编号与文字上下排，不再换行 */
@media (max-width: 560px) {
  .steps-bar {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 0;
  }
  .steps-bar .s {
    flex-direction: column; align-items: flex-start; gap: 5px;
    min-width: 0; margin-right: -2px; padding: 8px;
    font-size: .72rem; line-height: 1.25;
  }
  .steps-bar .s:last-child { margin-right: 0; }
  .steps-bar .s b { width: 20px; height: 20px; font-size: .7rem; }
}

@media (max-width: 480px) {
  .wrap { padding: 16px 12px 40px; }
  .card { padding: 14px 13px 16px; }
  .login-card { padding: 22px 18px 18px; box-shadow: 6px 6px 0 var(--ink); }
  .pick-row .btn { flex: 1 1 100%; }
  .stat .n { font-size: 1.3rem; }
  h1 { font-size: 1.3rem; }
}

/* 三角改为内联 SVG 后需要的基础样式 */
.bh-shapes svg.bh-tri { display: block; }

/* ---------- 收尾修正 ---------- */
.grid2 { align-items: start; }              /* 避免短卡片被拉成和旁边一样高 */

/* 统计卡：顶部色条按语义着色 */
.stat:nth-child(3n+1) { border-top-color: var(--blue); }
.stat:nth-child(3n+2) { border-top-color: var(--red); }
.stat:nth-child(3n+3) { border-top-color: var(--yellow); }
.stat-row.big .stat:nth-child(4n+1) { border-top-color: var(--blue); }
.stat-row.big .stat:nth-child(4n+2) { border-top-color: var(--red); }
.stat-row.big .stat:nth-child(4n+3) { border-top-color: var(--yellow); }
.stat-row.big .stat:nth-child(4n+4) { border-top-color: var(--ink); }

/* ============================================================
   注册页 / 账号管理
   ============================================================ */

/* 登录页：登录与注册之间的分隔 */
.login-split {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0 10px; color: var(--muted, #5a5a5a); font-size: .78rem;
}
.login-split::before, .login-split::after {
  content: ""; flex: 1; height: 2px; background: var(--ink, #111);
}
.login-split span { flex: none; }

/* 次级按钮（描边） */
.btn.ghost {
  background: #fff; color: var(--ink, #111);
  border: 2px solid var(--ink, #111);
  box-shadow: 3px 3px 0 var(--ink, #111);
}
.btn.ghost:hover { background: var(--yellow, #f2b705); color: var(--ink, #111); }

/* 注册卡片稍宽 */
.reg-card { max-width: 560px; }

/* 身份选择：两张可点的卡片 */
.role-pick {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin: 6px 0 14px;
}
.role-opt { display: block; cursor: pointer; }
.role-opt input { position: absolute; opacity: 0; pointer-events: none; }

.role-box {
  display: flex; flex-direction: column; gap: 5px;
  padding: 12px 14px; min-height: 104px;
  background: #fff; border: 2px solid #c9c3b7;
  transition: .08s linear;
}
.role-box b { font-size: .98rem; color: var(--ink, #111); }
.role-box em {
  font-style: normal; font-size: .74rem; line-height: 1.45;
  color: var(--muted, #5a5a5a);
}
.role-opt input:checked + .role-box {
  border-color: var(--ink, #111);
  box-shadow: 4px 4px 0 var(--ink, #111);
  background: #fffdf6;
}
.role-opt input:focus-visible + .role-box { outline: 3px solid var(--blue, #1d4e89); }

.role-shape { display: block; width: 18px; height: 18px; }
.role-shape.circle { background: var(--red, #d62828); border-radius: 50%; }
.role-shape.square { background: var(--blue, #1d4e89); }

/* 注册表单：两列 */
.reg-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px 12px; margin-bottom: 8px;
}
.reg-grid[hidden] { display: none; }
.reg-grid label { margin: 0; }

@media (max-width: 560px) {
  .role-pick { grid-template-columns: 1fr; }
  .reg-grid { grid-template-columns: 1fr; }
}

/* 账号管理：筛选条 */
.filter-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 10px 0 14px; border-bottom: 2px solid #e6e0d4; margin-bottom: 12px;
}
.fb-label { font-size: .78rem; color: var(--muted, #5a5a5a); }
.fb-note { margin-left: auto; font-size: .76rem; color: var(--muted, #5a5a5a); }

.chip-link {
  display: inline-block; padding: 4px 12px;
  font-size: .8rem; color: var(--ink, #111); text-decoration: none;
  background: #fff; border: 2px solid #c9c3b7;
}
.chip-link:hover { background: var(--yellow, #f2b705); border-color: var(--ink, #111); }
.chip-link.on {
  background: var(--ink, #111); color: #fff; border-color: var(--ink, #111);
}

/* 账号管理：行内操作 */
.ops { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ops .btn.sm { padding: 3px 9px; font-size: .76rem; }
.ops-reset { display: inline-flex; gap: 4px; align-items: center; }
.ops-input {
  width: 118px; padding: 3px 6px; font-size: .74rem;
  border: 2px solid #c9c3b7; background: #fff;
}
.ops-input:focus { border-color: var(--ink, #111); outline: none; }
.btn.sm.danger { background: var(--red, #d62828); color: #fff; border-color: var(--ink, #111); }
.btn.sm.danger:hover { background: #a81f1f; }

tr.row-off td { opacity: .55; }

/* 重置密码输入框太窄，占位符被截断 */
.ops-input { width: 104px; }
.ops-input::placeholder { color: #9a9a9a; font-size: .72rem; }

/* ============================================================
   iOS / macOS 适配（第三版新增）
   —— 目标：iPhone Safari、iPad、Mac Safari/Chrome 上表现一致
   ============================================================ */

/* 1) 禁止 iOS 双击缩放与文本自动放大 */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }

/* 2) 点击延迟与高亮：iOS 上按钮点击应有即时反馈而不是 300ms 灰色块 */
a, button, .btn, input, select, textarea {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* 3) 安全区：刘海 / 灵动岛 / 底部 Home 指示条
      env() 在不支持的浏览器里返回 0，max() 保证普通设备仍有原内边距 */
.topbar {
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
  padding-top: env(safe-area-inset-top);
}
.wrap {
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
  padding-bottom: calc(48px + env(safe-area-inset-bottom));
}
/* 安装成 PWA 后（standalone）没有浏览器工具栏，底部要多留一点 */
@media all and (display-mode: standalone) {
  body { padding-bottom: env(safe-area-inset-bottom); }
}

/* 4) iOS 输入框字号小于 16px 会触发"聚焦自动放大页面"，这里强制 16px */
input, select, textarea { font-size: 16px; }
@media (min-width: 821px) {
  input, select, textarea { font-size: .95rem; }
}

/* 5) 触摸设备没有 hover：去掉位移/阴影变化，避免点完"卡住" */
@media (hover: none) and (pointer: coarse) {
  .btn:hover, button:hover {
    transform: none;
    box-shadow: var(--shadow);
  }
  .nav a:hover { background: none; border-bottom-color: transparent; }
  .chip-link:hover { background: var(--white); border-color: #c9c3b7; }
  /* 触摸时用 :active 给反馈 */
  .btn:active, button:active { transform: translate(3px, 3px); box-shadow: none; }
}

/* 6) 横向滚动的容器在 iOS 上要惯性滚动 */
.nav, .table-wrap { -webkit-overflow-scrolling: touch; }

/* 7) iOS 下 date/time 输入框默认样式很窄，给个最小宽度免得被压扁 */
input[type="date"], input[type="time"], input[type="datetime-local"] {
  min-width: 132px;
  -webkit-appearance: none;
  appearance: none;
}

/* 8) 选中文件后 iOS 会显示很长的文件名，防止撑破布局 */
input[type="file"] { max-width: 100%; }

/* 9) 打印（部分老师会打印页面看） */
@media print {
  .topbar, .nav, .btn, button { display: none !important; }
  body { background: #fff; }
  .card { border: 1px solid #999; box-shadow: none; }
}

/* 安装指引页 */
.install-block {
  border: 2px solid var(--ink, #111);
  background: #fff;
  padding: 14px 16px;
}
.install-block h3 {
  font-size: .95rem; margin: 0 0 8px; display: flex; align-items: center; gap: 8px;
}
.install-block .steps { margin: 6px 0 8px; padding-left: 20px; }
.install-block .steps li { font-size: .85rem; line-height: 1.85; color: var(--ink-2, #333); }
.install-block .steps b { color: var(--ink, #111); }
.install-block code {
  background: #f7f4ee; border: 1px solid #d8d2c6;
  padding: 1px 5px; font-size: .82rem;
}

/* 登录页底部的"安装到主屏幕"入口 */
.install-hint { margin-top: 4px; }
.install-hint a {
  color: var(--blue, #1d4e89);
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
}
.install-hint a:hover { color: var(--red, #d62828); }

/* ============================================================
   患者端简化版 UI（第三版 · 面向患者的易读重排）
   ------------------------------------------------------------
   原则：
     · 首屏只回答三个问题：今天做什么 / 疗程在哪 / 上次测得怎么样
     · 一个主操作，其余降级为文字链接
     · 术语口语化（台账→我的记录，穴位图→拍穴位，依从率→还差几次）
     · 正文 17px 起，可点区域 ≥48px，照顾中老年患者
     · 卡片只留一层边框，去掉卡中卡与内部虚线
   ============================================================ */

/* 患者端容器：给底部标签栏留空间 */
.wrap-patient {
  max-width: 720px;
  padding: 0 0 calc(84px + env(safe-area-inset-bottom)) 0;
}
.wrap-patient .flash { margin: 14px 18px 0; }

/* ---------- 状态区 ---------- */
.p-status { padding: 22px 18px 4px; }
.p-status.small { padding-bottom: 0; }
.p-status .big {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: .2px;
}
.p-status .big b { color: var(--red); font-weight: 800; }
.p-status .sub {
  margin-top: 6px;
  font-size: .95rem;
  color: var(--grey);
  line-height: 1.5;
}

.p-track {
  height: 14px;
  background: #e8e4da;
  border: 2px solid var(--ink);
  margin-top: 14px;
}
.p-track i {
  display: block;
  height: 100%;
  background: var(--blue);
  transition: width .3s ease;
}

/* ---------- 主操作按钮 ---------- */
.p-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 22px 18px 0;
  min-height: 62px;
  background: var(--red);
  color: #fff;
  border: 2px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-decoration: none;
}
.p-primary:hover { color: #fff; background: var(--red-dark); }
.p-primary:active { transform: translate(3px, 3px); box-shadow: 3px 3px 0 var(--ink); }

/* ---------- 区块标题 ---------- */
.p-sec { padding: 28px 18px 0; }
.p-sec.tight { padding-top: 22px; }
.p-sec h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .86rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--grey);
  margin-bottom: 12px;
}
.p-sec h3::before {
  content: "";
  width: 10px;
  height: 10px;
  background: var(--red);
  flex: none;
}

/* ---------- 待办条目 ---------- */
.task {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  min-height: 78px;
  border: 2px solid var(--ink);
  background: #fff;
  margin-bottom: 12px;
  text-decoration: none;
  color: inherit;
}
.task .ico {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  background: #efece4;
  font-size: 1.15rem;
  font-weight: 800;
}
.task .body { flex: 1; min-width: 0; display: block; }
.task .t { display: block; font-size: 1.06rem; font-weight: 800; line-height: 1.4; }
.task .m { display: block; font-size: .82rem; color: var(--grey); margin-top: 3px; }
.task .arrow { color: var(--grey); font-size: 1.2rem; flex: none; }

/* 未完成且已超时：只有这一种情况用红色 */
.task.alert { border-color: var(--red); background: #fff5f5; }
.task.alert .ico { background: var(--red); border-color: var(--red); color: #fff; }
.task.alert .t { color: var(--red); }

/* 已完成：弱化，不抢注意力 */
.task.done { opacity: .5; background: transparent; }
.task.done .t { font-weight: 700; color: var(--grey); text-decoration: line-through; }

/* ---------- 上次测量 ---------- */
.p-last {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border: 2px solid var(--ink);
  background: #fff;
}
.p-last .n { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.p-last .l { font-size: .82rem; color: var(--grey); margin-top: 3px; }
.pill {
  padding: 5px 12px;
  border: 2px solid var(--ink);
  font-size: .9rem;
  font-weight: 800;
  white-space: nowrap;
}
.pill.ok { background: #e6f2e6; }
.pill.warn { background: var(--yellow); }
.pill.danger { background: var(--red); color: #fff; border-color: var(--red); }

/* ---------- 医生回复 ---------- */
.p-msg {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 18px 0;
  padding: 14px 16px;
  min-height: 58px;
  border: 2px solid var(--ink);
  background: #fff;
  text-decoration: none;
  color: inherit;
}
.p-msg .dot { width: 10px; height: 10px; background: var(--red); border-radius: 50%; flex: none; }
.p-msg .txt { flex: 1; min-width: 0; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-msg .arrow { color: var(--grey); flex: none; }

/* ---------- 环境一句话 ---------- */
.p-env { font-size: .95rem; color: var(--ink-2); line-height: 1.6; }
.p-note { font-size: .88rem; color: var(--grey); margin-bottom: 12px; }
.p-empty { font-size: .92rem; color: var(--grey); padding: 8px 0; }

/* ---------- 更多页 ---------- */
.more-list { padding: 18px 18px 0; }
.more-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  min-height: 74px;
  border: 2px solid var(--ink);
  background: #fff;
  margin-bottom: 12px;
  text-decoration: none;
  color: inherit;
}
.more-item .ico {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  background: #efece4;
  font-size: 1.2rem;
  font-weight: 800;
}
.more-item .body { flex: 1; min-width: 0; display: block; }
.more-item .t { display: block; font-size: 1.06rem; font-weight: 800; }
.more-item .m { display: block; font-size: .82rem; color: var(--grey); margin-top: 2px; }
.more-item .arrow { color: var(--grey); flex: none; font-size: 1.2rem; }

.rem-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  min-height: 58px;
  border: 2px solid var(--ink);
  background: #fff;
  margin-bottom: 10px;
}
.rem-row .rt { font-size: 1rem; }
.rem-row .rt b { font-size: 1.05rem; }

/* ---------- 底部标签栏（仅患者端） ---------- */
.tabbar {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  grid-template-columns: repeat(4, 1fr);
  background: var(--paper);
  border-top: 2px solid var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 62px;
  text-decoration: none;
  color: var(--grey);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .5px;
  border: 0;
}
.tabbar a .g { font-size: 1.2rem; line-height: 1; position: relative; }
.tabbar a .g .badge {
  position: absolute;
  top: -6px; right: -12px;
  min-width: 16px; height: 16px;
  font-size: .62rem;
  display: flex; align-items: center; justify-content: center;
}
.tabbar a.on { color: var(--ink); background: #fff; }
.tabbar a.on .g { color: var(--red); }

/* 手机端：显示标签栏，隐藏顶部导航 */
@media (max-width: 760px) {
  body.role-patient .nav { display: none; }
  body.role-patient .tabbar { display: grid; }
  body.role-patient .topbar { padding: 12px 18px; }
  body.role-patient .topbar .brand { font-size: 1.06rem; }
  body.role-patient .wrap-patient { padding-left: 0; padding-right: 0; }
}

/* 桌面端：隐藏标签栏，顶部导航保留 */
@media (min-width: 761px) {
  .tabbar { display: none; }
  .wrap-patient { padding: 22px 18px 56px; }
}

/* ---------- 打卡表单 ---------- */
.rec-form { padding: 18px 18px 0; }
.rec-field { margin-bottom: 26px; }
.rec-label {
  display: block;
  font-size: 1.06rem;
  font-weight: 800;
  margin-bottom: 10px;
}
.rec-label .opt { font-size: .84rem; font-weight: 500; color: var(--grey); }

/* 类型：三个大按钮 */
.rec-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.chip { position: relative; display: block; }
.chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  border: 2px solid var(--ink);
  background: #fff;
  font-size: 1.02rem;
  font-weight: 700;
}
.chip input:checked + span {
  background: var(--ink);
  color: #fff;
}

/* 鼻塞程度：四档 */
.rec-scale { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; }
.scale-item { position: relative; display: block; }
.scale-item input { position: absolute; opacity: 0; width: 0; height: 0; }
.scale-item span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 62px;
  border: 2px solid var(--ink);
  border-right-width: 0;
  background: #fff;
  font-size: .98rem;
  font-weight: 700;
}
.scale-item:last-child span { border-right-width: 2px; }
.scale-item input:checked + span {
  background: var(--yellow);
  box-shadow: inset 0 -5px 0 var(--ink);
}

.rec-note {
  width: 100%;
  height: 56px;
  padding: 0 14px;
  border: 2px solid var(--ink);
  background: #fff;
  font-size: 1rem;
  font-family: inherit;
}

/* 打卡页的主按钮：占满宽度并留出下方间距 */
.p-primary.full {
  width: calc(100% - 36px);
  margin: 6px 18px 0;
  border: 2px solid var(--ink);
  cursor: pointer;
  font-family: inherit;
}

/* ---------- 登录页（简化版） ---------- */
.login-card h1 { font-size: 1.9rem; }
.login-card .sub { font-size: .95rem; color: var(--grey); margin-top: 6px; }
.login-card form label { margin-top: 18px; }
.login-card form label input { height: 56px; font-size: 1.05rem; }
.login-card .p-primary.full {
  width: 100%;
  margin: 26px 0 0;
  cursor: pointer;
  font-family: inherit;
}
.login-register {
  display: block;
  margin-top: 20px;
  text-align: center;
  font-size: .95rem;
  color: var(--blue);
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
  padding-bottom: 1px;
}
.login-register:hover { color: var(--red); }

/* 提醒开关：已开启用中性深色，避免和"注意"黄色混淆 */
.rem-row .btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* 登录页脚注：两条之间留距离，避免虚线贴在一起 */
.login-card .foot-note + .foot-note { margin-top: 14px; }
.login-card .foot-note { line-height: 1.6; }

/* ============================================================
   医生端 · 风险优先工作台
   ------------------------------------------------------------
   目标不是"信息更少"，而是"决策更快"：
     · 顶部一句话告诉你今天有几个人要处理
     · 列表按风险排序，最高级风险用左侧色条表示
     · 每个患者一句人话说明"为什么他排在这"
     · 次要数据（次数/阻抗/间隔）压成一行小字
   ============================================================ */

.d-work { padding: 24px 18px 0; max-width: 1120px; margin: 0 auto; }
.d-head { display: flex; align-items: baseline; gap: 12px; }
.d-head h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: .5px; }
.d-count { font-size: .9rem; color: var(--grey); font-weight: 700; }

.d-alert {
  margin-top: 14px;
  padding: 14px 16px;
  border: 2px solid var(--ink);
  background: #fff;
  border-left-width: 10px;
  border-left-color: var(--red);
}
.d-alert.calm { border-left-color: var(--blue); }
.d-alert-num { font-size: 1.05rem; font-weight: 800; }
.d-alert-num b { font-size: 1.35rem; }
.d-alert-num b.danger { color: var(--red); }
.d-alert-num b.warn { color: #9a6b00; }
.d-alert-sub { font-size: .82rem; color: var(--grey); margin-top: 3px; }

.d-list { max-width: 1120px; margin: 18px auto 0; padding: 0 18px 40px; }

.d-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 2px solid var(--ink);
  background: #fff;
  margin-bottom: 12px;
  text-decoration: none;
  color: inherit;
  min-height: 92px;
}
.d-row .d-bar { width: 10px; flex: none; background: #cfcabc; }
.d-row.danger .d-bar { background: var(--red); }
.d-row.warn   .d-bar { background: var(--yellow); }
.d-row.ok     .d-bar { background: var(--blue); }

.d-main { flex: 1; min-width: 0; padding: 13px 4px 13px 16px; display: block; }
.d-name {
  display: flex; align-items: center; gap: 8px;
  font-size: 1.1rem; font-weight: 800;
}
.d-off { font-size: .72rem; font-style: normal; color: var(--grey); border: 1px solid var(--grey); padding: 0 5px; }

.d-reason { display: block; margin-top: 3px; font-size: .95rem; font-weight: 700; }
.d-reason.danger { color: var(--red); }
.d-reason.warn { color: #8a5f00; }
.d-reason.ok { color: var(--grey); font-weight: 500; }

.d-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 8px; font-size: .8rem; color: var(--grey);
}
.d-num { font-weight: 700; color: var(--ink-2); }
.d-num.muted { font-weight: 500; color: var(--grey); }
.d-gap { margin-left: auto; }

.d-tag {
  padding: 1px 7px;
  border: 1px solid var(--ink);
  font-size: .72rem;
  font-weight: 700;
}
.d-tag.ok { background: #e6f2e6; }
.d-tag.warn { background: var(--yellow); }
.d-tag.danger { background: var(--red); color: #fff; border-color: var(--red); }

.d-side {
  flex: none;
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
}
.d-unread {
  min-width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--red); color: #fff;
  font-size: .8rem; font-weight: 800;
}
.d-arrow { color: var(--grey); font-size: 1.3rem; }

.d-empty { font-size: .95rem; color: var(--grey); padding: 20px 0; }

@media (max-width: 760px) {
  .d-work { padding: 18px 14px 0; }
  .d-list { padding: 14px 14px 30px; }
  .d-meta { font-size: .76rem; }
  .d-gap { margin-left: 0; }
}

/* 医生端 · 患者详情头部 */
.d-detail {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 20px 18px 4px;
  max-width: 1120px; margin: 0 auto;
  flex-wrap: wrap;
}
.d-detail .back { display: block; width: 100%; font-size: .84rem; color: var(--blue); text-decoration: none; margin-bottom: 8px; }
.d-detail-main { flex: 1; min-width: 260px; }
.d-detail-name { font-size: 1.45rem; font-weight: 800; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.d-code { font-size: .78rem; font-weight: 700; border: 1px solid var(--ink); padding: 1px 6px; }
.d-detail-meta { font-size: .84rem; font-weight: 500; color: var(--grey); }
.d-detail-reason { margin-top: 6px; font-size: 1rem; font-weight: 800; }
.d-detail-reason.danger { color: var(--red); }
.d-detail-reason.warn { color: #8a5f00; }
.d-detail-reason.ok { color: var(--grey); font-weight: 600; }
.d-detail-note { margin-top: 4px; font-size: .82rem; color: var(--grey); }

/* 提醒计划：去掉嵌套重边框，改成一行一条 */
.card .rem-list .rem-row { border-width: 0 0 2px 0; background: transparent; padding: 10px 0; }
.card .rem-list .rem-row:last-child { border-bottom-width: 0; }

/* ============================================================
   管理端 / 医生端页面级标题（轻量统一，不动表格结构）
   ============================================================ */
.adm-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 18px 12px;
}
.adm-head h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: .5px;
  line-height: 1.3;
}
.adm-sub { font-size: .88rem; color: var(--grey); margin-top: 4px; }

/* 患者端表单：联系医生 */
.p-form { padding: 18px 18px 0; }
.p-textarea {
  width: 100%;
  min-height: 120px;
  padding: 14px;
  border: 2px solid var(--ink);
  background: #fff;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
}
.p-attach {
  margin-top: 12px;
  padding: 10px 12px;
  border: 2px dashed var(--ink);
  font-size: .86rem;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.p-attach-time { color: var(--grey); }

/* 患者端：找医生 / 换医生 */
.d-mine {
  font-size: .7rem;
  font-style: normal;
  font-weight: 700;
  border: 1px solid var(--ink);
  padding: 0 5px;
  margin-left: 6px;
  background: #e6f2e6;
}
.p-switch { color: var(--blue); text-decoration: none; border-bottom: 1px dashed currentColor; }
.more-item.mine { border-left-width: 10px; border-left-color: var(--blue); }
.adm-foot { max-width: 1120px; margin: 0 auto; padding: 18px; }
.d-side form.inline { display: inline; }

/* ---------- 消息撤回 ---------- */
.msg-head { display: flex; align-items: center; gap: 8px; }
.recall-form { margin-left: auto; }
.recall-btn {
  border: 0;
  background: transparent;
  color: var(--grey);
  font-size: .72rem;
  font-family: inherit;
  cursor: pointer;
  padding: 2px 4px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.recall-btn:hover { color: var(--red); }

.msg.recalled {
  border: 0;
  background: transparent;
  text-align: center;
  font-size: .78rem;
  color: var(--grey);
  padding: 6px 0;
}

/* ---------- 账号设置 / 注销 ---------- */
.acc-wrap { max-width: 720px; margin: 0 auto; padding: 0 18px 40px; }
.acc-card {
  border: 2px solid var(--ink);
  background: #fff;
  padding: 18px;
  margin-bottom: 18px;
}
.acc-card h2 { font-size: 1.1rem; font-weight: 800; margin-bottom: 12px; }
.acc-card.danger { border-color: var(--red); }
.acc-card.danger h2 { color: var(--red); }
.acc-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px dashed #ddd6c8; font-size: .95rem;
}
.acc-row:last-of-type { border-bottom: 0; }
.acc-row .k { color: var(--grey); }
.acc-row .v { font-weight: 700; }
.acc-note { font-size: .88rem; color: var(--ink-2); line-height: 1.6; margin-bottom: 14px; }
.acc-card .btn.danger { background: var(--red); color: #fff; border-color: var(--ink); }
.acc-card label { display: block; margin-bottom: 12px; font-size: .9rem; font-weight: 700; }
.acc-card label input { margin-top: 6px; height: 48px; font-size: 1rem; }
