﻿/* department-stats.css —— 报表布局与组件。中文说明：颜色全部来自 report-theme.css 的变量。 */

/* ---------- 外壳 ---------- */
.rpt-shell {
  width: min(var(--rpt-max), calc(100% - 40px));
  margin: 28px auto 40px;
}

/* ---------- 顶部 ---------- */
.rpt-header {
  padding: 22px var(--rpt-pad) 20px;
  background: var(--rpt-surface);
  border: 1px solid var(--rpt-line);
  border-radius: var(--rpt-radius);
  box-shadow: var(--rpt-shadow);
}
.rpt-header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.rpt-header-main { min-width: 200px; }
.rpt-eyebrow {
  margin-bottom: 6px;
  color: var(--rpt-gold);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* 中文说明：右上角栏目入口，与系统首页按钮风格一致，退出用红色区分 */
.rpt-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  max-width: 100%;
}
.rpt-nav-btn {
  height: 34px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 13px;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  border-radius: 8px;
  color: var(--rpt-navy-700);
  background: var(--rpt-surface);
  border: 1px solid var(--rpt-line);
}
.rpt-nav-btn:hover { border-color: var(--rpt-navy-300); color: var(--rpt-navy-900); }
.rpt-nav-btn:focus-visible { outline: 2px solid rgba(29, 78, 122, 0.24); outline-offset: 2px; }
.rpt-nav-btn.is-active {
  border-color: var(--rpt-navy-700);
  background: var(--rpt-navy-700);
  color: #FFFFFF;
}
.rpt-nav-btn.is-active:hover { background: var(--rpt-navy-900); border-color: var(--rpt-navy-900); color: #FFFFFF; }
.rpt-nav-exit { border-color: #B91C1C; background: #B91C1C; color: #FFFFFF; }
.rpt-nav-exit:hover { border-color: #991B1B; background: #991B1B; color: #FFFFFF; }

/* 中文说明：工具行与标题区用一条细分隔线拉开层次；标签与控件同一行，查询与打印靠右对齐 */
.rpt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--rpt-line);
}
.rpt-toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-left: auto; }
.rpt-field { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--rpt-text-2); white-space: nowrap; }
.rpt-field select,
.rpt-field input {
  min-height: 36px;
  padding: 4px 10px;
  border: 1px solid var(--rpt-line);
  border-radius: 8px;
  background: var(--rpt-surface);
  color: var(--rpt-text);
  font-size: 13px;
}
.rpt-field select:focus,
.rpt-field input:focus {
  outline: none;
  border-color: var(--rpt-navy-500);
  box-shadow: 0 0 0 3px rgba(29, 78, 122, 0.14);
}
.rpt-btn {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--rpt-line);
  border-radius: 8px;
  background: var(--rpt-surface);
  color: var(--rpt-navy-700);
  font-size: 13px;
  cursor: pointer;
}
.rpt-btn:hover { border-color: var(--rpt-navy-300); color: var(--rpt-navy-900); }
.rpt-btn-primary {
  border-color: var(--rpt-navy-700);
  background: var(--rpt-navy-700);
  color: #FFFFFF;
}
.rpt-btn-primary:hover { background: var(--rpt-navy-900); border-color: var(--rpt-navy-900); color: #FFFFFF; }

/* ---------- 栏目切换条（吸顶） ---------- */
.rpt-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  margin: 14px -4px 8px;
  padding: 8px 4px;
  background: var(--rpt-bg);
  border-bottom: 1px solid var(--rpt-line);
  scrollbar-width: none;
}
.rpt-tabs::-webkit-scrollbar { display: none; }
.rpt-tab {
  position: relative;
  flex: 0 0 auto;
  padding: 9px 14px;
  border: 0;
  background: transparent;
  color: var(--rpt-text-2);
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}
.rpt-tab:hover { color: var(--rpt-navy-700); }
.rpt-tab[aria-selected="true"] { color: var(--rpt-navy-900); font-weight: 600; }
.rpt-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--rpt-gold);
}
.rpt-tab:focus-visible { outline: 2px solid var(--rpt-navy-300); outline-offset: 2px; border-radius: 6px; }

.rpt-notice { min-height: 20px; margin: 8px 0 0; color: var(--rpt-down); font-size: 13px; }

/* ---------- 视图标题 ---------- */
.rpt-view-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 4px;
}
.rpt-view-head p { color: var(--rpt-text-2); font-size: 13px; }

/* ---------- KPI 带 ---------- */
.rpt-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--rpt-gap);
  margin: 14px 0 26px;
}
.rpt-kpi {
  display: grid;
  gap: 6px;
  padding: 18px var(--rpt-pad);
  border-radius: var(--rpt-radius);
  background: var(--rpt-surface);
  box-shadow: var(--rpt-shadow);
}
.rpt-kpi-label { color: var(--rpt-text-2); font-size: 12px; }
.rpt-kpi-value { color: var(--rpt-navy-900); font-size: 30px; font-weight: 700; line-height: 1.1; }
.rpt-kpi-value small { margin-left: 3px; font-size: 12px; font-weight: 500; color: var(--rpt-text-3); }
.rpt-kpi-hint { color: var(--rpt-text-3); font-size: 11px; line-height: 1.5; }
.rpt-kpi[data-status="unavailable"] .rpt-kpi-value { color: var(--rpt-text-3); }
.rpt-drilldown {
  justify-self: start;
  margin-top: 2px;
  padding: 3px 9px;
  border: 1px solid var(--rpt-navy-100);
  border-radius: 999px;
  background: var(--rpt-surface-2);
  color: var(--rpt-navy-500);
  font-size: 11px;
  cursor: pointer;
}
.rpt-drilldown:hover { border-color: var(--rpt-navy-300); color: var(--rpt-navy-900); }

/* ---------- 图表矩阵 ---------- */
.rpt-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--rpt-gap);
}
.rpt-chart {
  min-width: 0;
  padding: 18px var(--rpt-pad) 14px;
  border-radius: var(--rpt-radius);
  background: var(--rpt-surface);
  box-shadow: var(--rpt-shadow);
}
.rpt-chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rpt-chart-unit { color: var(--rpt-text-3); font-size: 11px; white-space: nowrap; }
.rpt-chart-canvas { width: 100%; height: 260px; margin-top: 8px; }
.rpt-chart-note { margin-top: 6px; color: var(--rpt-text-3); font-size: 11px; line-height: 1.5; }
.rpt-chart-fallback { display: none; margin-top: 12px; color: var(--rpt-down); font-size: 12px; }
.rpt-chart[data-chart-failed="1"] .rpt-chart-canvas { display: none; }
.rpt-chart[data-chart-failed="1"] .rpt-chart-fallback { display: block; }

/* ---------- 空态与错误 ---------- */
.rpt-block-empty,
.rpt-error {
  padding: 28px var(--rpt-pad);
  border-radius: var(--rpt-radius);
  background: var(--rpt-surface);
  box-shadow: var(--rpt-shadow);
  color: var(--rpt-text-2);
  font-size: 13px;
}
.rpt-error h2 { margin-bottom: 6px; color: var(--rpt-navy-900); }
.rpt-error .rpt-btn { margin-top: 12px; }

/* ---------- 骨架屏 ---------- */
.rpt-skeleton .rpt-kpi,
.rpt-skeleton .rpt-chart {
  min-height: 110px;
  background: linear-gradient(90deg, #F1F3F7 25%, #F8FAFC 37%, #F1F3F7 63%);
  background-size: 400% 100%;
  animation: rpt-shimmer 1.4s ease infinite;
  box-shadow: none;
}
.rpt-skeleton .rpt-chart { min-height: 300px; }
@keyframes rpt-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- 附录 ---------- */
.rpt-appendix {
  margin-top: 28px;
  padding: 16px var(--rpt-pad);
  border-radius: var(--rpt-radius);
  background: var(--rpt-surface);
  box-shadow: var(--rpt-shadow);
}
.rpt-appendix > summary {
  cursor: pointer;
  color: var(--rpt-navy-700);
  font-size: 14px;
  font-weight: 600;
  list-style: none;
}
.rpt-appendix > summary::-webkit-details-marker { display: none; }
.rpt-appendix > summary::before { content: "▸ "; color: var(--rpt-gold); }
.rpt-appendix[open] > summary::before { content: "▾ "; }
.rpt-appendix-note { margin: 10px 0 6px; color: var(--rpt-text-2); font-size: 12px; }
.rpt-appendix-body { overflow-x: auto; }

/* ---------- 表格 ---------- */
  position: sticky;
  top: 0;
  background: var(--rpt-surface-2);
  color: var(--rpt-text-2);
  font-size: 12px;
  font-weight: 600;
}
.rpt-appendix-id { width: 56px; color: var(--rpt-text-3); font-size: 12px; }
.rpt-appendix-value { width: 150px; font-weight: 600; color: var(--rpt-navy-900); }
.rpt-appendix-reason { color: var(--rpt-text-2); font-size: 12px; }

/* ---------- 页脚 ---------- */
.rpt-footer { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--rpt-line); color: var(--rpt-text-2); font-size: 12px; }
.rpt-disclaimer { margin-bottom: 6px; color: var(--rpt-navy-700); font-weight: 600; }
.rpt-meta { margin-bottom: 4px; color: var(--rpt-text-3); }
.rpt-meta a { margin-left: 6px; }

/* ---------- 名单弹窗 ---------- */
.rpt-dialog-mask {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(11, 34, 57, 0.45);
}
.rpt-dialog-mask[hidden] { display: none; }
.rpt-dialog {
  width: min(680px, 100%);
  max-height: 86vh;
  overflow: auto;
  padding: 22px var(--rpt-pad);
  border-radius: var(--rpt-radius);
  background: var(--rpt-surface);
  box-shadow: 0 24px 60px rgba(11, 34, 57, 0.24);
}
.rpt-dialog h2 { margin-bottom: 6px; }
.rpt-dialog-tip { margin-bottom: 12px; color: var(--rpt-text-2); font-size: 12px; }
.rpt-dialog-body { max-height: 56vh; overflow: auto; margin-bottom: 14px; }
.rpt-dialog-summary { margin-bottom: 10px; color: var(--rpt-text-2); font-size: 12px; }

/* ---------- 修改密码弹窗 ---------- */
.rpt-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(11, 34, 57, 0.45);
}
.rpt-modal[hidden] { display: none; }
.rpt-modal-card {
  width: 100%;
  max-width: 400px;
  padding: 24px;
  border-radius: var(--rpt-radius);
  background: var(--rpt-surface);
  box-shadow: 0 24px 60px rgba(11, 34, 57, 0.24);
}
.rpt-modal-title { font-size: 18px; }
.rpt-modal-tip { margin: 10px 0 18px; color: var(--rpt-text-2); font-size: 13px; }
.rpt-modal-field { display: block; margin-bottom: 14px; font-size: 13px; color: var(--rpt-text-2); }
.rpt-modal-field span { display: block; margin-bottom: 6px; }
.rpt-input {
  width: 100%;
  min-height: 36px;
  padding: 4px 10px;
  border: 1px solid var(--rpt-line);
  border-radius: 8px;
  background: var(--rpt-surface);
  color: var(--rpt-text);
  font-size: 13px;
}
.rpt-input:focus {
  outline: none;
  border-color: var(--rpt-navy-500);
  box-shadow: 0 0 0 3px rgba(29, 78, 122, 0.14);
}
.rpt-modal-error { margin: 0 0 12px; min-height: 18px; color: var(--rpt-down); font-size: 13px; }
.rpt-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.rpt-modal-actions .rpt-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---------- KPI 待补态（压缩展示，不占满首屏） ---------- */
.rpt-kpi.is-pending {
  background: var(--rpt-surface-2);
  box-shadow: none;
  border: 1px dashed var(--rpt-line);
  align-content: start;
  gap: 4px;
}
.rpt-kpi.is-pending .rpt-kpi-label { color: var(--rpt-text-2); }
.rpt-kpi-pending {
  display: inline-flex;
  align-items: center;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--rpt-gold-soft);
  color: var(--rpt-down);
  font-size: 11px;
  font-weight: 600;
}
.rpt-kpi.is-pending .rpt-kpi-hint { font-size: 11px; }

/* ---------- KPI 不适用态（分母为 0，例如本月没有出组时的续管率） ---------- */
/* 中文说明：不适用用“—”加说明表示，样式保持干净中性，不能和“待补（缺数据）”混淆。 */
.rpt-kpi.is-not-applicable { background: var(--rpt-surface-2); box-shadow: none; }
.rpt-kpi.is-not-applicable .rpt-kpi-value { color: var(--rpt-text-3); }
.rpt-kpi.is-not-applicable .rpt-kpi-hint { font-size: 11px; }

/* ---------- 附录分段 ---------- */
.rpt-appendix-section { margin-top: 14px; }
.rpt-appendix-section h4 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--rpt-line);
  color: var(--rpt-navy-700);
  font-size: 13px;
  font-weight: 600;
}
.rpt-appendix-section h4 span { color: var(--rpt-text-3); font-size: 11px; font-weight: 400; }
.rpt-appendix-scroll { overflow-x: auto; }
.rpt-appendix-hint { width: 190px; color: var(--rpt-text-2); font-size: 12px; }
.rpt-appendix-state { width: 170px; font-size: 12px; }
.rpt-appendix-code {
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--rpt-surface-2);
  color: var(--rpt-text-2);
  font-size: 11px;
}
.rpt-chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.rpt-chip[data-tone="ok"] { background: #EAF6F0; color: #1F7A5A; }
.rpt-chip[data-tone="warn"] { background: #FFF7ED; color: var(--rpt-down); }
.rpt-chip[data-tone="muted"] { background: #F1F3F7; color: var(--rpt-text-3); }
.rpt-appendix-sub {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--rpt-line);
  border-radius: 10px;
  background: var(--rpt-surface-2);
}
.rpt-appendix-sub > summary {
  cursor: pointer;
  color: var(--rpt-navy-700);
  font-size: 13px;
  font-weight: 600;
  list-style: none;
}
.rpt-appendix-sub > summary::-webkit-details-marker { display: none; }
.rpt-appendix-sub > summary::before { content: "＋ "; color: var(--rpt-gold); }
.rpt-appendix-sub[open] > summary::before { content: "－ "; }
.rpt-appendix-legend { margin-top: 14px; color: var(--rpt-text-3); font-size: 11px; line-height: 1.7; }

/* ---------- 合并指标小结卡 ---------- */
.rpt-summary {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--rpt-surface);
  border: 1px solid var(--rpt-line);
  border-radius: 12px;
  box-shadow: var(--rpt-shadow);
}
.rpt-summary-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--rpt-line);
}
.rpt-summary-row:last-of-type { border-bottom: none; }
.rpt-summary-label {
  flex: 0 0 88px;
  color: var(--rpt-navy-700);
  font-size: 12px;
  font-weight: 600;
}
.rpt-summary-items { display: flex; flex-wrap: wrap; gap: 16px; }
.rpt-summary-item { display: inline-flex; align-items: baseline; gap: 4px; font-size: 12px; }
.rpt-summary-item em { color: var(--rpt-text-2); font-style: normal; }
.rpt-summary-item b { color: var(--rpt-navy-700); font-weight: 600; font-variant-numeric: tabular-nums; }
.rpt-summary-note { margin: 8px 0 0; color: var(--rpt-text-3); font-size: 11px; }

/* ---------- 手机适配 ---------- */
@media (max-width: 1100px) {
  .rpt-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .rpt-shell { width: calc(100% - 24px); margin-top: 16px; }
  .rpt-charts { grid-template-columns: 1fr; }
  .rpt-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .rpt-kpi { padding: 14px 16px; }
  .rpt-kpi-value { font-size: 24px; }
  .rpt-header { padding: 18px 16px; }
  .rpt-header-top { flex-direction: column; gap: 12px; }
  .rpt-nav { justify-content: flex-start; }
  .rpt-nav-btn { height: 32px; padding: 0 11px; font-size: 12.5px; }
  .rpt-toolbar { gap: 10px; }
  .rpt-field { flex: 0 0 auto; }
  .rpt-toolbar-actions { width: 100%; margin-left: 0; }
  .rpt-toolbar-actions .rpt-btn { flex: 1 1 0; }
  .rpt-chart-canvas { height: 220px; }
  .rpt-view-head { flex-wrap: wrap; gap: 4px; }
}

.rpt-sections { display: flex; flex-direction: column; gap: 20px; margin: 20px 0; }
.rpt-section { padding: 16px 18px; background: var(--color-surface, #FFFFFF); border: 1px solid var(--color-border, #E6ECEA); border-radius: 12px; }
.rpt-section-title { margin: 0 0 10px; font-size: 16px; color: var(--color-text-main, #111827); }
.rpt-section-note { margin: 0 0 12px; font-size: 12px; line-height: 1.6; color: var(--color-warning, #B45309); }
.rpt-section .rpt-kpis { margin-bottom: 12px; }

/* 中文说明：表格通用样式，颜色全部取自标准色板 */
.rpt-table { width: 100%; border-collapse: collapse; font-size: 12px; background: var(--color-surface, #FFFFFF); color: var(--color-text-main, #111827); }
.rpt-table th { padding: 8px 10px; text-align: left; background: var(--color-page-bg, #F5F7F7); border-bottom: 1px solid var(--color-border, #E6ECEA); font-weight: 600; }
.rpt-table td { padding: 8px 10px; border-bottom: 1px solid var(--color-border, #E6ECEA); }
.rpt-table tbody tr:hover { background: var(--color-table-hover, #F5F7F7); }
/* 中文说明：附录表保持原样（自带滚动容器），不参与对账表的紧凑布局 */
.rpt-appendix-scroll .rpt-table th, .rpt-appendix-scroll .rpt-table td { white-space: nowrap; }
/* 中文说明：续费与续管对账明细表：固定布局 + 两层表头，20 列一屏排满，不出现横向滚动条 */
.rpt-table-wrap { margin: 12px 0 4px; border: 1px solid var(--color-border, #E6ECEA); border-radius: 10px; overflow: hidden; }
.rpt-detail-table { table-layout: fixed; }
.rpt-detail-table th { padding: 7px 3px; text-align: center; white-space: normal; word-break: break-word; font-size: 11px; line-height: 1.25; }
.rpt-detail-table td { padding: 7px 3px; text-align: center; white-space: normal; word-break: break-word; }
.rpt-detail-table th:first-child, .rpt-detail-table td:first-child { width: 76px; text-align: left; padding-left: 8px; }
.rpt-detail-table tbody tr:last-child td { border-bottom: none; font-weight: 600; }
.rpt-table-note { margin: 6px 0 0; font-size: 12px; color: var(--color-text-secondary, #374151); }
@media (max-width: 900px) { .rpt-detail-table { font-size: 11px; } .rpt-detail-table th, .rpt-detail-table td { padding: 6px 2px; } .rpt-detail-table th:first-child, .rpt-detail-table td:first-child { width: 58px; } }
/* 中文说明：表头固定两行：每行一个 span，行高一致，避免列宽不同时高低不齐 */
/* 中文说明：表头自动换行（每行最多 3 个汉字），列宽压窄，行高随行数自然变化 */
.rpt-detail-table th .rpt-th-line { display: block; line-height: 1.3; }
.rpt-detail-table thead th { vertical-align: bottom; padding: 6px 2px; font-size: 11px; }
.rpt-detail-table td { padding: 6px 2px; font-size: 12px; }