/* =============================================================
   机构养老管理系统 · 视觉系统
   基调：暖白底 + 深墨绿侧栏 + 赭金强调
   原则：低饱和、强层次、数字对齐；信息密度高但不拥挤
   ============================================================= */

:root {
  /* 底色与中性色 */
  --bg: #f2f4f2;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --surface-3: #f1f5f3;
  --ink: #15211d;
  --ink-2: #55635d;
  --ink-3: #8b9993;
  --line: #e5eae7;
  --line-strong: #d5ded9;

  /* 主色：墨绿 */
  --brand: #146a57;
  --brand-600: #0f5647;
  --brand-700: #0b4237;
  --brand-300: #5fb79b;
  --brand-soft: #e8f3ef;

  /* 语义色 */
  --gold: #b0832f;
  --gold-soft: #fbf4e5;
  --red: #ad473f;
  --red-soft: #fbebe9;
  --blue: #34648f;
  --blue-soft: #edf3f9;
  --slate: #6b7a83;
  --slate-soft: #eef1f3;

  /* 圆角与阴影 */
  --r-s: 8px;
  --r-m: 12px;
  --r-l: 16px;
  --shadow-1: 0 1px 2px rgba(18, 32, 27, 0.05), 0 2px 8px rgba(18, 32, 27, 0.04);
  --shadow-2: 0 6px 20px rgba(18, 32, 27, 0.07);
  --shadow-3: 0 24px 64px rgba(12, 26, 21, 0.2);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: 14px; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { letter-spacing: -0.01em; }

::selection { background: rgba(20, 106, 87, 0.16); }

:focus-visible {
  outline: 2px solid rgba(20, 106, 87, 0.45);
  outline-offset: 2px;
}

.hidden { display: none !important; }

/* 细滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfd8d3; border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #b7c3bd; background-clip: padding-box; border: 3px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================ 登录 ============================ */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 24px;
  background:
    radial-gradient(1100px 600px at 8% -10%, rgba(20, 106, 87, 0.16), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, rgba(176, 131, 47, 0.10), transparent 62%),
    var(--bg);
}

.login-shell {
  width: min(1020px, 100%);
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(16, 38, 31, 0.16);
}

.login-visual {
  position: relative;
  padding: 42px 40px;
  color: #eaf3ef;
  background:
    radial-gradient(520px 320px at 88% 8%, rgba(95, 183, 155, 0.28), transparent 60%),
    radial-gradient(420px 300px at 0% 100%, rgba(176, 131, 47, 0.22), transparent 62%),
    linear-gradient(165deg, #13332b 0%, #0b211b 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.login-visual::after {
  content: "";
  position: absolute;
  right: -120px; bottom: -140px;
  width: 380px; height: 380px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 0 0 40px rgba(255, 255, 255, 0.03), 0 0 0 90px rgba(255, 255, 255, 0.02);
}

.visual-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 44px; }
.logo-mark {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 18px; font-weight: 600; color: #0c2a22;
  background: linear-gradient(150deg, #8fd6bd, #4faf92);
  box-shadow: 0 6px 18px rgba(79, 175, 146, 0.35);
}
.logo-text { font-size: 15px; font-weight: 600; letter-spacing: 0.02em; color: #fff; line-height: 1.3; }
.logo-text small { display: block; font-size: 10.5px; font-weight: 400; letter-spacing: 0.14em; color: #8fb3a7; text-transform: uppercase; }

.login-visual h1 {
  font-size: 30px;
  line-height: 1.42;
  margin: 0 0 14px;
  font-weight: 600;
  color: #fff;
}
.visual-sub { margin: 0 0 30px; color: #a9c6bb; font-size: 13.5px; }

.visual-points { list-style: none; margin: 0 0 auto; padding: 0; display: grid; gap: 14px; position: relative; z-index: 1; }
.visual-points li {
  padding-left: 14px;
  border-left: 2px solid rgba(143, 214, 189, 0.35);
  display: grid;
  gap: 2px;
}
.visual-points b { font-weight: 600; font-size: 13.5px; color: #eef7f3; }
.visual-points span { font-size: 12.5px; color: #93b3a8; }

.visual-foot {
  margin-top: 36px; padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  font-size: 11.5px; color: #8aa9a0;
  display: flex; align-items: center; gap: 8px;
  position: relative; z-index: 1;
}
.dot-live { width: 6px; height: 6px; border-radius: 50%; background: #64c9a8; box-shadow: 0 0 0 4px rgba(100, 201, 168, 0.16); }

.login-form-wrap { display: grid; place-items: center; padding: 40px 34px; }
.login-card { width: 100%; max-width: 340px; }
.login-card h2 { font-size: 20px; margin: 0 0 4px; }
.login-card p.sub { color: var(--ink-2); margin: 0 0 26px; font-size: 12.5px; }
.login-card label { display: block; font-size: 12px; color: var(--ink-2); margin: 16px 0 6px; }
.login-card input {
  width: 100%; height: 42px; padding: 0 13px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.login-card input:focus {
  outline: none; background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20, 106, 87, 0.12);
}
.login-err { color: var(--red); font-size: 12.5px; min-height: 20px; margin-top: 10px; }

.demo-hint {
  margin-top: 22px; padding: 13px 14px;
  background: var(--surface-3); border: 1px solid var(--line);
  border-radius: 10px; font-size: 11.5px; color: var(--ink-2); line-height: 1.7;
}
.demo-hint strong { color: var(--ink); font-weight: 600; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; margin-top: 6px; }
.demo-grid span { display: flex; gap: 6px; align-items: baseline; }
.demo-grid i { font-style: normal; color: var(--brand); font-weight: 600; min-width: 46px; }

/* ============================ 布局 ============================ */
#app { display: grid; grid-template-columns: 226px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  color: #cfdfd8;
  padding: 20px 14px 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* 菜单超出时由 #nav 自己滚，不许漏到页面白底上 */
  background:
    radial-gradient(300px 200px at 50% -10%, rgba(95, 183, 155, 0.16), transparent 65%),
    linear-gradient(180deg, #12332b 0%, #0a1f19 100%);
  border-right: 1px solid rgba(0, 0, 0, 0.18);
}

/* 品牌区与页脚固定，中间菜单区自己滚动：13 项菜单在 720px 高的笔记本上放不下 */
.brand { flex: none; display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 600; color: #0b2a22;
  background: linear-gradient(150deg, #8fd6bd, #4faf92);
}
.brand-text { font-size: 14px; font-weight: 600; color: #fff; line-height: 1.25; }
.brand-text small { display: block; font-weight: 400; font-size: 10.5px; color: #7fa094; margin-top: 3px; letter-spacing: 0.02em; }

#nav {
  display: flex; flex-direction: column; gap: 2px;
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  margin-right: -6px; padding-right: 6px; padding-bottom: 10px; /* 给滚动条留位；底部不贴着页脚分隔线 */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
#nav::-webkit-scrollbar { width: 6px; }
#nav::-webkit-scrollbar-track { background: transparent; }
#nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 3px; }
#nav::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.28); }
/* 还有上/下未展示的菜单时，边缘渐隐，避免半行被硬切 */
#nav.has-more {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent 100%);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent 100%);
}
#nav.has-above {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 18px);
}
#nav.has-above.has-more {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
}
.nav-group {
  /* 中文字距别用英文的 0.12em，两字会被拉散；这里只留极轻的字距 */
  font-size: 10.5px; letter-spacing: 0.02em; font-weight: 500;
  color: #7fa296; padding: 16px 12px 6px;
}
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px;
  color: #a9c2b9; font-size: 13px; text-align: left; width: 100%;
  border: none; background: none; user-select: none;
  transition: background 0.15s, color 0.15s;
}
.nav-item .ico { width: 17px; height: 17px; display: grid; place-items: center; opacity: 0.85; flex: none; }
.nav-item .ico svg { width: 17px; height: 17px; }
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #f0f7f4; }
.nav-item.active {
  background: rgba(255, 255, 255, 0.10);
  color: #fff; font-weight: 500;
}
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px; border-radius: 0 3px 3px 0; background: var(--brand-300);
}
.nav-item.active .ico { opacity: 1; color: #8fd6bd; }

.sidebar-foot {
  flex: none; margin-top: auto; padding: 12px;
  font-size: 10.5px; color: #6f8d82; line-height: 1.7;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: 62px; padding: 0 28px;
  display: flex; align-items: center; gap: 16px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.title-wrap { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.topbar h2 { font-size: 16.5px; margin: 0; font-weight: 600; white-space: nowrap; }
.page-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.topbar-date {
  font-size: 12px; color: var(--ink-2);
  padding: 5px 10px; border-radius: 99px;
  background: var(--surface-3); border: 1px solid var(--line);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.user-chip { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--ink-2); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(150deg, #d7ece4, #bfdfd3);
  color: var(--brand-600); display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  border: 1px solid #c3e0d5;
}

.view {
  padding: 22px 28px 56px;
  max-width: 1440px;
  width: 100%;
}

/* ============================ 卡片 ============================ */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: 15px 17px;
  box-shadow: var(--shadow-1);
  transition: box-shadow 0.18s, transform 0.18s;
}
.card:hover { box-shadow: var(--shadow-2); }
.card .label { font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }
.card .value {
  font-size: 27px; font-weight: 650; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.card .value small { font-size: 12.5px; font-weight: 400; color: var(--ink-2); margin-left: 4px; letter-spacing: 0; }
.card .foot { font-size: 11.5px; color: var(--ink-2); margin-top: 7px; }
.card.kpi::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.card.kpi.warn::before { background: var(--gold); }
.card.kpi.danger::before { background: var(--red); }
.card.kpi.info::before { background: var(--blue); }

/* ============================ 角色首页 ============================ */
/* 同一套总览，不同岗位看到的第一屏不一样；这条横幅告诉用户「这是给你看的」 */
.home-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 17px 21px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  background:
    radial-gradient(420px 150px at 0% 0%, rgba(74, 168, 140, 0.1), transparent 70%),
    var(--surface);
  box-shadow: var(--shadow-1);
}
.hero-scope {
  display: inline-block;
  font-size: 11px;
  color: var(--brand-600);
  background: var(--brand-soft);
  border: 1px solid #d3e9e0;
  border-radius: 20px;
  padding: 1px 9px 2px;
  margin-bottom: 8px;
}
.hero-title { font-size: 19px; font-weight: 650; letter-spacing: -0.01em; }
.hero-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.hero-meta { font-size: 12px; color: var(--ink-2); text-align: right; line-height: 1.85; white-space: nowrap; }

/* 指标卡按数量均分一行：6 张排 5+1 会让人以为少了一张，用列数变量严格对齐 */
.cards.kpi-grid { grid-template-columns: repeat(var(--kpi-cols, 5), minmax(0, 1fr)); }
.card.kpi.clickable { cursor: pointer; }
.card.kpi.clickable:hover { transform: translateY(-1px); }

.link {
  color: var(--brand-600);
  cursor: pointer;
  border-bottom: 1px dashed rgba(74, 168, 140, 0.5);
}
.link:hover { border-bottom-style: solid; }
.text-danger { color: var(--red); }
.text-ok { color: var(--brand-600); }

/* 首页是「一眼看完」的场景，空面板不必占掉半屏 */
.home-panel > .empty { padding: 24px 20px; }
.home-panel > .empty::before { display: none; }

/* 首页表格在窄屏转卡片后的排版 */
.home-panel .m-card-sub { font-size: 11.5px; color: var(--ink-2); line-height: 1.6; }
.home-panel .m-card-sub.muted { color: var(--ink-3); }
.home-panel .m-card-act { margin-top: 6px; }
.home-panel .m-card-act .btn { width: 100%; }
.m-sep { color: var(--ink-3); margin: 0 5px; }

/* ============================ 驾驶舱图表 ============================
   12 栏网格：环形图窄、趋势图宽，靠 --span 控制占比。
   图表本体是手写 SVG，viewBox 固定、宽度自适应，字号会随面板缩放，
   所以轴文字统一压在 11px、不用极细字重，缩到 70% 仍能看清。
*/
.cockpit {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.chart-panel {
  grid-column: span var(--span, 6);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.chart-panel .panel-head { min-height: 50px; padding: 12px 18px; flex-wrap: wrap; row-gap: 6px; }
.chart-panel .panel-head h3 { font-size: 13px; }
.chart-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 14px 10px;
  min-height: 218px;
}
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-svg .axis { fill: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.chart-svg .mark { fill: var(--ink-2); font-size: 13px; font-weight: 600; }
.chart-svg .pt:hover circle { r: 5; }
.chart-svg rect:hover { opacity: 0.82; }
.chart-svg.donut { max-width: 232px; margin: 0 auto; }
.donut-value { fill: var(--ink); font-size: 27px; font-weight: 700; letter-spacing: -0.02em; }
.donut-label { fill: var(--ink-3); font-size: 11px; }
.chart-hint { font-size: 11.5px; color: var(--ink-3); }
.chart-legend { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.chart-foot {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 6px 16px; padding: 0 16px 14px;
}
.chart-legend .lg {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--ink-2); white-space: nowrap;
}
.chart-legend .lg i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.chart-legend .lg b { color: var(--ink); font-variant-numeric: tabular-nums; }
.chart-delta { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 20px; }
.chart-delta.up { color: var(--brand-600); background: var(--brand-soft); }
.chart-delta.down { color: var(--red); background: var(--red-soft); }

/* 横向占比条：护理等级这类类目少、差别大的数据 */
.hbars { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.hbar { display: grid; grid-template-columns: 64px 1fr 84px; align-items: center; gap: 10px; }
.hbar-label { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 9px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.hbar-track i {
  display: block; height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, var(--brand), var(--brand-300));
  transition: width 0.4s ease;
}
/* 欠费这类「越多越不好」的条用红色，别让绿色把风险读成业绩 */
.hbar-track i.danger { background: linear-gradient(90deg, var(--red), #cf7f77); }
.hbar-track i.gold { background: linear-gradient(90deg, var(--gold), #d5b06a); }
.hbar-value { font-size: 12px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 今日现场：四条进度，点一下跳到对应页面 */
.ck-pulse { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 26px; }
.ck-pulse-item { cursor: pointer; border-radius: var(--r-s); }
.ck-pulse-item:hover .ck-pulse-head b { color: var(--brand-600); }
.ck-pulse-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.ck-pulse-head span { font-size: 12px; color: var(--ink-2); }
.ck-pulse-head b { font-size: 13.5px; font-variant-numeric: tabular-nums; }
.ck-pulse-track { height: 8px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.ck-pulse-track i { display: block; height: 100%; border-radius: 6px; transition: width 0.45s ease; }
.ck-pulse-track i.ok { background: var(--brand); }
.ck-pulse-track i.warn { background: var(--gold); }
.ck-pulse-track i.bad { background: var(--red); }
.ck-pulse-track i.mute { background: var(--line-strong); }

@media (max-width: 1180px) {
  .chart-panel { grid-column: span 6; }
  .chart-panel[style*="--span:9"] { grid-column: span 12; }
}
@media (max-width: 760px) {
  .chart-panel { grid-column: span 12 !important; }
  .chart-body { min-height: 0; padding: 12px 10px 6px; }
  .chart-legend { display: none; }
  .ck-pulse { grid-template-columns: 1fr; gap: 14px; }
  .cockpit { gap: 10px; }
  /* 趋势图 viewBox 640 宽，缩到 340 时字号只剩一半：这里按比例补回来，
     否则轴标签在手机上等于看不清（11px × 0.53 ≈ 5.8px）。 */
  .chart-svg .axis, .chart-svg .mark { font-size: 20px; }
  .chart-hint { display: none; }
  .hbar { grid-template-columns: 58px 1fr 78px; gap: 8px; }
  .hbar-label { font-size: 11.5px; }
  .hbar-value { font-size: 11.5px; }
}

.stat-line { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }

/* ============================ 面板 ============================ */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-1);
  margin-bottom: 18px;
  overflow-x: auto;
}
.panel-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  min-height: 54px;
}
.panel-head h3 { font-size: 13.5px; margin: 0; font-weight: 600; white-space: nowrap; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 16px 18px; }
.panel-note { padding: 0 18px 14px; }

.section-title {
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  letter-spacing: 0.04em; margin: 22px 0 10px;
}

/* ============================ 按钮 ============================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-s);
  background: var(--surface); color: var(--ink);
  font-size: 12.5px; font-weight: 500;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: #c2cec8; background: #fbfdfc; }
.btn:active { transform: translateY(0.5px); }
.btn.primary {
  background: linear-gradient(180deg, #1a7a64, #12614f);
  border-color: var(--brand-600); color: #fff;
  box-shadow: 0 1px 2px rgba(15, 86, 71, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.btn.primary:hover { background: linear-gradient(180deg, #1c846c, #136a56); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); border-color: var(--line); color: var(--ink); }
.btn.danger { color: var(--red); border-color: #eed6d2; background: #fff; }
.btn.danger:hover { background: var(--red-soft); border-color: #e3c2bd; }
.btn.small { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn.block { width: 100%; height: 42px; font-size: 13.5px; border-radius: 10px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ============================ 标签 ============================ */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
  background: var(--slate-soft); color: var(--slate);
  border: 1px solid transparent;
}
.tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.7; flex: none; }
.tag.green { background: var(--brand-soft); color: var(--brand-600); border-color: #d3e9e0; }
.tag.orange { background: var(--gold-soft); color: #97661a; border-color: #f1e2c4; }
.tag.red { background: var(--red-soft); color: var(--red); border-color: #f0d8d4; }
.tag.blue { background: var(--blue-soft); color: var(--blue); border-color: #d9e7f4; }
.tag.plain::before { display: none; }

/* ============================ 表格 ============================ */
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left; padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px; vertical-align: middle;
}
th {
  background: var(--surface-2);
  color: var(--ink-3); font-weight: 500;
  font-size: 11.5px; letter-spacing: 0.03em;
  white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: #f9fbfa; }
tbody tr:last-child td { border-bottom: none; }
th:last-child, td:last-child { width: 1%; white-space: nowrap; }
th:first-child, td:first-child { width: 1%; white-space: nowrap; }
td strong { font-weight: 600; font-variant-numeric: tabular-nums; }

.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--ink-3); font-size: 11.5px; }
.empty { padding: 44px 20px; text-align: center; color: var(--ink-3); font-size: 12.5px; }
.empty::before {
  content: ""; display: block; width: 34px; height: 34px; margin: 0 auto 10px;
  border-radius: 50%; border: 1px dashed var(--line-strong); background: var(--surface-2);
}
.money-in { color: var(--brand-600); }
.money-out { color: var(--red); }

/* ============================ 工具条 ============================ */
.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.toolbar input[type="date"],
.toolbar input[type="month"],
.toolbar input[type="text"],
.toolbar input[type="search"],
.toolbar select {
  height: 32px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: var(--r-s);
  background: var(--surface); font-size: 12.5px;
}
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(20, 106, 87, 0.10); }

/* ============================ 床位看板 ============================ */
.floor { margin-bottom: 20px; }
.floor-title {
  font-size: 11.5px; color: var(--ink-3); margin: 0 0 10px;
  font-weight: 500; letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 8px;
}
.floor-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(216px, 1fr)); gap: 12px; }
.room-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-m); padding: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.room-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.room-card .room-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px; }
.room-card .room-no { font-weight: 600; font-size: 13.5px; letter-spacing: 0.01em; }
.room-card .room-type { font-size: 10.5px; color: var(--ink-3); }

.bed {
  border-radius: 9px; padding: 8px 10px; margin-bottom: 6px;
  font-size: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1px solid transparent; border-left: 3px solid transparent;
  transition: transform 0.12s, box-shadow 0.12s;
  cursor: pointer;
}
.bed:last-child { margin-bottom: 0; }
.bed:hover { box-shadow: var(--shadow-1); transform: translateY(-1px); }
.bed:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.bed .bed-main { min-width: 0; }
.bed.free { background: #f4f8f6; color: #4a6b61; border-color: #e3ece8; border-left-color: #b9d8cc; }
.bed.free:hover { background: #ecf5f1; }
.bed.reserved { background: var(--gold-soft); color: #8a5c1c; border-color: #f2e3c7; border-left-color: #dcae5e; }
.bed.occupied { background: var(--brand-soft); color: #145847; border-color: #d2e9e0; border-left-color: #4aa88c; }
.bed.maintenance { background: var(--slate-soft); color: #6b7a83; border-color: #e4e8ea; border-left-color: #bcc6cb; }
.bed .bed-name { font-weight: 600; letter-spacing: 0.01em; }
.bed .bed-meta { color: inherit; opacity: 0.72; font-size: 10.5px; }

/* 床位上的传感器角标：几台在线 / 几台异常，扫一眼就知道哪屋设备掉了 */
.bed-sensor {
  flex: none; font-size: 10px; line-height: 1; padding: 4px 6px; border-radius: 99px;
  border: 1px solid transparent; white-space: nowrap; letter-spacing: 0.01em;
}
.bed-sensor.ok { background: rgba(255, 255, 255, 0.72); border-color: #d2e9e0; color: #2f7d67; }
.bed-sensor.ok::before {
  content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: #4aa88c; margin-right: 4px; vertical-align: 1px;
}
.bed-sensor.bad { background: var(--red-soft); border-color: #f0d8d4; color: var(--red); font-weight: 600; }
.bed-sensor.none { background: transparent; border-color: transparent; color: #9aada6; }

.progress { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress > span {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #4aa88c, var(--brand));
  transition: width 0.4s ease;
}

/* ============================ 弹窗 ============================ */
.modal-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(11, 26, 21, 0.42);
  display: grid; place-items: center;
  padding: 24px;
  backdrop-filter: blur(3px);
  animation: fade-in 0.16s ease;
}
@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--surface); border-radius: var(--r-l);
  width: min(660px, 100%); max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-3);
  animation: pop-in 0.18s ease;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.99) } to { opacity: 1; transform: none } }
.modal-head {
  padding: 18px 22px 14px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-body { padding: 18px 22px; overflow-y: auto; min-width: 0; }
.modal-foot {
  padding: 14px 22px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 9px;
  background: var(--surface-2); border-radius: 0 0 var(--r-l) var(--r-l);
}

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 9px 11px; min-height: 38px;
  border: 1px solid var(--line-strong); border-radius: var(--r-s);
  background: var(--surface-2);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none; background: #fff; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20, 106, 87, 0.10);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-tip {
  font-size: 11.5px; color: var(--ink-2); background: var(--surface-3);
  border: 1px solid var(--line); border-radius: var(--r-s);
  padding: 10px 12px; line-height: 1.7; margin-top: 4px;
}

.scale-item { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.scale-item:last-child { border-bottom: none; }
.scale-item .q { font-size: 12.5px; margin-bottom: 6px; }
.scale-item select { max-width: 250px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface-2); }

/* 结算/明细里的键值行 */
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: 12.5px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.kv .total { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; font-size: 14px; }
.kv .total dt, .kv .total dd { font-weight: 600; color: var(--ink); }

.settle-box {
  border: 1px solid var(--line); border-radius: var(--r-m);
  padding: 14px 16px; background: var(--surface-2); margin-bottom: 14px;
}
.settle-box h4 { margin: 0 0 10px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.settle-highlight {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 12px 14px; border-radius: var(--r-m); margin-bottom: 14px;
  background: linear-gradient(120deg, #eaf5f0, #f7fbf9);
  border: 1px solid #d8ece4;
}
.settle-highlight .lbl { font-size: 12px; color: var(--brand-600); }
.settle-highlight .amt { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--brand-700); }

.alert-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border-radius: var(--r-s);
  background: var(--gold-soft); border: 1px solid #f1e2c4;
  color: #7d5315; font-size: 12px; line-height: 1.65; margin-bottom: 14px;
}

/* ============================ 提示 ============================ */
#toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #16241f; color: #fff;
  padding: 11px 18px; border-radius: 10px;
  font-size: 12.5px; box-shadow: var(--shadow-2);
  opacity: 0; transition: opacity 0.22s, transform 0.22s;
  pointer-events: none; z-index: 90; max-width: 80vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--red); }

/* ============================ 表格容器 ============================ */
.table-wrap { overflow-x: auto; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.tiny { font-size: 10.5px; line-height: 1.5; }
.req { color: var(--red); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.danger-text { color: var(--red); }
.warn-text { color: var(--gold); font-weight: 500; }
.acct { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.acct b { font-weight: 600; font-size: 12px; }

/* ============================ 表单补充 ============================ */
.form-block {
  margin-top: 18px; padding: 14px 16px;
  border: 1px dashed var(--line-strong); border-radius: var(--r-m);
  background: var(--surface-2);
}
.chk {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--ink-2); cursor: pointer;
}
.chk input { accent-color: var(--brand); width: 14px; height: 14px; }
.hint-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px 26px; }
.hint-grid b { display: block; font-size: 12.5px; margin-bottom: 6px; color: var(--ink); }
.hint-grid p { margin: 0; font-size: 12px; line-height: 1.7; color: var(--ink-2); }
.secret-box .kv { font-size: 13px; }
.secret-box .kv dd { font-size: 14px; }
.secret-pwd { letter-spacing: 0.08em; color: var(--brand-600); font-weight: 600; }

/* ============================ 角色权限 ============================ */
.perm-layout {
  display: grid; grid-template-columns: 262px minmax(0, 1fr);
  gap: 16px; align-items: start;
}
.role-panel .panel-body { padding: 8px; }
.role-list { display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.role-item {
  display: block; width: 100%; text-align: left; padding: 10px 12px;
  border: 1px solid transparent; border-radius: var(--r-s);
  background: transparent; transition: background 0.12s, border-color 0.12s;
}
.role-item:hover { background: var(--surface-3); }
.role-item.active { background: var(--brand-soft); border-color: #cfe6dc; }
.role-item .role-name {
  font-size: 13px; font-weight: 600; color: var(--ink);
  display: flex; align-items: center; gap: 6px;
}
.role-item .role-meta { font-size: 10.5px; color: var(--ink-3); margin-top: 4px; }
.role-item .role-meta code { font-size: 10px; color: var(--ink-3); }
.role-item[data-disabled] { opacity: 0.55; }

.perm-groups { display: flex; flex-direction: column; gap: 18px; }
.perm-group { border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.perm-group-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.perm-group-head b { font-size: 12.5px; }
.perm-group-head .muted { font-size: 11px; }
.perm-group-head > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.perm-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px; padding: 8px 10px 12px; }
.perm-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: var(--r-s); cursor: pointer;
  font-size: 12.5px; transition: background 0.1s;
}
.perm-item:hover { background: var(--surface-3); }
.perm-item input { accent-color: var(--brand); width: 14px; height: 14px; flex: none; }
.perm-item .perm-name { flex: 1; min-width: 0; }
.perm-item code {
  font-size: 10px; color: var(--ink-3); background: var(--surface-3);
  padding: 2px 5px; border-radius: 4px; white-space: nowrap;
}
.perm-item.locked { opacity: 0.72; cursor: default; }

/* ============================ 房间管理 ============================ */
.room-card.manage { display: flex; flex-direction: column; }
.bed-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.bed-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; padding: 7px 9px;
  border: 1px solid transparent; border-left-width: 3px; border-radius: 7px;
  font-size: 12px; transition: box-shadow 0.12s, transform 0.12s;
}
.bed-btn:hover { box-shadow: var(--shadow-1); transform: translateX(1px); }
.bed-btn .bed-name { font-weight: 600; font-size: 12px; }
.bed-btn .bed-meta { font-size: 10.5px; opacity: 0.78; }
.room-actions {
  display: flex; align-items: center; gap: 2px;
  margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--line);
}
.room-actions .spacer { flex: 1; }
.room-actions .btn { height: 24px; padding: 0 7px; font-size: 11px; }
.batch-preview {
  margin-top: 14px; padding: 10px 12px;
  background: var(--brand-soft); border-radius: var(--r-s);
  font-size: 12.5px; color: var(--brand-700); line-height: 1.8;
}
.batch-preview b { font-variant-numeric: tabular-nums; }

/* ============================ 机构设置 ============================ */
.kv.policy { grid-template-columns: 168px 1fr; row-gap: 10px; font-size: 12.5px; }
.kv.policy dd { text-align: left; font-weight: 400; color: var(--ink-2); }
.kv.policy dt { color: var(--ink-3); }

/* ============================ 响应式 ============================ */
@media (max-width: 1100px) {
  .login-shell { grid-template-columns: 1fr; max-width: 480px; }
  .login-visual { display: none; }
  .perm-layout { grid-template-columns: 1fr; }
  .role-list { flex-direction: row; flex-wrap: wrap; }
  .role-item { width: auto; }
}
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; align-items: center;
    padding: 10px 22px 10px 12px; overflow-x: auto; gap: 6px;
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .brand, .sidebar-foot, .nav-group { display: none; }
  #nav {
    flex-direction: row; gap: 4px;
    flex: none; min-height: auto; overflow: visible;
    margin-right: 0; padding-right: 0; padding-bottom: 0;
  }
  .nav-item { width: auto; white-space: nowrap; }
  .nav-item.active::before { display: none; }
  .view { padding: 16px 14px 40px; }
  .topbar { padding: 0 14px; height: 56px; }
  .page-sub, .topbar-date { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ============================ 排班与派工 ============================ */
.page-tabs {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-3); border-radius: 10px; margin-bottom: 16px;
}
.page-tab {
  border: none; background: transparent; color: var(--ink-2);
  font-size: 12.5px; padding: 6px 16px; border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.page-tab:hover { color: var(--ink); }
.page-tab.active { background: var(--surface); color: var(--brand-700); font-weight: 600; box-shadow: var(--shadow-1); }

.panel-body.no-pad { padding: 0; }
.panel-body.no-pad .table-wrap { border-radius: 0 0 var(--r-m) var(--r-m); }
.panel-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2);
}

.shift-grid { min-width: 880px; }
.shift-grid th, .shift-grid td { padding: 8px 8px; text-align: center; }
.shift-grid th.who, .shift-grid td.who { text-align: left; padding-left: 16px; min-width: 132px; }
.shift-grid td.who b { display: block; font-size: 13px; }
.shift-grid th.area-cell, .shift-grid td.area-cell { min-width: 116px; }
.shift-grid th .wd { display: block; font-size: 11px; color: var(--ink-3); }
.shift-grid th .dnum { display: block; font-size: 12px; color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; }
.shift-grid th.is-today, .shift-grid td.is-today { background: #f2f8f5; }
.shift-grid th.is-today .wd { color: var(--brand); }
.shift-grid .shift-cell { padding: 5px 6px; }
.shift-select {
  width: 100%; min-width: 84px; height: 30px;
  border: 1px solid transparent; border-radius: 7px;
  background: var(--surface-3); color: var(--ink-2);
  font-size: 12px; padding: 0 6px; text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.shift-select:hover { border-color: var(--line-strong); }
.shift-select:focus { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px rgba(20, 106, 87, 0.10); }
.shift-select.c-brand { background: var(--brand-soft); color: var(--brand-700); font-weight: 600; }
.shift-select.c-gold { background: var(--gold-soft); color: #8a5c1c; font-weight: 600; }
.shift-select.c-blue { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.shift-select.c-slate { background: var(--slate-soft); color: var(--slate); font-weight: 600; }
.area-select {
  height: 30px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface); font-size: 12px; padding: 0 6px; color: var(--ink-2); width: 100%;
}
.area-select:focus { outline: none; border-color: var(--brand); }
.area-select:disabled { background: var(--surface-2); color: var(--ink-3); cursor: not-allowed; }

/* 不可改的格子：请假 / 缺勤 / 已锁账，用扁平小标签代替下拉，避免「填了又被退回」 */
.cell-tag {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 84px; height: 30px; border-radius: 7px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  background: var(--slate-soft); color: var(--slate);
  border: 1px dashed var(--line-strong); cursor: not-allowed;
}
.cell-tag.leave { background: var(--blue-soft); color: var(--blue); border-color: #cfdfef; border-style: solid; }
.cell-tag.absent { background: var(--red-soft); color: var(--red); border-color: #f0d8d4; border-style: solid; }
.cell-tag.locked { background: var(--surface-3); color: var(--ink-3); }
/* 锁账月份里已有班次的格子：保留班次颜色，但明确标出不可改 */
.cell-tag.locked.has-shift {
  background: var(--brand-soft); color: var(--brand-700);
  border: 1px solid #d3e9e0; font-weight: 600; opacity: 0.75;
}
/* 已打卡仍可改，但要一眼看出「这天有实际打卡，改班次会影响工时」 */
.shift-select.has-punch { box-shadow: inset 0 0 0 1px var(--gold); }

.rule-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.rule-col { border-left: 3px solid var(--line-strong); padding-left: 12px; }
.rule-col.bad { border-left-color: var(--red); }
.rule-col.warn { border-left-color: var(--gold); }
.rule-col b { display: block; font-size: 12.5px; margin-bottom: 8px; }
.rule-col ul { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 6px; }
.rule-col li { font-size: 12px; color: var(--ink-2); line-height: 1.6; }

.issue-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.issue-list li {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface-2);
}
.issue-list li b { font-size: 12.5px; }
.issue-list li p { flex: 1 0 100%; margin: 0; font-size: 12px; color: var(--ink-2); line-height: 1.55; }
.check-block + .check-block { margin-top: 16px; }
.check-block h4 { font-size: 12.5px; color: var(--ink-2); margin: 0 0 8px; font-weight: 600; }

.btn-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; margin-left: 8px;
  border-radius: 99px; background: rgba(255, 255, 255, 0.24);
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
}

.roster { display: flex; flex-direction: column; gap: 14px; }
.roster-group { border-left: 3px solid var(--line-strong); padding-left: 12px; }
.roster-group:has(.c-brand) { border-left-color: var(--brand-300); }
.roster-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.roster-members { display: flex; flex-wrap: wrap; gap: 8px; }
.roster-chip {
  display: inline-flex; align-items: baseline; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 6px 10px; font-size: 12px;
}
.roster-chip b { font-weight: 600; }
.roster-chip .load {
  font-size: 10.5px; color: var(--brand-600);
  background: var(--brand-soft); border-radius: 99px; padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}

.duty-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.duty-group { margin-bottom: 16px; }
.duty-group:last-child { margin-bottom: 0; }
.duty-group-head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 6px 2px 8px; font-size: 12.5px;
}
.duty-group-head b { font-weight: 600; }
.duty-group table { border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.duty-group th { position: static; background: var(--surface-3); }
td.tick, th.tick { width: 34px; padding-left: 14px; }
td.tick input, th.tick input { width: 14px; height: 14px; accent-color: var(--brand); cursor: pointer; }

.check-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.check-grid.inline { gap: 6px; }
.chip-check {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 6px 11px; font-size: 12.5px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.chip-check:has(input:checked) { border-color: var(--brand-300); background: var(--brand-soft); color: var(--brand-700); }
.chip-check input { accent-color: var(--brand); margin: 0; }
.inline-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); cursor: pointer; }
.inline-check input { accent-color: var(--brand); }

.row-dim td { opacity: 0.55; }
.text-warn { color: var(--gold); }

@media (max-width: 900px) {
  .shift-grid { min-width: 720px; }
  .rule-grid { grid-template-columns: 1fr; gap: 14px; }
  /* 窄屏下这行说明会把保存按钮挤成两行，直接收起 */
  .panel-foot .foot-hint { display: none; }
  .panel-foot { flex-wrap: wrap; }
  .roster-members { gap: 6px; }
  .panel-head { flex-wrap: wrap; gap: 8px; }
  .panel-head .toolbar { width: 100%; }
  .panel-head .toolbar .btn { padding: 5px 10px; }
  .page-tabs { display: flex; width: 100%; overflow-x: auto; }
  .page-tab { padding: 6px 12px; white-space: nowrap; }
}

/* ============================ 安全告警 ============================ */
.tiny { font-size: 11px; }

.filter-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.filter-bar select, .filter-bar input {
  height: 32px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); padding: 0 10px; font-size: 12.5px; color: var(--ink);
}
.filter-bar select:focus, .filter-bar input:focus { outline: none; border-color: var(--brand); }
.filter-bar .kw { min-width: 180px; flex: 1; max-width: 280px; }

/* ---- 正在发生的告警 ---- */
.alarm-live-list { display: flex; flex-direction: column; gap: 10px; }
.alarm-live {
  display: grid; grid-template-columns: 76px 1fr auto; gap: 14px;
  align-items: stretch; padding: 12px 16px 12px 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-m); position: relative; overflow: hidden;
}
.alarm-live::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line-strong);
}
.alarm-live.lv1::before { background: var(--red); }
.alarm-live.lv2::before { background: var(--gold); }
.alarm-live.lv3::before { background: var(--blue); }
.alarm-live.lv1.pending { background: #fdf7f6; border-color: #f0d8d4; }
.alarm-live .al-left {
  padding-left: 18px; display: flex; flex-direction: column; justify-content: center; gap: 3px;
}
.alarm-live .al-lv { font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; }
.alarm-live.lv1 .al-lv { color: var(--red); }
.alarm-live.lv2 .al-lv { color: #97661a; }
.alarm-live.lv3 .al-lv { color: var(--blue); }
.alarm-live .al-time { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.alarm-live .al-title {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 14px; font-weight: 600; margin-bottom: 4px;
}
.alarm-live .al-meta {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px;
  font-size: 12px; color: var(--ink-2);
}
.alarm-live .al-meta b { color: var(--ink); font-weight: 600; }
.alarm-live .al-meta span { color: var(--ink-2); }
.alarm-live .al-meta span.muted { color: var(--ink-3); }
.alarm-live .al-detail {
  font-size: 12px; color: var(--ink-3); margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 1; -webkit-box-orient: vertical;
}
.alarm-live .al-right {
  display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 8px;
}
.alarm-live .al-elapsed { font-size: 11.5px; color: var(--ink-3); }
.alarm-live .al-elapsed b { color: var(--ink); font-variant-numeric: tabular-nums; }
.alarm-live .al-acts { display: flex; gap: 6px; }

/* 呼吸点 */
.pulse {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); position: relative; flex: none;
}
.pulse::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1.5px solid var(--red); opacity: 0.6;
  animation: pulse-ring 1.6s ease-out infinite;
}
@keyframes pulse-ring {
  0% { transform: scale(0.7); opacity: 0.7; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ---- 告警明细表 ---- */
.alarm-table { min-width: 940px; }
.alarm-table td { font-size: 12.5px; }
.alarm-table tbody tr { cursor: pointer; }
.alarm-table tbody tr:hover { background: var(--surface-2); }
.alarm-row.lv1 td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.alarm-row.lv2 td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.alarm-row.lv3 td:first-child { box-shadow: inset 3px 0 0 var(--blue); }
.alarm-table td .tiny, .panel-body td .tiny { display: block; color: var(--ink-3); line-height: 1.4; }

/* ---- 详情 ---- */
.detail-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 14px;
}
.detail-head .detail-type { margin-left: 10px; font-size: 13px; font-weight: 600; }
.detail-when { font-size: 12px; color: var(--ink-3); }
.detail-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 18px; margin-bottom: 14px;
}
.detail-grid > div { display: flex; flex-direction: column; gap: 2px; }
.detail-grid .k { font-size: 11.5px; color: var(--ink-3); }
.detail-grid .v { font-size: 13px; font-weight: 500; }
.detail-detail {
  background: var(--surface-2); border-radius: 9px; padding: 10px 13px;
  font-size: 12.5px; color: var(--ink-2); margin-bottom: 12px;
}
.detail-section { margin-top: 18px; }
.detail-section h4 { font-size: 12.5px; margin: 0 0 10px; color: var(--ink-2); font-weight: 600; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }

.steps { display: flex; gap: 0; flex-wrap: wrap; }
.step {
  display: flex; align-items: flex-start; gap: 8px;
  flex: 1; min-width: 120px; position: relative; padding-right: 12px;
}
.step > div { position: relative; z-index: 1; background: var(--surface); padding-right: 6px; }
.step .dot { position: relative; z-index: 1;
  width: 9px; height: 9px; border-radius: 50%; margin-top: 4px; flex: none;
  background: var(--line-strong);
}
.step.done .dot { background: var(--brand); }
.step b { display: block; font-size: 12.5px; font-weight: 600; }
.step .tiny { display: block; margin-top: 1px; }
.step:not(:last-child)::after {
  content: ""; position: absolute; left: 4px; top: 8px; width: calc(100% - 20px);
  height: 1px; background: var(--line); z-index: 0;
}

.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item {
  display: grid; grid-template-columns: 148px 110px 1fr; gap: 10px;
  font-size: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line);
}
.tl-item:last-child { border-bottom: none; }
.tl-time { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tl-actor { color: var(--ink-2); font-weight: 500; }
.tl-note { color: var(--ink-2); }

/* ---- 顶栏告警角标（不悬浮，避免遮挡内容与操作按钮） ---- */
.alarm-dock {
  position: relative;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px 5px 9px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink-2); font-size: 12px; box-shadow: none;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  height: 30px;
}
.alarm-dock:hover { border-color: var(--brand-300); color: var(--ink); }
.alarm-dock .bell svg { width: 15px; height: 15px; display: block; }
.alarm-dock b {
  background: var(--brand-soft); color: var(--brand-700);
  border-radius: 999px; padding: 1px 7px; font-size: 11.5px; font-variant-numeric: tabular-nums;
}
.alarm-dock.is-open { border-color: #f1e2c4; color: #8a5c1c; background: var(--gold-soft); }
.alarm-dock.is-open b { background: #fff; color: #8a5c1c; }
.alarm-dock.is-urgent {
  border-color: #e3c2bd; background: var(--red-soft); color: var(--red);
  animation: dock-alert 1.8s ease-in-out infinite;
}
.alarm-dock.is-urgent b { background: #fff; color: var(--red); }
@keyframes dock-alert {
  0%, 100% { box-shadow: 0 0 0 0 rgba(173, 71, 63, 0.28); }
  50% { box-shadow: 0 0 0 8px rgba(173, 71, 63, 0); }
}

/* ---- 全屏弹屏 ---- */
.alarm-screen {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center;
  background: rgba(28, 14, 13, 0.62); backdrop-filter: blur(3px);
  padding: 24px; animation: fade-in 0.18s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.alarm-screen-card {
  width: min(560px, 100%); background: var(--surface);
  border-radius: var(--r-l); overflow: hidden;
  box-shadow: var(--shadow-3); border-top: 5px solid var(--red);
  animation: screen-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes screen-in {
  from { transform: translateY(14px) scale(0.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.as-head {
  display: flex; align-items: center; gap: 9px;
  padding: 14px 22px; background: var(--red-soft); color: var(--red);
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em;
}
.as-head .as-no { margin-left: auto; font-weight: 400; opacity: 0.75; font-variant-numeric: tabular-nums; }
.as-title { font-size: 21px; font-weight: 700; padding: 18px 22px 6px; letter-spacing: -0.01em; }
.as-meta {
  display: flex; gap: 12px; align-items: baseline; padding: 0 22px;
  font-size: 13px; color: var(--ink-2);
}
.as-meta b { font-size: 15px; color: var(--ink); }
.as-meta .as-type { color: var(--ink-3); }
.as-timer { padding: 10px 22px 0; font-size: 12.5px; color: var(--ink-2); }
.as-timer b { color: var(--red); font-variant-numeric: tabular-nums; font-size: 14px; }
.as-detail {
  margin: 10px 22px 0; padding: 10px 13px; background: var(--surface-2);
  border-radius: 9px; font-size: 12.5px; color: var(--ink-2);
}
.as-actions { display: flex; gap: 9px; padding: 18px 22px 8px; }
.as-actions .btn { flex: 1; justify-content: center; height: 38px; }
.as-hint { padding: 0 22px 18px; font-size: 11.5px; color: var(--ink-3); }

/* ---- 规则表 ---- */
.rule-care { max-width: 300px; line-height: 1.5; }
.mini-num {
  width: 78px; height: 28px; border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 0 8px; font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums;
}
.mini-num:focus { outline: none; border-color: var(--brand); }
.mini-select {
  height: 28px; border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 0 6px; font-size: 12px; background: var(--surface);
}
.mini-select:focus { outline: none; border-color: var(--brand); }

@media (max-width: 900px) {
  .alarm-live {
    grid-template-columns: 1fr; gap: 5px;
    padding: 11px 13px 11px 16px;
  }
  .alarm-live .al-left { flex-direction: row; align-items: center; gap: 10px; padding-left: 0; }
  .alarm-live .al-title { font-size: 13.5px; margin-bottom: 2px; }
  .alarm-live .al-meta { gap: 8px; font-size: 11.5px; }
  .alarm-live .al-right {
    grid-column: auto; flex-direction: row; align-items: center;
    justify-content: space-between; padding: 8px 0 0; margin-top: 2px;
    border-top: 1px dashed var(--line);
  }
  .alarm-live .al-acts { flex: none; }
  .alarm-live .al-acts .btn { padding: 4px 9px; font-size: 11.5px; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .alarm-dock { padding: 5px 10px 5px 7px; }
  .alarm-dock .txt { display: none; }
  .alarm-screen { padding: 16px; }
  .alarm-screen-card { width: 100%; }
  .as-title { font-size: 18px; padding: 14px 18px 4px; }
  .as-head { padding: 12px 18px; }
  .as-meta, .as-timer, .as-hint { padding-left: 18px; padding-right: 18px; }
  .as-detail { margin: 8px 18px 0; }
  .as-actions { flex-wrap: wrap; padding: 14px 18px 6px; }
  .as-actions .btn { flex: 1 1 45%; }
  .tl-item { grid-template-columns: 1fr; gap: 2px; }
  .filter-bar select, .filter-bar input { flex: 1 1 44%; min-width: 0; }
  .filter-bar .kw { max-width: none; }
  .steps { flex-direction: column; gap: 10px; }
  .step:not(:last-child)::after { display: none; }
}

/* 手机：KPI 两列，落单的那张占满整行；告警角标收成小圆钮，别压住操作按钮 */
@media (max-width: 640px) {
  .cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .topbar { gap: 8px; padding: 0 12px; }
  .user-chip { gap: 5px; }
  .user-chip #userName { display: none; }
  .user-chip .btn { padding: 4px 8px; font-size: 11.5px; }
  .topbar h2 { font-size: 15px; }
  .cards > .card:nth-child(odd):last-child { grid-column: 1 / -1; }
  .alarm-dock { padding: 0 9px; height: 28px; gap: 5px; }
  .alarm-dock .txt { display: none; }
  .view { padding-bottom: 36px; }
}

/* ============================ 健康体征 ============================ */
.trend-svg { width: 100%; height: auto; display: block; }
.trend-head {
  display: flex; flex-wrap: wrap; gap: 8px 26px; margin-bottom: 6px;
}
.trend-kpi { display: flex; flex-direction: column; gap: 1px; }
.trend-kpi span { font-size: 11px; color: var(--ink-3); }
.trend-kpi b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-legend {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--ink-2); margin-top: 4px;
}
.chart-legend i { width: 16px; height: 0; border-top: 2px solid var(--brand); margin-left: 8px; }
.chart-legend i.lg-dash { border-top-style: dashed; border-top-color: #5b8fb9; }
.chart-legend i.lg-band { height: 9px; border: 1px solid #d8ece4; background: #e8f4ee; border-radius: 2px; }

/* 条形分布 */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 132px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.bar-track { position: relative; width: 100%; max-width: 42px; flex: 1; display: flex; align-items: flex-end; justify-content: center; }
.bar-total { position: absolute; bottom: 0; width: 100%; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, #7cc4ac, #d9ece5); }
.bar-abn { position: absolute; bottom: 0; width: 100%; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, #d9805f, #f0c8ba); }
.bar-label { font-size: 10px; color: var(--ink-3); white-space: nowrap; }
.bar-val { font-size: 11px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.dist-row {
  display: grid; grid-template-columns: 90px 1fr auto; align-items: center;
  gap: 10px; font-size: 12px; padding: 4px 0;
}
.dist-row span { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dist-row b { font-variant-numeric: tabular-nums; font-weight: 600; }
.dist-bar { height: 7px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.dist-bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #4aa88c, var(--brand)); }
.dist-box { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.dist-box h4, .mini-title { font-size: 12px; color: var(--ink-2); font-weight: 600; margin: 0 0 8px; }
.stat-two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* 体征卡 */
.v-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.v-card {
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px;
  background: var(--surface-2); display: flex; flex-direction: column; gap: 2px;
}
.v-card.abn { border-color: #f0d8d4; background: var(--red-soft); }
.v-card span { font-size: 11px; color: var(--ink-3); }
.v-card b { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.v-card i { font-style: normal; font-size: 10.5px; color: var(--ink-3); }
.v-card.abn b { color: var(--red); }

/* 录入弹窗：当前长者条（快速录入时用来确认「录的是谁」并就地换人） */
.m-elder {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 12px; margin-bottom: 12px;
  background: var(--brand-soft); border: 1px solid #d5e8e1; border-radius: var(--r-s);
}
.m-elder b { font-size: 14.5px; color: var(--brand-700); letter-spacing: -0.01em; }
.m-elder .m-elder-meta { font-size: 11.5px; color: var(--ink-2); }
.m-elder .spacer { flex: 1; min-width: 8px; }

/* 快速录入第一步：选长者 */
.pick-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pick-bar input {
  flex: 1; min-width: 0; height: 34px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-s);
  background: var(--surface); color: var(--ink); font-size: 13.5px;
}
.pick-bar input:focus { outline: none; border-color: var(--brand-300); box-shadow: 0 0 0 3px var(--brand-soft); }
.pick-bar > span { white-space: nowrap; }
.pick-list {
  max-height: min(54vh, 460px); overflow: auto;
  border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface);
}
.pick-item {
  display: grid; grid-template-columns: minmax(104px, 1.2fr) 84px minmax(0, 1.4fr) auto;
  align-items: center; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--line); cursor: pointer;
  transition: background 0.12s;
}
.pick-item:last-child { border-bottom: 0; }
.pick-item:hover { background: var(--brand-soft); }
.pick-item[hidden] { display: none; }
.pick-item .who { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--ink); }
.pick-item .who b { font-weight: 600; }
.pick-item .loc { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pick-item .meta { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-item .state { justify-self: end; }
.pick-empty { padding: 30px 12px; text-align: center; font-size: 12.5px; color: var(--ink-3); }
.pick-empty[hidden] { display: none; }

/* 录入弹窗 */
.m-tip {
  font-size: 11.5px; color: var(--ink-2); background: var(--surface-3);
  border: 1px solid var(--line); border-radius: var(--r-s);
  padding: 9px 12px; line-height: 1.65; margin-bottom: 14px;
}
.m-group-title {
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.measure-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.m-item {
  display: flex; flex-direction: column; gap: 3px;
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px;
  background: var(--surface-2);
}
.m-item.m-preset { border-color: var(--brand-300); background: #f4faf7; }
.m-item > span { font-size: 11.5px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 6px; }
.m-item > span em { font-style: normal; font-size: 10.5px; color: var(--ink-3); }
.m-item input {
  width: 100%; border: none; background: transparent; padding: 0;
  font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.m-item input:focus { outline: none; }
.m-item input::placeholder { font-size: 13px; font-weight: 400; color: #b9c5c0; }
.m-item > i { font-style: normal; font-size: 10px; color: var(--ink-3); }
.m-more { margin-top: 12px; }
.m-more summary { font-size: 12px; color: var(--brand-600); cursor: pointer; padding: 6px 0; }
.m-more[open] summary { margin-bottom: 8px; }

/* 健康档案弹窗 */
.hp-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 16px;
}
.hp-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--ink-2); }
.hp-bp { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--ink-2); }
.hp-bp b { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.hp-bp i { font-style: normal; font-size: 10.5px; color: var(--ink-3); }
.mini-table { min-width: 520px; }
.mini-table td, .mini-table th { padding: 7px 10px; font-size: 12px; }
.mini-table td .tiny { display: block; color: var(--ink-3); }

@media (max-width: 900px) {
  .stat-two { grid-template-columns: 1fr; gap: 16px; }
  .trend-head { gap: 6px 18px; }
  .measure-grid { grid-template-columns: repeat(2, 1fr); }
  .v-grid { grid-template-columns: repeat(2, 1fr); }
  .hp-head { gap: 8px; }
  .bars { height: 108px; }
}
@media (max-width: 480px) {
  .measure-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .m-item { padding: 6px 8px; }
  .m-item input { font-size: 16px; }
  .dist-row { grid-template-columns: 76px 1fr auto; }
}

/* ---- 照护执行确认 ---- */
.care-table { min-width: 940px; }
.exec-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 14px; font-size: 13px;
}
.exec-head b { font-size: 15px; }
.exec-steps { display: flex; flex-direction: column; gap: 2px; }
.exec-step {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 7px 10px; border-radius: 8px; font-size: 12.5px; line-height: 1.5;
  cursor: pointer; transition: background 0.12s;
}
.exec-step:hover { background: var(--surface-2); }
.exec-step input { accent-color: var(--brand); margin-top: 2px; flex: none; }
.exec-step:has(input:not(:checked)) span { color: var(--ink-3); text-decoration: line-through; }
.exec-results { display: flex; flex-wrap: wrap; gap: 8px; }
.table-wrap.scroll-y { max-height: 430px; overflow-y: auto; }
.table-wrap.scroll-y thead th { position: sticky; top: 0; z-index: 1; }
.measure-grid { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); }
.m-item input { min-height: 30px; }
.m-item input::-webkit-outer-spin-button,
.m-item input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.m-item input[type='number'] { -moz-appearance: textfield; }
.health-table { min-width: 860px; }
.health-table.wide { min-width: 1060px; }
@media (max-width: 640px) {
  .health-table th, .health-table td { padding: 8px 10px; }
}

/* 总览 7 张 KPI：宽屏下一行放下，避免第 7 张落单换行 */
@media (min-width: 1400px) {
  .cards:has(> .card:nth-child(7):last-child) { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
  .cards:has(> .card:nth-child(7):last-child) .card { padding: 13px 14px; }
  .cards:has(> .card:nth-child(7):last-child) .card .value { font-size: 21px; letter-spacing: -0.01em; }
  .cards:has(> .card:nth-child(7):last-child) .card .foot { font-size: 11px; }
}

/* ============================ 告警 ↔ 照护联动 ============================ */
/* 挂起横幅：一条告警把长者的一串常规任务按了暂停，这件事必须显眼 */
.hold-bar {
  border: 1px solid #dbe7f2; background: linear-gradient(180deg, #f6fafd, #f1f7fb);
  border-radius: var(--r-m); padding: 12px 16px; margin-bottom: 16px;
}
.hold-bar-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.hold-bar-head b { font-size: 13px; color: #2f5f86; }
.hold-bar-head span { font-size: 11.5px; }
.hold-item {
  display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap;
  padding: 8px 0; font-size: 12.5px; border-top: 1px dashed #dbe7f2;
}
.hold-item:first-of-type { border-top: none; }
.hold-main { display: flex; align-items: center; gap: 8px; flex: none; }
.hold-who { font-weight: 600; }
.hold-why { color: var(--ink-2); flex: 1; min-width: 200px; }
.hold-act { display: flex; align-items: center; gap: 12px; flex: none; margin-left: auto; }
.hold-until { color: #2f5f86; font-variant-numeric: tabular-nums; }

/* 特护任务行：左侧竖条标记，扫一眼就知道这条不是常规计划 */
tr.row-urgent td:first-child { position: relative; }
tr.row-urgent td:first-child::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--red);
}
tr.row-urgent td { background: #fffaf9; }

/* 告警详情里的联动任务清单 */
.link-tasks { display: flex; flex-direction: column; gap: 4px; }
.link-task {
  display: grid; grid-template-columns: 96px 1fr auto 92px; align-items: center; gap: 10px;
  font-size: 12.5px; padding: 6px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface-2);
}
.link-task .lt-time { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.link-task .lt-name { font-weight: 500; }
.link-task .lt-by { color: var(--ink-3); font-size: 11.5px; text-align: right; }

/* 规则页的联动按钮：做成可点的信息块，而不是纯文字 */
.link-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  text-align: left; line-height: 1.4; padding: 5px 10px; max-width: 100%;
}
.link-btn b { font-size: 12px; font-weight: 600; }
.link-btn span { color: var(--ink-3); }

/* 指标多选 */
.metric-pick {
  display: flex; flex-wrap: wrap; gap: 6px;
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; background: var(--surface-2);
}
.mp-item {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  font-size: 12px; padding: 4px 9px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface); user-select: none;
}
.mp-item input { accent-color: var(--brand); margin: 0; }
.mp-item em { font-style: normal; color: var(--ink-3); font-size: 10.5px; }
.mp-item.on { border-color: var(--brand-300); background: #f2faf6; }

@media (max-width: 900px) {
  .link-task { grid-template-columns: 78px 1fr auto; row-gap: 2px; }
  .link-task .lt-by { grid-column: 2 / -1; text-align: left; }
  .hold-item { flex-direction: column; align-items: flex-start; gap: 6px; }
  .hold-why { min-width: 0; }
  .hold-act { margin-left: 0; width: 100%; justify-content: space-between; }
}
/* 规则表的「启用」复选框在窄列里会被拆成两行 */
td .inline-check { white-space: nowrap; }
/* .form-row input 是 100% 宽的控件样式，勾选框要还原成小方块 */
.mp-item input[type='checkbox'] {
  width: 15px; height: 15px; min-height: 0; padding: 0; margin: 0;
  border: none; background: none; box-shadow: none; flex: none;
  accent-color: var(--brand); cursor: pointer;
}
.mp-item input[type='checkbox']:focus { box-shadow: none; background: none; }

/* ============================ 考勤与交接班 ============================ */
.nowrap { white-space: nowrap; }

/* 我的打卡：护工手机上第一屏，不做成卡片墙 */
.duty-card {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 18px; margin-bottom: 16px;
  border: 1px solid #d9e8e1; border-radius: var(--r-m);
  background: linear-gradient(120deg, #f4fbf8, #ffffff 62%);
  box-shadow: var(--shadow-1);
}
.duty-left { display: flex; align-items: center; gap: 11px; flex: none; min-width: 190px; }
.duty-left b { display: block; font-size: 14px; }
.duty-left .tiny { color: var(--ink-3); }
.duty-avatar {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-size: 15px; font-weight: 600;
  background: var(--brand-soft); color: var(--brand-700);
}
.duty-mid { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; min-width: 200px; }
.duty-mid .tiny { color: var(--ink-2); }
.duty-right { margin-left: auto; flex: none; }

/* 交班单：系统先汇总，交班人只做增删 */
.ho-summary { display: flex; flex-wrap: wrap; gap: 6px; }
.ho-headline {
  margin-top: 10px; padding: 9px 12px; border-radius: 9px;
  background: var(--brand-soft); color: var(--brand-700); font-size: 12.5px;
}
.ho-items { display: flex; flex-direction: column; gap: 5px; padding: 2px; }
/* 用 label.ho-item 提高权重：否则被 .form-row label{display:block} 覆盖，四列网格失效 */
.ho-item, label.ho-item {
  display: grid; grid-template-columns: 16px 44px 1fr auto; align-items: start; gap: 8px;
  padding: 8px 10px; margin: 0; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface-2); font-size: 12.5px; cursor: pointer;
}
/* 展开态的四列网格覆盖 .form-row label 的 display:block（同权重，靠后生效） */
.form-row label.ho-item { display: grid; font-size: 12.5px; color: inherit; margin-bottom: 0; }
.ho-item input[type='checkbox'] {
  width: 15px; height: 15px; min-height: 0; margin: 2px 0 0 0; padding: 0;
  border: none; background: none; box-shadow: none; accent-color: var(--brand); flex: none;
}
.ho-item .ho-type {
  font-size: 10.5px; color: var(--ink-3); border: 1px solid var(--line);
  border-radius: 5px; text-align: center; padding: 1px 0; background: var(--surface);
}
.ho-item .ho-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ho-item .ho-body b { font-weight: 600; font-size: 12.5px; }
.ho-item .ho-body em { font-style: normal; color: var(--ink-2); font-size: 11.5px; line-height: 1.5; }
.ho-item.high { border-color: #f0d8d4; background: #fffaf9; }
.ho-item.acked { opacity: 0.72; }
.ho-block { margin-top: 10px; }
.ho-block h4 { margin: 0 0 3px; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.ho-block p { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.65; }
.ho-reject {
  margin-top: 10px; padding: 8px 11px; border-radius: 8px;
  background: var(--red-soft); color: var(--red); font-size: 12px;
}
.ho-rejectbar { display: flex; gap: 8px; margin-top: 12px; }
.ho-rejectbar input { flex: 1; height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; }
.ho-confirm {
  margin-top: 10px; padding: 8px 11px; border-radius: 8px;
  background: var(--brand-soft); color: var(--brand-700); font-size: 12px;
}

@media (max-width: 900px) {
  .duty-card { flex-direction: column; align-items: flex-start; gap: 10px; }
  .duty-right { margin-left: 0; width: 100%; }
  .duty-right .btn { width: 100%; height: 40px; }
  .ho-item { grid-template-columns: 16px 40px 1fr; row-gap: 3px; }
  .ho-item .tag { grid-column: 3; justify-self: start; }
  .ho-rejectbar { flex-direction: column; }
  .ho-rejectbar .btn { height: 34px; }
}

/* 未绑定员工档案时的提示，不做成整张空卡片 */
.duty-hint {
  padding: 11px 16px; margin-bottom: 16px; font-size: 12.5px; color: var(--ink-2);
  border: 1px dashed var(--line-strong); border-radius: var(--r-m); background: var(--surface-2);
}

/* 表格最后一列（操作）：td 上不能挂 display:flex，否则该单元格会被浏览器当成匿名块，
   按钮直接盖在前一列数字上 */
.health-table td.row-actions {
  display: table-cell; text-align: right; padding-left: 16px; white-space: nowrap;
}
.health-table td.row-actions .btn { margin-left: 4px; }
.health-table th.num, .health-table td.num { white-space: nowrap; }
.health-table td.row-actions .btn + .btn { margin-left: 4px; }

/* 手机端卡片列表：横滚表格会把打卡时间和按钮推出屏幕 */
.only-mobile { display: none !important; }
.m-list { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; }
.m-card {
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 4px;
}
.m-card.bad { border-color: #f0d8d4; background: #fffaf9; }
.m-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.m-card-head b { font-size: 13px; }
.m-card-meta { font-size: 11.5px; color: var(--ink-2); }
.m-card-body { font-size: 12px; color: var(--ink-2); line-height: 1.5; }
.m-card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 2px; font-size: 11.5px; color: var(--ink-2);
}

@media (max-width: 760px) {
  .only-desktop { display: none !important; }
  .only-mobile { display: block !important; }
  .only-mobile.m-list { display: flex !important; }
}

/* 手机端 5 张 KPI：auto-fit 会把落单的第 5 张拉成整行，固定两列更整齐 */
@media (max-width: 900px) {
  .cards.kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards.kpi-grid .card { padding: 12px 13px; }
  .cards.kpi-grid .card .value { font-size: 23px; }

  /* 角色横幅：窄屏改为上下排，避免标题和「姓名·角色」挤在一行 */
  .home-hero { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px 16px; }
  .hero-title { font-size: 17px; }
  .hero-meta { text-align: left; white-space: normal; font-size: 11.5px; }

  /* 奇数张指标卡时，最后一张会独占一行；改成横向排布，看起来是设计而不是漏了一张 */
  .kpi-grid .card.kpi:last-child:nth-child(odd) {
    grid-column: span 2;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
  }
  .kpi-grid .card.kpi:last-child:nth-child(odd) .label { margin-bottom: 0; }
  .kpi-grid .card.kpi:last-child:nth-child(odd) .value { margin-left: auto; }
  .kpi-grid .card.kpi:last-child:nth-child(odd) .foot { width: 100%; }
}

/* =============================================================
   床旁概览：床位 → 健康档案摘要 + 关联传感器实时状态
   场景是「站在床边抬头看」，所以只读、短句、数字大、状态用颜色
   ============================================================= */
.bs-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.bs-room-no { font-size: 15px; font-weight: 600; letter-spacing: 0.01em; }
.bs-room-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.bs-room-actions { display: flex; gap: 6px; flex: none; }

.bs-elder {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px;
  border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface-2);
}
.bs-face {
  width: 44px; height: 44px; flex: none; border-radius: 12px;
  display: grid; place-items: center; background: var(--brand-soft); color: var(--brand);
  font-size: 18px; font-weight: 600;
}
.bs-elder-main { flex: 1; min-width: 0; }
.bs-name { font-size: 16px; font-weight: 600; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.bs-sub { font-size: 11.5px; font-weight: 400; color: var(--ink-2); }
.bs-meta { display: flex; flex-wrap: wrap; gap: 3px 12px; font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.bs-risks { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.bs-risk {
  font-size: 10.5px; padding: 2px 7px; border-radius: 99px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
}
.bs-risk.red { background: var(--red-soft); color: var(--red); border-color: #f0d8d4; }
.bs-risk.orange { background: var(--gold-soft); color: #97661a; border-color: #f1e2c4; }
.bs-bp { flex: none; text-align: right; border-left: 1px solid var(--line); padding-left: 14px; }
.bs-bp span { display: block; font-size: 10.5px; color: var(--ink-3); }
.bs-bp b { font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.bs-bp i { display: block; font-style: normal; font-size: 10.5px; color: var(--ink-3); }

.bs-vacant {
  padding: 16px; border: 1px dashed var(--line-strong);
  border-radius: var(--r-m); background: var(--surface-2);
}
.bs-vacant-t { font-size: 14px; font-weight: 600; }
.bs-vacant-d { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }

.bs-section { margin-top: 18px; }
.bs-section-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.bs-section-head h4 { margin: 0; font-size: 13px; font-weight: 600; }
.bs-section-head .muted { font-size: 11px; }
.bs-live {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; color: var(--brand-600);
}
.bs-live i {
  width: 6px; height: 6px; border-radius: 50%; background: #3fae8b;
  animation: bsPulse 2s infinite;
}
.bs-live em { font-style: normal; color: var(--ink-3); }
.bs-live.off { color: var(--ink-3); }
.bs-live.off i { background: var(--ink-3); animation: none; }
@keyframes bsPulse {
  0% { box-shadow: 0 0 0 0 rgba(63, 174, 139, 0.45); }
  70% { box-shadow: 0 0 0 6px rgba(63, 174, 139, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 174, 139, 0); }
}
.bs-sensor-sum {
  font-size: 10.5px; color: var(--ink-2); background: var(--surface-3);
  padding: 2px 8px; border-radius: 99px;
}

.bs-vitals { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.bs-vital {
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px;
  background: var(--surface-2);
}
.bs-vital span { display: block; font-size: 10.5px; color: var(--ink-3); }
.bs-vital b { display: block; font-size: 16px; font-weight: 600; margin: 1px 0; font-variant-numeric: tabular-nums; }
.bs-vital i { font-style: normal; font-size: 10px; color: var(--ink-3); }
.bs-vital.abn { border-color: #f0d8d4; background: var(--red-soft); }
.bs-vital.abn b { color: var(--red); }

.bs-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.bs-block { border: 1px solid var(--line); border-radius: var(--r-m); padding: 10px 12px; background: var(--surface); }
.bs-block-t { font-size: 11.5px; font-weight: 600; margin-bottom: 6px; display: flex; gap: 8px; align-items: baseline; }
.bs-block-t .muted { font-weight: 400; font-size: 10.5px; }
.bs-diseases { display: flex; flex-wrap: wrap; gap: 5px; }
.bs-dis {
  font-size: 11px; padding: 2px 7px; border-radius: 6px;
  background: var(--surface-3); border: 1px solid var(--line);
}
.bs-dis em { font-style: normal; color: var(--red); margin-right: 3px; font-size: 9.5px; }
.bs-dis i { font-style: normal; color: var(--ink-3); margin-left: 4px; font-size: 9.5px; }
.bs-dis.severe { background: var(--red-soft); border-color: #f0d8d4; }
.bs-note {
  margin-top: 8px; font-size: 11.5px; line-height: 1.65;
  background: var(--gold-soft); border-radius: 8px; padding: 7px 9px; color: #6d4f14;
}
.bs-note b { display: block; font-size: 10.5px; color: #97661a; margin-bottom: 2px; font-weight: 600; }
.bs-hint { margin-top: 8px; font-size: 10.5px; color: var(--ink-3); }
.bs-hint.ok { color: var(--brand-600); }
.bs-tasks { display: flex; flex-direction: column; gap: 4px; }
.bs-task { display: flex; align-items: center; gap: 7px; font-size: 11.5px; }
.bs-task span { color: var(--ink-3); font-variant-numeric: tabular-nums; flex: none; }
.bs-task b {
  font-weight: 500; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bs-task .tag { font-size: 9.5px; flex: none; }

.bs-sensors { display: flex; flex-direction: column; gap: 6px; }
.bs-sensor {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface);
}
.bs-sensor-ico {
  width: 30px; height: 30px; flex: none; border-radius: 8px;
  display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2);
}
.bs-sensor-ico svg { width: 17px; height: 17px; }
.bs-sensor-main { flex: 1; min-width: 0; }
.bs-sensor-name { font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bs-scope {
  font-size: 9.5px; color: var(--ink-3); border: 1px solid var(--line);
  border-radius: 4px; padding: 0 4px; font-weight: 400;
}
.bs-sensor-meta { font-size: 10.5px; color: var(--ink-3); margin-top: 1px; }
.bs-sensor-side {
  display: flex; align-items: center; gap: 8px; flex: none;
  flex-wrap: wrap; justify-content: flex-end;
}
.bs-heart { font-size: 10.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.bs-heart.warn { color: var(--red); }
.bs-sensor.is-stale { border-color: #f1e2c4; background: #fffcf5; }
.bs-sensor.is-stale .bs-sensor-ico { background: var(--gold-soft); color: #97661a; }
.bs-batt {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 9.5px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.bs-batt::before {
  content: ""; width: 30px; height: 9px; border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: linear-gradient(to right, #4aa88c 0, #4aa88c var(--p, 70%), #fff var(--p, 70%));
}
.bs-batt.low::before {
  background: linear-gradient(to right, var(--red) 0, var(--red) var(--p, 15%), #fff var(--p, 15%));
}
.bs-batt em { font-style: normal; }
.bs-batt-none { font-size: 9.5px; color: var(--ink-3); }

.bs-empty {
  padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--r-s);
  font-size: 11.5px; color: var(--ink-3); background: var(--surface-2); line-height: 1.7;
}
.bs-feed { display: flex; flex-direction: column; }
.bs-event {
  display: flex; align-items: center; gap: 10px; padding: 7px 2px;
  border-bottom: 1px dashed var(--line); font-size: 11.5px;
}
.bs-event:last-child { border-bottom: none; }
.bs-event-time { flex: none; width: 40px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.bs-event-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bs-event-main b { font-weight: 500; }
.bs-event-main i {
  font-style: normal; font-size: 10px; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bs-foot-hint { margin-top: 14px; font-size: 10.5px; color: var(--ink-3); text-align: center; }

@media (max-width: 900px) {
  .bs-top { flex-direction: column; }
  .bs-room-actions { width: 100%; }
  .bs-elder { flex-wrap: wrap; }
  .bs-bp {
    width: 100%; margin-left: 56px; padding-left: 0; border-left: none;
    text-align: left; display: flex; align-items: baseline; gap: 8px;
  }
  .bs-bp span { display: inline; }
  .bs-two { grid-template-columns: 1fr; }
  .bs-vitals { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .bs-sensor { flex-wrap: wrap; align-items: flex-start; }
  .bs-sensor-side { width: 100%; padding-left: 40px; justify-content: flex-start; }
  .bs-live { margin-left: 0; }
}

/* =============================================================
   换班 / 替班
   列表用表格（桌面）+ 卡片（移动），申请弹窗的分段选择器沿用按钮语言
   ============================================================= */
.swap-arrow { color: var(--brand); font-weight: 600; margin: 0 2px; }
.ellipsis { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.mono { color: var(--ink-2); letter-spacing: 0.2px; }

/* 分段选择：两张互斥的选项，比单选框更好点 */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-s); overflow: hidden; }
.seg-item {
  appearance: none; border: none; background: var(--surface); color: var(--ink-2);
  padding: 7px 18px; font: inherit; font-size: 12.5px; cursor: pointer;
  border-right: 1px solid var(--line-strong); transition: background 0.15s, color 0.15s;
}
.seg-item:last-child { border-right: none; }
.seg-item:hover { background: var(--surface-3); }
.seg-item.active { background: var(--brand); color: #fff; font-weight: 500; }

/* 审批节点流水 */
.flow-line { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.flow-node {
  display: flex; align-items: baseline; gap: 8px; padding: 7px 10px;
  border-left: 2px solid var(--line-strong); background: var(--surface-2);
  border-radius: 0 var(--r-s) var(--r-s) 0; font-size: 12px;
}
.flow-node b { font-weight: 500; }
.flow-node.approve { border-left-color: var(--brand); }
.flow-node.reject { border-left-color: var(--red); }
.flow-node.wait { border-left-color: var(--gold); }

@media (max-width: 900px) {
  .seg { width: 100%; }
  .seg-item { flex: 1; }
  .ellipsis { max-width: none; }
}

/* 弹窗里的长文本行：标签定宽、内容左对齐自动换行 */
.kv-note { display: flex; gap: 14px; font-size: 12.5px; }
.kv-note span { flex: none; width: 62px; color: var(--ink-2); }
.kv-note p { margin: 0; flex: 1; min-width: 0; color: var(--ink); font-weight: 500; line-height: 1.6; }

/* =============================================================
   工时结算
   台账用表格，明细进弹窗；锁账与漂移用通栏提示条，不抢表格的视线
   ============================================================= */
.good-text { color: var(--brand); font-weight: 500; }
tr.row-click { cursor: pointer; }
tr.row-click:hover td { background: var(--surface-3); }

.wt-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-m); background: var(--surface-2);
  font-size: 12.5px; line-height: 1.6;
}
.wt-banner b { font-weight: 600; }
.wt-banner > span { color: var(--ink-2); }
.wt-banner .muted { flex: 1 1 280px; }
.wt-banner.ok { border-color: #cfe6d9; background: var(--brand-soft); }
.wt-banner.bad { border-color: #efd6d2; background: var(--red-soft); }
.wt-banner button { margin-left: auto; }

/* 明细弹窗顶部的六个数字，一行看完再往下看逐日 */
.wt-sum {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px; margin-bottom: 14px;
}
.wt-sum > div {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-s); padding: 8px 10px;
}
.wt-sum span { display: block; font-size: 11px; color: var(--ink-3); margin-bottom: 2px; }
.wt-sum b { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; }

@media (max-width: 900px) {
  .wt-banner { align-items: flex-start; }
  .wt-banner button { margin-left: 0; }
  .wt-sum { grid-template-columns: repeat(3, 1fr); }
}

/* ============================ 数据报表 ============================
 * 左目录 + 右报表。目录用 236px 固定宽（够放下「F02-09 主要疾病分布」不折行），
 * 报表区是主体，图表整宽、表格可横向滚动。
 */
.report-layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.report-nav-wrap { position: sticky; top: 14px; min-width: 0; }
.report-picker { display: none; }
.report-nav {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-1);
  padding: 8px 8px 12px;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
}
.report-nav-group + .report-nav-group {
  border-top: 1px solid var(--line);
  padding-top: 7px;
  margin-top: 5px;
}
.report-nav-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 1px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}
.report-nav-title span {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--ink-3);
  opacity: 0.8;
}
.report-nav-hint {
  padding: 0 8px 5px;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--ink-3);
}
.report-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  text-align: left;
  font-size: 12.5px;
  color: var(--ink-2);
  transition: background 0.12s ease;
}
.report-item:hover { background: var(--surface-3); color: var(--ink); }
.report-item.active { background: var(--brand-soft); color: var(--brand-700); font-weight: 600; }
.report-item.pending { color: var(--ink-3); }
.report-no {
  flex: none;
  font-size: 10.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.report-item.active .report-no { color: var(--brand-600); }
.report-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-flag {
  flex: none;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  font-size: 10px;
  color: var(--ink-3);
}

.report-main { min-width: 0; }
.report-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 18px;
}
.report-head-main { min-width: 200px; }
.report-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.report-title h3 { margin: 0; font-size: 16px; letter-spacing: -0.01em; }
.report-badge {
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--brand-soft);
  color: var(--brand-600);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.report-desc { margin: 5px 0 0; font-size: 12.5px; color: var(--ink-2); }
.report-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.report-tools .sel-sm {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-s);
  background: var(--surface);
  font-size: 12.5px;
}
.report-tools .sel-sm:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(20, 106, 87, 0.1); }

.report-chart .chart-panel { margin-bottom: 18px; }
.report-chart .chart-body { min-height: 246px; }
/* 报表里的类目名普遍是 5–8 个汉字（慢性阻塞性肺疾病、脑卒中后遗症），
   驾驶舱那套 64px 的标签列在这里会把名字全截成省略号 */
.report-chart .hbars { gap: 9px; }
.report-chart .hbar { grid-template-columns: 124px 1fr 88px; }

.report-table-panel .panel-head { padding: 12px 18px; }
.report-table-wrap { overflow-x: auto; }
.report-table { min-width: 520px; }
/* 通用表格把首列压到 1% 用于按钮列，报表的首列是分组名，要让它自己撑开 */
.report-table th:first-child,
.report-table td:first-child { width: auto; white-space: normal; }
.report-table .report-dim { color: var(--ink); font-weight: 500; }
.report-table tbody tr:hover td { background: var(--surface-2); }
.report-table tfoot td {
  border-top: 1px solid var(--line-strong);
  background: var(--surface-2);
  font-weight: 600;
}

.report-note {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-m);
  background: var(--surface-2);
  font-size: 12px;
  line-height: 1.65;
  color: var(--ink-2);
}
.report-note b { flex: none; color: var(--ink); font-weight: 600; }

.report-pending-body { padding: 16px 20px 20px; font-size: 13px; color: var(--ink-2); }
.report-pending-lead { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.report-pending-desc { margin: 0 0 12px; }
.report-pending-dep {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--r-s);
  background: var(--gold-soft);
  font-size: 12.5px;
}
.report-pending-dep span { color: #97661a; }
.report-pending-dep b { color: var(--ink); }
.report-pending-note { margin: 0; font-size: 12px; color: var(--ink-3); }

@media (max-width: 1180px) {
  .report-layout { grid-template-columns: 210px minmax(0, 1fr); gap: 14px; }
}
@media (max-width: 900px) {
  .report-layout { grid-template-columns: 1fr; }
  .report-nav-wrap { position: static; }
  /* 手机上目录默认收起，点「切换」才展开；展开后按分组横滑 */
  .report-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-m);
    background: var(--surface);
    box-shadow: var(--shadow-1);
    font-size: 13px;
    color: var(--ink);
  }
  .report-picker-cur { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
  .report-picker-cur i { font-style: normal; font-weight: 500; font-size: 11px; color: var(--brand-600); }
  .report-picker em { flex: none; font-style: normal; font-size: 12px; color: var(--brand-600); font-weight: 600; }
  /* 展开后纵向滚动、限高：分组横滑会在右边缘切掉半个「机构分析」，
     看起来像坏了；竖排 29 项滑起来反而更快找到目标 */
  .report-nav {
    display: none;
    position: static;
    max-height: 330px;
    margin-top: 8px;
    padding: 8px 8px 10px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .report-nav.open { display: block; }
  .report-nav-group {
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
  }
  .report-nav-group + .report-nav-group { border-top: 1px solid var(--line) !important; padding-top: 6px !important; margin-top: 4px !important; }
  .report-nav-hint { display: none; }
  .report-tools { width: 100%; }
  .report-chart .chart-panel { margin-bottom: 12px; }
  .report-chart .chart-body { min-height: 0; }
  .report-chart .hbar { grid-template-columns: 100px 1fr 74px; }
  .report-note { flex-direction: column; gap: 4px; }
}

/* ============================ 后勤报修 ============================ */
.panel-head .sel-sm {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-s);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--ink);
}
.panel-head .sel-sm:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(20, 106, 87, 0.1); }

.rp-table-wrap { overflow-x: auto; }
.rp-table { min-width: 1080px; }
.rp-table th:first-child, .rp-table td:first-child { width: auto; }
/* 超时只在最左侧留一道细红线：整行铺红三次之后就被自动忽略了 */
.rp-late-row td:first-child { box-shadow: inset 2px 0 0 var(--red); }
.rp-no { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 11.5px; }
.rp-title { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 位置与类别不许折行：「卫浴洁具」被拆成「卫浴洁/具」比省那几像素难看得多 */
.rp-table td:nth-child(2), .rp-table td:nth-child(3) { white-space: nowrap; }
.rp-sla { margin-top: 4px; font-size: 11px; line-height: 1.3; }
.rp-sla .tag { font-size: 10.5px; padding: 1px 7px; }
.rp-ops { white-space: nowrap; }
.rp-ops .btn.small { margin-left: 2px; }
.rp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 11px 18px 13px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-2);
}

/* 验收评分：三档按钮，不引第三方评分组件 */
.rp-rate { display: flex; gap: 8px; }
.rp-rate-btn {
  flex: 1;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-s);
  background: var(--surface);
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}
.rp-rate-btn:hover { border-color: var(--brand); color: var(--brand-600); }
.rp-rate-btn.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-700); font-weight: 600; }

/* 工单详情 */
.rp-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.rp-detail-title { font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.rp-detail-sub { margin-top: 4px; font-size: 12px; color: var(--ink-3); }
.rp-detail-note {
  margin: 0 0 12px;
  padding: 9px 12px;
  border-radius: var(--r-s);
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.6;
}
.rp-info {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 18px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.rp-info div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rp-info span { font-size: 11px; color: var(--ink-3); }
.rp-info b { font-size: 12.5px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-finish { margin-top: 12px; }
.rp-finish span { font-size: 11px; color: var(--ink-3); }
.rp-finish p { margin: 3px 0 0; font-size: 12.5px; line-height: 1.65; color: var(--ink-2); }

.rp-track { margin-top: 16px; }
.rp-track-title { font-size: 11.5px; font-weight: 600; color: var(--ink-3); letter-spacing: 0.05em; margin-bottom: 8px; }
.rp-track-item { display: flex; gap: 10px; padding-bottom: 12px; position: relative; }
.rp-track-item i {
  flex: none;
  width: 7px; height: 7px; margin-top: 5px;
  border-radius: 50%; background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.rp-track-item:not(:last-child)::after {
  content: ""; position: absolute; left: 3px; top: 15px; bottom: 0; width: 1px; background: var(--line);
}
.rp-track-item b { font-size: 12.5px; font-weight: 600; color: var(--ink); margin-right: 7px; }
.rp-track-item span { font-size: 11.5px; color: var(--ink-3); }
.rp-track-item p { margin: 3px 0 0; font-size: 12px; color: var(--ink-2); line-height: 1.55; }
.rp-track-item em { display: block; margin-top: 2px; font-style: normal; font-size: 10.5px; color: var(--ink-3); }

@media (max-width: 900px) {
  .rp-info { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rp-title { max-width: 132px; }
  .rp-foot { flex-direction: column; align-items: flex-start; gap: 5px; }
  /* 手机上横向滚 1000 多像素才能点到「派单」，等于这个页面在手机上不能干活。
     所以不硬撑表格，直接把行改成卡片：位置 + 紧急一行，事项一行，状态与操作各占一头。
     单号、类别、处理人不上手机——单号进详情看，类别看位置就知道，处理人派单后才关心。 */
  .rp-table-wrap { overflow: visible; }
  .rp-table { min-width: 0; }
  .rp-table thead { display: none; }
  .rp-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
  }
  .rp-table td { padding: 0; border: 0; width: auto !important; font-size: 12.5px; }
  .rp-table th:nth-child(1), .rp-table td:nth-child(1),
  .rp-table th:nth-child(3), .rp-table td:nth-child(3),
  .rp-table th:nth-child(7), .rp-table td:nth-child(7) { display: none; }
  .rp-table td:nth-child(2) { grid-column: 1; font-weight: 600; white-space: normal; }
  .rp-table td:nth-child(4) { grid-column: 2; grid-row: 1; justify-self: end; }
  .rp-table td:nth-child(5) { grid-column: 1 / -1; max-width: none; white-space: normal; color: var(--ink-2); }
  .rp-table td:nth-child(6) { grid-column: 1; display: flex; gap: 8px; font-size: 11px; line-height: 1.4; }
  .rp-table td:nth-child(8) { grid-column: 2; justify-self: end; text-align: right; }
  .rp-table td:nth-child(9) { grid-column: 1 / -1; }
  .rp-table td:nth-child(6) br { display: none; }
  .rp-ops { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 5px !important; }
  .rp-ops .btn.small { padding: 0 9px; }
  .rp-late-row td:first-child { box-shadow: none; }
  .rp-table tbody tr.rp-late-row { box-shadow: inset 2px 0 0 var(--red); }
}

/* ============================ 支出台账 ============================ */
/* 待付款在左侧留一道细橙线：这不是错误，是「还没做完的事」，用红色会读成异常 */
.exp-table-wrap { overflow-x: auto; }
.exp-table { min-width: 1000px; }
.exp-table th:first-child, .exp-table td:first-child { width: auto; }
.exp-pending-row td:first-child { box-shadow: inset 2px 0 0 var(--gold); }
.exp-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.exp-no { white-space: nowrap; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.exp-cat { white-space: nowrap; }
.exp-item { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-supplier { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-amount { white-space: nowrap; font-weight: 600; }
.exp-sub { margin-top: 3px; font-size: 11px; color: var(--ink-3); white-space: nowrap; }
/* 「待付款」三个字被表格挤成两行是最扎眼的排版事故，状态列一律不折行 */
.exp-table td:nth-child(7) { white-space: nowrap; }
/* 自动入账的标记：让人一眼看出这笔不是人录的，改不了（要去改报修单） */
.exp-auto {
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 3px;
  background: var(--surface-3);
  font-size: 10px;
  color: var(--ink-3);
  vertical-align: 1px;
}
.exp-ops { white-space: nowrap; }
.exp-ops .btn.small { margin-left: 2px; }
.exp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 11px 18px 13px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-2);
}

/* 手机上条子只剩几十像素，看起来像全是零头——改成「标签+金额」一行、条占满下一行 */
@media (max-width: 640px) {
  .exp-structure .hbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "label value" "track track";
    gap: 4px 10px;
  }
  .exp-structure .hbar-label { grid-area: label; }
  .exp-structure .hbar-value { grid-area: value; }
  .exp-structure .hbar-track { grid-area: track; height: 8px; }
}

/* 本月结构：类别名比报表页短，标签列可以收到 78px */
.exp-structure .hbars { padding: 4px 18px 18px; gap: 10px; }
.exp-structure .hbar { grid-template-columns: 78px 1fr 132px; }

.card .value.sm { font-size: 19px; font-weight: 600; }

.exp-check {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 4px 0 2px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.exp-check input[type="date"] {
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-s);
  background: var(--surface);
  font-size: 12px;
  color: var(--ink);
}
.exp-pay-lead { margin: 0 0 12px; font-size: 13px; color: var(--ink-2); }
.exp-pay-lead b { color: var(--ink); font-variant-numeric: tabular-nums; }
.exp-detail-head { margin-bottom: 8px; }
.exp-detail-title { font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.exp-detail-sub { margin-top: 5px; font-size: 12px; color: var(--ink-3); }

@media (max-width: 900px) {
  .exp-foot { flex-direction: column; align-items: flex-start; gap: 5px; }
  /* 手机上一行九列横滚等于不能对账，所以改卡片：
     第一行日期与金额（最关心的两个数），第二行事项，第三行类别与状态，最后是操作。
     单号、供应商、经办不上手机——单号进详情看，后两个是录入时才关心的字段。 */
  .exp-table-wrap { overflow: visible; }
  .exp-table { min-width: 0; }
  .exp-table thead { display: none; }
  .exp-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
  }
  .exp-table td { padding: 0; border: 0; width: auto !important; font-size: 12.5px; }
  .exp-table th:nth-child(2), .exp-table td:nth-child(2),
  .exp-table th:nth-child(5), .exp-table td:nth-child(5),
  .exp-table th:nth-child(8), .exp-table td:nth-child(8) { display: none; }
  .exp-table td:nth-child(1) { grid-row: 1; grid-column: 1; font-size: 11.5px; color: var(--ink-3); align-self: center; }
  .exp-table td:nth-child(6) { grid-row: 1; grid-column: 2; justify-self: end; font-size: 14px; }
  .exp-table td:nth-child(4) { grid-row: 2; grid-column: 1 / -1; max-width: none; white-space: normal; color: var(--ink); }
  .exp-table td:nth-child(3) { grid-row: 3; grid-column: 1; align-self: center; }
  .exp-table td:nth-child(7) { grid-row: 3; grid-column: 2; justify-self: end; text-align: right; }
  .exp-table td:nth-child(9) { grid-row: 4; grid-column: 1 / -1; padding-top: 4px !important; }
  .exp-ops { display: flex; gap: 6px; flex-wrap: wrap; }
  .exp-ops .btn.small { padding: 0 9px; }
  .exp-pending-row td:first-child { box-shadow: none; }
  .exp-table tbody tr.exp-pending-row { box-shadow: inset 2px 0 0 var(--gold); }
  .exp-structure .hbars { padding: 4px 14px 16px; }
}

/* ============================ 物品与库房 ============================ */
/* 三个页签：库存 / 采购 / 领用。做成下划线式而不是按钮组，
   因为它切换的是同一件事的三个视角，不是三个独立功能 */
.gd-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.gd-tab {
  position: relative;
  padding: 9px 16px 10px;
  border: 0;
  background: none;
  font-size: 13px;
  color: var(--ink-3);
  cursor: pointer;
  transition: color .15s;
}
.gd-tab:hover { color: var(--ink); }
.gd-tab.on { color: var(--ink); font-weight: 600; }
.gd-tab.on::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: -1px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px 2px 0 0;
}

.gd-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 16px;
  border-radius: var(--r-m);
  border: 1px solid rgba(214, 158, 46, .28);
  background: var(--gold-soft, rgba(214, 158, 46, .08));
  font-size: 12.5px;
}
.gd-alert b { color: var(--ink); }

.gd-table-wrap { overflow-x: auto; }
.gd-table { min-width: 940px; }
.gd-code { white-space: nowrap; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.gd-name { font-weight: 500; }
.gd-spec { margin-top: 2px; font-size: 11px; color: var(--ink-3); font-weight: 400; }
.gd-qty { white-space: nowrap; font-weight: 600; }
.gd-qty small { margin-left: 2px; font-size: 10.5px; font-weight: 400; color: var(--ink-3); }
.gd-amt { white-space: nowrap; font-weight: 600; }
.gd-items { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-ops { white-space: nowrap; }
.gd-ops .btn.small { margin-left: 2px; }
/* 待补货在左侧留一道细橙线：这是「该干活了」，不是「出错了」 */
.gd-low-row td:first-child { box-shadow: inset 2px 0 0 var(--gold); }
.gd-void-row { opacity: .55; }

.gd-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 11px 18px 13px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-2);
}

/* ---------- 多行明细编辑器 ---------- */
.gd-lines-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0 8px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.gd-lines { display: flex; flex-direction: column; gap: 8px; }
.gd-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px 92px 96px 28px;
  gap: 8px;
  align-items: center;
}
.gd-line.gd-line-out { grid-template-columns: minmax(0, 1fr) 92px 96px 28px; }
.gd-line select,
.gd-line input {
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-s);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--ink);
  min-width: 0;
}
.gd-line-amt {
  text-align: right;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.gd-line-del {
  width: 26px; height: 26px;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: none;
  color: var(--ink-3);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.gd-line-del:hover:not(:disabled) { color: var(--rose, #c0392b); border-color: currentColor; }
.gd-line-del:disabled { opacity: .3; cursor: default; }
/* 领用行下面那行小字：库存与均价。放在网格外一行，避免把四列撑乱 */
.gd-line-out .gd-line-hint {
  grid-column: 1 / -1;
  margin-top: -2px;
  font-size: 11px;
  color: var(--ink-3);
}
.gd-lines-total {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  text-align: right;
  font-size: 12.5px;
  color: var(--ink-2);
}
.gd-lines-total b { margin-left: 6px; font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- 单据详情 ---------- */
.gd-doc-head {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 16px;
  margin-bottom: 14px;
}
.gd-doc-head div { display: flex; flex-direction: column; gap: 3px; }
.gd-doc-head span { font-size: 11px; color: var(--ink-3); }
.gd-doc-head b { font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.gd-doc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.gd-doc-table th {
  padding: 7px 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
  text-align: left;
  white-space: nowrap;
}
.gd-doc-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.gd-doc-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.gd-doc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--ink-2);
}

@media (max-width: 900px) {
  .gd-tabs { margin-bottom: 12px; }
  .gd-tab { padding: 8px 12px 9px; font-size: 12.5px; }
  .gd-foot { flex-direction: column; align-items: flex-start; gap: 5px; }

  /* 手机上一行九列横滚等于不能对账，改成卡片。
     每一列都必须显式指定行列，漏一个就会在网格里乱跑——
     上一版就是这么把「安全/均价/库存金额」散成一堆孤立的数字的。 */
  .gd-table-wrap { overflow: visible; }
  .gd-table { min-width: 0; }
  .gd-table thead { display: none; }
  .gd-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
  }
  .gd-table td {
    padding: 0 !important;
    border: 0;
    width: auto !important;
    min-width: 0;
    font-size: 12.5px;
  }

  /* 库存页：物品 | 库存 / 编码 | 类别 / 均价 | 状态 / 操作 */
  .gd-table td:nth-child(1) { grid-area: 2 / 1; }              /* 编码 */
  .gd-table td:nth-child(2) { grid-area: 1 / 1; font-size: 13.5px; align-self: center; }
  .gd-table td:nth-child(3) { grid-area: 2 / 2; justify-self: end; color: var(--ink-3); font-size: 11.5px; }
  .gd-table td:nth-child(4) { grid-area: 1 / 2; justify-self: end; font-size: 15px; align-self: center; }
  .gd-table td:nth-child(5) { display: none; }                  /* 安全库存 */
  .gd-table td:nth-child(6) { grid-area: 3 / 1; color: var(--ink-3); font-size: 11.5px; }
  .gd-table td:nth-child(7) { display: none; }                  /* 库存金额 */
  .gd-table td:nth-child(8) { grid-area: 3 / 2; justify-self: end; }
  .gd-table td:nth-child(9) { grid-area: 4 / 1 / 5 / 3; padding-top: 6px !important; display: flex; gap: 6px; }

  /* 采购页：供应商 | 金额 / 单号 | 日期 / 物品 / 状态 + 操作 */
  .gd-table-order td:nth-child(1) { grid-area: 2 / 1; }
  .gd-table-order td:nth-child(2) { grid-area: 2 / 2; justify-self: end; }
  .gd-table-order td:nth-child(3) { grid-area: 1 / 1; font-size: 13.5px; }
  .gd-table-order td:nth-child(4) { grid-area: 3 / 1 / 4 / 3; }
  .gd-table-order td:nth-child(5) { display: none; }
  .gd-table-order td:nth-child(6) { grid-area: 1 / 2; justify-self: end; font-size: 15px; }
  .gd-table-order td:nth-child(7) { grid-area: 4 / 1; }
  .gd-table-order td:nth-child(8) { grid-area: 4 / 1 / 5 / 3; padding-top: 6px !important; display: flex; gap: 6px; }
  /* 状态与操作同时在第 4 行会叠在一起，把状态挪到第 3 行右侧 */
  .gd-table-order td:nth-child(7) { grid-area: 3 / 2; justify-self: end; }

  /* 领用页：科室 | 成本 / 单号 | 日期 / 物品 / 类型 / 操作 */
  .gd-table-out td:nth-child(1) { grid-area: 2 / 1; }
  .gd-table-out td:nth-child(2) { grid-area: 2 / 2; justify-self: end; }
  .gd-table-out td:nth-child(3) { grid-area: 1 / 1; font-size: 13.5px; }
  .gd-table-out td:nth-child(4) { grid-area: 4 / 1; }
  .gd-table-out td:nth-child(5) { display: none; }
  .gd-table-out td:nth-child(6) { grid-area: 3 / 1 / 4 / 3; }
  .gd-table-out td:nth-child(7) { grid-area: 1 / 2; justify-self: end; font-size: 15px; }
  .gd-table-out td:nth-child(8) { grid-area: 5 / 1 / 6 / 3; padding-top: 6px !important; display: flex; gap: 6px; }

  .gd-table-order .gd-items, .gd-table-out .gd-items { max-width: none; white-space: normal; color: var(--ink-3); font-size: 12px; }
  .gd-low-row td:first-child { box-shadow: none; }
  .gd-table tbody tr.gd-low-row { box-shadow: inset 2px 0 0 var(--gold); }

  /* 明细行：第一行物品，第二行数量 + 单价 + 金额。
     不能用 .gd-line input 统一指定区域——数量和单价会叠在同一格里，
     上一版就是这么把单价盖在数量上的。 */
  .gd-line {
    grid-template-columns: minmax(0, 1fr) 76px 76px 26px;
    grid-template-areas: "item item item del" "qty price amt .";
    gap: 6px 8px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--line);
  }
  .gd-line.gd-line-out {
    grid-template-columns: minmax(0, 1fr) 76px 26px;
    grid-template-areas: "item item del" "qty amt amt";
  }
  .gd-line select { grid-area: item; }
  .gd-line input[data-f="qty"] { grid-area: qty; }
  .gd-line input[data-f="price"] { grid-area: price; }
  .gd-line .gd-line-amt { grid-area: amt; justify-self: end; align-self: center; }
  .gd-line .gd-line-del { grid-area: del; justify-self: end; align-self: center; }
  .gd-line-out .gd-line-hint { grid-column: 1 / -1; grid-row: 3; }
  .gd-doc-head { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============================ 长者档案：身份 / 地址 / 家属 ============================ */
.el-search {
  width: 260px; padding: 7px 11px; min-height: 32px; font-size: 12.5px;
  border: 1px solid var(--line-strong); border-radius: var(--r-s);
  background: var(--surface-2); margin-right: 4px;
}
.el-search:focus { outline: none; background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(20, 106, 87, 0.1); }
.el-table td { vertical-align: middle; }
.el-name { font-weight: 600; font-size: 13px; }
.el-sub { font-size: 10.5px; color: var(--ink-3); line-height: 1.5; margin-top: 2px; }
.el-contact { font-size: 12.5px; }
.el-warn { color: var(--red); }
.el-mini { padding: 1px 5px; font-size: 9.5px; margin-left: 5px; }

/* 详情里的「标签 : 值」两列网格，户籍与居家地址整行铺开 */
.el-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 22px; }
.el-f { min-width: 0; }
.el-f > span { display: block; font-size: 10.5px; color: var(--ink-3); margin-bottom: 3px; }
.el-f > div { font-size: 12.5px; line-height: 1.6; word-break: break-all; }
.el-f.wide { grid-column: 1 / -1; }
.el-f i.muted { font-style: normal; }

.el-fam { min-width: 700px; }
.el-fam td { vertical-align: middle; }
/* 关系只有两个字，列宽不够会被折成「儿 / 子」两行，看着像两个人 */
.el-fam th:nth-child(2), .el-fam td:nth-child(2) { white-space: nowrap; }
.el-fam th:nth-child(4), .el-fam td:nth-child(4) { min-width: 176px; }
.el-fam th:nth-child(5), .el-fam td:nth-child(5) { max-width: 240px; }
.el-fam .el-sub { margin-top: 0; }
.el-fam tr.el-off { opacity: 0.55; }
.el-fam tr.el-off b { font-weight: 400; text-decoration: line-through; }

/* 表单分区标题：一张表单里塞三段（基本信息 / 证件 / 地址），没有分隔会看串行 */
.el-sec {
  font-size: 12px; font-weight: 600; color: var(--brand-700);
  margin: 20px 0 12px; padding-bottom: 7px; border-bottom: 1px solid var(--line);
  display: flex; align-items: baseline; gap: 8px;
}
.el-sec:first-child { margin-top: 0; }
.el-sec .muted { font-weight: 400; }

.form-tip.ok { background: var(--brand-soft); color: var(--brand-700); border-color: #d3e9e0; }
.form-tip.warn { background: var(--red-soft); color: var(--red); border-color: #f0d8d4; }

.el-ck {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--ink-2); margin-top: 6px; cursor: pointer;
}
.el-ck input[type='checkbox'] { width: 14px; height: 14px; min-height: 0; margin: 0; padding: 0; accent-color: var(--brand); }

/* 家属角色：五个可以同时成立的标记，横排卡片比一行 checkbox 更容易读 */
.el-flags { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.el-flag {
  display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 9px;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-s);
  background: var(--surface-2); cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.el-flag:hover { border-color: var(--line-strong); background: #fff; }
.el-flag:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.el-flag input[type='checkbox'] {
  width: 15px; height: 15px; min-height: 0; margin: 1px 0 0 0; padding: 0;
  border: none; background: none; accent-color: var(--brand);
}
.el-flag b { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.el-flag i { display: block; font-style: normal; font-size: 10.5px; color: var(--ink-3); line-height: 1.55; margin-top: 2px; }

@media (max-width: 900px) {
  .el-head { flex-wrap: wrap; }
  .el-search { width: 100%; margin: 10px 0 0; }
  .el-info { grid-template-columns: minmax(0, 1fr); gap: 11px; }
  .el-flags { grid-template-columns: 1fr; }

  /* 家属表在桌面上 min-width 700px，塞进手机弹窗会把整个弹窗撑到屏幕外，
     所以这里也改成一人一卡：姓名与关系在头、电话与角色居中、操作在底。 */
  .el-fam { min-width: 0; }
  .el-fam thead { display: none; }
  .el-fam, .el-fam tbody { display: block; }
  .el-fam tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 10px; padding: 11px 0; border-bottom: 1px solid var(--line);
  }
  .el-fam tbody tr:last-child { border-bottom: none; }
  .el-fam td { display: block; padding: 0; border: none; vertical-align: top; }
  .el-fam td:nth-child(1) { grid-column: 1; }
  .el-fam td:nth-child(2) { grid-column: 2; justify-self: end; color: var(--ink-2); }
  .el-fam td:nth-child(3) { grid-column: 1 / -1; }
  .el-fam td:nth-child(4) { grid-column: 1 / -1; }
  .el-fam td:nth-child(5) { grid-column: 1 / -1; max-width: none; }
  .el-fam td:nth-child(6) {
    grid-column: 1 / -1; width: 100%;
    display: flex; justify-content: flex-end; gap: 6px;
  }
  .el-fam th:nth-child(2), .el-fam td:nth-child(2) { white-space: normal; }

  /* 8 列表格在 390px 屏上必然横向溢出，改成一条一卡：
     姓名与状态在头、房床等级次之、家属与第一联系人随后、操作压到底部右侧。 */
  .el-table { min-width: 0; }
  .el-table thead { display: none; }
  .el-table, .el-table tbody { display: block; }
  .el-table tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px; padding: 13px 14px; border-bottom: 1px solid var(--line); align-items: start;
  }
  .el-table tbody tr:last-child { border-bottom: none; }
  .el-table td { display: block; padding: 0; border: none; }
  .el-table td:nth-child(1) { display: none; }
  .el-table td:nth-child(2) { grid-row: 1; grid-column: 1; }
  .el-table td:nth-child(7) { grid-row: 1; grid-column: 2; justify-self: end; }
  .el-table td:nth-child(3) { grid-row: 2; grid-column: 1; }
  .el-table td:nth-child(3)::before { content: '房/床 '; font-size: 10.5px; color: var(--ink-3); }
  .el-table td:nth-child(4) { grid-row: 2; grid-column: 2; justify-self: end; }
  .el-table td:nth-child(5) { grid-row: 3; grid-column: 1; }
  .el-table td:nth-child(5)::before { content: '家属 '; font-size: 10.5px; color: var(--ink-3); }
  .el-table td:nth-child(6) { grid-row: 4; grid-column: 1 / 3; }
  .el-table td:nth-child(6)::before { content: '联系人 '; font-size: 10.5px; color: var(--ink-3); }
  /* justify-self: end 会把 td 收缩到 min-content（挤成 3px，按钮全溢出到卡片外），
     改成 flex 撑满整行再右对齐 */
  .el-table td:nth-child(8) {
    grid-row: 5; grid-column: 1 / -1; width: 100%;
    display: flex; justify-content: flex-end; gap: 6px;
  }
}

/* 弹窗宽度用内联 style="width:min(880px,100%)" 传进来，在手机上有浏览器
   把 100% 解析成 auto，弹窗被内容撑到屏幕外；这里强制压回视口内 */
@media (max-width: 760px) {
  /* 光给 width:100% 不够：grid item 的 min-width 默认是 auto（= min-content），
     内容宽 509 就会把弹窗顶到屏幕外。要把 min-width 一起压成 0。 */
  #modalRoot .modal { width: 100% !important; max-width: 100%; min-width: 0; }
  #modalRoot .modal-body { min-width: 0; }
  #modalRoot .modal-body .panel,
  #modalRoot .modal-body .panel-body,
  #modalRoot .modal-body .cards,
  #modalRoot .modal-body .el-info { min-width: 0; }
  /* 评估记录这类窄表格在手机上放不下，让所在面板自己横滚，别把弹窗顶出去 */
  #modalRoot .modal-body .panel { overflow-x: auto; }
}

/* ============================ 餐饮服务 ============================ */
.ml-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.ml-head .spacer { flex: 1; }
.ml-date {
  padding: 7px 10px; min-height: 32px; font-size: 12.5px;
  border: 1px solid var(--line-strong); border-radius: var(--r-s);
  background: var(--surface-2); color: var(--ink);
}
.ml-date:focus { outline: none; background: #fff; border-color: var(--brand); }
.ml-week { font-size: 13px; letter-spacing: 0.3px; color: var(--brand-700); }

/* ---- 今日备餐：三餐并排 ---- */
.ml-meals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.ml-meal { margin-bottom: 0; display: flex; flex-direction: column; }
.ml-meal .panel-head { padding-bottom: 10px; }
.ml-time { font-size: 11px; font-weight: 400; color: var(--ink-3); margin-left: 7px; letter-spacing: 0.2px; }
.ml-qty { font-size: 19px; font-weight: 700; color: var(--brand-700); font-variant-numeric: tabular-nums; }
.ml-qty small { font-size: 10.5px; font-weight: 400; color: var(--ink-3); margin-left: 3px; }
.ml-body { padding: 0 18px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }

.ml-chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* 饮食分布这一排是页面最有用的信息：厨房照着它决定要不要另起一锅 */
.ml-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px;
  background: var(--surface-3); color: var(--ink-2);
}
.ml-chip b { font-size: 12px; color: var(--ink); font-variant-numeric: tabular-nums; }
.ml-chip.special { background: var(--blue-soft); color: var(--blue); }
.ml-chip.special b { color: var(--blue); }

.ml-dishes { display: flex; flex-wrap: wrap; gap: 5px; }
.ml-dish {
  font-size: 11.5px; padding: 2px 8px; border-radius: 5px;
  background: #fff; border: 1px solid var(--line); color: var(--ink-2);
}
.ml-dish.none { border-style: dashed; color: var(--ink-3); }

.ml-warn {
  font-size: 11px; line-height: 1.6; color: var(--gold);
  background: var(--gold-soft); border-radius: 6px; padding: 7px 10px;
}

.ml-progress { display: flex; align-items: center; gap: 9px; font-size: 11px; color: var(--ink-3); }
.ml-bar { flex: 1; height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.ml-bar i { display: block; height: 100%; background: var(--brand-300); border-radius: 999px; transition: width 0.3s; }

.ml-foot { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 2px; }
.ml-foot .spacer { flex: 1; }

.ml-alert {
  font-size: 12px; line-height: 1.7; color: var(--gold);
  background: var(--gold-soft); border: 1px solid #efe0c2; border-radius: var(--r-s);
  padding: 10px 14px; margin-bottom: 14px;
}
.ml-note { background: var(--surface-2); border-style: dashed; }
.ml-note-body { padding: 14px 18px; font-size: 11.5px; line-height: 1.8; color: var(--ink-2); }
.ml-note-body b { color: var(--brand-700); }

/* ---- 订单台账 ---- */
.ml-table-wrap { overflow-x: auto; }
.ml-table { width: 100%; min-width: 860px; border-collapse: collapse; }
.ml-table th {
  font-size: 11px; font-weight: 500; color: var(--ink-3); text-align: left;
  padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.ml-table td { font-size: 12.5px; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ml-table tbody tr:last-child td { border-bottom: none; }
.ml-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.ml-elder { font-weight: 600; }
.ml-sub { font-size: 10.5px; font-weight: 400; color: var(--ink-3); margin-top: 2px; }
.ml-mini { font-size: 9.5px; margin-left: 4px; }
.ml-extra { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }
/* 未用餐与漏留都用左橙线：它们是「有记录但不正常」，不是错误 */
.ml-skip-row td { background: #fdfbf6; }
.ml-skip-row td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.ml-issue { font-size: 12px; line-height: 1.6; max-width: 320px; }

/* ---- 菜品档案：菜名下挂一行「工艺/配料」，操作多一个停用 ---- */
/* 宽 880 的弹窗里要塞 9 列，靠缩单元格内边距换空间，比让表格横向滚动友好 */
.ml-dish-table { min-width: 0; }
.ml-dish-table th, .ml-dish-table td { padding: 8px 6px; }
.ml-dish-table th:first-child, .ml-dish-table td:first-child { padding-left: 10px; }
.ml-dish-table th:last-child, .ml-dish-table td:last-child { padding-right: 10px; }
.ml-dish-table td.muted:first-child { font-size: 11px; color: var(--ink-3); }
.ml-dish-table .ml-dt { max-width: 160px; }
.ml-recipe { display: flex; gap: 4px; margin-top: 3px; }
.ml-recipe .tag { font-size: 10px; }
.ml-ops { white-space: nowrap; }
.ml-ops .btn + .btn { margin-left: 3px; }
.ml-ops .btn { padding: 3px 7px; }
.ml-dish-bar { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }

/* 配菜详情：一行一个原料，名称宽、用量窄、单位更窄 */
.md-ing { display: flex; flex-direction: column; gap: 6px; }
.md-ing-row { display: grid; grid-template-columns: minmax(0, 1fr) 88px 64px 32px; gap: 6px; align-items: center; }
.md-ing-row input { height: 32px; padding: 0 9px; font-size: 12.5px; }
.md-ing-row .btn { height: 32px; padding: 0; line-height: 1; font-size: 14px; }
.md-ing-foot { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

/* ---- 食谱编排：7 列 × 3 行的周表 ---- */
.ml-menupanel { padding: 0; overflow: hidden; }
.ml-grid {
  display: grid;
  grid-template-columns: 78px repeat(7, minmax(0, 1fr));
  min-width: 780px;
}
.ml-ghead {
  padding: 10px 8px; text-align: center; border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line); background: var(--surface-2);
}
.ml-ghead:first-child { border-left: none; }
.ml-ghead b { display: block; font-size: 12px; color: var(--ink); }
.ml-ghead span { display: block; font-size: 10.5px; color: var(--ink-3); margin-top: 1px; }
.ml-ghead.today { background: var(--brand-soft); }
.ml-ghead.today b { color: var(--brand-700); }
.ml-gside {
  padding: 14px 10px; border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.ml-gside b { font-size: 12.5px; color: var(--ink); }
.ml-gside span { font-size: 10.5px; color: var(--ink-3); }
.ml-mcell {
  position: relative; padding: 10px 8px; border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line); min-height: 96px;
  display: flex; flex-direction: column; gap: 4px; cursor: pointer;
  transition: background 0.12s;
}
.ml-mcell:hover { background: var(--brand-soft); }
.ml-mcell.blank { background: var(--surface-2); }
.ml-mchip { font-size: 11.5px; color: var(--ink-2); line-height: 1.5; }
.ml-mempty { font-size: 11px; color: var(--ink-3); }
.ml-mwarn {
  position: absolute; top: 6px; right: 6px; width: 15px; height: 15px; border-radius: 50%;
  background: var(--gold); color: #fff; font-size: 10px; font-style: normal; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.ml-foot-note { padding: 10px 16px; font-size: 11px; color: var(--ink-3); border-top: 1px solid var(--line); background: var(--surface-2); }

/* ---- 食品安全：左留样右检查 ---- */
.ml-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.ml-two .panel { margin-bottom: 0; }

/* ---- 多选卡片（饮食/菜品/原因）：一行 checkbox 看不清，做成带说明的方块 ---- */
.ml-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.ml-check {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-s);
  background: var(--surface-2); font-size: 12px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.ml-check:hover { border-color: var(--brand-300); }
.ml-check.on { border-color: var(--brand); background: var(--brand-soft); }
.ml-check input { width: 14px; height: 14px; min-height: 0; margin: 0; padding: 0; accent-color: var(--brand); }
.ml-check span { color: var(--ink); }
.ml-check i { font-style: normal; font-size: 10px; color: var(--ink-3); margin-left: 2px; }

.ml-dgroups { max-height: 58vh; overflow-y: auto; }
.ml-dgroup { margin-bottom: 14px; }
.ml-dtitle { font-size: 11px; color: var(--ink-3); margin-bottom: 7px; letter-spacing: 0.3px; }

/* ---- 加菜行编辑 ---- */
.ml-ex-lines { display: flex; flex-direction: column; gap: 8px; }
.ml-ex-line { display: grid; grid-template-columns: minmax(0, 1fr) 72px 96px 44px; gap: 8px; align-items: center; }
.ml-ex-line select, .ml-ex-line input {
  width: 100%; padding: 8px 10px; min-height: 34px; font-size: 12.5px;
  border: 1px solid var(--line-strong); border-radius: var(--r-s); background: var(--surface-2);
}
.ml-ex-total { margin-top: 14px; text-align: right; font-size: 12px; color: var(--ink-2); }
.ml-ex-total b { font-size: 17px; color: var(--brand-700); margin-left: 6px; font-variant-numeric: tabular-nums; }

.form-2col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-inline { display: flex; align-items: center; gap: 8px; }
.form-inline input { width: auto; flex: 1; }

@media (max-width: 1180px) {
  .ml-meals { grid-template-columns: 1fr; }
  .ml-two { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .ml-head .ml-date { flex: 1; min-width: 120px; }
  .ml-grid { min-width: 0; grid-template-columns: 60px repeat(7, minmax(0, 1fr)); }
  .ml-mcell { min-height: 74px; padding: 8px 5px; }
  .ml-mchip { font-size: 10px; }
  /* 订单表 9 列在手机上横不过来，改成一条一卡：日期 + 长者 + 饮食在头，状态与操作在底。
     留样与检查两张窄表保持表格，让所在面板自己横滚——7 列的留样清单卡片化后反而看不出餐次归属 */
  .ml-otable { min-width: 0; }
  .ml-otable thead { display: none; }
  .ml-otable, .ml-otable tbody { display: block; }
  .ml-otable tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); align-items: center;
  }
  .ml-otable tbody tr:last-child { border-bottom: none; }
  .ml-otable td { display: block; padding: 0; border: none; }
  /* 每一格都显式指定行列：自动排布会因为隐藏列而错行，卡片变成一大片空白 */
  .ml-otable td:nth-child(1) { grid-row: 1; grid-column: 1; font-size: 10.5px; color: var(--ink-3); }
  .ml-otable td:nth-child(2) { grid-row: 1; grid-column: 2; justify-self: end; font-size: 10.5px; color: var(--ink-3); }
  .ml-otable td:nth-child(3) { grid-row: 2; grid-column: 1 / -1; }
  .ml-otable td:nth-child(4) { grid-row: 3; grid-column: 1; }
  .ml-otable td:nth-child(6) { grid-row: 3; grid-column: 2; justify-self: end; font-size: 10.5px; color: var(--ink-3); }
  .ml-otable td:nth-child(5) { grid-row: 4; grid-column: 1; font-size: 11px; color: var(--ink-2); text-align: left; }
  .ml-otable td:nth-child(5)::after { content: ' 份'; font-size: 10px; color: var(--ink-3); }
  .ml-otable td:nth-child(7) { grid-row: 4; grid-column: 2; justify-self: end; text-align: right; }
  .ml-otable td:nth-child(8) { grid-row: 5; grid-column: 1; }
  .ml-otable td:nth-child(9) {
    grid-row: 5; grid-column: 2; width: 100%;
    display: flex; justify-content: flex-end; gap: 6px;
  }
  .ml-ex-line { grid-template-columns: minmax(0, 1fr) 60px 84px; }
  .ml-ex-line [data-exdel] { grid-column: 3; }
  .form-2col { grid-template-columns: 1fr; }
}

/* 留样与检查两张表塞在半屏宽里：min-width 收窄到 0，靠内容自适应，列数已精简到 5 */
.ml-stable { min-width: 0; }
.ml-stable th, .ml-stable td { padding: 8px 8px; }
.ml-keep { color: var(--brand); font-variant-numeric: tabular-nums; }

/* 窄屏食谱：一天一卡，三餐竖排 */
.ml-days { display: flex; flex-direction: column; }
.ml-day { border-bottom: 1px solid var(--line); }
.ml-day:last-child { border-bottom: none; }
.ml-day.today { background: #f4faf7; }
.ml-day-head {
  display: flex; align-items: baseline; gap: 7px;
  padding: 10px 14px 7px; font-size: 12.5px;
}
.ml-day-head b { color: var(--ink); }
.ml-day-head span { font-size: 11px; color: var(--ink-3); }
.ml-day-head i {
  font-style: normal; font-size: 10px; padding: 1px 6px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-700); margin-left: auto;
}
.ml-day-meal {
  position: relative; display: flex; gap: 10px; align-items: flex-start;
  padding: 7px 14px; cursor: pointer;
}
.ml-day-meal:active { background: var(--brand-soft); }
.ml-day-t { flex: 0 0 34px; font-size: 11px; color: var(--ink-3); padding-top: 1px; }
.ml-day-d { display: flex; flex-wrap: wrap; gap: 3px 10px; flex: 1; }
.ml-day-d .ml-mchip { font-size: 12px; color: var(--ink-2); }

/* ============================================================
   自选服务
   ============================================================ */
.sv-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 0 2px 12px;
}
.sv-date, .sv-kw {
  height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); font-size: 12.5px; font-family: inherit;
}
.sv-kw { width: 180px; }
.sv-date:focus, .sv-kw:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* 状态筛选做成小页签，塞进 panel-head 也不占地方 */
.sv-stabs { gap: 2px; }
.sv-stabs .gd-tab { padding: 4px 9px; font-size: 11.5px; }

.sv-otable { table-layout: fixed; width: 100%; }
/* 列宽必须按序号写到 th 上：table-layout:fixed 只认第一行的宽度，
   只给 td 加 class 的话浏览器会把各列均分，最后「操作」列被压成一条缝。 */
.sv-otable th:nth-child(1), .sv-otable td:nth-child(1) { width: 36px; }
.sv-otable th:nth-child(2), .sv-otable td:nth-child(2) { width: 112px; }
.sv-otable th:nth-child(3), .sv-otable td:nth-child(3) { width: 132px; }
.sv-otable th:nth-child(5), .sv-otable td:nth-child(5) { width: 78px; }
.sv-otable th:nth-child(6), .sv-otable td:nth-child(6) { width: 96px; }
.sv-otable th:nth-child(7), .sv-otable td:nth-child(7) { width: 120px; }
.sv-otable th:nth-child(8), .sv-otable td:nth-child(8) { width: 132px; }
.sv-otable .sv-ck { text-align: center; }
.sv-otable .sv-ck input { width: 14px; height: 14px; accent-color: var(--brand); cursor: pointer; }
.sv-otable td { vertical-align: middle; }
.sv-otable td small { display: block; font-size: 10.5px; color: var(--ink-3); font-weight: 400; margin-top: 1px; }
.sv-otable .sv-qty i, .sv-itable .sv-u {
  font-style: normal; font-size: 10px; color: var(--ink-3); margin-left: 2px; font-weight: 400;
}
.sv-otable .sv-amt { font-variant-numeric: tabular-nums; }
.sv-otable .sv-st { white-space: nowrap; }
.sv-otable .sv-ops { white-space: nowrap; }
.sv-otable .sv-ops .btn + .btn { margin-left: 4px; }
/* 取消的单整行压暗：它的金额是 0，不该和真金白银抢注意力 */
.sv-row.cancelled { opacity: 0.55; }
.sv-row.cancelled .sv-amt { text-decoration: line-through; }

.sv-note { margin-top: 14px; }
.sv-note-body {
  padding: 12px 16px; font-size: 12px; line-height: 1.75; color: var(--ink-2);
  background: var(--brand-soft); border-radius: 10px;
}
.sv-note-body b { color: var(--brand-700); }

/* 目录表：列多，桌面靠横向滚动，不做卡片化——这是低频维护页 */
.sv-tablewrap { overflow-x: auto; }
.sv-itable { min-width: 760px; }
.sv-itable tr.off { opacity: 0.5; }
.sv-mono { font-variant-numeric: tabular-nums; font-size: 11.5px; }

/* 窄屏服务目录卡片：与订单卡片同样做成独立卡片，两种列表看起来才是一套东西 */
.sv-icards { display: flex; flex-direction: column; gap: 8px; padding: 8px 10px; }
.sv-icard { padding: 12px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.sv-icard.off { opacity: 0.6; }
/* 触屏没有悬停态，ghost 按钮的透明边框等于没有边界，点了不知道有没有点到 */
.sv-icard-b .btn.ghost { border-color: var(--line-strong); background: var(--surface); }
.sv-icard-h { display: flex; align-items: center; gap: 8px; }
.sv-icard-h b { font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-icard-m { margin-top: 5px; font-size: 11.5px; color: var(--ink-2); }
.sv-icard-m b { color: var(--ink); font-variant-numeric: tabular-nums; }
.sv-icard-m i { font-style: normal; font-size: 10px; color: var(--ink-3); }
.sv-icard-s { margin-top: 4px; font-size: 11px; color: var(--ink-3); }
.sv-icard-b { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.sv-inline { margin-left: 6px; font-size: 10px; }
/* 「待 N」不该用标签：标签自带边框和圆点，会跟数字抢位置，
   而且数字宽度一变标签就左右跳。小字靠右，一眼能扫到就够。 */
.sv-done { white-space: nowrap; }
.sv-wait { font-style: normal; font-size: 10px; color: var(--blue); margin-left: 5px; }

/* 项目表单里的勾选行 */
.sv-check-line {
  display: flex; align-items: flex-start; gap: 7px; padding: 4px 0 12px;
  font-size: 12px; color: var(--ink-2); line-height: 1.6; cursor: pointer;
}
.sv-check-line input { margin-top: 2px; accent-color: var(--brand); }

/* 下单弹窗：项目按类别分组的多选清单 */
.sv-pick-head {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--ink); padding: 4px 0 8px;
}
.sv-pick-head .muted { font-weight: 400; font-size: 11px; }
.sv-pick-list {
  max-height: 320px; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 12px;
}
.sv-pick-cat {
  position: sticky; top: 0; z-index: 1;
  padding: 6px 12px; font-size: 11px; font-weight: 600; color: var(--brand-700);
  background: var(--brand-soft); border-bottom: 1px solid #dcebe5;
}
.sv-pick {
  display: grid; grid-template-columns: 16px minmax(0, 1fr) auto 64px;
  align-items: center; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid var(--line); cursor: pointer; font-size: 12.5px;
}
.sv-pick:last-child { border-bottom: none; }
.sv-pick.on { background: #f7fbf9; }
.sv-pick input[type='checkbox'] { width: 14px; height: 14px; accent-color: var(--brand); cursor: pointer; }
.sv-pick-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-pick-p { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 11.5px; }
.sv-pick-p i { font-style: normal; font-size: 10px; color: var(--ink-3); }
.sv-pick-q {
  width: 100%; height: 28px; padding: 0 6px; text-align: right;
  border: 1px solid var(--line); border-radius: 7px; font-size: 12px; font-family: inherit;
  background: #fff; color: var(--ink);
}
.sv-pick-q:disabled { background: #f6f7f8; color: var(--ink-3); border-color: #eceeed; }

.sv-total {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 10px 2px 2px; border-top: 1px dashed var(--line); font-size: 12.5px; color: var(--ink-2);
}
.sv-total b { font-size: 20px; color: var(--ink); font-variant-numeric: tabular-nums; }
.sv-confirm { font-size: 12.5px; line-height: 1.8; color: var(--ink-2); }

@media (max-width: 760px) {
  .sv-bar { gap: 6px; }
  .sv-date { flex: 1; min-width: 0; }
  .sv-kw { width: 100%; order: 5; }
  .sv-bar .spacer { display: none; }
  .sv-stabs { flex-wrap: wrap; }

  /* 订单表 → 卡片：每一格显式指定行列，自动排布遇隐藏列会错行 */
  .sv-otable { min-width: 0; table-layout: auto; width: auto; }
  .sv-otable thead { display: none; }
  .sv-otable, .sv-otable tbody { display: block; }
  /* 每张订单做成独立卡片：只靠一条 1px 分隔线，连排十几条会糊成一片 */
  .sv-otable tbody { padding: 8px 10px; }
  .sv-otable tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 10px; padding: 11px 13px; margin-bottom: 8px;
    border: 1px solid var(--line); border-radius: 10px; background: #fff; align-items: center;
  }
  .sv-otable tbody tr:last-child { margin-bottom: 0; }
  .sv-otable td { display: block; padding: 0; border: none; width: auto; }
  .sv-otable th { width: auto; }
  /* 窄屏不做批量操作：勾选框和批量按钮一起藏。
     只藏其中一个，另一个就成了永远点不了的摆设。 */
  .sv-otable td:nth-child(1) { display: none; }
  #svBatch { display: none !important; }
  .sv-otable td:nth-child(2) { grid-row: 1; grid-column: 1 / -1; font-size: 10.5px; color: var(--ink-3); }
  .sv-otable td:nth-child(3) { grid-row: 2; grid-column: 1 / -1; font-size: 14px; font-weight: 600; }
  .sv-otable td:nth-child(4) { grid-row: 3; grid-column: 1; font-size: 12px; color: var(--ink-2); }
  .sv-otable td:nth-child(6) { grid-row: 3; grid-column: 2; justify-self: end; font-size: 14px; }
  .sv-otable td:nth-child(5) { grid-row: 4; grid-column: 1; font-size: 11px; color: var(--ink-3); text-align: left; }
  .sv-otable td:nth-child(7) { grid-row: 4; grid-column: 2; justify-self: end; text-align: right; }
  .sv-otable td:nth-child(8) {
    grid-row: 5; grid-column: 1 / -1; width: 100%;
    display: flex; justify-content: flex-end; gap: 6px;
  }
  /* 窄屏只有「房床」「类别」这种短提示跟在主文字后面，
     时间与执行人仍换行——挤在一行会把「完成」两个字甩到下一行去 */
  .sv-otable td.sv-d small,
  .sv-otable td.sv-elder small,
  .sv-otable td.sv-item small { display: inline; margin-left: 5px; }
  .sv-otable .sv-fin { display: none; }

  .sv-pick { grid-template-columns: 16px minmax(0, 1fr) 56px; }
  .sv-pick-p { display: none; }
  .sv-pick-list { max-height: 260px; }
}

/* ============================================================
   精神慰藉（F03-10）
   - 列表每行是「一位长者的一次被陪伴」，所以日期只留月-日，月份靠上方筛选
   - 情绪用「前 ↑ 后」两枚小标签表达，比一行文字更快看出这次聊完往哪边走了
   ============================================================ */

.cf-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 0 2px 12px;
}
.cf-date, .cf-sel, .cf-kw {
  height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); font-size: 12.5px; font-family: inherit;
}
.cf-kw { width: 170px; }
.cf-date:focus, .cf-sel:focus, .cf-kw:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.cf-ck { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.cf-ck input { width: 14px; height: 14px; accent-color: var(--brand); }
.cf-hint { font-size: 11.5px; }

/* 8 列：日期 / 长者 / 方式 / 时长 / 执行人 / 情绪 / 状态 / 操作
   宽度必须写到 th 上，table-layout:fixed 只认第一行 */
.cf-table { table-layout: fixed; width: 100%; }
.cf-table th:nth-child(1), .cf-table td:nth-child(1) { width: 62px; }
.cf-table th:nth-child(2), .cf-table td:nth-child(2) { width: 130px; }
.cf-table th:nth-child(3), .cf-table td:nth-child(3) { width: 148px; }
.cf-table th:nth-child(4), .cf-table td:nth-child(4) { width: 96px; }
.cf-table th:nth-child(5), .cf-table td:nth-child(5) { width: 82px; }
.cf-table th:nth-child(6), .cf-table td:nth-child(6) { width: 152px; }
.cf-table th:nth-child(7), .cf-table td:nth-child(7) { width: 96px; }
.cf-table th:nth-child(8), .cf-table td:nth-child(8) { width: 150px; }
.cf-table td { vertical-align: middle; }
.cf-table td small { display: block; font-size: 10.5px; color: var(--ink-3); font-weight: 400; margin-top: 1px; }
.cf-table .cf-ops { white-space: nowrap; text-align: right; }
.cf-table .cf-ops .btn + .btn { margin-left: 3px; }
.cf-table .cf-ops .btn { padding: 3px 8px; font-size: 11.5px; }
/* 作废的记录压暗但不划掉：它不是「错的」，是「当初记过、后来说不算的」 */
.cf-row.voided { opacity: 0.5; }
.cf-tag {
  font-style: normal; font-size: 10px; margin-left: 5px; padding: 1px 5px;
  border-radius: 4px; background: var(--blue-soft); color: var(--blue); border: 1px solid #d9e7f4;
}
.cf-fu {
  font-style: normal; font-size: 10px; margin-left: 5px; padding: 1px 5px;
  border-radius: 4px; background: var(--gold-soft); color: #97661a; border: 1px solid #f1e2c4;
}

/* 情绪：前 → 后。箭头单独上色，因为要看的其实是它 */
.cf-mm {
  display: inline-block; font-size: 10.5px; padding: 1px 6px; border-radius: 4px;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink-2);
}
.cf-mm.red { background: var(--red-soft); color: var(--red); border-color: #f0d8d4; }
.cf-mm.orange { background: var(--gold-soft); color: #97661a; border-color: #f1e2c4; }
.cf-mm.blue { background: var(--blue-soft); color: var(--blue); border-color: #d9e7f4; }
.cf-mm.green { background: var(--brand-soft); color: var(--brand-600); border-color: #d3e9e0; }
.cf-arrow { font-style: normal; font-size: 11px; margin: 0 3px; color: var(--ink-3); }
.cf-arrow.up { color: var(--brand); font-weight: 700; }
.cf-arrow.down { color: var(--red); font-weight: 700; }
.cf-arrow.flat { color: var(--ink-3); }

/* 清单表：列少、内容短，不套用记录表的固定列宽——那是给 8 列用的，
   套到 4 列上会把长者姓名压成一窄条 */
.cf-mini { width: 100%; }
.cf-mini th { font-weight: 500; }
.cf-mini td { vertical-align: middle; }
.cf-mini td small { display: block; font-size: 10.5px; color: var(--ink-3); font-weight: 400; margin-top: 1px; }
.cf-mini .cf-ops { white-space: nowrap; text-align: right; }
.cf-mini .cf-ops .btn { padding: 3px 9px; font-size: 11.5px; }
.cf-mini .cf-elder { font-weight: 600; }

/* 覆盖页：两张清单并排，桌面占一屏，窄屏叠起来 */
.cf-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.cf-split .panel { margin: 0; }
.cf-over { color: var(--red); font-weight: 600; }
.cf-never { color: var(--red); font-size: 11.5px; }
.cf-note-cell { max-width: 260px; font-size: 11.5px; color: var(--ink-2); }

.cf-note { margin-top: 14px; }
.cf-note-body {
  padding: 12px 16px; font-size: 12px; line-height: 1.75; color: var(--ink-2);
  background: var(--brand-soft); border-radius: 10px;
}
.cf-note-body b { color: var(--brand-700); }

/* ---------- 登记弹窗 ---------- */
.cf-elders { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.cf-elder-kw {
  width: 100%; height: 32px; padding: 0 11px; border: 0; border-bottom: 1px solid var(--line);
  font-size: 12.5px; font-family: inherit; color: var(--ink);
}
.cf-elder-kw:focus { outline: none; background: var(--surface-2); }
.cf-elder-list { max-height: 168px; overflow-y: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.cf-elder-pick {
  display: flex; align-items: center; gap: 6px; padding: 7px 10px;
  font-size: 12.5px; cursor: pointer; border-bottom: 1px solid var(--surface-3);
}
.cf-elder-pick:hover { background: var(--surface-2); }
.cf-elder-pick input { width: 14px; height: 14px; accent-color: var(--brand); flex: none; }
.cf-elder-pick span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-elder-pick small { font-size: 10.5px; color: var(--ink-3); flex: none; }

/* 方式做成按钮组而不是下拉：七种方式一眼全看见，选错的概率比翻下拉低 */
.cf-modes { display: flex; flex-wrap: wrap; gap: 6px; }
.cf-mode-pick {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px;
  cursor: pointer; background: #fff; color: var(--ink-2);
}
.cf-mode-pick input { display: none; }
.cf-mode-pick:has(input:checked) {
  border-color: var(--brand); background: var(--brand-soft); color: var(--brand-700); font-weight: 600;
}

.cf-dur-row { display: flex; align-items: center; gap: 5px; }
.cf-dur-row input { width: 72px; }
.cf-dur-row .btn { padding: 3px 8px; font-size: 11.5px; }

.cf-locked {
  padding: 7px 11px; border: 1px dashed var(--line-strong); border-radius: 8px;
  background: var(--surface-2); font-size: 13px;
}
.cf-locked small { display: block; font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.cf-ck-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.cf-ck-inline input { width: 14px; height: 14px; accent-color: var(--brand); }

/* ---------- 详情弹窗 ---------- */
.cf-detail { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; margin: 0 0 12px; }
.cf-detail > div { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--surface-3); }
.cf-detail dt { width: 68px; flex: none; font-size: 12px; color: var(--ink-3); }
.cf-detail dd { margin: 0; font-size: 12.5px; color: var(--ink); }
.cf-group-note {
  padding: 8px 12px; margin-bottom: 10px; border-radius: 8px;
  background: var(--blue-soft); color: var(--blue); font-size: 12px; line-height: 1.6;
}
.cf-content-box { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cf-content-head {
  padding: 7px 12px; font-size: 11.5px; color: var(--ink-2);
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.cf-content-body { padding: 11px 13px; font-size: 12.5px; line-height: 1.8; color: var(--ink); max-height: 220px; overflow-y: auto; }
.cf-fu-box {
  padding: 9px 13px; border-top: 1px solid var(--line); background: var(--gold-soft);
  font-size: 12px; color: #7d5314;
}
.cf-confirm { font-size: 12.5px; line-height: 1.75; color: var(--ink-2); margin-bottom: 12px; }

@media (max-width: 900px) {
  .cf-split { grid-template-columns: 1fr; }
  .cf-elder-list { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .cf-bar { gap: 6px; }
  .cf-date { flex: 1; min-width: 0; }
  .cf-kw { width: 100%; order: 9; }
  .cf-bar .spacer { display: none; }

  /* 记录表 → 卡片：每格显式指定行列，自动排布遇隐藏列会错行 */
  .cf-table { display: block; }
  .cf-table thead { display: none; }
  .cf-table tbody { display: block; }
  .cf-table tr.cf-row {
    display: grid; grid-template-columns: auto 1fr auto; grid-auto-rows: auto;
    gap: 2px 8px; padding: 11px 12px; margin: 0 10px 8px;
    border: 1px solid var(--line); border-radius: 10px; background: #fff;
  }
  .cf-table td { border: 0; padding: 0; width: auto !important; }
  .cf-table td.cf-d { grid-row: 1; grid-column: 1; font-size: 11.5px; color: var(--ink-3); }
  .cf-table td.cf-st { grid-row: 1; grid-column: 3; justify-self: end; text-align: right; }
  .cf-table td.cf-elder { grid-row: 2; grid-column: 1 / -1; font-size: 14px; font-weight: 600; }
  .cf-table td.cf-mode { grid-row: 3; grid-column: 1 / 3; font-size: 12px; color: var(--ink-2); }
  .cf-table td.cf-dur { grid-row: 3; grid-column: 3; justify-self: end; font-size: 12px; }
  .cf-table td.cf-wk { grid-row: 4; grid-column: 1; font-size: 11px; color: var(--ink-3); }
  .cf-table td.cf-mood { grid-row: 4; grid-column: 2 / -1; justify-self: end; text-align: right; }
  .cf-table td.cf-ops {
    grid-row: 5; grid-column: 1 / -1; width: 100%;
    display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px;
  }
  .cf-table td.cf-elder small,
  .cf-table td.cf-mode small { display: inline; margin-left: 5px; }
  .cf-table td.cf-st small { display: inline; margin-left: 4px; }

  /* 清单表 → 一人一卡：半屏宽的表塞 5 列，最后一定是「2026-10-0149 天」
     这种日期和数字粘在一起的东西，看不出哪个是哪个 */
  .cf-mini { display: block; }
  .cf-mini thead { display: none; }
  .cf-mini tbody { display: block; }
  .cf-mini tr {
    display: grid; grid-template-columns: 1fr; gap: 3px;
    padding: 10px 12px; border-bottom: 1px solid var(--surface-3);
  }
  .cf-mini tr:last-child { border-bottom: 0; }
  /* width:100% 是必须的：td 变成网格项后不会自动撑满那一列，
     不写就会缩成几像素宽，文字叠在一起看不清*/
  .cf-mini td { display: flex; width: 100%; gap: 8px; align-items: baseline; padding: 0; border: 0; }
  .cf-mini td::before {
    content: attr(data-l); flex: none; width: 58px;
    font-size: 11px; color: var(--ink-3); font-weight: 400;
  }
  .cf-mini td[data-l='']::before { display: none; }
  /* 姓名当标题行，不重复标「长者」两个字 */
  .cf-mini td.cf-elder { display: block; font-size: 14px; font-weight: 600; }
  .cf-mini td.cf-elder::before { display: none; }
  .cf-mini td.cf-elder small { display: inline; margin-left: 6px; font-size: 11px; }
  .cf-mini td.cf-ops { justify-content: flex-end; margin-top: 4px; }
  .cf-mini td.cf-ops::before { display: none; }
  .cf-mini td.cf-note-cell { display: flex; }
  .cf-mini .cf-note-cell { max-width: none; }

  .cf-detail { grid-template-columns: 1fr; }
  .cf-elder-list { grid-template-columns: repeat(2, 1fr); max-height: 150px; }
  .cf-mode-pick { padding: 5px 9px; font-size: 12px; }
}

/* 快速录入选长者：窄屏改成两行（姓名+状态 / 房床·等级·上次） */
@media (max-width: 640px) {
  .pick-bar { flex-wrap: wrap; }
  .pick-bar input { flex: 1 1 100%; }
  .pick-item {
    grid-template-columns: auto 1fr;
    grid-template-areas: 'who state' 'loc meta';
    gap: 3px 10px; padding: 10px 12px;
  }
  .pick-item .who { grid-area: who; }
  .pick-item .state { grid-area: state; }
  .pick-item .loc { grid-area: loc; }
  .pick-item .meta { grid-area: meta; text-align: right; }
  .pick-list { max-height: 58vh; }
  /* 窄屏：姓名与「换一位」同行，房床等级信息另起一行，别把按钮挤到第三行 */
  .m-elder {
    display: grid; grid-template-columns: 1fr auto;
    grid-template-areas: 'name switch' 'meta meta';
    gap: 4px 8px; padding: 8px 10px;
  }
  .m-elder b { grid-area: name; }
  .m-elder .spacer { display: none; }
  .m-elder .m-elder-meta { grid-area: meta; }
  .m-elder button { grid-area: switch; }
}

/* =============================================================
   智能配餐
   一屏要回答的是「这一餐每个人打什么」，不是「推荐几道好菜」。
   所以表格以人为行、以菜为块，慎用的菜带黄边、缺项带红字。
   ============================================================= */

.nt-meals { display: flex; gap: 4px; margin-left: 4px; }
.nt-mbtn {
  padding: 6px 13px; font-size: 12px; min-height: 32px;
  border: 1px solid var(--line-strong); border-radius: var(--r-s);
  background: var(--surface-2); color: var(--ink-2);
}
.nt-mbtn.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.nt-empty { padding: 44px 24px; text-align: center; }
.nt-empty b { display: block; font-size: 15px; margin-bottom: 8px; }
.nt-empty p { font-size: 12.5px; color: var(--ink-3); line-height: 1.9; margin: 0 0 16px; }

.nt-panel { padding: 0; overflow-x: auto; }
.nt-table { width: 100%; min-width: 940px; border-collapse: collapse; table-layout: fixed; }
.nt-table th {
  font-size: 11px; font-weight: 500; color: var(--ink-3); text-align: left;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.nt-table th:nth-child(1) { width: 17%; }
.nt-table th:nth-child(2) { width: 10%; }
.nt-table th:nth-child(3) { width: 15%; }
.nt-table th:nth-child(4) { width: 33%; }
.nt-table th:nth-child(5) { width: 15%; }
.nt-table th:nth-child(6) { width: 10%; }
.nt-table td { font-size: 12.5px; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.nt-table tbody tr { cursor: pointer; }
.nt-table tbody tr:hover { background: var(--surface-2); }
.nt-table tbody tr:last-child td { border-bottom: none; }
.nt-table .num { text-align: right; }

.nt-who { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nt-who b { font-weight: 600; font-size: 13px; }
.nt-bed { font-size: 10.5px; color: var(--ink-3); margin-top: 3px; }
.nt-alg {
  font-style: normal; font-size: 10.5px; color: var(--red);
  background: var(--red-soft); padding: 1px 6px; border-radius: 3px; white-space: nowrap;
}
.nt-drug {
  font-style: normal; font-size: 10.5px; color: var(--ink-3);
  background: var(--surface-3); padding: 1px 6px; border-radius: 3px; cursor: help;
}
.nt-tube { font-style: normal; color: var(--gold); font-weight: 600; }
.nt-src { font-size: 10px; color: var(--gold); margin-top: 3px; }

.nt-conds { display: flex; flex-wrap: wrap; gap: 4px; }
.nt-cond {
  font-size: 10.5px; padding: 1px 7px; border-radius: 3px;
  background: var(--slate-soft); color: var(--ink-2); white-space: nowrap;
}

.nt-chips { display: flex; flex-wrap: wrap; gap: 5px; align-content: flex-start; }
.nt-dish {
  display: inline-flex; align-items: baseline; gap: 4px;
  font-size: 12px; padding: 3px 9px; border-radius: 5px;
  background: #fff; border: 1px solid var(--line-strong); color: var(--ink);
}
.nt-dish.warn { background: var(--gold-soft); border-color: #ecdcb9; color: var(--gold); }
.nt-dish i { font-style: normal; font-size: 10px; color: var(--ink-3); }
.nt-nodish { font-size: 11.5px; color: var(--red); }

.nt-miss-cell { display: flex; flex-direction: column; gap: 3px; }
.nt-miss {
  font-size: 11px; color: var(--gold); background: var(--gold-soft);
  border: 1px solid #efe0c2; border-radius: 3px; padding: 1px 7px; align-self: flex-start;
}

/* ---- 餐盘单弹窗 ---- */
.nt-sheet { font-size: 12.5px; }
.nt-sheet-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 12px;
}
.nt-sheet-name { font-size: 17px; font-weight: 700; }
.nt-sheet-name span { font-size: 12px; font-weight: 400; margin-left: 8px; }
.nt-sheet-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.nt-sheet-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.nt-sheet-alg {
  font-size: 11.5px; padding: 7px 12px; border-radius: var(--r-s);
  background: var(--surface-2); margin-bottom: 14px;
}

.nt-sec { margin-bottom: 14px; }
.nt-sec-t {
  font-size: 12px; font-weight: 600; color: var(--brand-700);
  display: flex; align-items: center; gap: 6px; margin-bottom: 7px;
}
.nt-sec-t b {
  font-size: 10.5px; font-weight: 500; color: var(--ink-3);
  background: var(--surface-3); padding: 0 6px; border-radius: 3px;
}
.nt-sec.warn .nt-sec-t { color: var(--gold); }
.nt-sec.block .nt-sec-t { color: var(--red); }

.nt-line {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px;
  padding: 7px 11px; border-radius: var(--r-s); background: var(--surface-2); margin-bottom: 5px;
}
.nt-line.warn { background: var(--gold-soft); }
.nt-line.block { background: var(--red-soft); }
.nt-g {
  font-size: 10px; color: var(--ink-3); background: #fff;
  padding: 0 5px; border-radius: 3px; min-width: 30px; text-align: center;
}
.nt-por { font-size: 11px; color: var(--gold); }
.nt-line.block .nt-por { color: var(--red); }
.nt-why { flex: 1 1 100%; font-size: 11px; color: var(--ink-2); line-height: 1.65; }
.nt-cond-row { display: flex; align-items: baseline; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.nt-cond-row:last-child { border-bottom: none; }
.nt-cond-row b { font-size: 11.5px; color: var(--brand-700); min-width: 92px; }
.nt-cond-row span { font-size: 11px; color: var(--ink-3); }
.nt-cond-row i { font-style: normal; font-size: 11px; color: var(--ink-2); flex: 1 1 100%; line-height: 1.7; }
.nt-miss-row { display: flex; gap: 8px; padding: 5px 0; align-items: baseline; flex-wrap: wrap; }
.nt-miss-row b { font-size: 11.5px; color: var(--gold); min-width: 62px; }
.nt-miss-row span { font-size: 11.5px; color: var(--ink-2); }
.nt-note-row { display: flex; gap: 8px; padding: 4px 0; font-size: 11.5px; line-height: 1.7; }
.nt-note-row b { color: var(--brand-700); min-width: 62px; }
.nt-note-row span { color: var(--ink-2); flex: 1; }
.nt-print-btn { margin-right: auto; }

@media (max-width: 760px) {
  .nt-meals { margin-left: 0; width: 100%; }
  .nt-mbtn { flex: 1; }
  .nt-table { min-width: 0; table-layout: auto; }
  .nt-table thead { display: none; }
  .nt-table tbody tr { display: block; padding: 11px 12px; border-bottom: 1px solid var(--line); }
  .nt-table tbody td { display: block; padding: 2px 0; border: none; }
  .nt-table tbody td:nth-child(3),
  .nt-table tbody td:nth-child(6) { display: none; }
  .nt-table tbody td:nth-child(2) { margin-top: 3px; }
  .nt-table tbody td:nth-child(4) { margin-top: 7px; }
  .nt-table tbody td:nth-child(5) { margin-top: 6px; }
  .nt-table tbody td:nth-child(5) .nt-miss-cell { flex-direction: row; flex-wrap: wrap; gap: 5px; }
  .nt-table td.num { text-align: left; }
  .nt-sheet-head { flex-direction: column; gap: 8px; }
  .nt-cond-row b { min-width: 0; }
  .nt-note-row { flex-direction: column; gap: 1px; }
}

/* 餐饮加到五个页签后，390px 下 4 个字的页签加起来刚好放不下，
   「智能配餐」被压成竖排两行。缩字号 + 允许横滑，比折行好读。 */
@media (max-width: 760px) {
  #view .gd-tabs {
    overflow-x: auto; flex-wrap: nowrap;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  #view .gd-tabs::-webkit-scrollbar { display: none; }
  #view .gd-tabs .gd-tab {
    flex: 0 0 auto; white-space: nowrap;
    padding: 8px 10px 9px; font-size: 12px;
  }
}

/* 营养属性勾选：正面标签用品牌绿、风险标签用赭金与砖红，
   一眼能看出这道菜是「偏咸」还是「补蛋白」，不用逐个读字 */
.ml-check.nt-tag-red.on { background: var(--red-soft); border-color: #eccac6; color: var(--red); }
.ml-check.nt-tag-orange.on { background: var(--gold-soft); border-color: #ecdcb9; color: var(--gold); }
.ml-check.nt-tag-green.on { background: var(--brand-soft); border-color: #cfe3db; color: var(--brand-700); }

/* =============================================================
   用药管理
   一条原则：待执行的行要能被一眼找到。护士早上端着药盘，
   扫一眼就知道这一车还有哪几床没发——所以待执行用实心按钮，
   已执行退成灰字，异常用红标签顶在最前面。
   ============================================================= */

.md-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.md-head .md-date { padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-s); background: var(--surface); }
.md-search {
  padding: 8px 11px; min-width: 200px;
  border: 1px solid var(--line-strong); border-radius: var(--r-s); background: var(--surface-2);
}
.md-search:focus { outline: none; background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(20,106,87,.1); }

.md-minis { display: inline-flex; background: var(--surface-3); border-radius: var(--r-s); padding: 3px; }
.md-mini {
  border: 0; background: transparent; padding: 6px 14px; border-radius: 6px;
  font-size: 13px; color: var(--ink-2);
}
.md-mini.on { background: var(--surface); color: var(--brand); font-weight: 600; box-shadow: var(--shadow-1); }

.md-kpi { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }

.md-alert {
  background: var(--blue-soft); border: 1px solid #cfdcea; color: #2b5273;
  border-radius: var(--r-s); padding: 10px 13px; font-size: 12.5px; margin-bottom: 14px;
}
.md-alert-warn { background: var(--gold-soft); border-color: #eadcc0; color: #7a5a1e; margin-top: -4px; }

/* ---------- 时间点条 ---------- */
.md-slots {
  display: flex; gap: 7px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px;
  scrollbar-width: thin;
}
.md-slot {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 78px; padding: 8px 12px; border-radius: var(--r-s);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-size: 13px; font-weight: 600; line-height: 1.2;
}
.md-slot i { font-style: normal; font-size: 11px; font-weight: 400; color: var(--ink-3); }
.md-slot.on { border-color: var(--brand); background: var(--brand); color: #fff; }
.md-slot.on i { color: rgba(255,255,255,.75); }
.md-slot.todo { border-color: #d8c79f; background: #fdfaf2; }
.md-slot.todo i { color: var(--gold); }
.md-slot.late { border-color: #e2b7b2; background: #fdf3f2; }
.md-slot.late i { color: var(--red); }

/* ---------- 长者给药卡 ---------- */
.md-elders { display: grid; grid-template-columns: repeat(auto-fill, minmax(430px, 1fr)); gap: 14px; }
.md-elder {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
  box-shadow: var(--shadow-1); overflow: hidden;
}
.md-elder-head {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 11px 13px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfcfb, #f6f8f7);
}
.md-elder-head b { font-size: 15px; }
.md-level { font-size: 11.5px; color: var(--ink-3); }
.md-allergy { font-size: 11.5px; color: var(--red); background: var(--red-soft); padding: 1px 7px; border-radius: 4px; }
.md-prog { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.md-lines { padding: 4px 0; }
.md-line {
  display: grid; grid-template-columns: 46px 1fr 148px 96px;
  align-items: center; gap: 10px;
  padding: 9px 13px; border-bottom: 1px dashed var(--line);
}
.md-line:last-child { border-bottom: 0; }
.md-line.late { background: #fdf7f6; }
.md-t { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.md-drug b { font-size: 13.5px; }
.md-spec { font-size: 11.5px; color: var(--ink-3); margin-left: 4px; }
.md-dose { font-size: 11.5px; color: var(--ink-2); margin-top: 1px; }
.md-st { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 11.5px; }
.md-time { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.md-who { color: var(--ink-3); font-size: 11.5px; }
.md-chk { color: var(--ink-3); font-size: 11px; }
.md-why { color: var(--red); font-size: 11px; width: 100%; }
.md-ops { display: flex; gap: 5px; justify-content: flex-end; }
.md-ops .btn { padding: 4px 9px; font-size: 12px; }

/* ---------- 表格 ---------- */
.md-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.md-table th {
  text-align: left; font-size: 11.5px; font-weight: 500; color: var(--ink-3);
  padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
  background: var(--surface-2);
}
.md-table td { padding: 10px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
.md-table tbody tr:hover { background: var(--surface-2); }
.md-table tbody tr.md-off { opacity: .55; }
.md-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.md-table tbody tr td:first-child { cursor: pointer; }
.md-table tbody tr td:first-child:hover b { color: var(--brand); }
.md-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.md-good { color: var(--brand); }
.md-bad { color: var(--red); }

/* ---------- 依从率柱 ---------- */
.md-chart {
  display: flex; align-items: flex-end; gap: 6px; height: 96px;
  padding: 10px 4px 0; overflow-x: auto;
}
.md-bar { flex: 1 0 26px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.md-bar i {
  display: block; width: 100%; max-width: 26px; border-radius: 3px 3px 0 0;
  background: var(--brand-300);
}
.md-bar i.bad { background: #d9a35a; }
.md-bar span { font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }
.md-bar em { font-style: normal; font-size: 10px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.md-times { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.md-timechip {
  display: inline-flex; align-items: baseline; gap: 5px; font-size: 12px;
  background: var(--surface-3); border-radius: 20px; padding: 3px 11px; color: var(--ink-2);
}
.md-timechip b { font-variant-numeric: tabular-nums; color: var(--ink); }
.md-timechip i { font-style: normal; font-size: 11px; color: var(--red); }

/* ---------- 单人档案 ---------- */
.md-profile-head {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
  padding: 15px 17px; margin-bottom: 14px; box-shadow: var(--shadow-1);
}
.md-ph-name { font-size: 19px; font-weight: 600; display: flex; align-items: baseline; gap: 9px; }
.md-ph-name span { font-size: 12.5px; font-weight: 400; color: var(--ink-3); }
.md-ph-meta { margin-top: 5px; font-size: 12.5px; color: var(--ink-2); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.md-ph-dis { margin-top: 6px; font-size: 12px; color: var(--ink-3); }

.md-tblock { display: grid; grid-template-columns: 62px 1fr; gap: 12px; padding: 10px 4px; border-bottom: 1px dashed var(--line); }
.md-tblock:last-child { border-bottom: 0; }
.md-ttime { font-size: 13px; font-weight: 600; color: var(--brand); font-variant-numeric: tabular-nums; }
.md-tlist { display: flex; flex-wrap: wrap; gap: 6px; }
.md-titem {
  display: inline-flex; align-items: baseline; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 4px 9px; font-size: 12.5px;
}
.md-titem b { font-weight: 500; }
.md-titem span { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.md-titem i { font-style: normal; font-size: 11px; color: var(--ink-3); }

/* ---------- 弹窗内 ---------- */
.md-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 16px; }
.md-unit { font-size: 12px; color: var(--ink-3); margin-left: 6px; }
.md-hint { font-size: 11.5px; color: var(--ink-3); margin-left: 6px; }
.md-warn-box { background: var(--gold-soft); border: 1px solid #eadcc0; border-radius: var(--r-s); padding: 9px 12px; font-size: 12.5px; color: #7a5a1e; margin: 6px 0 12px; }
.md-warn-box:empty { display: none; }
.md-warn-list { display: grid; gap: 9px; }
.md-warn-item {
  background: var(--gold-soft); border-left: 3px solid var(--gold);
  padding: 9px 12px; border-radius: 0 6px 6px 0; font-size: 12.5px; color: #7a5a1e; line-height: 1.65;
}
.md-check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); padding: 8px 0; }
.md-check-inline input { width: auto; min-height: auto; }

.md-ex-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-s); padding: 12px 14px; margin-bottom: 14px; }
.md-ex-drug { font-size: 15px; display: flex; align-items: baseline; gap: 7px; }
.md-ex-meta { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.md-ex-note { font-size: 12px; color: #7a5a1e; background: var(--gold-soft); border-radius: 5px; padding: 5px 9px; margin-top: 7px; }
.md-ex-allergy { color: var(--red); background: var(--red-soft); }
.md-ex-status { display: flex; gap: 7px; margin-bottom: 14px; flex-wrap: wrap; }
.md-ex-btn {
  flex: 1 1 0; min-width: 92px; padding: 9px 6px; border-radius: var(--r-s);
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink-2); font-size: 13px;
}
.md-ex-btn.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-700); font-weight: 600; }
.md-logsum { font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px; }

/* ---------- 窄屏 ---------- */
@media (max-width: 760px) {
  .md-elders { grid-template-columns: 1fr; }
  .md-line { grid-template-columns: 42px 1fr; grid-template-areas: 't drug' 'st ops'; row-gap: 6px; }
  .md-t { grid-area: t; }
  .md-drug { grid-area: drug; }
  .md-st { grid-area: st; }
  .md-ops { grid-area: ops; }
  .md-form-grid { grid-template-columns: minmax(0, 1fr); }
  .md-head { gap: 6px; }
  .md-search { min-width: 0; flex: 1 1 140px; }
  .md-ex-btn { min-width: 0; font-size: 12px; }
  .md-kpi { grid-template-columns: repeat(2, 1fr); }
}

/* 剂量输入 + 单位同行：单位跟在输入框右侧，不让它掉到下一行 */
.md-inline { display: flex; align-items: center; gap: 8px; }
.md-inline input { flex: 1 1 auto; min-width: 0; width: auto; }
.md-inline .md-unit { flex: 0 0 auto; margin-left: 0; }

/* =============================================================
   处方开嘱（一次多种药 / 病情描述 / 标准方案）
   -------------------------------------------------------------
   这一块的目标是「像一张处方」，不是「像一张表单」：
   药名、剂量、用法、时间按处方笺的阅读顺序横排，
   医生扫一眼就知道这一行和上一行差在哪。
   ============================================================= */
.rx-block { border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); }
.rx-rows { overflow-x: auto; }
.rx-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) 64px 42px 82px 92px 122px 108px 26px;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}
.rx-row:last-child { border-bottom: 0; }
.rx-row.head {
  background: var(--surface-3);
  color: var(--ink-3);
  font-size: 11.5px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
}
.rx-row select,
.rx-row input {
  height: 32px;
  padding: 0 8px;
  font-size: 12.5px;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}
.rx-row input[type='number'] { text-align: right; font-variant-numeric: tabular-nums; }
.rx-row select:focus,
.rx-row input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(20, 106, 87, 0.09); }
.rx-row .rx-u { font-size: 11.5px; color: var(--ink-3); text-align: center; }
.rx-row.rx-hr { background: #fdfaf3; }
.rx-del {
  width: 26px; height: 26px; border: 0; background: none; color: var(--ink-3);
  cursor: pointer; border-radius: 6px; font-size: 15px; line-height: 1;
}
.rx-del:hover { background: var(--red-soft); color: var(--red); }
.rx-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px; background: var(--surface-2); border-top: 1px solid var(--line);
}
.rx-sum { font-size: 12px; color: var(--ink-2); }
.rx-sum b { color: var(--brand); font-variant-numeric: tabular-nums; }
.rx-sum .warn { color: var(--gold); }

/* 病情描述：标准病名联想，手写也只能落到词表上，统计才归得并 */
.rx-dx { display: flex; gap: 8px; align-items: center; }
.rx-dx input { flex: 1 1 auto; }
.rx-dx-hint { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }

/* 标准方案 */
.rx-tpl { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rx-chip {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: 4px 11px; font-size: 12px; cursor: pointer;
}
.rx-chip:hover { border-color: var(--brand-300); color: var(--brand); }
.rx-chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.rx-panel {
  border: 1px solid var(--line); border-radius: var(--r-s);
  max-height: 232px; overflow: auto; margin-top: 8px;
  background: var(--surface);
}
.rx-tpl-card { padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.rx-tpl-card:last-child { border-bottom: 0; }
.rx-tpl-card:hover { background: var(--brand-soft); }
.rx-tpl-card .t { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rx-tpl-card .t b { font-size: 13px; }
.rx-tpl-card .dx { font-size: 11.5px; color: var(--ink-3); }
.rx-tpl-card .d { font-size: 11.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.5; }
.rx-tpl-card .use { font-size: 11px; color: var(--gold); background: var(--gold-soft); padding: 0 6px; border-radius: 4px; }
.rx-tpl-empty { padding: 16px; text-align: center; color: var(--ink-3); font-size: 12.5px; }

/* 处方记录 */
.rx-no { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--ink-3); }
.rx-dx-cell { max-width: 260px; }
.rx-dx-cell b { font-weight: 600; }
.rx-drugs { font-size: 11.5px; color: var(--ink-2); line-height: 1.55; margin-top: 2px; }
.rx-tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--brand-soft); color: var(--brand); }
.rx-warn-list { display: flex; flex-direction: column; gap: 6px; }
.rx-warn-item {
  font-size: 12.5px; color: #7a5a1e; background: var(--gold-soft);
  border: 1px solid #eadcc0; border-radius: 6px; padding: 6px 9px; line-height: 1.5;
}
.rx-warn-item b { color: #6b4c12; }

@media (max-width: 720px) {
  /* 手机上一行八列必然挤成图标。改成两列：药名占满，
     剂量/单位、途径/频次、时间/进餐 依次落两列，删除放到药名右侧。
     字段顺序与桌面完全一致，照着位置读就是。 */
  .rx-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    row-gap: 6px;
    padding: 10px;
  }
  .rx-row.head { display: none; }
  .rx-row > *:nth-child(1) { grid-column: 1 / 2; grid-row: 1; }
  .rx-row > *:nth-child(8) { grid-column: 2 / 3; grid-row: 1; justify-self: end; }
  .rx-row > *:nth-child(4),
  .rx-row > *:nth-child(5) { }
  .rx-row .rx-u {
    display: flex; align-items: center; justify-content: center;
    height: 32px; border: 1px dashed var(--line-strong); border-radius: 6px;
  }
  .rx-dx { flex-wrap: wrap; }
  .rx-dx-hint { white-space: normal; }
  .modal .rx-rows { margin: 0 -2px; }
}

/* 套用过的那张方案要留痕：医生点完一条，回头能看见「我刚才套的是这个」 */
.rx-tpl-card.on { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }

/* =============================================================
   派工中心 · 漏做清单
   -------------------------------------------------------------
   窄屏只保留「几点、谁、什么项目、谁负责」，判定时间收起来 ——
   手机上没人关心系统是几点判的，只关心现在还能不能补。
   ============================================================= */
.dp-missed td:nth-child(3) { white-space: nowrap; }
@media (max-width: 640px) {
  .dp-missed th:nth-child(5),
  .dp-missed td:nth-child(5) { display: none; }
  .dp-missed th,
  .dp-missed td { padding: 8px 6px; font-size: 12px; }
}

/* ============================================================
   W1/W2 补漏模块：客户咨询 / 不良事件 / 信息发布 / 变更单 / 探视
   ============================================================ */

/* ---------------- 通用工具条与按钮排 ---------------- */
.pd-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.pd-toolbar .spacer { flex: 1; }
.pd-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.pd-check input { accent-color: var(--brand); }
select.mini,
input.mini {
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-s);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
}
select.mini:focus,
input.mini:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand-300); }
td.ops { white-space: nowrap; }
td.ops .btn + .btn { margin-left: 4px; }

/* ---------------- 咨询漏斗 ---------------- */
.cs-funnel {
  display: flex;
  gap: 10px;
  padding: 16px 18px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-1);
}
.cs-step { flex: 1; min-width: 0; text-align: center; }
.cs-step.side { flex: 0 0 96px; padding-left: 10px; border-left: 1px dashed var(--line-strong); }
.cs-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
  margin-bottom: 8px;
}
.cs-bar span { display: block; height: 100%; border-radius: 3px; }
.cs-bar.blue span { background: var(--blue); }
.cs-bar.gold span { background: var(--gold); }
.cs-bar.green span { background: var(--brand); }
.cs-bar.red span { background: var(--red); }
.cs-num { font-size: 20px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.cs-label { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.cs-over { color: var(--red); font-weight: 500; }
td small .cs-over { display: block; font-size: 11px; margin-top: 2px; }

/* ---------------- 咨询详情 ---------------- */
.cs-detail { display: grid; grid-template-columns: 300px 1fr; gap: 20px; }
.cs-side { border-right: 1px solid var(--line); padding-right: 18px; }
.cs-kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.cs-kv span { color: var(--ink-3); flex: none; }
.cs-kv b { color: var(--ink); font-weight: 500; text-align: right; }
.cs-note {
  margin-top: 14px; padding: 10px 12px; background: var(--surface-2);
  border-radius: var(--r-s); font-size: 13px; color: var(--ink-2); line-height: 1.7;
  white-space: pre-wrap;
}
.cs-warn {
  margin-top: 12px; padding: 9px 12px; background: var(--red-soft);
  border-left: 3px solid var(--red); border-radius: 4px;
  font-size: 12.5px; color: var(--red); line-height: 1.6;
}
.cs-tip {
  margin-top: 12px; padding: 9px 12px; background: var(--blue-soft);
  border-left: 3px solid var(--blue); border-radius: 4px;
  font-size: 12.5px; color: var(--blue); line-height: 1.6;
}
.cs-tl-title { font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 12px; }
.cs-tl { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.cs-tl:not(:last-child)::before {
  content: ''; position: absolute; left: 4px; top: 14px; bottom: 0;
  width: 1px; background: var(--line-strong);
}
.cs-tl-dot {
  flex: none; width: 9px; height: 9px; margin-top: 5px; border-radius: 50%;
  background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.cs-tl-body { flex: 1; min-width: 0; }
.cs-tl-head { font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.cs-tl-trend { margin-left: 8px; font-weight: 500; }
.cs-tl-trend.up { color: var(--brand); }
.cs-tl-trend.down { color: var(--red); }
.cs-tl-text { font-size: 13.5px; color: var(--ink); line-height: 1.7; }
.cs-tl-next { font-size: 12px; color: var(--gold); margin-top: 4px; }
.cs-follow-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 16px;
  background: var(--surface-2); border-radius: var(--r-s); font-size: 13px;
}

/* ---------------- 不良事件 ---------------- */
.in-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.in-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.in-grid label { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 3px; }
.in-grid div div { font-size: 13px; color: var(--ink); }
.in-block { margin-bottom: 14px; }
.in-block label { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 5px; }
.in-block p {
  margin: 0; font-size: 13.5px; line-height: 1.75; color: var(--ink);
  background: var(--surface-2); padding: 10px 12px; border-radius: var(--r-s);
  white-space: pre-wrap;
}
.in-steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.in-step {
  position: relative; padding: 10px 12px 10px 28px;
  background: var(--surface-2); border-radius: var(--r-s);
  border-left: 3px solid var(--line-strong);
}
.in-step.ok { border-left-color: var(--brand); background: var(--brand-soft); }
.in-step.bad { border-left-color: var(--red); background: var(--red-soft); }
.in-dot {
  position: absolute; left: 11px; top: 14px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3);
}
.in-step.ok .in-dot { background: var(--brand); }
.in-step.bad .in-dot { background: var(--red); }
.in-step b { display: block; font-size: 13px; font-weight: 500; color: var(--ink); }
.in-step small { display: block; font-size: 12px; color: var(--ink-3); margin-top: 3px; line-height: 1.6; }
.in-closed {
  margin-top: 14px; padding: 10px 12px; background: var(--brand-soft);
  border-radius: var(--r-s); font-size: 12.5px; color: var(--brand);
}
.in-desc { max-width: 240px; color: var(--ink-2); font-size: 12.5px; }

/* ---------------- 信息发布 ---------------- */
.nt-table td:first-child { max-width: 640px; }
.nt-title { font-size: 14px; font-weight: 500; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.nt-pin {
  flex: none; font-size: 10px; padding: 1px 5px; border-radius: 3px;
  background: var(--brand); color: #fff; font-weight: 400;
}
.nt-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 11.5px; color: var(--ink-3); margin: 5px 0; }
.nt-body { font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }
.nt-dim { opacity: 0.62; }

/* ---------------- 变更单 ---------------- */
.ch-flow { font-size: 13px; }
.ch-from { color: var(--ink-3); }
.ch-arrow { margin: 0 6px; color: var(--brand); }
.ch-to { color: var(--ink); font-weight: 500; }
.ch-diff {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 16px; margin-bottom: 16px;
  background: var(--surface-2); border-radius: var(--r-m);
}
.ch-diff > div { flex: 1; min-width: 0; }
.ch-diff label { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.ch-diff div div { font-size: 14px; color: var(--ink); }
.ch-arrow-lg { flex: none !important; font-size: 20px; color: var(--brand); }
.ch-fee { flex: 0 0 150px !important; text-align: right; border-left: 1px solid var(--line-strong); padding-left: 16px; }
.ch-fee div { font-weight: 600; }
.num.up, .ch-fee .up { color: var(--red); }
.num.down, .ch-fee .down { color: var(--brand); }

/* 单号 + 时间、姓名 + 房床这类「主行 + 副行」的单元格，
   必须让副行换行。挤在一行时单号和时间会连成 18 位数字，读不出来。 */
.cs-table td small,
.in-table td small,
.ch-table td small,
.vs-table td small {
  display: block;
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 3px;
  line-height: 1.45;
}

/* ---------------- 附件 ---------------- */
.fl-up {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 14px;
  background: var(--surface-2); border-radius: var(--r-s);
}
.fl-list { display: flex; flex-direction: column; gap: 8px; }
.fl-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-s);
}
.fl-thumb {
  flex: none; width: 44px; height: 44px; border-radius: 6px;
  background: var(--surface-3); display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.fl-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fl-ext { font-size: 10px; color: var(--ink-3); letter-spacing: 0.03em; }
.fl-meta { flex: 1; min-width: 0; }
.fl-name { font-size: 13.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.fl-ops { flex: none; white-space: nowrap; }

/* ---------------- 首页提醒 ---------------- */.dash-alert {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 14px;
  margin: 16px 0;
}
.dash-alert.solo { grid-template-columns: 1fr; }
.da-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.da-card {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}
.da-card:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.da-card.danger { border-left-color: var(--red); }
.da-card.gold { border-left-color: var(--gold); }
.da-card.green { border-left-color: var(--brand); }
.da-n { font-size: 24px; font-weight: 600; line-height: 1.1; color: var(--ink); }
.da-card.danger .da-n { color: var(--red); }
.da-card.gold .da-n { color: var(--gold); }
.da-t { font-size: 13px; color: var(--ink-2); margin: 4px 0 6px; }
.da-s { font-size: 11.5px; color: var(--ink-3); line-height: 1.55; }
.da-notice {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.da-notice-head { font-size: 12px; color: var(--ink-3); letter-spacing: 0.04em; }
.da-notice-item { border-left: 2px solid var(--line-strong); padding-left: 9px; }
.da-notice-item.urgent { border-left-color: var(--red); }
.da-notice-t { font-size: 13px; color: var(--ink); line-height: 1.5; display: flex; gap: 5px; align-items: center; }
.da-notice-m { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.da-notice .btn { align-self: flex-start; }

@media (max-width: 900px) {
  .dash-alert { grid-template-columns: 1fr; }
}

/* ---------------- 探视 ---------------- */
.vs-panel { margin-bottom: 16px; }
.vs-in-list { display: flex; flex-direction: column; gap: 1px; background: var(--line); }
.vs-in {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; background: var(--surface);
}
.vs-in-main { flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.vs-in-main small { color: var(--ink-3); font-size: 12px; }
.vs-in-meta { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.vs-open td { background: var(--brand-soft); }
.vs-items { max-width: 220px; font-size: 12.5px; color: var(--ink-2); }

@media (max-width: 900px) {
  .cs-detail { grid-template-columns: 1fr; }
  .cs-side { border-right: none; border-bottom: 1px solid var(--line); padding: 0 0 14px; }
  .in-grid { grid-template-columns: repeat(2, 1fr); }
  .in-steps { grid-template-columns: 1fr; }
  .cs-funnel { flex-wrap: wrap; }
  .cs-step { flex: 1 1 80px; }
  .cs-step.side { flex: 1 1 80px; border-left: none; padding-left: 0; }
}
@media (max-width: 640px) {
  .ch-diff { flex-direction: column; align-items: stretch; }
  .ch-fee { border-left: none; padding-left: 0; text-align: left; }
  .nt-table td:first-child { max-width: none; }
  .vs-items { display: none; }
  .vs-in { flex-wrap: wrap; }
}

/* ---------------- 新模块台账：窄屏横向滚动，不压竖排字 ----------------
   客户咨询 / 不良事件 / 变更 / 探视这四张表都是 9–12 列，主行 + 副行（单号与时间、
   长者与房床）。不给 min-width 的话，手机上 100% 宽会把「电话」「来源」压成
   一列一个字，表头变成竖排，读起来像乱码。宽度定死后由 .table-wrap 横向滚动。 */
.cs-table { min-width: 1040px; }
.in-table { min-width: 980px; }
.ch-table { min-width: 900px; }
.vs-table { min-width: 940px; }

.cs-table th,
.in-table th,
.ch-table th,
.vs-table th {
  white-space: nowrap;
}

/* ============ 慢病与物业（W2 第二批） ============ */

/* 慢病详情：左信息 + 右随访时间轴，窄屏叠成一列 */
.ch-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.ch-left { border-right: 1px solid var(--line); padding-right: 18px; }
.ch-block { margin-top: 16px; }
.ch-block:first-child { margin-top: 0; }
.ch-block h4 {
  margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  display: flex; align-items: center; gap: 8px;
}
.ch-block h4 .muted { font-weight: 400; font-size: 12px; }

.ch-plan {
  padding: 10px 12px; margin-bottom: 8px; background: var(--surface-2);
  border-radius: var(--r-s); font-size: 13px; line-height: 1.6;
}
.ch-plan-h { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ch-plan-h .spacer { flex: 1; }
.ch-plan small { display: block; color: var(--ink-3); margin-top: 4px; }

.ch-alert {
  padding: 9px 12px; margin-bottom: 10px; background: var(--gold-soft);
  border-left: 3px solid var(--gold); border-radius: 4px; font-size: 12.5px; color: var(--ink-2);
}

.ch-tl { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.ch-tl li { position: relative; padding: 0 0 14px 12px; font-size: 13px; }
.ch-tl li::before {
  content: ''; position: absolute; left: -21px; top: 4px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.ch-fu-h { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.ch-fu-b { color: var(--ink-2); }
.ch-fu-n { color: var(--ink-2); font-size: 12.5px; margin-top: 2px; }
.ch-tl small { display: block; color: var(--ink-3); margin-top: 3px; }

.ch-split { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.ch-split h4 { margin: 0 0 10px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.ch-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 13px; }
.ch-bar span { flex: 0 0 84px; color: var(--ink-2); }
.ch-bar i {
  flex: 1; height: 8px; border-radius: 4px; background: var(--brand-300);
  display: block; max-width: 100%;
}
.ch-bar i.red { background: var(--red); }
.ch-bar i.gold { background: var(--gold); }
.ch-bar b { flex: 0 0 40px; text-align: right; font-weight: 500; }

/* 巡检：路线与点位 */
.pv-routes { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.pv-route {
  padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-m);
}
.pv-route-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; font-size: 13px; }
.pv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-chip {
  padding: 3px 8px; border-radius: 20px; background: var(--surface);
  border: 1px solid var(--line-strong); font-size: 12px; color: var(--ink-2);
}
.pv-pick {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px;
  max-height: 220px; overflow: auto; padding: 10px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-s);
}
.pv-pick label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.pv-pick label small { color: var(--ink-3); }

/* 窄屏：慢病详情与统计并排改单列 */
@media (max-width: 900px) {
  .ch-detail { grid-template-columns: 1fr; }
  .ch-left { border-right: none; border-bottom: 1px solid var(--line); padding: 0 0 14px; }
  .ch-split { grid-template-columns: 1fr; gap: 16px; }
}

/* 详情里的键值对：两列排布，比一行一个更省纵向空间 */
.ch-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.ch-kv > div {
  display: flex; justify-content: space-between; gap: 10px; padding: 7px 0;
  border-bottom: 1px dashed var(--line); font-size: 13px; min-width: 0;
}
.ch-kv span { color: var(--ink-3); flex: none; }
.ch-kv b { color: var(--ink); font-weight: 500; text-align: right; }
@media (max-width: 720px) {
  .ch-kv { grid-template-columns: 1fr; }
}

/* ---------- 生活相册 ---------- */
.al-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.al-thumb {
  position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-s); overflow: hidden;
  border: 1px solid var(--line); background: var(--surface-2); cursor: pointer;
  margin: 0; /* figure 默认左右各 40px 外边距，会把 126px 的格子挤成 46px */
}
.al-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.al-thumb figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 6px;
  font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.al-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.al-card { border: 1px solid var(--line); border-radius: var(--r-s); overflow: hidden; background: var(--surface); }
.al-card-img { aspect-ratio: 4 / 3; background: var(--surface-2); display: block; width: 100%; object-fit: cover; }
.al-card-body { padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.al-card-body b { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.al-card-body small { color: var(--ink-3); font-size: 11px; }
.al-card-foot { display: flex; align-items: center; gap: 6px; padding: 0 10px 9px; }
.al-empty { padding: 26px 0; text-align: center; color: var(--ink-3); font-size: 13px; }
.al-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.al-chip {
  padding: 4px 10px; border-radius: 20px; border: 1px solid var(--line-strong);
  background: var(--surface); font-size: 12px; color: var(--ink-2); cursor: pointer;
}
.al-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.al-preview { width: 100%; max-height: 260px; object-fit: contain; background: #000; border-radius: var(--r-s); }
.al-up { display: grid; grid-template-columns: 200px 1fr; gap: 14px; align-items: start; }
@media (max-width: 720px) {
  .al-up { grid-template-columns: 1fr; }
  .al-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ---------- 预存账户 ---------- */
.pp-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pp-box { border: 1px solid var(--line); border-radius: var(--r-s); padding: 10px 12px; background: var(--surface); }
.pp-box span { font-size: 12px; color: var(--ink-3); display: block; }
.pp-box b { font-size: 18px; font-weight: 600; }
.pp-bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-s);
  background: var(--surface-2); border: 1px dashed var(--line-strong); font-size: 13px; color: var(--ink-2);
}
@media (max-width: 720px) { .pp-row { grid-template-columns: 1fr 1fr; } }

/* ---------- 库存盘点 ---------- */
.ck-row-count { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.ck-input { width: 78px; text-align: right; }
.ck-diff-up { color: var(--ok, #1f8a5b); font-weight: 600; }
.ck-diff-down { color: var(--danger, #c0392b); font-weight: 600; }
.ck-skip { color: var(--ink-3); }

/* 相册图加载失败时的占位，避免破图图标 */
.al-broken {
  display: flex; align-items: center; justify-content: center;
  height: 100%; aspect-ratio: 4 / 3; background: var(--surface-2);
  color: var(--ink-3); font-size: 12px;
}

/* 窄屏：金额位数多时不能把卡片撑破；筛选控件宁可换行也别溢出 */
@media (max-width: 560px) {
  .card .value { font-size: 20px; letter-spacing: -0.01em; }
  .toolbar { flex-wrap: wrap; gap: 6px; }
  .toolbar > input, .toolbar > select { flex: 1 1 132px; min-width: 0; }
}

/* 盘点行的保存与「不盘」：宁可窄也別让复选框和文字分家 */
.ck-row-count { flex-wrap: nowrap; }
.ck-row-count label { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }

/* 操作列只有一窄条：保存与「不盘」上下排，横向挤会把按钮压成两个字 */
.ck-row-count { flex-direction: column; align-items: flex-end; gap: 4px; }
.ck-row-count .btn { flex: 0 0 auto; }
.ck-row-count { min-width: 118px; }

/* 入库行的批次信息：批号 / 厂家 / 效期占整行第二排，
   不与数量单价挤在一排——挤一排会把「数量」压到 60px，输错一位数看不出来 */
.gd-line-batch {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 150px;
  gap: 8px;
}
.gd-line-batch input {
  height: 30px;
  font-size: 12px;
}

/* ---------- 短信推送配置页 ---------- */
.sm-sec {
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: 14px 16px 6px;
  margin: 6px 0 14px;
  background: var(--surface-2);
}
.sm-sec-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 10px;
}
.sm-sec-title .muted { font-weight: 400; font-size: 12px; }
.sm-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}
.sm-check input { width: 15px; height: 15px; accent-color: var(--brand); }
.sm-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 0 4px;
  border-top: 1px dashed var(--line);
  margin-top: 4px;
}
.sm-verify {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--r-m);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 13px;
  color: var(--ink-2);
}
.sm-verify.ok { border-color: #bfe0d2; background: var(--brand-soft); }
.sm-verify.bad { border-color: #efc9c4; background: var(--red-soft); }
.sm-verify > b { display: block; margin-bottom: 6px; color: var(--ink); }
.sm-kv {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 3px 0;
  font-size: 13px;
}
.sm-kv > span:first-child {
  min-width: 84px;
  color: var(--ink-3);
  font-size: 12px;
}
.sm-pre {
  margin: 8px 0 4px;
  padding: 10px 12px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-all;
}
.sm-verify details { margin-top: 8px; }
.sm-verify summary { cursor: pointer; font-size: 12px; color: var(--brand); }
.sm-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.sm-filter input, .sm-filter select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-s);
  font-size: 13px;
  background: var(--surface);
}
.sm-filter input { width: 230px; }
.sm-inp {
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-size: 12.5px;
  background: var(--surface);
}
.sm-tpl td { vertical-align: top; padding-top: 10px; }
.sm-warn { color: var(--gold); }
.sm-err { color: var(--red); font-size: 12px; }
.sm-content {
  white-space: pre-wrap;
  padding: 10px 12px;
  background: var(--surface-3);
  border-radius: var(--r-s);
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.7;
}
