:root {
  --bg: #ffffff;
  --card: #ffffff;
  --ink: #0a0a0a;
  --muted: #71717a;
  --faint: #a1a1aa;
  --line: rgba(10, 10, 10, 0.08);
  --rule: rgba(10, 10, 10, 0.06);
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.07);
  --accent-ink: #1d4ed8;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
}

.sheet {
  --row: clamp(30px, 8.2vh, 40px);
  position: relative;
  width: min(400px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(12px, 3.4vh, 18px) clamp(12px, 4vw, 18px) clamp(10px, 2.6vh, 14px);
  box-shadow: 0 1px 2px rgba(10, 10, 10, 0.04), 0 18px 40px -22px rgba(10, 10, 10, 0.18);
}

.sheet__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 6px clamp(6px, 1.8vh, 10px);
}
.sheet__title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.sheet__sub { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* the table: a name column and four months; the frame lives on top of the cells */
.grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.25fr repeat(var(--cols, 4), 1fr);
  grid-auto-rows: var(--row);
  outline: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  border-radius: 10px;
}
.grid:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }

.cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 10px;
  font-size: clamp(13px, 3.6vw, 14px);
  font-variant-numeric: tabular-nums;
  font-variation-settings: 'wght' 420, 'wdth' 100;
  color: #3f3f46;
  border-top: 1px solid var(--rule);
  transition: color 0.25s ease, font-variation-settings 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  cursor: cell;
  z-index: 1;
}
.cell.is-in { color: var(--accent-ink); font-variation-settings: 'wght' 580, 'wdth' 104; }

.th, .rh {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--faint);
  font-variation-settings: 'wght' 480, 'wdth' 100;
  transition: color 0.25s ease, font-variation-settings 0.35s ease;
  cursor: pointer;
  z-index: 1;
}
.th { justify-content: flex-end; padding: 0 10px; }
.rh { padding: 0 6px; font-size: clamp(13px, 3.6vw, 14px); color: var(--muted); border-top: 1px solid var(--rule); }
.th.is-on, .rh.is-on { color: var(--accent-ink); font-variation-settings: 'wght' 600, 'wdth' 100; }
.corner { z-index: 1; }

/* the frame: one element for GSAP (position and size), its children for the CSS */
.sel {
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 2;
}
.sel__fill {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1.5px var(--accent), 0 6px 16px -10px rgba(37, 99, 235, 0.45);
}
.sel__grip {
  position: absolute;
  right: -4px; bottom: -4px;
  width: 8px; height: 8px;
  border-radius: 2px;
  background: #fff;
  box-shadow: inset 0 0 0 1.5px var(--accent), 0 1px 2px rgba(10, 10, 10, 0.15);
}

.sheet__foot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
  padding: clamp(8px, 2.2vh, 12px) 6px 0;
  border-top: 1px solid var(--line);
  min-height: 40px;
}
.sum { display: flex; align-items: baseline; gap: 8px; }
.sum__label { font-size: 12px; color: var(--muted); font-weight: 500; }
.sum__unit { font-size: 13px; color: var(--faint); margin-left: -4px; }
.hint { position: absolute; left: 6px; font-size: 13px; color: var(--faint); pointer-events: none; }
.meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.num {
  display: inline-flex;
  font-size: 22px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.num__slot { position: relative; display: inline-block; height: 1.1em; overflow: hidden; }
.num__col { display: flex; flex-direction: column; will-change: transform; }
.num__col > span { display: block; height: 1.1em; line-height: 1.1em; text-align: center; }
.num__slot { -webkit-mask-image: linear-gradient(transparent 0%, #000 22%, #000 78%, transparent 100%); mask-image: linear-gradient(transparent 0%, #000 22%, #000 78%, transparent 100%); }

.fake {
  position: absolute;
  left: 0; top: 0;
  width: 18px; height: 22px;
  fill: var(--ink);
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(10, 10, 10, 0.25));
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.rh { white-space: pre; }
@media (max-width: 440px) {
  .rh__last { display: none; }
}
@media (max-width: 360px) {
  .sheet__sub { display: none; }
}
