/* ===== 经代业务每日速报工具 样式(浅色主题) ===== */
:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --up: #dc2626;   /* 同比上涨(红) */
  --down: #16a34a; /* 同比下跌(绿) */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ---------- 顶栏 ---------- */
.topbar {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff;
  padding: 16px 0;
  box-shadow: 0 2px 12px rgba(30, 58, 138, .25);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
  font-size: 30px;
  width: 52px; height: 52px;
  background: rgba(255,255,255,.15);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.brand h1 { font-size: 20px; font-weight: 700; }
.brand .sub { font-size: 12px; opacity: .85; margin-top: 2px; }
.date-picker { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.date-picker input[type=date] {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.35);
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 14px;
}
.date-picker input[type=date]::-webkit-calendar-picker-indicator { filter: invert(1); }
.date-picker .hint { font-size: 11px; opacity: .8; max-width: 220px; }

/* ---------- 主体 ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* 步骤指示 */
.steps {
  display: flex; align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 20px;
  margin-bottom: 18px;
}
.step { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--muted); }
.step.active { color: var(--primary); }
.step-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #e2e8f0;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.step.active .step-num { background: var(--primary); color: #fff; }
.step-line { flex: 1; height: 2px; background: var(--border); margin: 0 12px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
}
.card h2 {
  font-size: 16px;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.report-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 8px;
}
.report-header h2 { margin-bottom: 0; }
.card-badge {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.desc { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
code {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  color: #0f172a;
}
.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }

/* ---------- 导入 ---------- */
.drop-zone {
  border: 2px dashed #94a3b8;
  border-radius: 12px;
  padding: 34px 20px;
  text-align: center;
  transition: all .2s;
  background: #f8fafc;
}
.drop-zone.drag {
  border-color: var(--primary);
  background: #eff6ff;
}
.dz-icon { font-size: 40px; margin-bottom: 8px; }
.drop-zone p { margin: 6px 0; color: var(--muted); }
.dz-hint { font-size: 12px; }
.dz-hint a { color: var(--primary); }
.paste-area {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: #f8fafc;
}
.paste-area textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 13px;
  resize: vertical;
  margin-bottom: 10px;
}
.row-btns { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-ghost:hover { background: #eff6ff; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
  text-decoration: underline;
  font-family: inherit;
}
.btn-link:hover { color: var(--primary-dark); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- 模板导入行 ---------- */
.template-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px dashed var(--border);
  border-radius: 10px;
}
.template-row .desc { margin: 10px 0 0; width: 100%; }

/* ---------- 特殊调整编辑器 ---------- */
.adj-editor {
  margin-top: 16px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.adj-editor h3 { font-size: 14px; margin: 0 0 4px; }
.adj-editor .desc { margin: 0 0 10px; }
.adj-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.adj-row input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
}
.adj-row .adj-name { width: 110px; }
.adj-row .adj-val { width: 130px; }
.adj-unit { color: var(--muted); font-size: 12px; }
.adj-del {
  background: none;
  border: none;
  color: #dc2626;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
}
.adj-del:hover { background: #fee2e2; border-radius: 6px; }

/* ---------- 校验框 ---------- */
.warn-box {
  margin-top: 14px;
  border-radius: 10px;
  padding: 12px 16px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  font-size: 13px;
}
.warn-box.ok {
  background: #f0fdf4;
  border-color: #86efac;
  color: var(--ok);
}
.warn-error { color: var(--err); }
.warn-warn { color: var(--warn); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; margin-top: 6px; }
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}
.tbl th, .tbl td {
  border: 1px solid var(--border);
  padding: 7px 10px;
  text-align: left;
}
.tbl thead th {
  background: #f1f5f9;
  font-weight: 600;
  color: #334155;
}
.tbl tbody tr:nth-child(even) { background: #fafbfc; }
.tbl tbody tr:hover { background: #eff6ff; }
.tbl .num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .strong { font-weight: 700; }
.tbl .row-total td {
  background: #eef2f7;
  font-weight: 700;
  border-top: 2px solid #94a3b8;
}
.name-cell { font-weight: 600; }

/* 报表表头分组 */
.tbl-report thead th { text-align: center; }
.tbl-report th.grp { border-bottom: 1px solid var(--border); }
.tbl-report thead tr:first-child th { border-bottom: none; }
.tbl-report thead tr:last-child th { background: #f8fafc; }

/* 报表第一列(机构名)居中, 其余数据列靠右 */
.tbl-report td.name-cell { text-align: center; }

/* 输入表 */
.tbl input {
  width: 100%;
  min-width: 90px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 13px;
  font-family: inherit;
  background: transparent;
  color: var(--text);
}
.tbl input:hover { border-color: #cbd5e1; background: #fff; }
.tbl input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 2px rgba(37, 99, 235, .15); }
.tbl .name-cell input { font-weight: 600; }
.tbl td.num input { text-align: right; }

/* 同比列右对齐(渲染层已加 num class, 此处兜底) */
.tbl-report td:has(.yoy) { text-align: right; }

/* 达成率颜色 */
/* 达成率颜色: 红色为佳(≥100%), 琥珀居中, 绿色不佳(<60%) */
.c-ach-hi { color: var(--err); font-weight: 700; }
.c-ach-mid { color: #b45309; font-weight: 700; }
.c-ach-lo { color: var(--ok); font-weight: 700; }

/* 同比 */
.yoy { font-weight: 600; }
.yoy.up { color: var(--up); }
.yoy.down { color: var(--down); }

/* 报表截图2: 隐藏「受理未成立」列(最后一列) */
.tbl-report.hide-unsettled th:last-child,
.tbl-report.hide-unsettled td:last-child { display: none; }

/* 达成率进度条 */
.pbar {
  width: 100px;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
  overflow: hidden;
}
.pbar-fill { height: 100%; border-radius: 4px; }
.fill-hi { background: var(--err); }
.fill-mid { background: var(--warn); }
.fill-lo { background: var(--ok); }

/* 标签 */
.tag {
  font-size: 11px;
  background: #eff6ff;
  color: var(--primary);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 4px;
}
.tag-light {
  font-size: 11px;
  font-weight: 400;
  background: #f1f5f9;
  color: var(--muted);
  border-radius: 4px;
  padding: 2px 8px;
}

/* 元信息条 */
.meta-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
  margin: 10px 0 4px;
}
.meta-bar strong { color: var(--text); }
.meta-bar-2 { margin-top: 10px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin: 0 2px; }
.dot-hi { background: var(--err); }
.dot-mid { background: var(--warn); }
.dot-lo { background: var(--ok); }

/* ---------- 图表 ---------- */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.chart-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}
.chart { width: 100%; height: 300px; }
.chart-wide { grid-column: 1 / -1; }
.chart-wide .chart { height: 320px; }

/* ---------- 导出 ---------- */
.export-btns { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.adj-box {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.adj-box input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  width: 300px;
}
.adj-chip {
  display: inline-block;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  margin-right: 6px;
}
.hint { font-size: 12px; color: var(--muted); }

/* ---------- 页脚 / Toast ---------- */
.foot { text-align: center; padding: 14px 0 26px; font-size: 12px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  background: #0f172a;
  color: #fff;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  z-index: 99;
  max-width: 90vw;
}

/* ---------- 打印(仅业务速报) ---------- */
@media print {
  .topbar, .steps, #importCard, #inputCard, #dailyCard, #chartCard, #exportArea,
  .adj-editor, #toast, footer, .export-btns { display: none !important; }
  body { background: #fff; }
  .container { padding: 0; max-width: 100%; }
  #reportCard { border: none; box-shadow: none; padding: 0; break-inside: avoid; }
  #reportCard h2 { font-size: 18px; margin-bottom: 8px; }
  #reportCard .desc { margin-bottom: 8px; }
  .tbl-report { font-size: 11px; }
  .tbl-report th, .tbl-report td { padding: 5px 8px; }
  @page { size: A4 landscape; margin: 12mm; }
}

/* ---------- 小屏 ---------- */
@media (max-width: 820px) {
  .chart-grid { grid-template-columns: 1fr; }
  .hidden-mobile { display: none; }
}
