:root {
  --sidebar-width: 280px;
  --bg-page: #f0f2f5;
  --bg-sidebar: #ffffff;
  --border: #f0f0f0;
  --text: #262626;
  --text-secondary: #595959;
  --active: #1890ff;
  --hover-bg: #f5f5f5;
  --font: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-page);
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* —— 侧栏 —— */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 12px 0;
  overflow-y: auto;
}

.side-menu {
  display: flex;
  flex-direction: column;
}

.menu-group {
  display: flex;
  flex-direction: column;
}

.menu-children {
  display: flex;
  flex-direction: column;
}

.menu-children[hidden] {
  display: none;
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.menu-item:hover {
  background: var(--hover-bg);
  color: var(--text);
}

.menu-item__main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.menu-icon {
  display: inline-flex;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: inherit;
}

.menu-icon svg {
  width: 100%;
  height: 100%;
}

.menu-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 层级缩进：对齐图2 */
.level-1 {
  padding-left: 20px;
  font-weight: 500;
}

.level-2 {
  padding-left: 36px;
}

.level-3 {
  padding-left: 52px;
}

.level-4 {
  padding-left: 68px;
}

/* 展开箭头：展开朝上，收起朝下 */
.menu-arrow {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.55;
  transition: transform 0.2s ease;
}

.menu-group.is-open > .menu-item[data-toggle] > .menu-arrow {
  transform: rotate(-135deg);
  margin-top: 4px;
}

/* 选中态：蓝色文字 + 图标，文字下划线（对齐图2） */
.menu-item.is-active {
  color: var(--active);
  background: transparent;
}

.menu-item.is-active .menu-label {
  border-bottom: 1px solid var(--active);
  padding-bottom: 1px;
}

.menu-item.is-active:hover {
  color: var(--active);
  background: var(--hover-bg);
}

/* —— 右侧内容区（预览用） —— */
.content {
  flex: 1;
  min-width: 0;
  padding: 24px 32px;
}

.content-header h1 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}

.content-header p {
  margin: 0 0 24px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.content-body {
  padding: 24px;
  background: #fff;
  border-radius: 4px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
}

.content-body--tabs {
  padding: 0;
}

.page-panel[hidden] {
  display: none;
}

/* —— Tab（排放数据报表·集团/区域） —— */
.page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 0 24px;
  border-bottom: 1px solid #e8e8e8;
}

.page-tabs[hidden],
.quota-tabs[hidden] {
  display: none !important;
}

.page-tab {
  position: relative;
  margin: 0;
  padding: 16px 4px;
  margin-right: 32px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  cursor: pointer;
  transition: color 0.15s ease;
}

.page-tab:hover {
  color: var(--active);
}

.page-tab.is-active {
  color: var(--active);
  font-weight: 500;
}

.page-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--active);
}

.page-tab-panels {
  padding: 24px;
}

.page-tab-panel[hidden] {
  display: none;
}

.tab-placeholder {
  margin: 0;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.data-source-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 20px;
  padding: 18px 20px;
  background: #f0f5ff;
  border: 1px solid #d6e4ff;
  border-radius: 6px;
}

.data-source-bar__main {
  flex: 1;
  min-width: 240px;
}

.data-source-bar__main strong {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  color: #1a1a1a;
}

.data-source-bar__main p {
  margin: 0;
  max-width: 720px;
  font-size: 16px;
  line-height: 1.7;
  color: #595959;
}

.data-source-bar__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.update-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 4px;
  background: #1677ff;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}

.update-time {
  font-size: 15px;
  line-height: 1.5;
  color: #595959;
}

.filter-bar--inline {
  margin-bottom: 16px;
}

.status-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 15px;
  line-height: 1.4;
  white-space: nowrap;
}

.status-tag--ok {
  background: #f6ffed;
  color: #389e0d;
  border: 1px solid #b7eb8f;
}

.page-tab-panel .table-wrap {
  max-height: calc(100vh - 420px);
}

.table-wrap--wide {
  max-height: calc(100vh - 420px);
  border: 1px solid #e5e8ef;
  border-radius: 4px;
  background: #fff;
}

.report-table--monthly {
  min-width: 4800px;
  width: max-content;
  table-layout: fixed;
  font-size: 15px;
  border-collapse: separate;
  border-spacing: 0;
}

.report-table--monthly th,
.report-table--monthly td {
  padding: 12px 10px;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
  min-width: 110px;
  vertical-align: middle;
  border: 1px solid #e5e8ef;
  color: #1a1a1a;
  line-height: 1.45;
}

.report-table--monthly thead th {
  background: #f5f7fb !important;
  color: #1a1a1a !important;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.45;
  border-color: #dce3ee;
  position: sticky;
  z-index: 3;
  text-align: center;
  white-space: normal;
  word-break: keep-all;
  min-width: 108px;
}

.report-table--monthly thead th br {
  content: "";
}

.report-table--monthly thead tr:first-child th {
  top: 0;
  height: 48px;
}

.report-table--monthly thead tr:nth-child(2) th {
  top: 48px;
  z-index: 2;
  background: #eef2f8 !important;
  color: #1a1a1a !important;
  min-width: 120px;
}

.report-table--monthly thead tr:nth-child(3) th {
  top: 96px;
  z-index: 2;
  background: #f7f9fc !important;
  color: #1a1a1a !important;
  font-size: 14px;
  min-width: 120px;
  max-width: 160px;
  white-space: normal;
  word-break: keep-all;
  line-height: 1.35;
}

.report-table--monthly .sticky-col {
  position: sticky;
  z-index: 4;
}

.report-table--monthly thead .sticky-col {
  background: #f5f7fb !important;
  color: #1a1a1a !important;
  z-index: 6;
  box-shadow: 2px 0 0 #dce3ee;
}

.report-table--monthly tbody .sticky-col {
  background: #fff !important;
  z-index: 2;
  color: #1a1a1a;
  box-shadow: 2px 0 0 #eef0f4;
}

.report-table--monthly tbody tr:nth-child(even) .sticky-col {
  background: #fafbfd !important;
}

.report-table--monthly .sticky-col-1 {
  left: 0;
  min-width: 160px;
  width: 160px;
  max-width: 160px;
  white-space: normal;
  word-break: keep-all;
}

.report-table--monthly .sticky-col-2 {
  left: 160px;
  min-width: 260px;
  width: 260px;
  max-width: 260px;
  text-align: left;
  white-space: normal;
  word-break: keep-all;
}

.report-table--monthly .sticky-col-3 {
  left: 420px;
  min-width: 120px;
  width: 120px;
  max-width: 120px;
  white-space: nowrap;
}

.report-table--monthly thead .sticky-col-3 {
  z-index: 6;
}

.report-table--monthly .row-total td {
  font-weight: 600;
  background: #f3f6fb;
}

.report-table--monthly .row-total .sticky-col {
  background: #f3f6fb !important;
}

.report-table--monthly td {
  text-align: center;
}

/* —— 企业报表筛选 + 表格 —— */
.content-body--report {
  padding: 20px 24px 24px;
}

.filter-bar {
  margin-bottom: 16px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid #eef0f4;
  border-radius: 6px;
}

.filter-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 24px;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 200px;
}

.filter-label {
  font-size: 16px;
  line-height: 1.5;
  color: #1a1a1a;
  font-weight: 500;
}

.filter-control {
  height: 40px;
  min-width: 220px;
  max-width: 320px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  background: #fff;
  font: inherit;
  font-size: 16px;
  color: #1a1a1a;
  outline: none;
}

.filter-control:hover,
.filter-control:focus {
  border-color: var(--active);
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 0;
}

.filter-extra {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 18px;
  border-radius: 4px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  cursor: pointer;
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: #1677ff;
  border-color: #1677ff;
  color: #fff;
}

.btn-primary:hover {
  background: #4096ff;
  border-color: #4096ff;
}

.btn-default {
  background: #fff;
  border-color: #d9d9d9;
  color: var(--text);
}

.btn-default:hover {
  color: var(--active);
  border-color: var(--active);
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 280px);
  border: 1px solid #e8e8e8;
  border-radius: 2px;
}

.report-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: #fff;
}

.report-table th,
.report-table td {
  padding: 12px 14px;
  border: 1px solid #e8e8e8;
  vertical-align: middle;
}

.report-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f0f4fa;
  font-weight: 600;
  text-align: center;
  line-height: 1.45;
}

.report-table tbody tr:nth-child(even) {
  background: #fafbfd;
}

.report-table .section-row td {
  font-weight: 600;
  background: #f7f9fc;
}

.col-merged {
  text-align: center;
  font-weight: 500;
}

.section-row .col-merged {
  font-weight: 600;
}

.col-material {
  min-width: 120px;
  text-align: center;
  font-weight: 500;
}

.col-param {
  min-width: 180px;
  text-align: left;
}

.col-unit {
  min-width: 120px;
  text-align: center;
}

.col-num,
.th-dyn {
  min-width: 100px;
  text-align: center;
  color: var(--text-secondary);
}

.th-dyn {
  color: var(--text);
  white-space: nowrap;
}

/* —— 配额报表 —— */
.quota-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.quota-tabs {
  padding: 0;
  border-bottom: 0;
  gap: 8px;
}

.quota-tabs .page-tab {
  margin-right: 16px;
  padding: 10px 4px;
}

.table-wrap--quota {
  max-height: calc(100vh - 420px);
  border: 1px solid #d0d7e2;
}

.table-wrap--quota-enterprise {
  max-height: calc(100vh - 420px);
  border: 1px solid #d0d7e2;
}

.report-table--quota {
  min-width: 1400px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 15px;
}

.report-table--quota-enterprise {
  min-width: 2200px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 15px;
}

.report-table--quota th,
.report-table--quota td,
.report-table--quota-enterprise th,
.report-table--quota-enterprise td {
  padding: 12px 10px;
  border: 1px solid #e8e8e8;
  text-align: center;
  vertical-align: middle;
  line-height: 1.45;
  color: #1a1a1a;
}

.report-table--quota thead th,
.report-table--quota-enterprise thead th {
  background: #f0f4fa;
  color: #1a1a1a;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 2;
}

.report-table--quota .sticky-col-1,
.report-table--quota-enterprise .sticky-col {
  position: sticky;
  z-index: 3;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.06);
}

.report-table--quota .sticky-col-1 {
  left: 0;
  min-width: 240px;
  width: 240px;
  text-align: left;
  background: #f0f4fa;
}

.report-table--quota-enterprise .sticky-col-1 {
  left: 0;
  min-width: 160px;
  width: 160px;
  text-align: left;
  background: #f0f4fa;
}

.report-table--quota-enterprise .sticky-col-2 {
  left: 160px;
  min-width: 240px;
  width: 240px;
  text-align: left;
  background: #f0f4fa;
}

.report-table--quota-enterprise thead .sticky-col {
  z-index: 5;
  background: #f0f4fa;
}

.report-table--quota tbody .sticky-col-1,
.report-table--quota-enterprise tbody .sticky-col {
  background: #fff;
  z-index: 1;
}

.report-table--quota tbody tr:nth-child(even) .sticky-col-1,
.report-table--quota-enterprise tbody tr:nth-child(even) .sticky-col {
  background: #fafbfd;
}

.report-table--quota .row-total td,
.report-table--quota .row-total .sticky-col-1,
.report-table--quota-enterprise .row-total td,
.report-table--quota-enterprise .row-total .sticky-col {
  font-weight: 600;
  background: #f3f6fb !important;
}

/* —— 分页 —— */
.pagination {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  padding: 4px 0;
}

.pagination-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
}

.pagination-total em {
  font-style: normal;
  font-weight: 600;
  margin: 0 2px;
}

.pagination-size {
  height: 32px;
  padding: 0 8px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  background: #fff;
  font: inherit;
  font-size: 15px;
}

.pagination-pages {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pager-btn,
.pager-num {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.pager-btn:hover,
.pager-num:hover {
  color: var(--active);
  border-color: var(--active);
}

.pager-num.is-active {
  color: #fff;
  background: #1677ff;
  border-color: #1677ff;
}

.pager-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pager-jump {
  width: 48px;
  height: 32px;
  padding: 0 6px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  text-align: center;
  font: inherit;
  font-size: 15px;
}

@media (max-width: 1100px) {
  .filter-item {
    min-width: 160px;
  }

  .filter-control {
    min-width: 180px;
  }
}

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    max-height: 50vh;
  }
}
