/* ============================================================
   view-datareport.css · 数据报表填写
   字重仅用 400 / 600 / 700；中文字号不小于 12px
   （例外：圆形小徽标内的单个字符、图表刻度标签等纯装饰元素）
   ============================================================ */

/* ---------------- 视图骨架（flush 满高） ---------------- */
.dr { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.dr__wrap { padding: 16px 18px 36px; }

/* 无 item 时的极简引导页：报表在对话里生成，这里只解释去哪做 */
.dr-guide { padding-top: 68px; }
.dr-guide .empty__art { background: #eaf8f0; color: #0f9d58; }

.dr__body { flex: 1; min-height: 0; overflow: auto; background: var(--bg); }
.dr__body .dr__wrap { padding-top: 16px; }

.dr-vbar__src {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-12); color: var(--text-3);
  padding: 3px 9px; border-radius: var(--r-full);
  background: var(--surface-3);
  max-width: 260px; overflow: hidden; text-overflow: ellipsis;
}

.dr-hint {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: var(--fs-12); color: var(--text-4);
}
.dr-hint__k {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 3px; margin-right: -7px;
  border: 1px solid var(--line-strong);
}
.dr-hint__k--edit { background: #fffdf5; border-color: #f3d99b; }
.dr-hint__k--calc { background: var(--brand-50); border-color: var(--brand-200); }

/* 侧栏内的小标签（中文不小于 12px） */
.dr .tag, [data-dr-pad] .tag { font-size: var(--fs-12); }

/* ---------------- 二级表头数据表格 ---------------- */
.dr-table-wrap { max-height: 452px; }
.dr-table { table-layout: fixed; min-width: 1020px; }
.dr-table col { min-width: 0; }

.dr-table thead th {
  height: 34px; padding-top: 0; padding-bottom: 0;
  font-size: var(--fs-12);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line-strong);
}
.dr-table thead th:last-child { border-right: 0; }
.dr-table thead tr:nth-child(1) th { top: 0; z-index: 5; }
.dr-table thead tr:nth-child(2) th { top: var(--dr-h1, 34px); z-index: 4; }
.dr-table thead tr:nth-child(1) th.dr-th-lead { z-index: 6; }

.dr-th-lead { text-align: left; }
.dr-th-group {
  text-align: center; position: relative;
  background: var(--surface-3) !important;
  color: var(--text-2);
  font-size: var(--fs-12); letter-spacing: .05em;
}
.dr-th-group--ai {
  background: linear-gradient(180deg, #eef4ff 0%, #e6efff 100%) !important;
  color: var(--brand-800);
}
.dr-th-group .dr-calc-ico,
.dr-th-group__ico { margin-right: 5px; vertical-align: -1px; }
.dr-th-group__hint {
  display: block; font-size: var(--fs-12); font-weight: 400;
  letter-spacing: 0; color: var(--text-4);
}
.dr-th-group--ai .dr-th-group__hint { color: #6b8ed6; }

.dr-th-num { background: #fffdf5 !important; color: #92700f !important; }
.dr-th-calc { background: #eef4ff !important; color: var(--brand-700) !important; }

.dr-cell--num { padding: 4px 8px !important; }
.dr-cell--num .cell-input {
  padding: 4px 4px; text-align: right; border-radius: var(--r-xs);
  transition: background .14s var(--ease);
}
.dr-cell--num .cell-input:hover { background: #fff8e2; }
.dr-cell--num .cell-input:focus { background: #fff; box-shadow: 0 0 0 2px var(--brand-400) inset; }
.dr-table tbody tr:hover td.dr-cell--num { background: #fff8e6; }

.dr-cell--calc {
  background: var(--brand-50) !important;
  color: var(--brand-800);
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: var(--fs-13); font-weight: 600;
}
.dr-table tbody tr:hover td.dr-cell--calc { background: #e4eeff !important; }
.dr-calc__v { letter-spacing: -.01em; }

.dr-cell--text { color: var(--text-2); }
.dr-cell--text.strong { color: var(--text); font-weight: 600; }
/* 已人工修改的行：序号列角标（装饰性圆点，不承载文字） */
.dr-table tbody tr.is-edited td:first-child { position: relative; }
.dr-table tbody tr.is-edited td:first-child::after {
  content: ""; position: absolute; right: 4px; top: 50%;
  width: 5px; height: 5px; margin-top: -2.5px;
  border-radius: 50%; background: var(--warn);
}

/* AI 低置信度单元格 */
.dr-table td.is-uncertain { position: relative; }
.dr-table td.is-uncertain::after {
  content: ""; position: absolute; left: 3px; top: 50%;
  width: 5px; height: 5px; margin-top: -2px;
  border-radius: 50%; background: var(--warn);
  box-shadow: 0 0 0 2px var(--warn-bg);
}
.dr-table td.dr-cell--num.is-uncertain .cell-input {
  box-shadow: inset 0 -2px 0 var(--warn-bd);
}
.dr-table td.dr-cell--calc.is-uncertain { background: #fff5e4 !important; color: #92610a; }

/* AI 填写后的闪烁提示 */
@keyframes drFill {
  0% { background: #dbe8fe; }
  100% { background: #fffdf5; }
}
.dr-cell--num.is-just-filled { animation: drFill 1.4s var(--ease-out) both; }

.dr-foot__label {
  font-size: var(--fs-12); font-weight: 600; color: var(--text-2);
  background: var(--surface-2); letter-spacing: .03em;
  position: sticky; left: 0; z-index: 3;
}
.dr-table tfoot td {
  position: sticky; bottom: 0; z-index: 3;
  background: var(--surface-2);
  border-top: 1px solid var(--line-strong);
  border-bottom: 0;
  font-weight: 600; color: var(--text);
  padding-top: 8px; padding-bottom: 8px;
}
.dr-table tfoot td.dr-cell--calc { background: #e9f0ff !important; }
.dr-table tfoot td.dr-cell--avg { font-size: var(--fs-13); }

/* ---------------- 异常检测 ---------------- */
.dr-anomaly { align-items: center; }
.dr-anomaly .btn { background: rgba(255, 255, 255, .72); }

/* ---------------- 图表区 ---------------- */
.dr-charts { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 1240px) { .dr-charts { grid-template-columns: minmax(0, 1fr); } }

.dr-chart__bars { padding: 4px 2px 0; }
.dr-bar--ok { background: linear-gradient(180deg, #6ee7a8, var(--success)) !important; }
.dr-bar--brand { background: linear-gradient(180deg, #93bbfd, var(--brand-500)) !important; }
.dr-bar--info { background: linear-gradient(180deg, #7dd3fc, var(--info)) !important; }
.dr-bar--warn { background: linear-gradient(180deg, #fcd34d, var(--warn)) !important; }
.dr-bar--danger { background: linear-gradient(180deg, #fca5a5, var(--danger)) !important; }

.dr-legend {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.dr-legend__i {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-12); color: var(--text-3);
}
.dr-legend__i b { color: var(--text); font-size: var(--fs-13); }
.dr-dot { width: 8px; height: 8px; border-radius: 3px; flex: none; background: var(--brand-500); }
.dr-dot--ok { background: var(--success); }
.dr-dot--brand { background: var(--brand-500); }
.dr-dot--info { background: var(--info); }
.dr-dot--warn { background: var(--warn); }
.dr-dot--danger { background: var(--danger); }

.dr-chart__foot {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-13); color: var(--text-3); line-height: 1.6;
}
.dr-chart__foot svg { margin-top: 1px; color: var(--brand-500); }
.dr-chart__foot b { color: var(--text); }
.dr-chart__foot .warn, .goal-row__sub .warn { color: var(--warn); }
.dr-chart__foot .ok, .goal-row__sub .ok { color: var(--success); }

/* 课程目标达成度对比条 */
.goal-row { margin-bottom: 15px; }
.goal-row:last-of-type { margin-bottom: 4px; }
.goal-row__head {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-13); color: var(--text-2);
  margin-bottom: 6px;
}
.goal-row__n {
  flex: none; font-size: var(--fs-12); font-weight: 600;
  color: var(--brand-700); background: var(--brand-50);
  border-radius: var(--r-xs); padding: 1px 6px;
}
.dr-goal-val { font-size: var(--fs-14); color: var(--text); letter-spacing: -.01em; }

.goal-track {
  position: relative; height: 9px; border-radius: var(--r-full);
  background: var(--surface-3); overflow: visible;
}
.goal-fill {
  display: block; height: 100%; border-radius: var(--r-full);
  background: linear-gradient(90deg, #60a5fa, var(--brand-600));
  transition: width .45s var(--ease-out);
}
.goal-fill--warn { background: linear-gradient(90deg, #fbbf24, var(--warn)); }
.goal-target {
  position: absolute; top: -4px; bottom: -4px;
  width: 2px; margin-left: -1px;
  background: var(--text-3); border-radius: 2px;
}
.goal-target i {
  position: absolute; left: 50%; top: -3px; transform: translateX(-50%);
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--text-3);
}
.goal-target::after {
  content: ""; position: absolute; left: 4px; top: -6px; bottom: -6px;
  border-left: 1px dashed var(--line-dark);
}
.goal-row__sub {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-12); color: var(--text-4); margin-top: 6px;
}

/* ---------------- 分页 ---------------- */
.dr-pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-1);
}
.dr-pager__num {
  font-size: var(--fs-13); color: var(--text-2);
  padding: 0 4px; font-variant-numeric: tabular-nums;
}

/* 数量类指标用警示色片，不加升降箭头（数量不是涨跌幅） */
.dr .stat__delta--warn { color: var(--warn); }

/* 面板内文字链高度 ≥ 24px，保证可点区域（仅数据报表面板） */
[data-dr-pad] .btn--link,
.dr-check .btn--link {
  min-height: 24px; padding: 4px 6px;
  display: inline-flex; align-items: center;
  border-radius: var(--r-xs);
}
[data-dr-pad] .btn--link:hover,
.dr-check .btn--link:hover { background: var(--brand-50); }

/* vbar 换行：窄屏 + 面板打开时操作不被裁掉 */
.dr .vbar { flex-wrap: wrap; overflow-x: visible; height: auto; row-gap: 7px; }

/* 非 d1 报表：表结构骨架 */
.dr-table--skel { min-width: 0; }
.dr-table--skel th, .dr-table--skel td { height: 34px; }
.dr-skel {
  display: block; height: 9px; width: 70%;
  border-radius: 3px;
  background: linear-gradient(90deg, #eef1f7 0%, #e2e8f2 50%, #eef1f7 100%);
  background-size: 200% 100%;
  animation: drSkel 1.4s var(--ease) infinite;
}
.dr-skel--th { width: 46%; height: 8px; background: linear-gradient(90deg, #e6ebf3 0%, #d9e0ec 50%, #e6ebf3 100%); background-size: 200% 100%; }
@keyframes drSkel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------------- 右面板 ---------------- */
/* 与 view-report.css 中的同名结构保持一致（面板骨架） */
.sidepanel__body--flush { display: flex; flex-direction: column; overflow: hidden; }
.sidepanel__pad { flex: 1; min-height: 0; overflow: auto; padding: 16px; }
.sidepanel__bottom { flex: none; border-top: 1px solid var(--line); background: var(--surface); }

.dr-fill { display: flex; align-items: center; gap: 14px; }
.dr-ring { display: block; color: var(--violet); flex: none; }

.dr-src-tip { align-items: center; margin-bottom: 8px; }
.dr-src-tip .ftile { width: 28px; height: 28px; font-size: 9px; }

.dr-formula {
  padding: 10px 12px; margin-bottom: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-family: var(--mono); font-size: var(--fs-12); line-height: 1.7;
  color: var(--brand-800); word-break: break-word;
}

.dr-weight { margin-bottom: 10px; }
.dr-weight__head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--fs-13); color: var(--text-2); margin-bottom: 4px;
}
.dr-weight__head b { color: var(--text); font-size: var(--fs-13); }
.dr-weight .slider { cursor: pointer; }
.dr-weight__sum {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px; padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: var(--fs-13); color: var(--text-3);
}
.dr-weight__sum b { color: var(--text); }

.dr-check {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 9px 10px; margin-bottom: 7px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-2);
}
.dr-check.is-warn { background: var(--warn-bg); border-color: var(--warn-bd); }
.dr-check__mark {
  width: 17px; height: 17px; flex: none; border-radius: 50%;
  display: grid; place-items: center; margin-top: 1px;
  background: var(--success-bg); color: var(--success);
  border: 1px solid var(--success-bd);
}
.dr-check.is-warn .dr-check__mark {
  background: #fff; color: var(--warn); border-color: var(--warn-bd);
}
.dr-check__t { font-size: var(--fs-13); font-weight: 600; color: var(--text); line-height: 1.5; }
.dr-check__d { font-size: var(--fs-12); color: var(--text-3); line-height: 1.55; margin-top: 1px; }
.dr-check .btn--link { font-size: var(--fs-12); flex: none; }

.dr-quick { padding: 10px 12px 0; }
.dr-quick .chip { height: 28px; font-size: var(--fs-12); }
.dr-composer .chat__hint { font-size: var(--fs-12); }

.dr-asklog { display: flex; flex-direction: column; gap: 9px; max-height: 260px; overflow: auto; }
.dr-ask { animation: riseIn .3s var(--ease-out) both; }
.dr-ask__q {
  font-size: var(--fs-13); font-weight: 600; color: var(--text);
  padding-left: 9px; border-left: 2px solid var(--brand-400);
  margin-bottom: 5px;
}
.dr-ask__a {
  font-size: var(--fs-13); line-height: 1.7; color: var(--text-2);
  background: var(--ai-grad-soft);
  border: 1px solid #e4dcfd; border-radius: var(--r-md);
  padding: 9px 11px;
}
.dr-ask__a b { color: var(--violet); }

/* 面板内进度条补充色（components.css 仅提供 ok / warn） */
.progress__bar--danger { background: var(--danger); }

/* ---------------- 向导：来源 / 选择 / 进度 ---------------- */
.dr-src {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-2);
  cursor: pointer; opacity: .55;
  transition: all .16s var(--ease);
}
.dr-src:hover { border-color: var(--brand-300); }
.dr-src.is-on { opacity: 1; background: var(--surface); border-color: var(--success-bd); }

.dr-pick {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); text-align: left;
  transition: all .16s var(--ease);
}
.dr-pick:hover { border-color: var(--brand-300); background: var(--brand-50); }
.dr-pick.is-active { border-color: var(--brand-500); background: var(--brand-50); box-shadow: var(--ring); }

.dr-step {
  display: flex; align-items: center; gap: 9px;
  color: var(--text-3);
  transition: color .2s var(--ease);
}
.dr-step.is-done { color: var(--success); font-weight: 600; }
.dr-step__dot {
  width: 17px; height: 17px; flex: none; border-radius: 50%;
  border: 1.5px solid var(--line-dark);
  display: grid; place-items: center;
  font-size: 10px; color: #fff;      /* 装饰性单字符（✓） */
  transition: all .2s var(--ease);
}
.dr-step.is-done .dr-step__dot { background: var(--success); border-color: var(--success); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1080px) {
  .dr__wrap { padding-left: 14px; padding-right: 14px; }
  .dr-anomaly { flex-wrap: wrap; }
  .dr-anomaly .row { width: 100%; justify-content: flex-end; }
}
