/* health_archive 插件样式（应用中心 ?view=health_archive） */

.health-archive-root {
  padding: 8px 4px 24px;
}

.ha-stack {
  width: 100%;
}

/* 隐藏动作通道输入 */
.ha-input-hidden {
  display: none !important;
}

/* 通用表单槽位：隐藏的控件不占位 */
.ha-fi[hidden],
.ha-fi .dm-TextInput-root[hidden],
div[hidden].ha-fi {
  display: none !important;
}

/* 会员列表 / 分区网格高度 */
.ha-member-grid,
.ha-sec-grid {
  height: 460px;
  width: 100%;
}

/* 表格竖线：表体单元格与表头列分隔线（覆盖全局 ceramic 主题透明竖线） */
.ag-theme-ceramic.ha-member-grid .ag-cell,
.ag-theme-ceramic.ha-sec-grid .ag-cell {
  border-right: 1px solid var(--border) !important;
}

.ag-theme-ceramic.ha-member-grid .ag-header-cell,
.ag-theme-ceramic.ha-sec-grid .ag-header-cell {
  border-right: 1px solid var(--border);
}

/* 概览过敏警示条 */
.ha-sec-grid .ag-row,
.ha-member-grid .ag-row {
  cursor: pointer;
}

/* 时间线节点紧凑化 */
.ha-stack .dm-Timeline-root {
  padding-top: 4px;
}

/* 健康档案一览表：紧凑、按内容自适应宽度、列多横向滚动 */
.ha-overview-tablewrap {
  width: 100%;
  overflow-x: auto;
}

table.ha-overview-table {
  width: auto !important;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}

table.ha-overview-table th,
table.ha-overview-table td {
  white-space: nowrap;
  padding: 6px 14px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  line-height: 1.5;
}

table.ha-overview-table th {
  font-weight: 600;
  color: var(--mantine-color-dimmed, #64748b);
  background: var(--bg1, #f8fafc);
  border-bottom: 1px solid var(--border, #e2e8f0);
}

table.ha-overview-table td {
  color: var(--text, #0f172a);
  border-bottom: 1px solid var(--border, #eef2f7);
}

table.ha-overview-table tr:last-child td {
  border-bottom: none;
}

/* 报告明细弹窗：表头不换行（列宽挤压时走横向滚动） */
#ha-detail-modal th {
  white-space: nowrap;
}

/* 检验报告 AI 识别：上传入口按钮化 + 核对弹窗明细网格 */
.ha-lab-ai-upload {
  border: 1px dashed #7048e8;
  border-radius: 4px;
  padding: 4px 12px;
  cursor: pointer;
  background: var(--bg1, #f8fafc);
}

.ha-lab-ai-upload:hover {
  background: #f3f0ff;
}

.ha-lab-ai-grid {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 4px;
}

/* 核对弹窗明细表：表头换行完整显示，表头行高自适应。
   alpine 主题里 .ag-header-cell-label 是绝对定位（top/bottom 撑满固定行高），
   换行后文字溢出被裁剪；改为静态流式布局，让行高随内容增长。 */
.ha-lab-ai-grid .ag-header {
  height: auto;
  min-height: 34px;
}

.ha-lab-ai-grid .ag-header-row,
.ha-lab-ai-grid .ag-header-cell {
  height: auto !important;
}

.ha-lab-ai-grid .ag-header-cell-label {
  position: static !important;
  height: auto !important;
  display: flex;
  align-items: center;
  white-space: normal !important;
  padding: 3px 2px;
}

.ha-lab-ai-grid .ag-header-cell {
  padding-left: 2px;
  padding-right: 2px;
}

.ha-lab-ai-grid .ag-cell {
  padding-left: 4px;
  padding-right: 4px;
}

.ha-lab-ai-grid .ag-header-cell-text {
  white-space: normal;
  line-height: 1.2;
  text-align: left;
}

/* 字典管理表格单元格边框 */
.ha-da-table {
  border-collapse: collapse !important;
}

.ha-da-table th,
.ha-da-table td {
  border: 1px solid var(--border, #e2e8f0) !important;
}

/* AI 识别核对/报告详情：异常指标行浅红背景 */
.ha-lab-ai-grid .ag-row.ha-row-abnormal {
  background-color: #FFF0F0 !important;
}

/* ---------------------------------------------------------------------------
 * 工作台分类切换过渡：保留旧内容 + 半透明遮罩 + 微光动画 + 新内容淡入
 * 目标：将“等待感”转化“即时响应”，避免下拉切换后长时间空白。
 * ------------------------------------------------------------------------- */
.ha-dynamic-area {
  position: relative;
  min-height: 120px;
  transition: opacity 160ms ease;
}

/* 切换中：旧内容变半透明，上面覆盖一层微光，不阻断阅读 */
.ha-dynamic-area.is-switching {
  opacity: 0.55;
}

.ha-dynamic-area.is-switching::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: linear-gradient(
      90deg,
      rgba(37, 99, 235, 0) 0%,
      rgba(37, 99, 235, 0.10) 50%,
      rgba(37, 99, 235, 0) 100%);
  background-size: 200% 100%;
  animation: ha-area-shimmer 1.2s linear infinite;
  pointer-events: none;
  z-index: 2;
}

/* 顶部细进度条：确认“有事在发生”，不阻断交互 */
.ha-dynamic-area.is-switching::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  height: 2px;
  width: 100%;
  background: linear-gradient(
      90deg,
      transparent 0%,
      #2563EB 40%,
      #2563EB 60%,
      transparent 100%);
  background-size: 200% 100%;
  animation: ha-area-progress 1.2s ease-in-out infinite;
  z-index: 3;
  border-radius: 2px;
}

@keyframes ha-area-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes ha-area-progress {
  0%   { background-position: 150% 0; }
  100% { background-position: -150% 0; }
}

/* 新内容淡入：React 替换 children 后自动播放，避免“闪现” */
.ha-dynamic-area > .ha-fade-in {
  animation: ha-area-fade-in 220ms ease;
}

@keyframes ha-area-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* 黑暗模式适配 */
[data-mantine-color-scheme='dark'] .ha-dynamic-area.is-switching {
  opacity: 0.6;
}

[data-mantine-color-scheme='dark'] .ha-dynamic-area.is-switching::after {
  background: linear-gradient(
      90deg,
      rgba(120, 180, 255, 0) 0%,
      rgba(120, 180, 255, 0.12) 50%,
      rgba(120, 180, 255, 0) 100%);
  background-size: 200% 100%;
}
