:root {
  --bg: #0b0f14;
  --bg2: #121821;
  --panel: #151c27;
  --panel2: #1b2431;
  --line: rgba(255, 255, 255, 0.08);
  --ink: #f3f6fa;
  --muted: rgba(243, 246, 250, 0.62);
  --dim: rgba(243, 246, 250, 0.42);
  --accent: #3dd6c6;
  --accent2: #7ce7db;
  --warn: #f0b35a;
  --danger: #ff7a7a;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Noto Sans SC", "IBM Plex Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(ellipse 70% 45% at 0% -10%, rgba(61, 214, 198, 0.16), transparent 55%),
    radial-gradient(ellipse 50% 35% at 100% 0%, rgba(240, 179, 90, 0.08), transparent 50%),
    linear-gradient(180deg, #10161f 0%, var(--bg) 40%, #080b10 100%);
}

a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 28px;
}
.brand .k {
  font: 700 12px/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.brand h1 {
  margin: 10px 0 8px;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.brand p {
  margin: 0;
  max-width: 52ch;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}
.ron {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}
.ron img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}
.ron span { font: 700 13px/1 var(--mono); color: var(--muted); }

.kpi {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.card {
  background: linear-gradient(180deg, var(--panel), var(--bg2));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
}
.card .lab {
  font-size: 12px;
  color: var(--dim);
  letter-spacing: 0.04em;
}
.card .val {
  margin-top: 8px;
  font: 700 26px/1.1 var(--mono);
  letter-spacing: -0.02em;
}
.card .sub {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.grid2 {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 14px;
  margin-bottom: 14px;
}
.panel {
  background: rgba(21, 28, 39, 0.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}
.panel h2 {
  margin: 0 0 6px;
  font-size: 18px;
}
.panel .hint {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.controls {
  display: grid;
  gap: 14px;
}
.field label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.field label b {
  color: var(--ink);
  font: 700 13px/1 var(--mono);
}
.field input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}
.field input[type="number"] {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 12px;
  font: 600 14px/1 var(--mono);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.chips button {
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
  font: 600 12px/1 var(--sans);
  cursor: pointer;
}
.chips button.active {
  border-color: rgba(61, 214, 198, 0.45);
  background: rgba(61, 214, 198, 0.12);
  color: var(--accent2);
}

.result-box {
  display: grid;
  gap: 12px;
}
.result {
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(61, 214, 198, 0.14), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(61, 214, 198, 0.28);
}
.result .big {
  font: 800 34px/1.1 var(--mono);
  color: var(--accent2);
  letter-spacing: -0.03em;
}
.result .meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mini {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--panel2);
  border: 1px solid var(--line);
}
.mini .lab { font-size: 12px; color: var(--dim); }
.mini .val {
  margin-top: 6px;
  font: 700 18px/1.15 var(--mono);
}

.matrix-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}
.matrix-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.matrix-legend i {
  width: 18px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.matrix-legend .note {
  margin-left: 4px;
  color: var(--dim);
}

.table-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  min-width: 640px;
}
th, td {
  padding: 12px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: right;
  white-space: nowrap;
}
th:first-child, td:first-child { text-align: left; }
th {
  background: #1a2330;
  color: #d7e2ef;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}
td.mono, th.mono { font-family: var(--mono); }
td.row-lab {
  background: #161e2a;
  color: #e8f0f8;
  font-weight: 700;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}
td.cell-heat {
  font-weight: 800;
  letter-spacing: -0.01em;
  border-right: 1px solid rgba(0, 0, 0, 0.12);
}
td.heat-1 {
  background: #1b4f8a;
  color: #dff0ff;
}
td.heat-2 {
  background: #1f8a6a;
  color: #e7fff4;
}
td.heat-3 {
  background: #b8860b;
  color: #fff8df;
}
td.heat-4 {
  background: #d4651a;
  color: #fff4ea;
}
td.heat-5 {
  background: #c0283a;
  color: #ffe8ec;
}
.matrix-legend i.heat-1 { background: #1b4f8a; }
.matrix-legend i.heat-2 { background: #1f8a6a; }
.matrix-legend i.heat-3 { background: #b8860b; }
.matrix-legend i.heat-4 { background: #d4651a; }
.matrix-legend i.heat-5 { background: #c0283a; }
td.cell-heat.hl {
  outline: 2px solid #ffffff;
  outline-offset: -2px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  filter: saturate(1.25) brightness(1.08);
}

.week-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.week-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}
.week-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.weeks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
}
.week {
  position: relative;
  padding: 12px 12px 11px;
  border-radius: 14px;
  border: 1px solid transparent;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}
.week::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: currentColor;
}
.week .w {
  font: 700 12px/1 var(--mono);
  opacity: 0.85;
  letter-spacing: 0.02em;
}
.week .p {
  margin-top: 8px;
  font: 800 14px/1.2 var(--mono);
  letter-spacing: -0.02em;
}
.week .tag {
  margin-top: 7px;
  font: 700 10px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.8;
}

/* 按周发放量分段：低 → 高，颜色拉开对比 */
.week.tier-low {
  color: #8fd3ff;
  background: linear-gradient(145deg, rgba(56, 147, 214, 0.34), rgba(18, 40, 62, 0.95));
  border-color: rgba(143, 211, 255, 0.35);
}
.week.tier-mid {
  color: #7dffb2;
  background: linear-gradient(145deg, rgba(34, 180, 112, 0.32), rgba(16, 42, 30, 0.95));
  border-color: rgba(125, 255, 178, 0.35);
}
.week.tier-high {
  color: #ffe08a;
  background: linear-gradient(145deg, rgba(214, 150, 40, 0.36), rgba(52, 36, 12, 0.95));
  border-color: rgba(255, 224, 138, 0.4);
}
.week.tier-peak {
  color: #ff9f9f;
  background: linear-gradient(145deg, rgba(220, 72, 90, 0.38), rgba(52, 18, 28, 0.95));
  border-color: rgba(255, 159, 159, 0.45);
}
.week.tier-fixed {
  color: #c5b4ff;
  background: linear-gradient(145deg, rgba(120, 88, 220, 0.34), rgba(30, 22, 58, 0.95));
  border-color: rgba(197, 180, 255, 0.4);
}

.footer {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 860px) {
  .kpi, .grid2, .mini-grid { grid-template-columns: 1fr 1fr; }
  .top { flex-direction: column; }
}
@media (max-width: 560px) {
  .kpi, .grid2, .mini-grid { grid-template-columns: 1fr; }
  .brand h1 { font-size: 28px; }
}
