:root {
  --bg: #070d1a;
  --bg-elev: #0e1730;
  --panel: #121c38;
  --panel-2: #182448;
  --ink: #eef3ff;
  --muted: #8fa0c2;
  --line: rgba(120, 160, 255, 0.16);
  --line-strong: rgba(120, 160, 255, 0.28);
  --accent: #2f7dff;
  --accent-soft: rgba(47, 125, 255, 0.18);
  --accent-2: #7b61ff;
  --good: #31d0aa;
  --warn: #ff8a3d;
  --gold: #f5c542;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --radius: 12px;
  --radius-sm: 8px;
  --font-display: "Noto Sans SC", "PingFang SC", sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: var(--font-body);
  background: var(--bg);
  line-height: 1.5;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 40% at 8% 0%, rgba(47, 125, 255, 0.18), transparent 55%),
    radial-gradient(ellipse 45% 35% at 92% 8%, rgba(123, 97, 255, 0.14), transparent 50%),
    linear-gradient(180deg, #0a1226 0%, var(--bg) 45%, #060a14 100%);
  z-index: 0;
}

.top,
main,
.foot,
.modules {
  position: relative;
  z-index: 1;
  width: min(1280px, calc(100% - 2rem));
  margin-inline: auto;
  transition: width 0.25s ease;
}

body[data-tab="mingxi"] .top,
body[data-tab="mingxi"] main,
body[data-tab="mingxi"] .foot,
body[data-tab="mingxi"] .modules,
body[data-tab="chengzhang"] .top,
body[data-tab="chengzhang"] main,
body[data-tab="chengzhang"] .foot,
body[data-tab="chengzhang"] .modules,
body[data-module="peisongfei"][data-tab="ps-mingxi"] .top,
body[data-module="peisongfei"][data-tab="ps-mingxi"] main,
body[data-module="peisongfei"][data-tab="ps-mingxi"] .foot,
body[data-module="peisongfei"][data-tab="ps-mingxi"] .modules,
body[data-module="butie"][data-tab="bt-mingxi"] .top,
body[data-module="butie"][data-tab="bt-mingxi"] main,
body[data-module="butie"][data-tab="bt-mingxi"] .foot,
body[data-module="butie"][data-tab="bt-mingxi"] .modules,
body[data-module="xinjieti"][data-tab="xj-mingxi"] .top,
body[data-module="xinjieti"][data-tab="xj-mingxi"] main,
body[data-module="xinjieti"][data-tab="xj-mingxi"] .foot,
body[data-module="xinjieti"][data-tab="xj-mingxi"] .modules {
  width: min(1560px, calc(100% - 1.25rem));
}

/* —— Header —— */
.top {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.25rem;
  align-items: center;
  padding: 1.4rem 0 1rem;
  animation: rise 0.55s ease both;
}

.eyebrow {
  margin: 0 0 0.3rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2.8vw, 2.05rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: #fff;
}

.tagline {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 0.65rem;
  animation: rise 0.55s ease 0.06s both;
}

.date-field,
.upload-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 160px;
  font-size: 0.72rem;
  color: var(--muted);
}

.upload-field input[type="file"] {
  border: 1px solid var(--line-strong);
  background: rgba(15, 28, 58, 0.85);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  font: inherit;
  font-size: 0.78rem;
  color: var(--ink);
  cursor: pointer;
}

.upload-field input[type="file"]::file-selector-button {
  border: 0;
  background: var(--accent-soft);
  color: #cfe0ff;
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  margin-right: 0.55rem;
  font: inherit;
  cursor: pointer;
}

.upload-msg {
  color: var(--good) !important;
  max-width: 260px;
  text-align: right;
}

.date-field select {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: rgba(15, 28, 58, 0.9)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238fa0c2' d='M1 1l5 5 5-5'/%3E%3C/svg%3E")
    right 0.75rem center / 12px no-repeat;
  border-radius: var(--radius-sm);
  padding: 0.55rem 2rem 0.55rem 0.8rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
}

.meta {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  width: 100%;
  text-align: right;
}

/* —— Primary module tabs —— */
.modules {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0 auto 1rem;
  padding: 0.15rem 0 0.35rem;
}

.module {
  border: 1px solid var(--line);
  background: var(--panel);
  color: #c5d2ef;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.7rem 1.15rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.module:hover {
  border-color: var(--line-strong);
  color: #fff;
  background: var(--panel-2);
}

.module.active {
  color: #fff;
  background: linear-gradient(180deg, #3a8bff 0%, #226ef0 100%);
  border-color: transparent;
  box-shadow: 0 8px 22px rgba(34, 110, 240, 0.35);
}

.module-view[hidden] {
  display: none !important;
}

.filter-note {
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(18, 28, 56, 0.7);
  color: var(--muted);
  font-size: 0.8rem;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  animation: rise 0.55s ease 0.1s both;
}

@media (max-width: 1100px) {
  .dash-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.dash-card {
  background: linear-gradient(180deg, rgba(24, 36, 72, 0.95), rgba(14, 23, 48, 0.95));
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 1rem 1.05rem 0.95rem;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  text-align: left;
  color: inherit;
  font: inherit;
  width: 100%;
}

.dash-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.4);
}

.dash-card.empty {
  opacity: 0.55;
  cursor: default;
}

.dash-card.empty:hover {
  transform: none;
}

.dash-card-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.dash-card-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: #fff;
}

.dash-card-sub {
  margin: 0.2rem 0 0;
  font-size: 0.74rem;
  color: var(--muted);
}

.dash-card-go {
  flex: 0 0 auto;
  font-size: 0.72rem;
  color: #9ec2ff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  white-space: nowrap;
}

.dash-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem 0.75rem;
}

.dash-metric {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(120, 160, 255, 0.08);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
}

.dash-metric .m-label {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
}

.dash-metric .m-value {
  display: block;
  margin-top: 0.15rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.dash-metric .m-value.good { color: var(--good); }
.dash-metric .m-value.bad { color: var(--warn); }
.dash-metric.hero {
  grid-column: 1 / -1;
  background: rgba(47, 125, 255, 0.1);
  border-color: rgba(47, 125, 255, 0.22);
}

.dash-metric.hero .m-value {
  font-size: 1.45rem;
}

.dash-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 2.5rem 1rem;
}


/* —— KPI —— */
.kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
  animation: rise 0.55s ease 0.1s both;
}

#kpiSection {
  grid-template-columns: repeat(5, 1fr);
}

#hqKpiSection {
  grid-template-columns: repeat(3, 1fr);
}

.kpi {
  position: relative;
  background: linear-gradient(180deg, rgba(24, 36, 72, 0.95), rgba(14, 23, 48, 0.95));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1rem 0.9rem;
  box-shadow: var(--shadow);
  min-height: 6.6rem;
}

.kpi .label {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
  text-align: center;
}

.kpi .value {
  margin: 0.4rem 0 0;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: center;
  color: #fff;
}

.kpi .sub {
  margin: 0.25rem 0 0;
  font-size: 0.74rem;
  color: var(--muted);
  text-align: center;
}

.kpi-rate {
  position: absolute;
  top: 0.75rem;
  right: 0.85rem;
  text-align: center;
  line-height: 1.05;
}

.kpi-rate-label {
  display: block;
  font-size: 0.66rem;
  color: var(--muted);
}

.kpi-rate-value {
  display: block;
  margin-top: 0.12rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.kpi.good .value,
.kpi.good .kpi-rate-value {
  color: var(--good);
}
.kpi.bad .value,
.kpi.bad .kpi-rate-value {
  color: var(--warn);
}

/* —— Secondary tabs —— */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
  animation: rise 0.55s ease 0.12s both;
}

.tab {
  border: 1px solid var(--line);
  background: rgba(18, 28, 56, 0.75);
  color: var(--muted);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.42rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.tab:hover {
  color: #fff;
  border-color: var(--line-strong);
}

.tab.active {
  color: #fff;
  background: var(--accent-2);
  border-color: transparent;
}

.panel {
  display: none;
  animation: rise 0.4s ease both;
}

.panel.active {
  display: block;
}

.split {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 0.85rem;
}

.xq-split {
  grid-template-columns: 1.35fr 0.85fr;
  margin-bottom: 0.85rem;
}

.cz-block {
  margin-top: 0;
}

/* —— Cards / tables —— */
.table-block {
  background: linear-gradient(180deg, rgba(18, 28, 56, 0.98), rgba(12, 20, 42, 0.98));
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-block > header {
  padding: 0.95rem 1.05rem 0.75rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}

.table-block h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.table-block h2::before {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.45rem;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  vertical-align: 0.05rem;
}

.table-block header p {
  margin: 0.28rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.table-wrap {
  overflow: auto;
  max-height: min(62vh, 640px);
}

.table-wrap.wide-scroll {
  max-height: min(72vh, 760px);
  overscroll-behavior: contain;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
}

.detail-head .hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  text-align: right;
  max-width: 240px;
}

.detail-table,
.interactive-table,
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.86rem;
}

.detail-table {
  width: max-content;
  min-width: 100%;
  font-size: 0.8rem;
}

.detail-table th,
.detail-table td,
.interactive-table th,
.interactive-table td,
th,
td {
  padding: 0.68rem 0.8rem;
  border-bottom: 1px solid rgba(120, 160, 255, 0.1);
  text-align: center !important;
  white-space: nowrap;
  background: transparent;
  color: var(--ink);
}

.detail-table th,
.interactive-table th,
th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #1a2748;
  color: #a9b8d8;
  font-weight: 500;
  font-size: 0.74rem;
  letter-spacing: 0.03em;
}

.interactive-table td.num,
.interactive-table th.num,
.detail-table td.num,
.detail-table th.num,
td.num,
th.num {
  text-align: center !important;
  font-variant-numeric: tabular-nums;
}

.interactive-table td.em {
  font-weight: 700;
  color: #fff;
}

.interactive-table tbody tr:hover td,
.detail-table tbody tr:hover td,
tbody tr:hover {
  background: rgba(47, 125, 255, 0.08);
}

.detail-table th.filterable,
.interactive-table th.filterable {
  overflow: visible;
  max-width: none;
}

.detail-table .th-inner,
.interactive-table .th-inner {
  display: flex;
  align-items: center;
  justify-content: center !important;
  gap: 0.25rem;
  min-width: 0;
}

.detail-table .th-sort-btn,
.interactive-table .th-sort-btn {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  padding: 0;
  cursor: pointer;
  min-width: 0;
  text-align: center !important;
}

.detail-table .th-label,
.interactive-table .th-label {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
}

.detail-table .sort-mark,
.interactive-table .sort-mark {
  color: var(--accent);
  font-size: 0.65rem;
  font-weight: 700;
}

.detail-table th.sort-on .th-sort-btn,
.interactive-table th.sort-on .th-sort-btn {
  color: #fff;
}

.col-filter-btn {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.7rem;
  line-height: 1;
  padding: 0.15rem 0.2rem;
  border-radius: 4px;
}

.col-filter-btn:hover,
.col-filter-btn.active,
.detail-table th.filter-on .col-filter-btn,
.interactive-table th.filter-on .col-filter-btn {
  color: #fff;
  background: var(--accent-soft);
}

.col-filter-menu {
  position: absolute;
  z-index: 50;
  width: 220px;
  max-height: min(360px, 70vh);
  display: none;
  flex-direction: column;
  background: #152246;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  color: var(--ink);
}

.col-filter-menu.open {
  display: flex;
}

.col-filter-menu .filter-search {
  margin: 0.55rem 0.55rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font: inherit;
  font-size: 0.8rem;
  background: #0e1730;
  color: var(--ink);
}

.col-filter-menu .filter-actions {
  display: flex;
  gap: 0.35rem;
  padding: 0 0.55rem 0.35rem;
}

.col-filter-menu .filter-actions button,
.col-filter-menu .filter-apply {
  border: 0;
  background: transparent;
  color: #9ec2ff;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.2rem 0.25rem;
}

.col-filter-menu .filter-list {
  overflow: auto;
  flex: 1;
  padding: 0.15rem 0.4rem 0.4rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  max-height: 220px;
}

.col-filter-menu .filter-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.35rem;
  font-size: 0.78rem;
  cursor: pointer;
  border-radius: 6px;
}

.col-filter-menu .filter-item:hover {
  background: rgba(47, 125, 255, 0.12);
}

.col-filter-menu .filter-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.col-filter-menu .filter-empty {
  margin: 0.6rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.col-filter-menu .filter-footer {
  display: flex;
  justify-content: flex-end;
  padding: 0.4rem 0.55rem 0.5rem;
}

.col-filter-menu .filter-apply {
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font-weight: 600;
}

.detail-table .sticky {
  position: sticky;
  z-index: 3;
  background: #121c38;
  box-shadow: 4px 0 12px rgba(0, 0, 0, 0.25);
}

.detail-table th.sticky {
  z-index: 4;
  background: #1a2748;
}

.detail-table .sticky-id {
  left: 0;
  min-width: 5.5rem;
}

.detail-table .sticky-name {
  left: 5.5rem;
  min-width: 12rem;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-table tbody tr:hover td.sticky {
  background: #1a2a52;
}

.rate {
  display: inline-block;
  min-width: 3.4rem;
  font-weight: 600;
  text-align: center;
}

.rate.good {
  color: var(--good);
}
.rate.bad {
  color: var(--warn);
}

.flag {
  display: inline-block;
  min-width: 1.6rem;
  text-align: center;
  font-weight: 600;
}

.flag.yes {
  color: var(--good);
}
.flag.no {
  color: var(--muted);
}

.empty {
  padding: 3rem 1.2rem;
  text-align: center;
  color: var(--muted);
}

.kpi .label,
.kpi .value,
.kpi .sub {
  text-align: center !important;
}

.foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 0 1.8rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.foot a {
  color: #9ec2ff;
  text-decoration: none;
}

.foot a:hover {
  text-decoration: underline;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .top,
  .split,
  .xq-split,
  .kpis,
  #kpiSection,
  #psKpiSection,
  #btKpiSection,
  #xjKpiSection,
  .dash-grid {
    grid-template-columns: 1fr;
  }

  .controls {
    justify-content: stretch;
  }

  .meta {
    text-align: left;
  }

  .kpis,
  #kpiSection {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .kpis,
  #kpiSection,
  #psKpiSection,
  #btKpiSection,
  #xjKpiSection {
    grid-template-columns: 1fr;
  }

  .top {
    padding-top: 1.1rem;
  }

  .modules {
    gap: 0.4rem;
  }

  .module {
    flex: 1 1 auto;
    text-align: center;
    padding: 0.6rem 0.75rem;
    font-size: 0.82rem;
  }
}
