:root {
  --ink: #070b12;
  --ink-2: #0c131c;
  --panel: #121a24;
  --line: #243140;
  --gold: #e8c27a;
  --gold-2: #f3d7a0;
  --teal: #5eead4;
  --onsite: #e09a6c;
  --receive: #7dd3fc;
  --plan: #8b9bb0;
  --remain: #c5d0dc;
  --slate: #8b9bb0;
  --text: #f4f7fb;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(232, 194, 122, 0.12), transparent),
    radial-gradient(900px 500px at 90% 0%, rgba(94, 234, 212, 0.08), transparent),
    var(--ink);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; cursor: pointer; }

.frame { max-width: 1440px; margin: 0 auto; }

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid rgba(36, 49, 64, 0.8);
  background: rgba(7, 11, 18, 0.88);
  backdrop-filter: blur(14px);
}

.head-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 28px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  letter-spacing: 0.18em;
  font-size: 11px;
}

.title-row { display: flex; align-items: center; gap: 8px; }

h1 {
  margin: 0;
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 600;
}

.version {
  border: 1px solid rgba(232, 194, 122, 0.4);
  color: var(--gold);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  letter-spacing: 0.16em;
}

.sub { margin: 4px 0 0; color: var(--slate); font-size: 12px; }

.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.nav button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--slate);
  border-radius: 999px;
  padding: 6px 14px;
}

.nav button.on { background: var(--gold); color: var(--ink); border-color: var(--gold); }

.nav .split { width: 10px; }

main.frame { padding: 20px 28px 64px; }

.stack { display: grid; gap: 14px; }

.panel {
  background: rgba(18, 26, 36, 0.92);
  border: 1px solid rgba(36, 49, 64, 0.8);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  min-width: 0;
}

.panel.gold {
  border-color: rgba(232, 194, 122, 0.55);
  background: linear-gradient(165deg, rgba(232, 194, 122, 0.3), rgba(18, 26, 36, 0.9) 78%);
}

.panel.flat { padding: 0; overflow: hidden; }
.panel.flat .pad { padding: 20px 20px 0; }

.eyebrow.small { letter-spacing: 0.16em; }

h2 { margin: 0; font-size: 18px; font-weight: 600; }

.section-head { margin-bottom: 16px; }

.tiles {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.tile {
  background: var(--ink-2);
  border-radius: 12px;
  padding: 16px;
  min-width: 0;
}

.tile p { margin: 0; color: var(--slate); font-size: 12px; }

.tile strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(20px, 1.7vw, 28px);
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  white-space: nowrap;
}

.tile.gold strong { color: var(--gold-2); }
.tile.teal strong { color: var(--teal); }
.tile small { display: block; margin-top: 6px; color: var(--slate); font-size: 12px; }

.year-label { margin: 18px 0 8px; color: var(--slate); font-size: 12px; }

.year-stack {
  display: flex;
  height: 44px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--ink-2);
}

.year-stack i {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
}

.year-stack .order { background: var(--teal); }
.year-stack .onsite { background: var(--onsite); }
.year-stack .remain { background: var(--remain); }

.year-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
  color: var(--slate);
  font-size: 12px;
}

.compare { display: grid; gap: 10px; margin-top: 18px; }

.compare-row {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.compare-row p { margin: 0; color: var(--slate); font-size: 14px; }

.compare-row strong {
  min-width: 11rem;
  text-align: right;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.track {
  position: relative;
  height: 28px;
  border-radius: 6px;
  background: var(--ink-2);
  overflow: hidden;
}

.track i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 6px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.75fr);
  gap: 14px;
}

.split-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 14px;
}

.projects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 28px;
}

.projects h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 8px; color: var(--slate); font-size: 12px; }
.swatch { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; }

.plot {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  height: 260px;
}

.plot.short { height: 200px; }

.yaxis { position: relative; }
.yaxis span {
  position: absolute;
  right: 8px;
  transform: translateY(-50%);
  color: var(--slate);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.canvas { position: relative; min-width: 0; }
.grids {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}
.grids i { border-top: 1px solid rgba(255, 255, 255, 0.06); }

.cols {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  align-items: end;
}

.col { height: 100%; display: flex; align-items: flex-end; justify-content: center; }

.gbar-row { height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }

.gbar {
  position: relative;
  width: 14px;
  height: var(--h);
  min-height: 0;
  border-radius: 4px 4px 2px 2px;
}

.gbar.solo { width: 28px; }

.tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}

.gbar:hover .tip { opacity: 1; }

.xrow { display: grid; grid-template-columns: 52px minmax(0, 1fr); margin-top: 8px; }
.xlabels { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
.xlabels p { margin: 0; text-align: center; color: var(--slate); font-size: 12px; }
.xlabels small { display: block; color: var(--gold-2); font-size: 11px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 16px; border-bottom: 1px solid rgba(36, 49, 64, 0.7); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--slate); font-weight: 500; font-size: 12px; }
tfoot td { background: rgba(12, 19, 28, 0.4); font-weight: 600; }

.timeline { position: relative; margin: 0 0 0 8px; padding: 0 0 0 22px; border-left: 1px solid rgba(232, 194, 122, 0.4); list-style: none; }
.timeline li { position: relative; padding-bottom: 22px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -27px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
}
.timeline h3 { margin: 6px 0 0; font-size: 15px; font-weight: 600; }
.timeline p { margin: 6px 0 0; color: var(--slate); font-size: 13px; line-height: 1.6; }

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(232, 194, 122, 0.3);
  background: rgba(232, 194, 122, 0.15);
  color: var(--gold-2);
  padding: 1px 8px;
  font-size: 11px;
}
.tag.teal { border-color: rgba(94, 234, 212, 0.25); background: rgba(94, 234, 212, 0.12); color: var(--teal); }
.tag.slate { border-color: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.05); color: var(--slate); }
.tag.danger { border-color: rgba(248, 113, 113, 0.3); background: rgba(248, 113, 113, 0.12); color: #f87171; }

.meta-line { display: flex; gap: 8px; align-items: center; color: var(--slate); font-size: 12px; }

.grades { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grade {
  background: var(--ink-2);
  border-radius: 12px;
  min-height: 104px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 14px;
}
.grade strong { font-size: 32px; font-weight: 600; font-variant-numeric: tabular-nums; }
.grade span { color: var(--slate); font-size: 12px; margin-top: 4px; }

.linkish {
  margin-top: 14px;
  border: 0;
  background: transparent;
  color: var(--gold);
  padding: 0;
  font-size: 12px;
}

.hbar { display: grid; gap: 16px; }
.hbar-top { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.hbar-top span:last-child { color: var(--slate); font-size: 12px; font-variant-numeric: tabular-nums; }
.hbar-track { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--ink-2); }
.hbar-track i:first-child { background: var(--teal); }
.hbar-track i:last-child { background: var(--gold); }

.explore {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.side { display: grid; gap: 14px; align-content: start; }
.side h2 { font-size: 16px; }
.group { display: flex; flex-wrap: wrap; gap: 6px; }
.group .name { width: 100%; color: var(--slate); font-size: 12px; margin-bottom: 2px; }

.chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 4px 10px;
}
.chip.on { background: var(--gold); color: var(--ink); border-color: var(--gold); }

.quiet { margin: 10px 0 0; color: var(--slate); font-size: 12px; }

.lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.lines polyline {
  fill: none;
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translate(-50%, 50%);
  border: 2px solid var(--panel);
}

@media (max-width: 1100px) {
  .tiles, .tiles.four { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .split, .split-2, .projects, .explore { grid-template-columns: 1fr; }
  .explore > .panel { order: 1; }
  .explore .side { order: 2; }
}

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

.gate[hidden] { display: none; }

.member-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.member-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.member-actions { display: flex; align-items: center; gap: 8px; }
.role-label { color: var(--gold); font-size: 12px; letter-spacing: 0.08em; }
.member-actions select,
.member-actions button,
.invite-row input,
.invite-row button {
  border: 1px solid var(--line);
  background: var(--ink-2);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
}
.invite-row { display: flex; gap: 8px; margin-top: 16px; }
.invite-row input { flex: 1; border-radius: 10px; }
.invite-row button { background: var(--gold); color: var(--ink); border: 0; font-weight: 600; }
.member-actions button:disabled,
.invite-row button:disabled,
.invite-row input:disabled { opacity: 0.45; cursor: not-allowed; }

.gate-card {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
}

.gate-card h1 { font-size: 26px; }

.gate-card label {
  display: grid;
  gap: 6px;
  color: var(--slate);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.gate-card input {
  border: 1px solid var(--line);
  background: var(--ink-2);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  letter-spacing: 0;
}

.gate-card button[type="submit"] {
  margin-top: 4px;
  border: 0;
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  padding: 10px 16px;
  font-weight: 600;
}

#sign-out { margin-left: 8px; }

@media (max-width: 720px) {
  .head-row, main.frame { padding-left: 16px; padding-right: 16px; }
  .tiles, .tiles.three, .tiles.four { grid-template-columns: 1fr 1fr; }
  .compare-row { grid-template-columns: 1fr; }
  .compare-row strong { text-align: left; min-width: 0; }
  .plot, .plot.short { height: 220px; }
}
