/* 医匠透析 · 平板触控 UI 组件 ---------------------------------------------
   Android 10" 平板 1280×800 横屏优先，触控目标 ≥48dp
-------------------------------------------------------------------------- */

/* ── 设备外壳：Android 横屏平板 ─────────────────────────────────── */
.tablet-stage {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 30% 20%, #1b2842 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, #16203a 0%, transparent 50%),
    #0b1220;
  overflow: hidden;
  padding: 20px;
}
.tablet-bezel {
  width: 1336px;
  height: 856px;
  background: linear-gradient(140deg, #1c1e26, #0f1117 60%, #1c1e26);
  border-radius: 28px;
  padding: 28px;
  box-shadow:
    0 0 0 1px #2a2d36 inset,
    0 0 0 2px #000 inset,
    0 40px 80px rgba(0,0,0,.55),
    0 16px 32px rgba(0,0,0,.4);
  position: relative;
  flex-shrink: 0;
}
.tablet-bezel::before {
  /* 前置摄像头 */
  content: '';
  position: absolute;
  top: 14px; left: 50%;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #060708;
  box-shadow: inset 0 0 2px rgba(255,255,255,.2);
}
.tablet-bezel::after {
  /* 反光高光 */
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 22px;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,.06) 0%, transparent 30%);
}
.tablet-screen {
  width: 1280px;
  height: 800px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-app);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px #000;
}

/* Android 状态栏 */
.android-statusbar {
  height: 24px;
  background: var(--brand-700);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 11px;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}
.android-statusbar .right { display: flex; align-items: center; gap: 6px; opacity: .9; }
.android-statusbar .right svg { display: block; }

/* ── 应用骨架 ────────────────────────────────────────────────────── */
.app {
  flex: 1;
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  min-height: 0;
  background: var(--bg-app);
}

/* Material Navigation Rail */
.rail {
  background: #0f172a;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  border-right: 1px solid #0b1220;
}
.rail-brand {
  height: 72px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-bottom: 1px solid #1e293b;
}
.brand-mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #2f6feb, #5990f5);
  border-radius: 9px;
  display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(47,111,235,.4);
  position: relative;
}
.brand-mark svg { display: block; }
.brand-name {
  font-size: 10px;
  color: #cbd5e1;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.rail-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: 10px;
  color: #94a3b8;
  font-size: 11px;
  cursor: pointer;
  position: relative;
  background: transparent;
  border: none;
  transition: var(--transition);
  min-height: var(--tap);
  text-align: center;
}
.rail-item:hover { color: #e2e8f0; }
.rail-item:hover .rail-ico-wrap { background: rgba(255,255,255,.06); }
.rail-item.active {
  color: #fff;
}
.rail-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 28px;
  background: var(--brand-400);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 12px var(--brand-400);
}
.rail-item.active .rail-ico-wrap {
  background: rgba(255,255,255,.08);
  color: var(--brand-300);
}
.rail-ico-wrap {
  width: 44px; height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  transition: var(--transition);
  position: relative;
}
.rail-ico-wrap svg { display: block; }
.rail-item .badge {
  position: absolute;
  top: -4px; right: -6px;
  background: var(--danger-500);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 0 4px;
  height: 15px;
  min-width: 15px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  border: 1.5px solid #0f172a;
  letter-spacing: 0;
}
.rail-divider {
  height: 1px;
  background: #1e293b;
  margin: 6px 8px;
}

.rail-footer {
  padding: 10px;
  border-top: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5990f5, #1f56d1);
  display: grid; place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  position: relative;
}
.avatar .status-dot {
  position: absolute;
  bottom: 0; right: 0;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--ok-500);
  border: 2px solid #0f172a;
}

/* ── 主内容区 ───────────────────────────────────────────────────── */
.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-app);
  overflow: hidden;
}

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-base);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 14px;
}
.topbar h1 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  color: var(--ink-900);
  letter-spacing: -0.2px;
}
.topbar .sub {
  font-size: 12px;
  color: var(--ink-500);
  padding-left: 12px;
  border-left: 1px solid var(--border-base);
  margin-left: 4px;
}

.subbar {
  height: var(--subbar-h);
  flex-shrink: 0;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-base);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  font-size: 13px;
  overflow-x: auto;
}

.page-body {
  flex: 1;
  overflow: auto;
  padding: 14px;
  min-height: 0;
}

/* 顶栏租户切换 */
.tenant-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--bg-sunken);
  font-size: 13px;
  cursor: pointer;
  color: var(--ink-700);
  font-weight: 500;
  min-height: 36px;
}
.tenant-switch:hover { background: var(--bg-hover); }
.tenant-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok-500); }
.tenant-switch .ward {
  font-size: 11px;
  color: var(--ink-500);
  padding-left: 6px;
  border-left: 1px solid var(--border-base);
  margin-left: 4px;
}

/* 搜索 */
.search-bar {
  flex: 1;
  max-width: 380px;
  height: 38px;
  background: var(--bg-sunken);
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  color: var(--ink-500);
  font-size: 13px;
}
.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--ink-800);
  height: 100%;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}
.iconbtn {
  width: var(--tap);
  height: var(--tap);
  border-radius: 10px;
  display: grid; place-items: center;
  color: var(--ink-600);
  background: transparent;
  border: none;
  position: relative;
  transition: var(--transition);
  cursor: pointer;
}
.iconbtn:hover { background: var(--bg-hover); color: var(--ink-900); }
.iconbtn:active { background: var(--bg-selected); }
.iconbtn .dot {
  position: absolute;
  top: 9px; right: 9px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--danger-500);
  border: 2px solid var(--bg-panel);
}

/* ── 通用按钮（触控规范） ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--field-h);
  padding: 0 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-base);
  background: var(--bg-panel);
  color: var(--ink-800);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  min-width: 44px;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #fff;
  box-shadow: 0 2px 6px rgba(47,111,235,.25);
}
.btn.primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.success {
  background: var(--ok-500);
  border-color: var(--ok-500);
  color: #fff;
}
.btn.success:hover { background: var(--ok-600); }
.btn.danger {
  background: var(--danger-500);
  border-color: var(--danger-500);
  color: #fff;
}
.btn.warning {
  background: var(--warn-500);
  border-color: var(--warn-500);
  color: #fff;
}
.btn.sm { height: 32px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 11px; border-radius: 5px; min-width: 0; }
.btn.lg { height: 52px; padding: 0 24px; font-size: 15px; }
.btn.icon-only { padding: 0; width: var(--field-h); }
.btn.block { width: 100%; }

/* FAB Material */
.fab {
  position: absolute;
  bottom: 24px; right: 24px;
  width: 60px; height: 60px;
  border-radius: 18px;
  background: var(--brand-500);
  color: #fff;
  display: grid; place-items: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(47,111,235,.4), 0 4px 8px rgba(15,23,42,.2);
  transition: var(--transition);
  z-index: 10;
}
.fab:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(47,111,235,.5); }
.fab:active { transform: scale(0.95); }

/* ── 卡片 ────────────────────────────────────────────────────── */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-800);
  min-height: 48px;
}
.card-head .title { display: flex; align-items: center; gap: 10px; }
.card-head .title .ico { color: var(--brand-500); }
.card-head .actions { display: flex; gap: 6px; align-items: center; }
.card-body { padding: var(--card-pad); }
.card-body.flush { padding: 0; }

/* ── 表格（触控优化） ───────────────────────────────────────────── */
.tbl-wrap {
  overflow: auto;
  border-radius: var(--r-lg);
  background: var(--bg-panel);
}
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.tbl thead th {
  background: var(--bg-sunken);
  color: var(--ink-600);
  font-weight: 500;
  text-align: left;
  padding: 0 12px;
  height: 40px;
  border-bottom: 1px solid var(--border-base);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 12px;
}
.tbl tbody td {
  padding: 0 12px;
  height: var(--row-h);
  border-bottom: 1px solid var(--border-soft);
  color: var(--ink-800);
  vertical-align: middle;
}
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--bg-hover); }
.tbl tbody tr.selected td { background: var(--bg-selected); }
.tbl tbody tr:active td { background: var(--bg-selected); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr.zebra:nth-child(2n) td { background: #fafbfd; }

/* sticky 首列 */
.tbl .sticky-col {
  position: sticky;
  left: 0;
  background: var(--bg-panel);
  z-index: 2;
  box-shadow: 4px 0 6px -4px rgba(0,0,0,.08);
}
.tbl tbody tr:hover .sticky-col { background: var(--bg-hover); }
.tbl tbody tr.selected .sticky-col { background: var(--bg-selected); }

/* ── 标签 / 徽章 ──────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  background: var(--ink-100);
  color: var(--ink-700);
  white-space: nowrap;
}
.tag.brand { background: var(--brand-50); color: var(--brand-700); }
.tag.ok { background: var(--ok-50); color: var(--ok-600); }
.tag.warn { background: var(--warn-50); color: var(--warn-600); }
.tag.danger { background: var(--danger-50); color: var(--danger-600); }
.tag.info { background: var(--info-50); color: var(--info-500); }
.tag.outline {
  background: transparent;
  border: 1px solid var(--border-base);
  color: var(--ink-700);
}
.tag.lg { height: 26px; padding: 0 10px; font-size: 12px; }

.tag .dot-s {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* 透析模式专属 */
.mode-tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  font-family: var(--ff-mono);
}
.mode-tag.HD { background: #e7f0ff; color: #1f56d1; }
.mode-tag.HDF { background: #e8f7ee; color: #15803d; }
.mode-tag.HFHD { background: #fff0e6; color: #c2570a; }
.mode-tag.\+HP, .mode-tag.HD-HP { background: #f3e8ff; color: #6d28d9; }

/* ── 状态指示 ───────────────────────────────────────────────── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.status .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}
.status.live .dot {
  background: var(--ok-500);
  box-shadow: 0 0 0 3px rgba(22,163,74,.18);
  animation: pulse 1.6s ease-in-out infinite;
}
.status.warn .dot { background: var(--warn-500); }
.status.danger .dot {
  background: var(--danger-500);
  animation: pulse-red 1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
  50% { box-shadow: 0 0 0 6px rgba(22,163,74,.05); }
}
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 3px rgba(220,38,38,.25); }
  50% { box-shadow: 0 0 0 7px rgba(220,38,38,.05); }
}

/* ── 输入框（触控） ───────────────────────────────────────────── */
.input, .select {
  height: var(--field-h);
  border: 1px solid var(--border-base);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  background: var(--bg-panel);
  color: var(--ink-800);
  outline: none;
  transition: var(--transition);
  width: 100%;
}
.input:focus, .select:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(47,111,235,.15);
}
.input.sm, .select.sm { height: 34px; font-size: 13px; padding: 0 10px; }
.input[readonly] { background: var(--bg-sunken); color: var(--ink-600); }

.field-label {
  font-size: 12px;
  color: var(--ink-500);
  margin-bottom: 4px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}
.field-label .req { color: var(--danger-500); }

.field-stack { display: flex; flex-direction: column; }
.field-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  min-height: var(--field-h);
}
.field-row > label { color: var(--ink-500); }

/* ── 分段控件（触控） ──────────────────────────────────────────── */
.segmented {
  display: inline-flex;
  background: var(--bg-sunken);
  padding: 3px;
  border-radius: 9px;
  gap: 1px;
}
.segmented button {
  border: none;
  background: transparent;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--ink-600);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  min-height: 36px;
}
.segmented button.active {
  background: var(--bg-panel);
  color: var(--ink-900);
  box-shadow: var(--shadow-sm);
}

/* ── 复选 / 单选（大触控） ─────────────────────────────────────── */
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-800);
  min-height: 36px;
  user-select: none;
}
.checkbox .box {
  width: 18px; height: 18px;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  display: grid; place-items: center;
  background: var(--bg-panel);
  flex-shrink: 0;
  transition: var(--transition);
}
.checkbox.checked .box {
  background: var(--brand-500);
  border-color: var(--brand-500);
}
.checkbox.checked .box::after {
  content: '';
  width: 4px; height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

/* ── 标签页 ────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-base);
  align-items: stretch;
  background: var(--bg-panel);
}
.tab {
  padding: 12px 18px;
  font-size: 14px;
  color: var(--ink-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  background: transparent;
  border-top: none;
  border-left: none;
  border-right: none;
  white-space: nowrap;
}
.tab:hover { color: var(--ink-800); background: var(--bg-hover); }
.tab.active { color: var(--brand-600); border-bottom-color: var(--brand-500); }
.tab .count {
  background: var(--ink-100);
  color: var(--ink-600);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tab.active .count { background: var(--brand-50); color: var(--brand-600); }

/* ── 面包屑 ───────────────────────────────────────────────────── */
.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-500);
}
.crumbs .crumb { cursor: pointer; }
.crumbs .crumb.current { color: var(--ink-800); font-weight: 500; }
.crumbs .sep { color: var(--ink-300); }

/* ── 工具类 ────────────────────────────────────────────────────── */
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.center { display: grid; place-items: center; }
.muted { color: var(--ink-500); }
.subtle { color: var(--ink-400); }
.fw500 { font-weight: 500; }
.fw600 { font-weight: 600; }
.fw700 { font-weight: 700; }
.fs11 { font-size: 11px; } .fs12 { font-size: 12px; } .fs14 { font-size: 14px; }
.fs15 { font-size: 15px; } .fs16 { font-size: 16px; } .fs18 { font-size: 18px; }
.fs20 { font-size: 20px; } .fs24 { font-size: 24px; } .fs28 { font-size: 28px; }
.fs32 { font-size: 32px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; }
.g-4 { gap: 4px; } .g-6 { gap: 6px; } .g-8 { gap: 8px; } .g-10 { gap: 10px; }
.g-12 { gap: 12px; } .g-16 { gap: 16px; } .g-20 { gap: 20px; }
.divider { height: 1px; background: var(--border-soft); margin: 8px 0; }
.vdiv { width: 1px; background: var(--border-soft); align-self: stretch; }

/* 网格 */
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

/* ── 警报横幅 ──────────────────────────────────────────────────── */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
}
.alert-banner.warn { background: var(--warn-50); color: var(--warn-600); border: 1px solid #fde6c4; }
.alert-banner.danger { background: var(--danger-50); color: var(--danger-600); border: 1px solid #f9c5c5; }
.alert-banner.info { background: var(--info-50); color: var(--info-500); border: 1px solid #c8e0f4; }
.alert-banner.ok { background: var(--ok-50); color: var(--ok-600); border: 1px solid #c4e9d2; }

/* ── 进度 ──────────────────────────────────────────────────────── */
.bar {
  height: 8px;
  background: var(--ink-100);
  border-radius: 4px;
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--brand-500);
  border-radius: 4px;
  transition: width var(--transition);
}
.bar.thin { height: 4px; }
.bar.success > span { background: var(--ok-500); }
.bar.warn > span { background: var(--warn-500); }
.bar.danger > span { background: var(--danger-500); }

/* 圆形进度 */
.ring-progress {
  --p: 70;
  --c: var(--brand-500);
  width: 60px; height: 60px;
  border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--p)*1%), var(--ink-100) 0);
  display: grid;
  place-items: center;
  position: relative;
}
.ring-progress::before {
  content: '';
  position: absolute;
  inset: 6px;
  background: var(--bg-panel);
  border-radius: 50%;
}
.ring-progress > span {
  position: relative;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-800);
  z-index: 1;
}

/* ── KPI 卡 ───────────────────────────────────────────────────── */
.kpi {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.kpi[style*="cursor: pointer"]:hover {
  border-color: var(--brand-300);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.kpi[style*="cursor: pointer"]:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}
.kpi .label { font-size: 12px; color: var(--ink-500); font-weight: 500; }
.kpi .value {
  font-size: 28px;
  font-weight: 600;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.kpi .value .unit { font-size: 13px; font-weight: 400; color: var(--ink-500); }
.kpi .trend { font-size: 11px; color: var(--ink-500); display: flex; align-items: center; gap: 4px; }
.kpi .trend.up { color: var(--ok-600); }
.kpi .trend.down { color: var(--danger-500); }
.kpi .accent {
  position: absolute; top: 0; right: 0;
  width: 36px; height: 36px;
  border-radius: 0 var(--r-lg) 0 10px;
  background: var(--brand-50);
  color: var(--brand-500);
  display: grid;
  place-items: center;
}

/* ── 患者卡片 ──────────────────────────────────────────────────── */
.patient-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: 12px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}
.patient-card:hover {
  border-color: var(--brand-300);
  box-shadow: var(--shadow-md);
}
.patient-card.selected {
  border-color: var(--brand-500);
  background: var(--bg-selected);
  box-shadow: 0 0 0 1px var(--brand-500);
}
.patient-card .name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.patient-card .name { font-size: 15px; font-weight: 600; color: var(--ink-900); }
.patient-card .machine {
  margin-left: auto;
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-600);
  background: var(--brand-50);
  padding: 2px 6px;
  border-radius: 4px;
}
.patient-card .meta {
  font-size: 11px;
  color: var(--ink-500);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.patient-card .meta .sep { color: var(--ink-300); }

/* ── 微型趋势线 (SVG sparkline 包装) ───────────────────────────── */
.spark {
  height: 32px;
  width: 100%;
  display: block;
}

/* ── 滚动条 ───────────────────────────────────────────────────── */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }

/* 缩略数字 */
.figure {
  font-variant-numeric: tabular-nums;
  font-family: var(--ff-num);
}

/* ── 弹窗与抽屉 ─────────────────────────────────────────────── */
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  z-index: 1000;
  animation: maskIn 160ms ease-out;
  padding: 24px;
}
.modal-mask.drawer { place-items: stretch; justify-items: end; padding: 0; }
@keyframes maskIn { from {opacity: 0;} to {opacity: 1;} }

.modal-shell {
  background: var(--bg-panel);
  border-radius: var(--r-xl);
  box-shadow: 0 24px 80px rgba(15,23,42,.32), 0 8px 16px rgba(15,23,42,.1);
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 220ms cubic-bezier(.2,.8,.2,1);
}
.drawer-shell {
  background: var(--bg-panel);
  box-shadow: -20px 0 60px rgba(15,23,42,.24);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: drawerIn 220ms cubic-bezier(.2,.8,.2,1);
  height: 100%;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes drawerIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.modal-head {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-base);
  flex-shrink: 0;
  gap: 12px;
}
.modal-title {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 0;
}
.modal-title-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-900);
}
.modal-sub {
  font-size: 11px;
  color: var(--ink-500);
  margin-top: 1px;
}
.modal-close {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: none; background: transparent;
  cursor: pointer;
  display: grid; place-items: center;
  color: var(--ink-500);
}
.modal-close:hover { background: var(--bg-hover); color: var(--ink-900); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-base);
  background: var(--bg-sunken);
  flex-shrink: 0;
}

/* 数字输入步进 hover */
.input[type="number"]::-webkit-inner-spin-button,
.input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ── 主题变体 ────────────────────────────────────────────────── */
/* 默认: 医疗蓝（已在 :root） */

/* 深沉医院风：深蓝紫 + 更高对比 + 更小阴影 */
html.theme-hospital {
  --brand-50:  #e8eef9;
  --brand-100: #ccd8ef;
  --brand-200: #9cb1de;
  --brand-300: #6889c8;
  --brand-400: #3c64b0;
  --brand-500: #1e3a8a;
  --brand-600: #16306f;
  --brand-700: #122859;
  --brand-800: #0e1f44;
  --brand-900: #0a162e;

  --bg-app:     #eef1f5;
  --bg-panel:   #ffffff;
  --bg-sunken:  #e6eaf1;
  --bg-hover:   #e9eef5;
  --bg-selected:#e0e7f3;

  --ink-900: #0a162e;
  --ink-800: #112147;
  --ink-700: #1f2a4e;

  --r-xs: 2px;
  --r-sm: 3px;
  --r-md: 5px;
  --r-lg: 8px;
  --r-xl: 10px;
}
html.theme-hospital .android-statusbar { background: #0e1f44; }
html.theme-hospital .rail { background: #0a162e; }
html.theme-hospital .brand-mark { background: linear-gradient(135deg, #1e3a8a, #3c64b0); }
html.theme-hospital .tablet-stage {
  background:
    radial-gradient(ellipse at 30% 20%, #1f2a4e 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, #122859 0%, transparent 50%),
    #060a18;
}

/* 现代科技风：深色面板 + 高饱和青蓝 + 大圆角 + 玻璃质感 */
html.theme-tech {
  --brand-50:  #ecfeff;
  --brand-100: #cffafe;
  --brand-200: #a5f3fc;
  --brand-300: #67e8f9;
  --brand-400: #22d3ee;
  --brand-500: #06b6d4;
  --brand-600: #0891b2;
  --brand-700: #0e7490;
  --brand-800: #155e75;
  --brand-900: #164e63;

  --bg-app:     #0f172a;
  --bg-panel:   #1a2336;
  --bg-sunken:  #131c2d;
  --bg-hover:   #243049;
  --bg-selected:#0e3142;

  --ink-0:   #1a2336;
  --ink-50:  #1f293f;
  --ink-100: #2a3550;
  --ink-150: #303d5a;
  --ink-200: #3a4763;
  --ink-300: #54607c;
  --ink-400: #7b8aa8;
  --ink-500: #94a3b8;
  --ink-600: #b4c2d6;
  --ink-700: #d4dcec;
  --ink-800: #e2e8f0;
  --ink-900: #f1f5f9;

  --border-soft:   #243049;
  --border-base:   #2e3b58;
  --border-strong: #3e4d6e;

  --ok-50:   #052e1c;
  --ok-500:  #4ade80;
  --ok-600:  #86efac;
  --warn-50: #3d2c0a;
  --warn-500:#fbbf24;
  --warn-600:#fcd34d;
  --danger-50: #3a1414;
  --danger-500:#f87171;
  --danger-600:#fca5a5;
  --info-50: #0a2a44;
  --info-500:#67e8f9;

  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;

  --shadow-xs: 0 1px 0 rgba(0,0,0,.3);
  --shadow-sm: 0 2px 4px rgba(0,0,0,.3);
  --shadow-md: 0 8px 24px rgba(0,0,0,.4);
}
html.theme-tech body { color: #e2e8f0; }
html.theme-tech .android-statusbar {
  background: linear-gradient(90deg, #0891b2, #06b6d4);
  color: #fff;
}
html.theme-tech .rail {
  background: linear-gradient(180deg, #0a1422 0%, #0f172a 100%);
  border-right: 1px solid #1e293b;
}
html.theme-tech .brand-mark {
  background: linear-gradient(135deg, #06b6d4, #22d3ee);
  box-shadow: 0 0 24px rgba(6,182,212,.4);
}
html.theme-tech .topbar {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-soft);
}
html.theme-tech .topbar h1 { color: var(--ink-900); }
html.theme-tech .tenant-switch { background: var(--bg-sunken); color: var(--ink-700); }
html.theme-tech .search-bar { background: var(--bg-sunken); color: var(--ink-500); }
html.theme-tech .search-bar input { color: var(--ink-800); }
html.theme-tech .card { background: var(--bg-panel); border: 1px solid var(--border-soft); }
html.theme-tech .card-head { color: var(--ink-800); border-bottom-color: var(--border-soft); }
html.theme-tech .btn { background: var(--bg-sunken); color: var(--ink-700); border-color: var(--border-soft); }
html.theme-tech .btn:hover { background: var(--bg-hover); border-color: var(--border-base); }
html.theme-tech .btn.ghost { background: transparent; }
html.theme-tech .input, html.theme-tech .select { background: var(--bg-sunken); color: var(--ink-800); border-color: var(--border-base); }
html.theme-tech .tbl thead th { background: var(--bg-sunken); color: var(--ink-500); border-bottom-color: var(--border-base); }
html.theme-tech .tbl tbody td { color: var(--ink-800); border-bottom-color: var(--border-soft); }
html.theme-tech .tbl tbody tr:hover td { background: var(--bg-hover); }
html.theme-tech .tbl tbody tr.zebra:nth-child(2n) td { background: rgba(255,255,255,.02); }
html.theme-tech .patient-card { background: var(--bg-panel); border-color: var(--border-soft); }
html.theme-tech .patient-card .name { color: var(--ink-900); }
html.theme-tech .patient-card .machine { background: rgba(6,182,212,.15); color: var(--brand-300); }
html.theme-tech .kpi { background: var(--bg-panel); border-color: var(--border-soft); }
html.theme-tech .kpi .value { color: var(--ink-900); }
html.theme-tech .segmented { background: var(--bg-sunken); }
html.theme-tech .segmented button.active { background: var(--bg-panel); color: var(--ink-900); }
html.theme-tech .tabs { background: var(--bg-panel); border-bottom-color: var(--border-soft); }
html.theme-tech .tab:hover { background: var(--bg-hover); color: var(--ink-800); }
html.theme-tech .alert-banner.warn { background: rgba(245,158,11,.12); color: #fbbf24; border-color: rgba(245,158,11,.3); }
html.theme-tech .alert-banner.danger { background: rgba(220,38,38,.15); color: #fca5a5; border-color: rgba(220,38,38,.35); }
html.theme-tech .alert-banner.ok { background: rgba(22,163,74,.12); color: #86efac; border-color: rgba(22,163,74,.3); }
html.theme-tech .alert-banner.info { background: rgba(6,182,212,.15); color: #67e8f9; border-color: rgba(6,182,212,.3); }
html.theme-tech .modal-shell, html.theme-tech .drawer-shell { background: var(--bg-panel); }
html.theme-tech .modal-foot { background: var(--bg-sunken); }
html.theme-tech .mode-tag.HD { background: rgba(31,86,209,.18); color: #93c5fd; }
html.theme-tech .mode-tag.HDF { background: rgba(21,128,61,.18); color: #86efac; }
html.theme-tech .mode-tag.HFHD { background: rgba(194,87,10,.18); color: #fdba74; }
html.theme-tech .mode-tag.HD-HP { background: rgba(109,40,217,.22); color: #c4b5fd; }
html.theme-tech .tag { background: var(--bg-sunken); color: var(--ink-700); }
html.theme-tech .tag.brand { background: rgba(6,182,212,.18); color: #67e8f9; }
html.theme-tech .tag.ok { background: rgba(22,163,74,.18); color: #86efac; }
html.theme-tech .tag.warn { background: rgba(245,158,11,.18); color: #fbbf24; }
html.theme-tech .tag.danger { background: rgba(220,38,38,.2); color: #fca5a5; }
html.theme-tech .tag.info { background: rgba(6,182,212,.18); color: #67e8f9; }
html.theme-tech .tablet-stage {
  background:
    radial-gradient(ellipse at 30% 20%, #1e293b 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, #0c4a6e 0%, transparent 60%),
    #020617;
}
html.theme-tech .tablet-bezel {
  background: linear-gradient(140deg, #0a1422 0%, #1e293b 50%, #0a1422 100%);
}

/* 圆角阶梯通过 root 变量 .radius-* */
html.radius-sharp { --r-md: 3px; --r-lg: 4px; --r-xl: 6px; }
html.radius-round { --r-md: 12px; --r-lg: 18px; --r-xl: 24px; }

