:root { --accent: #1a5fb4; --border: #333; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "SimSun", sans-serif;
  background: #f0f2f5; color: #222; font-size: 14px;
}

/* 工具栏 */
.toolbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  padding: 10px 16px; background: #fff; border-bottom: 1px solid #e2e2e2;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.toolbar .row { display: flex; align-items: center; gap: 6px; }
.toolbar label { color: #666; font-size: 13px; white-space: nowrap; }
.toolbar label.chk { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.toolbar label.chk input { cursor: pointer; }
select {
  padding: 6px 8px; border: 1px solid #ccc; border-radius: 4px; background: #fff;
  font-size: 13px; min-width: 90px;
}
.seg { display: flex; border: 1px solid #ccc; border-radius: 4px; overflow: hidden; }
.seg button {
  border: 0; background: #fff; padding: 6px 14px; cursor: pointer; font-size: 13px;
  color: #444; border-right: 1px solid #eee;
}
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--accent); color: #fff; }
button.export {
  padding: 7px 16px; background: var(--accent); color: #fff; border: 0;
  border-radius: 4px; cursor: pointer; font-size: 13px;
}
button.export:hover { opacity: .9; }

/* 页签 */
.tabs { display: flex; gap: 4px; padding: 10px 16px 0; background: #fff; border-bottom: 1px solid #e2e2e2; }
.tabs button {
  border: 0; background: transparent; padding: 9px 18px; cursor: pointer; font-size: 14px;
  color: #555; border-bottom: 2px solid transparent;
}
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* 报表区 */
.report-wrap { padding: 18px 16px 40px; }
.report {
  background: #fff; border: 1px solid #ddd; border-radius: 2px; padding: 24px 28px;
  max-width: 1120px; margin: 0 auto;
}
/* 报表标题与表头信息 */
.report-title {
  position: relative; text-align: center; font-size: 20px; font-weight: 600;
  margin-bottom: 10px;
}
.report-title .code { position: absolute; right: 0; top: 0.35em; font-size: 13px; font-weight: 400; color: #333; }
.report-head { font-size: 13px; margin-bottom: 12px; }
.report-head .head-row { display: flex; justify-content: space-between; padding: 1px 0; }
.report-head .head-row span { white-space: nowrap; }

.report table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report th, .report td {
  border: 1px solid #333; padding: 5px 8px; text-align: right;
}
.report th { background: #fafafa; text-align: center; font-weight: 600; }
.report td.item { text-align: left; }
.report td.item.indent { padding-left: 26px; }
.report td.rownum { text-align: center; color: #333; }
.report tr.section td { text-align: left; font-weight: 600; background: #f7f7f7; }
.report tr.bold td { font-weight: 700; background: #fbfbfb; }
.report td.num { font-variant-numeric: tabular-nums; }
.report .loading { text-align: center; color: #999; padding: 40px; }

/* 资产负债表左右两栏 */
.balance-cols { display: flex; gap: 0; align-items: flex-start; }
.balance-cols table { width: 50%; min-width: 0; }
.balance-cols .coltitle { text-align: center; font-weight: 700; }
.balance-cols tr.blank td { height: 1.6em; }

@media (max-width: 640px) {
  .report { padding: 14px 10px; }
  .report th, .report td { padding: 4px 5px; font-size: 12px; }
  .balance-cols { flex-direction: column; }
  .balance-cols table { width: 100%; }
  .toolbar { gap: 8px; padding: 8px 10px; }
  .toolbar .row { gap: 4px; }
}

/* 数据追踪 */
.report td.num.trace { cursor: pointer; color: var(--accent, #2b6cb0); }
.report td.num.trace:hover { background: #eef4fb; text-decoration: underline; }

.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 90;
}
.drawer-overlay.show { opacity: 1; pointer-events: auto; }

.trace-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 680px; max-width: 94vw;
  background: #fff; box-shadow: -2px 0 12px rgba(0,0,0,.15); z-index: 91;
  transform: translateX(100%); transition: transform .22s ease; display: flex; flex-direction: column;
}
.trace-drawer.show { transform: translateX(0); }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid #e2e2e2; font-size: 16px; font-weight: 600;
}
.drawer-head .trace-sub { font-size: 12px; color: #999; font-weight: 400; margin-left: 8px; }
.drawer-head button {
  border: 0; background: transparent; font-size: 26px; line-height: 1; cursor: pointer; color: #666;
}
.drawer-head button:hover { color: #b3261e; }

.drawer-body { flex: 1; overflow: auto; padding: 12px 18px 20px; }
.drawer-body .loading { text-align: center; color: #999; padding: 40px 0; }
.trace-count { font-size: 12px; color: #888; margin: 4px 0 10px; }
.trace-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.trace-table th, .trace-table td { border: 1px solid #ddd; padding: 5px 8px; text-align: right; }
.trace-table th { background: #f7f7f7; text-align: center; font-weight: 600; position: sticky; top: 0; }
.trace-table td.l { text-align: left; }
.trace-table td { font-variant-numeric: tabular-nums; }
.trace-code { color: #999; font-size: 11px; margin-left: 4px; }
.trace-table tr.total td { background: #f5f5f5; font-weight: 700; }
.rc-tag { font-size: 11px; padding: 1px 6px; border-radius: 3px; margin-left: 6px; white-space: nowrap; }
.rc-tag.out { background: #fdecea; color: #c0392b; }
.rc-tag.in { background: #e8f5e9; color: #1e7e34; }