:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #eaf2ff;
  color: #071833;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #eaf2ff;
}

h1,
h2,
p {
  margin: 0;
}

.page {
  width: min(1500px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 30px 28px 56px;
  background: #fff;
  min-height: 100vh;
}

.dashboard-page {
  box-shadow: 0 0 0 1px rgb(31 94 255 / 4%);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(260px, 1fr);
  align-items: start;
  gap: 24px;
  margin-bottom: 18px;
}

.topbar h1 {
  font-size: 22px;
  line-height: 1.2;
  font-weight: 800;
}

.topbar p,
.topbar-meta {
  color: #7b879a;
  font-size: 13px;
}

.topbar-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.topbar-actions,
.legend-controls,
.date-filter {
  display: flex;
  align-items: center;
  gap: 10px;
}

.month-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid #edf1f7;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgb(16 24 40 / 4%);
}

.month-switch span {
  padding-left: 4px;
  color: #344054;
  font-size: 14px;
}

button,
.button {
  border: 1px solid #2f63f6;
  background: #2f63f6;
  color: #fff;
  border-radius: 4px;
  padding: 9px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.button.secondary {
  background: #fff;
  color: #2f63f6;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #d8dee8;
  border-radius: 4px;
  padding: 8px 12px;
  font: inherit;
  background: #fff;
  color: #071833;
}

select:focus,
input:focus {
  outline: 2px solid rgb(47 99 246 / 20%);
  border-color: #2f63f6;
}

.notice {
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.notice.error {
  background: #fff1f0;
  border: 1px solid #ffccc7;
  color: #a8071a;
}

.leaderboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0 18px;
}

.rank-card,
.panel,
.metric-grid div {
  background: #fff;
  border: 1px solid #e8edf5;
  border-radius: 6px;
}

.rank-card {
  min-height: 210px;
  padding: 16px;
  box-shadow: 0 3px 14px rgb(16 24 40 / 4%);
}

.rank-head,
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.rank-index {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: #edf4ff;
  color: #2f63f6;
  font-weight: 800;
}

.roi-pill {
  color: #0f9f6e;
  background: #edfff7;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 13px;
}

.rank-card h2 {
  margin-top: 12px;
  font-size: 17px;
  line-height: 1.45;
}

.rank-sub {
  margin-top: 8px;
  color: #16a36d;
  font-size: 13px;
}

.rank-bars {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.rank-bars div {
  display: grid;
  grid-template-columns: 42px 1fr 96px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.rank-bars span,
.metric-grid span,
.rank-metrics span {
  color: #526176;
}

.rank-bars i,
.bar-track {
  height: 9px;
  border-radius: 999px;
  background: #edf3fa;
  overflow: hidden;
}

.rank-bars b,
.bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.blue,
.bar-track i {
  background: #1778e8;
}

.green {
  background: #0aa070;
}

.orange {
  background: #dc8a00;
}

.rank-bars strong {
  text-align: right;
  font-size: 13px;
}

.rank-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 14px;
  background: #f8fbff;
  border-radius: 4px;
}

.rank-metrics div {
  padding: 11px 12px;
}

.rank-metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 16px;
}

.empty-card {
  display: grid;
  place-items: center;
  color: #98a2b3;
}

.section-line {
  height: 16px;
  margin: 12px 0 24px;
  border-top: 12px solid #f4f7fb;
}

.control-panel {
  display: grid;
  gap: 20px;
  margin-bottom: 18px;
}

.date-filter {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.date-filter input {
  width: 170px;
}

.filter-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: end;
  gap: 22px;
}

label {
  display: grid;
  gap: 8px;
  color: #071833;
  font-size: 15px;
}

.dimension-tabs {
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: start;
  gap: 18px;
}

.dimension-tabs span {
  border: 1px solid #2f63f6;
  color: #2f63f6;
  padding: 9px 30px;
  border-radius: 0;
}

.overview h2,
.panel h2 {
  font-size: 20px;
  font-weight: 800;
}

.overview h2 {
  margin-bottom: 14px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.dashboard-metrics div {
  min-height: 86px;
  padding: 18px 20px;
  background: #f7f8fa;
  border: none;
}

.dashboard-metrics .tint-blue {
  background: #f0f4ff;
}

.dashboard-metrics .tint-cyan {
  background: #eeffff;
}

.metric-grid span {
  display: block;
  font-size: 14px;
  font-weight: 700;
}

.metric-grid strong {
  display: block;
  margin-top: 14px;
  font-size: 25px;
  letter-spacing: .2px;
}

.panel {
  padding: 18px;
  margin-bottom: 20px;
}

.chart-panel {
  border: none;
  padding-left: 0;
  padding-right: 0;
}

.blue-dot,
.cyan-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 10px;
  border-radius: 2px;
  vertical-align: -1px;
}

.blue-dot {
  background: #2f63f6;
}

.cyan-dot {
  background: #19c6d0;
}

.metric-select {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 260px;
  gap: 8px;
  border: 1px solid #2f63f6;
  border-radius: 4px;
  padding: 0 10px;
  background: #fff;
}

.metric-select select {
  min-height: 38px;
  border: 0;
  padding-left: 4px;
  font-size: 14px;
  background: transparent;
}

.metric-select select:focus {
  outline: 0;
}

.svg-chart-wrap {
  margin-top: 16px;
  overflow-x: auto;
}

.line-chart-svg {
  display: block;
  width: 100%;
  min-width: 820px;
  height: auto;
}

.grid-line {
  stroke: #e8edf5;
  stroke-width: 1;
}

.axis-label,
.axis-title,
.date-label {
  fill: #8a96aa;
  font-size: 12px;
}

.axis-label.left,
.axis-title.left {
  text-anchor: end;
}

.axis-label.right,
.axis-title.right {
  text-anchor: start;
}

.date-label {
  text-anchor: middle;
}

.date-label.muted-tick {
  display: none;
}

.series-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.blue-line {
  stroke: #3b6dff;
}

.cyan-line {
  stroke: #18c5cf;
}

.hover-column-hit {
  fill: transparent;
  cursor: crosshair;
  pointer-events: all;
}

.crosshair-line {
  display: none;
  stroke: #c5ccd8;
  stroke-width: 1;
}

.chart-tooltip {
  display: none;
  filter: drop-shadow(0 8px 18px rgb(16 24 40 / 14%));
  pointer-events: none;
}

.chart-tooltip rect {
  fill: #fff;
  stroke: #e4eaf4;
}

.chart-tooltip text {
  fill: #475467;
  font-size: 12px;
}

.chart-tooltip .tooltip-date {
  fill: #071833;
  font-weight: 700;
}

.chart-tooltip .tooltip-value {
  text-anchor: end;
  fill: #071833;
  font-weight: 700;
}

.hover-column:hover .crosshair-line,
.hover-column:hover .chart-tooltip {
  display: block;
}

.series-dot {
  stroke: #fff;
  stroke-width: 2;
}

.hover-target {
  fill: transparent;
  pointer-events: none;
}

.hover-target:hover + .series-dot {
  r: 6;
}

.blue-dot-svg {
  fill: #3b6dff;
}

.cyan-dot-svg {
  fill: #18c5cf;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.bar-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: 105px 1fr 118px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.bar-row strong {
  text-align: right;
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #edf1f7;
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
  white-space: nowrap;
}

th {
  color: #627086;
  background: #fafcff;
  font-weight: 700;
}

.empty {
  color: #98a2b3;
  text-align: center;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  background: #fff;
  border: 1px solid #e4eaf4;
  border-radius: 6px;
  padding: 28px;
  box-shadow: 0 18px 44px rgb(16 24 40 / 10%);
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar-meta,
  .date-filter {
    justify-content: flex-start;
  }

  .leaderboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .page {
    width: 100%;
    padding: 20px 14px 40px;
  }

  .leaderboard,
  .dashboard-grid,
  .filter-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .date-filter,
  .month-switch {
    flex-wrap: wrap;
  }

  .date-filter input {
    width: min(100%, 180px);
  }
}
