/* 心康在家 V0.7.1 样式
 * 基调：米白底 / 绿主色 / 暖色点缀；工作台克制小字号 + 大留白；
 * 患者端适老化：大字号、主要触控目标 ≥48px。
 */

:root {
  --bg: #f7f5f0;
  --panel: #ffffff;
  --ink: #1f2a26;
  --muted: #6b7a74;
  --line: #e2e0d8;
  --brand: #2f704f;
  --brand-2: #3d8a63;
  --brand-soft: #e8f1eb;
  --warm: #c8794a;
  --warm-soft: #fbf0e8;
  --danger: #b3402f;
  --danger-soft: #fdecea;
  --ok: #2f704f;
  --ok-soft: #e8f1eb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(31, 42, 38, .06), 0 8px 24px rgba(31, 42, 38, .05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; display: flex; flex-direction: column; }

/* 顶部边界提示条 */
.demo-bar {
  background: var(--brand);
  color: #eaf4ee;
  font-size: 12px;
  letter-spacing: .04em;
  text-align: center;
  padding: 6px 12px;
  flex: 0 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.topbar .identity { display: flex; align-items: center; gap: 12px; }
.topbar .logo {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px; letter-spacing: -1px;
}
.topbar .logo span { color: #f4c9a8; }
.topbar b { font-size: 16px; display: block; line-height: 1.2; }
.topbar small { color: var(--muted); font-size: 12px; }
#account { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
#account .quiet { font-size: 13px; color: var(--muted); }

.flash {
  display: none;
  margin: 12px 22px 0;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.flash.warn { border-color: #e9c4b2; background: var(--warm-soft); color: #7a3a18; }
.flash.ok { border-color: #bcd8c6; background: var(--ok-soft); color: #235c3e; }
.flash.info { border-color: #cddbd3; background: var(--brand-soft); color: #245139; }

/* 内容容器 */
.shell { flex: 1 1 auto; padding: 22px; }
.shell.wide { padding: 0; }
.shell.phone { display: flex; justify-content: center; padding: 18px; }

footer {
  flex: 0 0 auto;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 18px;
  border-top: 1px solid var(--line);
}

/* ---------------------------------------------------------------- 登录 */
.login-card {
  max-width: 400px;
  margin: 6vh auto 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.login-card h1 { font-size: 22px; margin: 6px 0 0; }
.login-card label { font-size: 13px; color: var(--muted); margin-top: 8px; }
.login-card input {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  background: #fdfcf9;
  color: var(--ink);
}
.login-card input:focus { outline: 2px solid var(--brand-2); outline-offset: 1px; }

.badge {
  align-self: flex-start;
  display: inline-block;
  background: var(--brand-soft);
  color: #235c3e;
  border: 1px solid #cddbd3;
  font-size: 11px;
  letter-spacing: .04em;
  padding: 3px 9px;
  border-radius: 999px;
}
.badge.warn { background: var(--warm-soft); color: #7a3a18; border-color: #e9c4b2; }

button { font-family: inherit; cursor: pointer; }
.primary {
  background: var(--brand);
  color: #fff;
  border: 1px solid var(--brand);
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
}
.primary:hover { background: var(--brand-2); }
.secondary, .sec {
  background: var(--panel);
  color: var(--brand);
  border: 1px solid #c9d8cf;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
}
.secondary:hover, .sec:hover { background: var(--brand-soft); }
.ghost {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--muted);
}
.ghost:hover { background: var(--bg); }
.link {
  background: transparent;
  border: 0;
  color: var(--brand);
  text-decoration: underline;
  font-size: 13px;
  padding: 2px 4px;
}
.wide { width: 100%; }
.touch { min-height: 48px; font-size: 16px; }
.danger { background: var(--danger); color: #fff; border: 1px solid var(--danger); border-radius: 10px; padding: 12px 18px; font-weight: 600; }

.caption { color: var(--muted); font-size: 13px; line-height: 1.6; }
.tiny { color: var(--muted); font-size: 11px; line-height: 1.6; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; }
.err { color: var(--danger); font-size: 13px; }
.okbox { background: var(--ok-soft); color: #235c3e; border: 1px solid #bcd8c6; border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.warnbox { background: var(--warm-soft); color: #7a3a18; border: 1px solid #e9c4b2; border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.6; }

/* ---------------------------------------------------------------- 工作台 */
.wb-wrap {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: calc(100vh - 150px);
}
.wb-nav {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  max-height: calc(100vh - 120px);
}
.wb-org { padding: 0 10px 14px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.wb-org b { font-size: 14px; display: block; }
.wb-org small { color: var(--muted); font-size: 11px; }
.wb-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: transparent; border: 0; border-radius: 8px;
  padding: 9px 10px; font-size: 13.5px; color: var(--ink);
  text-align: left;
}
.wb-item:hover { background: var(--bg); }
.wb-item.on { background: var(--brand-soft); color: #235c3e; font-weight: 600; }
.wb-item .lv {
  font-style: normal; font-size: 10px; padding: 1px 6px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); background: #fff;
}
.wb-item .lv2 { border-color: #bcd8c6; background: var(--ok-soft); color: #235c3e; }

.wb-main { padding: 26px 30px; max-width: 1180px; }
.wb-main > h1 { font-size: 21px; margin: 0 0 18px; letter-spacing: .01em; }
.wb-body { display: flex; flex-direction: column; gap: 16px; }

.metric-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(126px, 1fr)); gap: 10px; }
.kv {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 4px;
}
.kv small { color: var(--muted); font-size: 11.5px; }
.kv b { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }

.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 13.5px;
}
.row small { color: var(--muted); font-size: 12px; }

.tbl { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tbl th { background: #faf9f5; color: var(--muted); font-weight: 600; font-size: 12px; }
.tbl tr:last-child td { border-bottom: 0; }

.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--brand-soft); color: #235c3e; border: 1px solid #cddbd3;
}
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; min-width: 200px; background: #fdfcf9; }
.toolbar input, .toolbar select {
  padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; background: #fdfcf9; color: var(--ink);
}
h3 { font-size: 16px; margin: 4px 0; }
h4 { font-size: 13.5px; margin: 10px 0 6px; color: var(--muted); font-weight: 600; }

/* ---------------------------------------------------------------- 手机框架 */
.app-frame {
  width: 390px; max-width: 100%;
  height: min(844px, calc(100vh - 130px));
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  overflow: hidden;
  position: relative;
}
.app-inner {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 16px 96px;
  display: flex; flex-direction: column; gap: 12px;
  scroll-behavior: smooth;
}
.mobile-nav {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--line);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  backdrop-filter: blur(6px);
}
.mobile-nav .tab {
  background: transparent; border: 0; padding: 8px 2px;
  font-size: 12px; color: var(--muted); border-radius: 8px;
}
.mobile-nav .tab.on { color: var(--brand); font-weight: 700; background: var(--brand-soft); }

.app-intro { padding: 4px 2px 2px; }
.app-intro h1 { font-size: 25px; margin: 4px 0 6px; letter-spacing: -.01em; }
.app-intro p { margin: 0; font-size: 14px; }
.eyebrow { font-size: 11px; letter-spacing: .12em; color: var(--brand); text-transform: uppercase; }

.app-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.app-panel h2 { font-size: 16px; margin: 0; }
.app-panel .bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.today-priority { border-color: #cddbd3; background: linear-gradient(180deg, #fbfdfb, #ffffff); }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wheel-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wheel-field label { font-size: 13px; color: var(--muted); }
.wheel-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.wheel-btn {
  width: 34px; height: 48px; flex: 0 0 34px;
  border: 1px solid var(--line); background: #fdfcf9; border-radius: 9px;
  font-size: 18px; color: var(--brand); line-height: 1; padding: 0;
}
.wheel-btn:active { background: var(--brand-soft); }
.wheel-sel {
  flex: 1 1 0; min-width: 0; width: 100%;
  height: 48px; font-size: 17px; text-align: center; text-align-last: center;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
  font-variant-numeric: tabular-nums; padding: 0 2px;
}

/* 极窄屏（<360px）追加保护：按钮再收一档 */
@media (max-width: 359px) {
  .wheel-btn { width: 30px; flex-basis: 30px; font-size: 16px; }
  .wheel-sel { font-size: 15px; }
}
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; padding: 6px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }

.q-head { display: flex; flex-direction: column; gap: 6px; }
.q-head h3 { font-size: 16px; line-height: 1.5; margin: 0; }
.q-opts { display: flex; flex-direction: column; gap: 8px; }
.q-opt {
  min-height: 48px; text-align: left; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: #fdfcf9;
  font-size: 15px; color: var(--ink);
}
.q-opt.on { border-color: var(--brand); background: var(--brand-soft); font-weight: 600; color: #235c3e; }
.q-bar { display: flex; gap: 10px; }
.q-bar button { flex: 1 1 0; min-height: 46px; }

.cat-row { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 4px; }
.cat {
  flex: 0 0 auto; font-size: 12px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
}
.cat.on { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }

.msg {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 6px;
}
.msg.unread { border-left: 3px solid var(--warm); }
.msg p { margin: 0; font-size: 13.5px; line-height: 1.6; color: #38443f; }
.msg small { color: var(--muted); font-size: 11.5px; }
.msg .bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* 窄屏：工作台侧栏折叠 */
@media (max-width: 900px) {
  .wb-wrap { grid-template-columns: 1fr; }
  .wb-nav {
    flex-direction: row; overflow-x: auto; border-right: 0;
    border-bottom: 1px solid var(--line); max-height: none; padding: 10px;
  }
  .wb-org { display: none; }
  .wb-item { white-space: nowrap; }
  .wb-item .lv { display: none; }
  .wb-main { padding: 18px; }
}

/* V0.7.1 集中返修：触屏适老、双滚轮、固定停止入口。 */
.roller-viewport {
  height: 118px; overflow-y: auto; overflow-x: hidden;
  border: 1px solid var(--line); border-radius: 12px;
  background: linear-gradient(#f1f5ef, #fff 30%, #fff 70%, #f1f5ef);
  scroll-snap-type: y mandatory; overscroll-behavior: contain;
  scrollbar-width: thin; padding: 38px 6px;
}
.roller-item {
  display:block; margin: 0 auto; min-height: 40px; width:90%;
  scroll-snap-align:center; border:0; border-radius:7px;
  background:transparent; color:var(--muted); font-size:18px;
}
.roller-item[aria-selected="true"] { background:var(--brand-soft); color:var(--brand); font-size:22px; font-weight:700; }
.wheel-value { font-size:22px; font-variant-numeric:tabular-nums; text-align:center; min-height:30px; }
.wheel-field .wheel-row { justify-content:center; }
.wheel-field .wheel-row .tiny { font-size:11px; flex:1; text-align:center; }
.wheel-field .wheel-btn { width:46px; flex-basis:46px; min-height:46px; font-size:16px; }
.app-panel input:not([type="checkbox"]),.app-panel select,.app-panel textarea {
  width:100%; min-height:44px; border:1px solid var(--line); border-radius:9px;
  padding:9px 11px; font:inherit; background:#fff;
}
.app-panel button,.mobile-nav button { min-height:44px; }
.shell.phone { position:relative; }
.sim-stop-fixed { position:fixed; z-index:25; bottom:94px; left:50%;
  transform:translateX(-50%); width:min(calc(100vw - 44px),348px);
  min-height:54px; box-shadow:0 9px 22px #821c2180; font-size:18px;
}
.urgent-alert { background:#ffece8; color:#8e2118; border:2px solid #a82c21;
  font-size:17px; font-weight:700; }
.float-ask { position:fixed; z-index:23; bottom:155px; right:max(20px, calc((100vw - 390px)/2 - 5px));
  width:48px; height:48px; border:0; border-radius:50%;
  background:var(--brand); color:white; font-size:22px; box-shadow:0 6px 14px #0d352e44;
}
@media(max-width:420px){
  .shell.phone { padding:0; }
  .app-frame {width:100%;height:calc(100dvh - 86px);border-radius:0;}
  .app-panel {padding:15px;}
  .float-ask {right:14px;}
}

/* V0.7.1 final closeout: five-stage state presentation, reviewed knowledge screen. */
.exercise-steps {list-style:none;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));
  gap:4px;margin:0;padding:12px 6px;border:1px solid var(--line);border-radius:12px;background:#fff;}
.exercise-steps li {font-size:11px;line-height:1.35;min-width:0;text-align:center;color:var(--muted);}
.exercise-steps .step-num {display:grid;place-items:center;width:27px;height:27px;margin:0 auto 6px;
  background:#f1f4f0;border-radius:50%;color:var(--muted);font-weight:700;}
.exercise-steps li.on {color:var(--brand);font-weight:700;}
.exercise-steps li.on .step-num {background:var(--brand);color:white;}
.exercise-steps li.done .step-num {background:var(--brand-soft);color:var(--brand);}
.qa-article {border:1px solid var(--line);border-radius:9px;padding:11px;}
.qa-article summary {cursor:pointer;font-weight:650;min-height:28px;}
.qa-article-body {white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.6;}
.qa-history {max-height:265px;overflow-y:auto;}
.qa-bubble {padding:12px;border-radius:13px;background:var(--brand-soft);line-height:1.5;
  overflow-wrap:anywhere;display:flex;flex-direction:column;gap:6px;}
.qa-bubble.me {margin-left:28px;background:#f0f2f0;}
.qa-bubble-source {color:var(--muted);font-size:11px;}
@media(max-width:360px) { .exercise-steps {padding:10px 4px;gap:2px;} .exercise-steps li {font-size:10px;}
 .exercise-steps .step-num {width:24px;height:24px;} }

/* Integrated R4 parity: keep interactive controls unobstructed on 320/375px. */
.qa-inline { position:static; display:block; width:100%; min-height:48px;
  margin:0 0 10px; border:1px solid var(--line); border-radius:9px;
  background:#fff; color:var(--brand); font-weight:600; }
.precheck-options {min-width:0; border:1px solid var(--line); border-radius:10px;
  padding:10px; margin:10px 0;}
.precheck-options legend {font-size:15px; font-weight:650; padding:0 6px;}
.choice-row {display:flex;align-items:center;gap:10px;min-height:48px;
  border-bottom:1px solid var(--line);padding:8px 5px;font-size:15px;}
.choice-row:last-child {border-bottom:0;}
.choice-row input {width:22px;height:22px;flex:0 0 22px;accent-color:var(--brand);}
.sim-stop-fixed { width:min(calc(100vw - 24px),348px);bottom:80px;
  z-index:35; min-height:56px; }
@media (max-width:420px) {
  .app-inner { padding-bottom:165px; }
  .wheel-field,.roller-viewport,.qa-inline { z-index:auto; }
  .fields {gap:6px;}
  .float-ask { bottom:84px; right:12px; }
}

/* R6 小艾整轮UAT集中返修：沿用医院认可V0.7.1安全契约 */
.today-monitor {padding:12px 15px;gap:3px;}
.today-monitor h2 {font-size:14px;}
.today-priority .primary {font-size:18px;min-height:58px;}
.task-item {display:flex;align-items:center;gap:10px;width:100%;min-height:60px;
  border:0;border-bottom:1px solid var(--line);padding:8px 1px;text-align:left;
  background:transparent;color:var(--ink);cursor:pointer;}
.task-item:last-child {border-bottom:0;}
.task-item:focus-visible {outline:2px solid var(--brand);outline-offset:2px;}
.task-mark {width:22px;height:22px;flex:0 0 22px;border:2px solid #74958b;
  border-radius:5px;display:grid;place-items:center;color:white;}
.task-mark.done {border-color:var(--brand);background:var(--brand);}
.task-check {width:17px;height:17px;display:block;}
.task-text {flex:1;display:flex;flex-direction:column;gap:4px;min-width:0;}
.task-text b {font-size:15px;}
.task-text small {font-size:12px;color:var(--muted);line-height:1.4;}
.task-arrow {font-size:26px;color:var(--brand);line-height:1;}
.mobile-nav .tab {position:relative;min-width:0;}
.unread-badge {position:absolute;top:1px;right:3px;min-width:18px;height:18px;
  border-radius:10px;background:#c83a32;color:white;font-size:10px;font-weight:700;
  line-height:18px;text-align:center;padding:0 3px;}
.app-frame:has(#dr-inner) .mobile-nav {grid-template-columns:repeat(4,minmax(0,1fr));}
.history-list {max-height:300px;overflow-y:auto;}
.history-list .row {gap:7px;flex-wrap:wrap;}
.history-list small {white-space:nowrap;}
.history-list b {white-space:nowrap;font-variant-numeric:tabular-nums;}
.bp-trend {width:100%;height:auto;max-height:150px;display:block;
  border:1px solid var(--line);border-radius:9px;background:#fff;}
.trend-wrap {margin-top:5px;}
.compact-details {padding:12px 14px;}
.compact-details>summary {font-size:15px;font-weight:700;cursor:pointer;min-height:40px;
  display:flex;align-items:center;}
.qa-head {display:flex;align-items:flex-start;gap:10px;padding:3px 1px 8px;}
.qa-head h1 {margin:2px 0 5px;font-size:21px;}
.qa-head p {margin:0;}
.qa-back {flex:0 0 43px;width:43px;height:43px;font-size:30px;line-height:1;
  border:1px solid var(--line);border-radius:12px;background:#fff;color:var(--ink);}
.float-ask {touch-action:none;width:52px;height:52px;z-index:30;
  -webkit-user-select:none;user-select:none;cursor:grab;}
.float-ask:active {cursor:grabbing;}
.patient-drawer {position:fixed;inset:0;z-index:90;background:#11251f99;
  display:flex;justify-content:flex-end;align-items:stretch;}
.drawer-sheet {width:min(100%,690px);height:100%;overflow-y:auto;
  padding:22px;background:var(--bg);display:flex;flex-direction:column;gap:14px;}
.drawer-sheet>.secondary:first-child {align-self:flex-start;}
@media(max-width:380px){
  .mobile-nav {padding-left:2px;padding-right:2px;}
  .mobile-nav .tab {font-size:12px;padding:7px 0;}
  .unread-badge {right:0;}
  .task-item {min-height:62px;}
  .task-text b {font-size:14px;}
  .app-panel {padding:13px;}
}
/* Synthetic V7 admin data dashboard. Compact, accessible, responsive. */
.dash-controls{display:flex;align-items:end;flex-wrap:wrap;gap:10px;padding:12px 0;}
.dash-controls label{display:flex;flex-direction:column;gap:5px;font-size:12px;min-width:120px;}
.dash-controls input,.dash-controls select{min-height:42px;max-width:180px;}
.dash-kpis{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:10px;margin:16px 0;}
.dash-kpis .kv{min-width:0;padding:13px;border:1px solid var(--line);border-radius:10px;background:var(--paper);}
.dash-kpis .kv b{font-size:22px;}
.dash-two{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:14px 0;}
.dash-two .app-panel{min-width:0;overflow-x:auto;}
.dash-bar-row{width:100%;display:grid;grid-template-columns:90px 1fr 24px;gap:7px;align-items:center;
  min-height:44px;border:0;border-bottom:1px solid var(--line);background:transparent;text-align:left;cursor:pointer;}
.dash-bar-bg{height:12px;background:#eff2ef;border-radius:8px;overflow:hidden;}
.dash-bar-fill{height:12px;background:#2e7d5b;display:block;border-radius:8px;}
.dash-donut{width:126px;height:126px;border-radius:50%;margin:15px auto;position:relative;}
.dash-donut:after{content:'';position:absolute;inset:31px;background:var(--paper);border-radius:50%;}
.dash-trend-svg{width:100%;height:140px;}
@media(max-width:1000px){.dash-kpis{grid-template-columns:repeat(3,minmax(0,1fr));}}
@media(max-width:800px){.dash-kpis{grid-template-columns:repeat(2,minmax(0,1fr));}.dash-two{grid-template-columns:minmax(0,1fr);}}
@media(max-width:430px){.dash-controls label{min-width:105px;flex:1;}.dash-kpis .kv b{font-size:19px;}.dash-bar-row{grid-template-columns:76px 1fr 20px;}}

/* 10/27 本人四类记录：宽屏血压主卡+右侧体重/血糖，下方症状；窄屏不强制四列。 */
.patient-record-grid{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);grid-template-rows:auto auto;gap:10px;align-items:stretch}
.patient-record-grid [data-record-card='blood_pressure']{grid-column:1;grid-row:1 / span 2}
.patient-record-grid [data-record-card='weight']{grid-column:2;grid-row:1}
.patient-record-grid [data-record-card='glucose']{grid-column:2;grid-row:2}
.patient-record-grid [data-record-card='symptom']{grid-column:1 / -1;grid-row:3}
.record-panel{min-width:0;margin:0}.record-panel summary{cursor:pointer;white-space:normal;overflow-wrap:anywhere}
@media(max-width:420px){.patient-record-grid{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:7px}.patient-record-grid .record-panel{padding:9px}.patient-record-grid [data-record-card='blood_pressure']{grid-row:1 / span 2}.patient-record-grid [data-record-card='symptom']{grid-row:3}}

/* 2026-10-27 机构患者列表：筛选与操作两行、紧凑中文按钮。 */
.intake-search-row{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.intake-search-row > *{flex:1 1 160px;min-width:120px}
.intake-action-row{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:8px 0 12px}
.intake-action-row button{min-height:34px;min-width:auto;white-space:nowrap}
.intake-action-row [data-action="new-patient"]{margin-right:auto}
@media(max-width:560px){.intake-action-row{justify-content:flex-start}.intake-search-row > *{flex:1 1 100%}}

/* R08 统一患者列表：查询紧跟筛选；登记动作独立靠右，不遮挡小屏。 */
.intake-search-row{align-items:stretch}
.intake-search-row > input,.intake-search-row > select{flex:1 1 135px;min-width:112px}
.intake-inline-search-actions{display:flex;flex:0 0 auto;gap:6px;align-items:center}
.intake-inline-search-actions button{min-width:52px;min-height:36px;padding:6px 10px;white-space:nowrap}
.intake-action-row{justify-content:flex-end;gap:10px;margin:8px 0 12px}
.intake-action-row [data-action='new-patient']{margin-right:0}
.intake-action-row label{display:flex;align-items:center;gap:5px;margin-right:auto}
@media (max-width:600px){
 .intake-search-row > input,.intake-search-row > select{flex:1 1 calc(50% - 8px);min-width:0}
 .intake-inline-search-actions{flex:1 1 100%;justify-content:flex-end}
 .intake-action-row{flex-wrap:wrap}
}

/* R08 教育资料表单：简洁层级与合适输入面积，不在空白页散落控件。 */
.kb-create-form{display:grid;gap:11px;margin-top:16px;max-width:740px}
.kb-create-form label{display:flex;flex-direction:column;gap:5px;font-size:13px;font-weight:600;color:var(--ink)}
.kb-create-form input,.kb-create-form textarea{
 width:100%;min-width:0;box-sizing:border-box;padding:10px 12px;
 border:1px solid var(--line);border-radius:8px;color:var(--ink);
 background:var(--bg);font-size:14px;line-height:1.5;font-family:inherit}
.kb-create-form textarea{min-height:108px;resize:vertical}
.kb-form-actions{display:flex;justify-content:flex-end;padding-top:3px}
@media(max-width:600px){.kb-create-form{max-width:100%}.kb-form-actions button{width:100%}}

/* Authenticated, bounded research media preview. */
#action-preview-dialog video{display:block;width:100%;max-height:60vh;background:#111;border-radius:8px;}

/* M21: shared visual viewport / safe-area contract, no vendor-specific layouts. */
@supports (height:100dvh){body{min-height:100dvh}}
input,textarea,select{max-width:100%;min-width:0}
button{touch-action:manipulation}
/* The phone workspace remains usable inside a desktop/tablet frame as well. */
.app-frame{height:min(844px,calc(var(--xk-visible-height,100dvh) - 225px))}
.app-inner{min-height:0;flex:1 1 0;padding-bottom:18px}
.mobile-nav{position:relative;flex:0 0 auto;bottom:auto;left:auto;right:auto}
@media(max-width:600px){
  body{min-height:0;height:var(--xk-visible-height,100dvh);overflow:hidden}
  .demo-bar{padding:5px max(10px,env(safe-area-inset-right)) 5px max(10px,env(safe-area-inset-left));font-size:11px}
  .topbar{padding:8px max(10px,env(safe-area-inset-right)) 8px max(10px,env(safe-area-inset-left));gap:8px;min-width:0}
  .topbar .identity{gap:7px;flex:0 0 auto}
  .topbar .logo{width:30px;height:30px;border-radius:8px;font-size:15px}
  .topbar b{font-size:14px}.topbar small{font-size:10px}
  #account{gap:4px;min-width:0}#account .quiet{font-size:11px;overflow-wrap:anywhere;text-align:right}
  #account button{min-height:40px;padding:4px 8px;font-size:13px}
  body>footer{display:none}
  .shell,.shell.phone{min-height:0;overflow:auto;padding:8px 10px;overscroll-behavior:contain}
  .shell.phone{overflow:hidden;padding:0;display:flex;flex:1 1 0}
  .app-frame{width:100%;height:100%;max-height:none;min-height:0;border:0;border-radius:0;box-shadow:none}
  .app-inner{min-height:0;flex:1 1 0;padding:14px max(12px,env(safe-area-inset-right)) 18px max(12px,env(safe-area-inset-left));scroll-padding-bottom:28px;overscroll-behavior:contain}
  .mobile-nav{position:relative;flex:0 0 auto;bottom:auto;left:auto;right:auto;padding-bottom:calc(8px + env(safe-area-inset-bottom))}
  .mobile-nav .tab{min-height:48px;font-size:13px}
  .xk-keyboard-open .float-ask{visibility:hidden;pointer-events:none}
  .float-ask{bottom:calc(78px + env(safe-area-inset-bottom));right:max(12px,env(safe-area-inset-right))}
  .sim-stop-fixed{position:sticky;bottom:0;width:100%;max-width:none;min-height:54px}
  input,select,textarea,.toolbar input,.toolbar select,.kb-create-form input,.kb-create-form textarea,.login-card input{font-size:16px}
  .login-card{margin:12px auto;padding:20px;max-width:390px}
  .flash{margin:6px 10px 0;padding:8px 10px;flex:0 0 auto;max-height:25vh;overflow:auto}
  .patient-drawer{height:var(--xk-visible-height,100dvh);top:var(--xk-visible-top,0);bottom:auto}
  .drawer-sheet{height:100%;padding:14px 12px calc(18px + env(safe-area-inset-bottom));overscroll-behavior:contain}
  dialog{max-height:calc(var(--xk-visible-height,100dvh) - 28px);max-width:calc(100vw - 24px);overflow:auto;overscroll-behavior:contain;scroll-padding-block:18px}
  dialog input,dialog select,dialog textarea{min-height:44px}
  #action-preview-dialog video{max-height:calc(var(--xk-visible-height,100dvh) * .5)}
  #crf9-overlay{height:var(--xk-visible-height,100dvh);top:var(--xk-visible-top,0);bottom:auto}
  .wb-wrap{display:flex;flex-direction:column;min-height:0}
  .wb-nav{flex-direction:row;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;max-height:none;padding:8px;gap:5px;flex:0 0 auto}
  .wb-org{display:none}.wb-item{flex:0 0 auto;min-height:44px;padding:7px 10px;white-space:nowrap;font-size:13px}
  .wb-main{padding:16px 12px;min-width:0}.wb-body{min-width:0}
  .tbl{display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
  .toolbar .search{min-width:0;flex:1 1 140px}.toolbar button{min-height:44px}
  .xk-keyboard-open .mobile-nav{padding-bottom:4px}
}
@media(max-width:350px){
  .topbar small{display:none}.topbar .logo{display:none}
  .mobile-nav .tab{font-size:12px}.app-panel{padding:11px}
}
@media (prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}

/* 唯一完整产品整合：记录首页只导航，历史与表单均移入独立记录页。 */
.patient-record-grid{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);
  grid-template-rows:repeat(2,minmax(116px,auto)) minmax(105px,auto);gap:10px;align-items:stretch}
.record-link-card{display:flex;flex-direction:column;align-items:flex-start;text-align:left;min-width:0;
  padding:16px;gap:7px;border:1px solid #d3e4d7;background:#fff;border-radius:16px;
  box-shadow:var(--shadow);color:var(--ink);cursor:pointer;overflow-wrap:anywhere}
.record-link-card:hover,.record-link-card:focus-visible{border-color:var(--brand);outline:2px solid transparent;background:#f7fcf8}
.record-link-card .record-link-label{font-size:17px;font-weight:700;color:var(--brand)}
.record-link-card .record-link-value{font-size:19px;line-height:1.3;overflow-wrap:anywhere}
.record-link-card .record-link-date{font-size:12px;color:var(--muted);line-height:1.4}
.record-link-card .record-link-arrow{margin-top:auto;color:var(--brand);font-size:13px;font-weight:600}
.patient-record-grid [data-record-card='blood_pressure']{grid-column:1;grid-row:1 / span 2}
.patient-record-grid [data-record-card='weight']{grid-column:2;grid-row:1}
.patient-record-grid [data-record-card='glucose']{grid-column:2;grid-row:2}
.patient-record-grid [data-record-card='symptom']{grid-column:1/-1;grid-row:3}
@media(max-width:375px){.patient-record-grid{gap:8px}.record-link-card{padding:12px}
  .record-link-card .record-link-value{font-size:16px}}
.record-page-header{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-bottom:3px}
.record-page-header h1{font-size:23px;margin:0}
.record-page-header button{flex:0 0 auto}
.record-metric b{font-size:22px;line-height:1.3;overflow-wrap:anywhere}
.record-timeline{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}
.record-timeline li{border-left:3px solid var(--brand-soft);padding:5px 0 5px 12px;
  display:flex;flex-direction:column;gap:4px;overflow-wrap:anywhere}
.record-timeline time{font-size:12px;color:var(--muted)}
.record-timeline strong{font-size:16px}
.record-history{overflow:visible}
.record-history .history-list{overflow:visible;max-height:none}
.record-entry{display:flex;flex-direction:column;gap:12px;min-width:0}
.record-entry .fields{min-width:0}
.consent-summary-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:3px 10px;
  align-items:center;border-bottom:1px solid var(--line);padding:8px 0}
.consent-summary-row small{grid-column:1/-1;color:var(--muted)}
.consent-manage{display:flex;flex-direction:column;gap:12px}

/* 真聊天布局：一个独立消息滚动区，输入与发送始终同排，软键盘不吞掉操作区。 */
.app-inner.qa-screen{display:flex;flex-direction:column;gap:6px;overflow:hidden;
  min-height:0;padding-bottom:10px;scroll-behavior:auto}
.qa-screen .qa-head{flex:0 0 auto;align-items:center;padding-bottom:9px}
.qa-screen .qa-head h1{margin:0;font-size:20px}
.qa-screen .qa-head p{margin:3px 0 0;font-size:12px}
.qa-screen .qa-back{min-height:44px;min-width:44px;border-radius:10px;border:1px solid var(--line);
  background:#fff;font-size:25px;color:var(--brand)}
.qa-chat-feed{flex:1 1 0;min-height:70px;overflow-y:auto;overscroll-behavior:contain;
  display:flex;flex-direction:column;gap:11px;padding:12px 8px;border-radius:12px;background:#f3f5f1;
  scrollbar-width:thin}
.qa-chat-feed .qa-bubble{max-width:91%;align-self:flex-start;background:#fff;border:1px solid var(--line);
  border-radius:12px 12px 12px 4px;margin:0;white-space:pre-wrap;font-size:14px}
.qa-chat-feed .qa-bubble.me{align-self:flex-end;background:#e6f0e9;border-color:#cfe4d7;
  border-radius:12px 12px 4px 12px}
.qa-welcome{color:var(--muted);font-size:14px;line-height:1.6}
.qa-chat-compose{display:flex;flex-direction:column;flex:0 0 auto;gap:4px;padding:7px 0 0;
  margin:0;background:var(--bg);border:0}
.qa-compose-controls{display:flex;align-items:flex-end;gap:8px}
.qa-compose-controls textarea{flex:1 1 0;min-width:0;max-height:120px;resize:vertical;
  font:inherit;font-size:16px;line-height:1.5;border:1px solid var(--line);border-radius:12px;
  padding:10px;background:#fff}
.qa-compose-controls button{flex:0 0 70px;min-height:46px;padding:8px 10px}
.qa-compose-status{font-size:12px;color:var(--danger);min-height:0;line-height:1.5}
.qa-compose-status:empty{display:none}
.qa-safety-line{margin:0;text-align:left;font-size:11px;line-height:1.4;color:var(--muted)}
@media(max-width:600px){
  .app-inner.qa-screen{padding:8px max(10px,env(safe-area-inset-right)) 8px max(10px,env(safe-area-inset-left))}
  .qa-chat-feed{min-height:50px;padding:8px}
  .qa-chat-compose{padding-bottom:4px}
}
