:root {
  --navy: #102a4c;
  --navy-2: #1f3864;
  --blue: #2e75b6;
  --teal: #138a7b;
  --orange: #d98217;
  --red: #c0504d;
  --ink: #17263b;
  --muted: #6b7c93;
  --line: #e3e9f2;
  --bg: #f3f6fb;
  --card: #ffffff;
  --soft: #f8fafd;
  --shadow: 0 8px 24px rgba(16, 42, 76, 0.06);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 420px at 8% -8%, #e8f0fb 0%, transparent 60%),
    radial-gradient(900px 320px at 96% 0%, #eef7f4 0%, transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, select, input { font-family: inherit; }

.app {
  max-width: 1580px;
  margin: 0 auto;
  padding: 18px 20px 28px;
}

/* ---------------- top bar ---------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px;
  border-radius: 20px;
  color: #fff;
  background:
    radial-gradient(700px 220px at 90% -30%, rgba(94, 157, 214, 0.55), transparent 65%),
    linear-gradient(135deg, #0c1d38 0%, #17345c 55%, #24527f 100%);
  box-shadow: 0 18px 40px rgba(12, 29, 56, 0.22);
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 21px;
  color: #102a4c;
  background: linear-gradient(135deg, #dce9f9, #9cc3ea);
  box-shadow: inset 0 1px 0 #fff, 0 8px 18px rgba(0, 0, 0, 0.18);
}

.brand h1 {
  margin: 0;
  font-size: 21px;
  letter-spacing: 0.5px;
  font-weight: 700;
}

.brand p {
  margin: 4px 0 0;
  color: #b9cbe2;
  font-size: 12.5px;
  letter-spacing: 0.3px;
}

.top-badges { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.badge {
  font-size: 11.5px;
  color: #dbe8f7;
  border: 1px solid rgba(219, 232, 247, 0.28);
  background: rgba(255, 255, 255, 0.07);
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-accent {
  color: #102a4c;
  border-color: transparent;
  background: #c8e3d8;
  font-weight: 700;
}

/* ---------------- layout ---------------- */
.layout {
  display: grid;
  grid-template-columns: 302px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.side-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.side-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.side-title {
  font-size: 12px;
  font-weight: 700;
  color: #334a66;
  letter-spacing: 1px;
  margin-bottom: 9px;
}

.side-title-row .side-title { margin-bottom: 9px; }

.side-mini { font-size: 11px; color: var(--muted); }

.select {
  width: 100%;
  border: 1px solid #d7e1ee;
  background: #fbfdff;
  color: var(--ink);
  border-radius: 9px;
  padding: 9px 10px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(46, 117, 182, 0.12); }

.select-inline { width: auto; min-width: 190px; }

.side-hint {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.55;
  color: #8796a9;
}

.chip-tools {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.mini-btn {
  border: 1px solid #dbe4f0;
  background: #f8fbff;
  color: #46617f;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 11px;
  cursor: pointer;
  transition: 0.15s ease;
  white-space: nowrap;
}

.mini-btn:hover { border-color: #9db9d8; background: #eef5fc; color: var(--navy); }
.mini-btn:active { transform: translateY(1px); }

.model-chips { display: flex; flex-direction: column; gap: 6px; }

.model-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid #e4ebf5;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  transition: 0.14s ease;
  user-select: none;
}

.model-chip:hover { border-color: #b9cce3; background: #f9fcff; }

.model-chip.selected {
  border-color: var(--chip);
  background: var(--chip-bg);
  box-shadow: inset 3px 0 0 var(--chip);
}

.model-chip.disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.chip-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--chip);
  flex: 0 0 auto;
  box-shadow: 0 0 0 3px var(--chip-bg);
}

.chip-name {
  font-size: 11.8px;
  color: #2d425c;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
}

.chip-id {
  font-size: 10px;
  color: #8fa0b4;
  font-variant-numeric: tabular-nums;
}

.chip-role {
  font-size: 9.5px;
  color: #7b8ba1;
  border: 1px solid #e4ebf5;
  padding: 1px 4px;
  border-radius: 4px;
  white-space: nowrap;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: #40556e;
  padding: 4px 0;
  cursor: pointer;
}

.check-row input { accent-color: var(--blue); }

.side-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.side-stat {
  background: #f7fafd;
  border: 1px solid #edf2f8;
  border-radius: 8px;
  padding: 7px 8px;
}

.side-stat .k { font-size: 10px; color: #8b9aad; }
.side-stat .v { font-size: 13px; font-weight: 700; color: #223a56; margin-top: 2px; font-variant-numeric: tabular-nums; }

.side-note {
  font-size: 11px;
  line-height: 1.65;
  color: #7b8ba0;
  background: #f8fafd;
  border: 1px dashed #dbe5f1;
  border-radius: 12px;
  padding: 11px 12px;
}

.side-note b { color: #445d7a; }

/* ---------------- tabs ---------------- */
.main { min-width: 0; }

.tabs {
  display: flex;
  gap: 5px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 15px;
  overflow-x: auto;
  position: sticky;
  top: 10px;
  z-index: 30;
  backdrop-filter: blur(8px);
}

.tab-btn {
  border: 0;
  background: transparent;
  color: #5d7189;
  font-size: 12.5px;
  padding: 9px 15px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.15s ease;
}

.tab-btn:hover { background: #f0f5fb; color: #24415f; }

.tab-btn.active {
  background: var(--navy-2);
  color: #fff;
  box-shadow: 0 6px 14px rgba(31, 56, 100, 0.24);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

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

/* ---------------- cards ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px 14px;
  box-shadow: var(--shadow);
  margin-bottom: 15px;
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.card-head h2 {
  margin: 0;
  font-size: 14.5px;
  color: #183252;
  letter-spacing: 0.2px;
}

.card-head p {
  margin: 4px 0 0;
  font-size: 11.5px;
  color: #8190a4;
  line-height: 1.5;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 15px;
}

.grid-2 > .card { margin-bottom: 0; }

.section-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 6px 2px 10px;
}

.section-title h2 { margin: 0; font-size: 14.5px; color: #183252; }
.section-title span { font-size: 11.5px; color: #8190a4; }

/* ---------------- KPI ---------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 15px;
}

.kpi {
  background: linear-gradient(180deg, #fff, #fbfdff);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 13px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.kpi .label { font-size: 10.5px; color: #8493a6; letter-spacing: 0.3px; }
.kpi .value {
  margin-top: 5px;
  font-size: 22px;
  font-weight: 700;
  color: #143052;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.kpi .value small { font-size: 11px; font-weight: 500; color: #7d8da1; margin-left: 2px; }
.kpi .sub { margin-top: 4px; font-size: 10.5px; color: #8a99ac; }
.kpi.alert .value { color: var(--orange); }
.kpi.good .value { color: var(--teal); }

/* ---------------- charts ---------------- */
.chart-wrap { position: relative; width: 100%; min-height: 300px; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }

.chart-tip {
  position: absolute;
  z-index: 50;
  min-width: 150px;
  max-width: 260px;
  background: rgba(13, 32, 58, 0.94);
  color: #eaf2fb;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.55;
  pointer-events: none;
  box-shadow: 0 10px 24px rgba(8, 24, 46, 0.25);
  opacity: 0;
  transition: opacity 0.1s ease;
}

.chart-tip.show { opacity: 1; }
.chart-tip .tip-title { font-weight: 700; color: #fff; margin-bottom: 3px; }
.chart-tip .tip-row { display: flex; justify-content: space-between; gap: 14px; }
.chart-tip .tip-row span:last-child { font-variant-numeric: tabular-nums; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 13px;
  justify-content: flex-end;
  max-width: 62%;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #5b6d84;
  white-space: nowrap;
}

.legend-swatch { width: 14px; height: 3px; border-radius: 2px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }

/* ---------------- insight ---------------- */
.insight-card { background: linear-gradient(180deg, #fff, #fbfdff); }

.insight-body {
  font-size: 12.5px;
  line-height: 1.9;
  color: #3b5069;
  padding: 2px 2px 4px;
}

.insight-body b { color: #142f50; }

.insight-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.insight-pill {
  font-size: 10.5px;
  color: #47617e;
  background: #f1f6fc;
  border: 1px solid #e0eaf6;
  border-radius: 999px;
  padding: 3px 8px;
}

.insight-pill.warn { color: #9a5b0b; background: #fff7e8; border-color: #f3dfb8; }

/* ---------------- model cards ---------------- */
.model-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 11px;
}

.model-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px 13px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.mc-head { display: flex; align-items: center; gap: 7px; }
.mc-dot { width: 8px; height: 8px; border-radius: 50%; }
.mc-name { font-size: 12.5px; font-weight: 700; color: #1e3652; }
.mc-tag {
  margin-left: auto;
  font-size: 9.5px;
  color: #71839a;
  border: 1px solid #e5ecf5;
  border-radius: 4px;
  padding: 1px 5px;
}

.mc-formula {
  margin-top: 7px;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 10.5px;
  color: #5d7590;
  background: #f8fafd;
  border: 1px solid #edf2f8;
  border-radius: 6px;
  padding: 5px 7px;
  overflow-wrap: anywhere;
}

.mc-note { margin-top: 7px; font-size: 11px; color: #6f8197; line-height: 1.55; }

.mc-metrics {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #e9eff7;
  font-size: 10.5px;
  color: #526b87;
}

.mc-metrics b { color: #183252; font-variant-numeric: tabular-nums; }

.mc-error {
  margin-top: 8px;
  font-size: 11px;
  color: #a4551a;
  background: #fff7e8;
  border: 1px solid #f3dfb8;
  border-radius: 6px;
  padding: 6px 7px;
}

/* ---------------- metric bars ---------------- */
.metric-tabs { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }

.metric-btn {
  border: 1px solid #dbe5f1;
  background: #f8fbff;
  color: #4f6784;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 11px;
  cursor: pointer;
}

.metric-btn.active { background: var(--navy-2); color: #fff; border-color: var(--navy-2); }

.bar-list { padding: 6px 2px 2px; }

.bar-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) 88px;
  gap: 10px;
  align-items: center;
  padding: 5px 0;
}

.bar-name { font-size: 11.5px; color: #405873; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-name b { color: #1c3553; }
.bar-track { height: 9px; background: #eef3fa; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; transition: width 0.35s ease; }
.bar-value { font-size: 11.5px; color: #2d4663; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------- table ---------------- */
.table-wrap { overflow: auto; max-height: 560px; border: 1px solid #edf2f8; border-radius: 10px; }

table { border-collapse: collapse; width: 100%; font-size: 11.8px; }

th, td {
  padding: 9px 10px;
  border-bottom: 1px solid #eef3f9;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f7fafd;
  color: #5d7189;
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.2px;
}

th:first-child, td:first-child { text-align: left; }
tbody tr:hover { background: #fbfdff; }
td.best { color: #0e6b4f; font-weight: 700; background: #eefaf4; }
td.neg { color: #b04a42; }
.rank-badge {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #eef3fa;
  color: #526b87;
  font-size: 10px;
  font-weight: 700;
}
.rank-badge.top { background: #dff3ea; color: #0e6b4f; }

.metric-note {
  margin-top: 9px;
  font-size: 11px;
  color: #7b8ba0;
  line-height: 1.7;
}

.model-cell { display: flex; align-items: center; gap: 7px; }
.model-cell .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.model-cell small { color: #8a99ac; font-size: 9.5px; }

/* ---------------- residual ---------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 15px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 11px 13px;
  box-shadow: var(--shadow);
}

.stat-card .k { font-size: 10.5px; color: #8493a6; }
.stat-card .v { margin-top: 4px; font-size: 19px; font-weight: 700; color: #143052; font-variant-numeric: tabular-nums; }
.stat-card .s { margin-top: 2px; font-size: 10px; color: #8a99ac; }

/* ---------------- footer ---------------- */
.footer {
  margin-top: 8px;
  padding: 12px 4px 2px;
  font-size: 10.5px;
  color: #92a0b2;
  text-align: center;
  line-height: 1.6;
}

/* ---------------- empty ---------------- */
.empty {
  padding: 30px 16px;
  text-align: center;
  color: #8a99ac;
  font-size: 12px;
  border: 1px dashed #dbe5f1;
  border-radius: 12px;
  background: #fbfdff;
}

/* ---------------- responsive ---------------- */
@media (max-width: 1250px) {
  .layout { grid-template-columns: 270px minmax(0, 1fr); }
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .grid-2 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .legend { max-width: 100%; justify-content: flex-start; }
  .card-head { flex-direction: column; gap: 8px; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .top-badges { justify-content: flex-start; }
}

@media (max-width: 620px) {
  .app { padding: 12px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar-row { grid-template-columns: 88px minmax(0, 1fr) 72px; }
  .brand h1 { font-size: 17px; }
  .tab-btn { padding: 8px 11px; }
}


/* 隐藏托管平台自动追加的 About this page 面板，避免影响报告截图 */
#__bp_about { display: none !important; }
