/* ---------- tokens (follow the system appearance) ---------- */
:root {
  color-scheme: light dark;
  --bg: light-dark(#ffffff, #09090b);
  --wash: light-dark(rgb(9 9 11 / 0.025), rgb(255 255 255 / 0.035));
  --sel: light-dark(rgb(9 9 11 / 0.045), rgb(255 255 255 / 0.06));
  --line: light-dark(rgb(9 9 11 / 0.07), rgb(255 255 255 / 0.07));
  --line-2: light-dark(rgb(9 9 11 / 0.12), rgb(255 255 255 / 0.11));
  --tx: light-dark(#09090b, #fafafa);
  --tx-2: light-dark(#52525b, #a1a1aa);
  --tx-3: #71717a;
  --tx-4: light-dark(#a1a1aa, #52525b);
  /* Lime only ever means PR or progress. */
  --acc-mark: light-dark(#65a30d, #e4ff54);
  --acc-text: light-dark(#4d7c0f, #e4ff54);
  --acc-fill: #e4ff54;
  --acc-on: light-dark(#1a2e05, #0b0d02);
  --acc-wash: light-dark(rgb(132 204 22 / 0.12), rgb(228 255 84 / 0.1));
  --bar: light-dark(#d4d4d8, #3f3f46);
  --bar-hi: light-dark(#52525b, #a1a1aa);
  --tip-bg: light-dark(#ffffff, #18181b);
  --tip-shadow: light-dark(rgb(0 0 0 / 0.08), rgb(0 0 0 / 0.35));
  --font: InterVariable, Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  --rail-w: 320px;
  --lift-w: 460px;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--tx);
  font-family: var(--font);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, dl, dd { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }
.eq { color: var(--tx-3); font-weight: 400; }
.acc { color: var(--acc-text); }
:focus-visible { outline: 2px solid var(--acc-mark); outline-offset: 2px; border-radius: 4px; }

/* ---------- shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--lift-w);
  height: 100dvh;
  isolation: isolate;
}
.app[data-view="lifts"] { --rail-w: 360px; grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.app[data-view="lifts"] .pane-session { display: none; }
.rail { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.pane { min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.pane-session { border-right: 1px solid var(--line); }
.pane-lift { container-type: inline-size; }

@media (max-width: 1240px) {
  :root { --rail-w: 288px; --lift-w: 420px; }
}

.notice { padding: 48px 36px; color: var(--tx-3); }
.notice h2 { font-size: 20px; font-weight: 600; color: var(--tx); margin-bottom: 6px; }

/* ---------- rail ---------- */
.rail-head { padding: 22px 20px 0; }
.tabs { display: flex; gap: 14px; align-items: baseline; }
.tab { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; color: var(--tx-4); }
.tab:hover { color: var(--tx-2); }
.tab[aria-current="page"] { color: var(--tx); }
.rail-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 0 12px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.rail-foot {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 12px 20px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--tx-3);
}
.rail-foot a:hover { color: var(--tx); }

/* calendar */
.cal { padding: 18px 20px 6px; }
.cal-months, .cal-grid { display: grid; grid-template-columns: repeat(var(--weeks), 1fr); column-gap: 3px; }
.cal-months { height: 16px; font-size: 11px; color: var(--tx-3); }
.cal-months span { white-space: nowrap; }
.cal-grid { grid-template-rows: repeat(7, auto); grid-auto-flow: column; row-gap: 3px; }
.cal-c { aspect-ratio: 1; border-radius: 2px; background: var(--line); }
.cal-c[data-l="1"] { background: color-mix(in oklab, var(--acc-mark) 28%, var(--bg)); }
.cal-c[data-l="2"] { background: color-mix(in oklab, var(--acc-mark) 48%, var(--bg)); }
.cal-c[data-l="3"] { background: color-mix(in oklab, var(--acc-mark) 72%, var(--bg)); }
.cal-c[data-l="4"] { background: var(--acc-mark); }
.cal-c[data-future] { visibility: hidden; }
.cal-c[data-sel] { outline: 1.5px solid var(--tx); outline-offset: 1px; }
a.cal-c:hover { outline: 1.5px solid var(--tx-2); outline-offset: 1px; }
.cal-sum { display: flex; gap: 18px; margin-top: 14px; font-size: 12px; color: var(--tx-3); }
.cal-sum b { margin-right: 4px; font-size: 13px; font-weight: 600; color: var(--tx); font-variant-numeric: tabular-nums; }

/* week groups + session rows */
.week { padding: 0 8px; }
.week-h {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 20px 12px 6px;
  font-size: 12px; font-weight: 500; color: var(--tx-3);
}
.week-h span:last-child { font-variant-numeric: tabular-nums; }
.srow {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 9px 12px; border-radius: 10px;
}
.srow:hover { background: var(--wash); }
.srow[aria-current="true"] { background: var(--sel); }
.srow-date { text-align: center; line-height: 1.15; }
.srow-date .d { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.srow-date .w { font-size: 11px; color: var(--tx-3); }
.srow-t { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow-m { font-size: 12.5px; color: var(--tx-3); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow-pr { font-size: 12px; font-weight: 600; color: var(--acc-text); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* lifts index */
.find { display: grid; gap: 10px; padding: 16px 20px 4px; }
.search {
  width: 100%; height: 36px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 9px; background: transparent;
  color: var(--tx); font: inherit; font-size: 14px; outline: none;
}
.search::placeholder { color: var(--tx-3); }
.search:focus { border-color: var(--tx-3); }
.seg { display: flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--wash); }
.seg button { flex: 1; height: 28px; border-radius: 7px; font-size: 12.5px; font-weight: 500; color: var(--tx-3); }
.seg button:hover { color: var(--tx-2); }
.seg button[aria-pressed="true"] { background: var(--sel); color: var(--tx); box-shadow: inset 0 0 0 1px var(--line); }
.xlist { padding: 6px 8px 0; }
.xlist .none { padding: 16px 12px; color: var(--tx-3); }
.xrow {
  display: grid; grid-template-columns: minmax(0, 1fr) 52px 64px; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 10px;
}
.xrow:hover { background: var(--wash); }
.xrow[aria-current="true"] { background: var(--sel); }
.xrow-n { font-weight: 550; text-wrap: pretty; }
.xrow-m { font-size: 12.5px; color: var(--tx-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xrow-v { text-align: right; line-height: 1.25; }
.xrow-v .v { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.xrow-v .v small { margin-left: 3px; font-size: 11px; font-weight: 500; color: var(--tx-3); }
.spark { display: block; width: 100%; height: 24px; overflow: visible; }

/* ---------- shared atoms ---------- */
.pill {
  display: inline-block; vertical-align: 1px;
  padding: 1px 5px; border-radius: 4px;
  background: var(--acc-fill); color: var(--acc-on);
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em; line-height: 14px;
}
.dl { font-size: 12.5px; font-weight: 550; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--tx-3); }
.dl[data-dir="up"] { color: var(--acc-text); }
.dl[data-dir="new"] { color: var(--tx-4); font-weight: 500; }
.sets { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.set {
  padding: 1px 6px; border-radius: 5px;
  font-size: 13px; font-variant-numeric: tabular-nums; color: var(--tx-2);
  box-shadow: inset 0 0 0 1px var(--line);
  white-space: nowrap;
}
.set i { margin: 0 1px; font-style: normal; color: var(--tx-4); }
.set[data-pr] { background: var(--acc-wash); box-shadow: none; color: var(--acc-text); font-weight: 550; }
.set[data-pr] i { color: inherit; opacity: 0.6; }
.tot { margin-left: 2px; font-size: 12.5px; font-weight: 550; color: var(--acc-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.label { font-size: 12px; font-weight: 500; color: var(--tx-3); }

/* ---------- session pane ---------- */
.mbar { display: none; }
.s-wrap { max-width: 860px; padding: 32px 36px 48px; }
.s-head h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.025em; text-wrap: balance; }
.s-date { margin-top: 4px; color: var(--tx-3); font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 28px; border-top: 1px solid var(--line); }
.stat { padding: 16px 20px 0; }
.stat:first-child { padding-left: 0; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat dt { font-size: 12px; font-weight: 500; color: var(--tx-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat dd { margin-top: 4px; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.stat dd small { font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--tx-3); }
.stat dd[data-acc] { color: var(--acc-text); }
.stat .dl { margin-top: 2px; font-size: 12px; }

.lifts { margin-top: 32px; }
.lifts-h, .lrow { display: grid; grid-template-columns: minmax(0, 1fr) 84px 64px 64px; gap: 16px; align-items: center; }
.lifts-h { margin: 0 -12px 6px; padding: 0 12px 8px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 500; color: var(--tx-3); }
.lifts-h span:nth-child(n+3) { text-align: right; }
.lrow { margin: 0 -12px; padding: 12px; border-radius: 12px; }
.lrow:hover { background: var(--wash); }
.lrow[aria-current="true"] { background: var(--sel); }
.lrow-n { margin-bottom: 6px; font-size: 14.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow-n .pill { margin-left: 6px; }
.lrow-v { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.lrow-v small { display: block; font-size: 11px; font-weight: 500; color: var(--tx-4); }
.lrow .dl { text-align: right; }

/* ---------- lift pane ---------- */
.l-wrap { padding: 32px 28px 48px; }
.l-head h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
.l-meta { margin-top: 3px; font-size: 13px; color: var(--tx-3); font-variant-numeric: tabular-nums; }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-top: 24px; }
.hero-v { margin-top: 6px; font-size: 44px; font-weight: 600; letter-spacing: -0.035em; line-height: 1; }
.hero-v small { margin-left: 3px; font-size: 16px; font-weight: 500; letter-spacing: 0; color: var(--tx-3); }
.hero-side { padding-bottom: 3px; text-align: right; }
.hero-side .dl { font-size: 13px; }
.hero-side p { margin-top: 2px; font-size: 12px; color: var(--tx-3); }
.hero-side .pr-k { color: var(--acc-text); font-weight: 500; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 18px; border-top: 1px solid var(--line); }
.fact { padding: 12px 14px 0; }
.fact:first-child { padding-left: 0; }
.fact + .fact { border-left: 1px solid var(--line); }
.fact dt { font-size: 12px; color: var(--tx-3); white-space: nowrap; }
.fact dd { margin-top: 2px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fact dd i { font-style: normal; font-weight: 500; color: var(--tx-4); }
.fact dd .sub { display: block; margin-top: 1px; font-size: 12px; color: var(--tx-3); }

.chart { position: relative; margin-top: 26px; }
.chart svg { display: block; width: 100%; overflow: visible; touch-action: pan-y; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--tx-3); font-variant-numeric: tabular-nums; }
.chart .band-label { font-weight: 500; }
.chart-empty { padding: 24px 0; font-size: 13px; color: var(--tx-3); }

.block { margin-top: 30px; }
.block-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.block-h h3 { font-size: 13px; font-weight: 600; }
.block-h p { font-size: 12px; color: var(--tx-3); font-variant-numeric: tabular-nums; }
.next { display: grid; gap: 10px; }
.next-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.next-row .label { white-space: nowrap; }
.target {
  padding: 3px 8px; border-radius: 6px;
  background: var(--acc-wash); color: var(--acc-text);
  font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.target i { margin: 0 1px; font-style: normal; font-weight: 500; opacity: 0.6; }

.recs { display: grid; }
.rec { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); }
.rec:first-child { padding-top: 0; border-top: 0; }
.rec-v { font-weight: 600; font-variant-numeric: tabular-nums; }
.rec-v i { margin: 0 1px; font-style: normal; font-weight: 500; color: var(--tx-4); }
.rec-d { font-size: 12px; color: var(--tx-3); font-variant-numeric: tabular-nums; }

.hist { display: grid; }
.hrow { display: grid; grid-template-columns: 58px minmax(0, 1fr) 48px; gap: 12px; align-items: start; padding: 11px 0; border-top: 1px solid var(--line); }
.hrow-d { font-size: 13px; font-weight: 550; line-height: 22px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hrow-w { margin-top: 4px; font-size: 12px; color: var(--tx-3); }
.hrow-v { text-align: right; font-weight: 600; line-height: 22px; font-variant-numeric: tabular-nums; }
.hrow[data-gap]::before {
  content: attr(data-gap); grid-column: 1 / -1; margin: -2px 0 6px;
  font-size: 11.5px; color: var(--tx-4);
}
.hrow[aria-current="true"] .hrow-d { color: var(--acc-text); }
.more {
  width: 100%; height: 38px; margin-top: 4px; border-radius: 9px;
  box-shadow: inset 0 0 0 1px var(--line-2); color: var(--tx-2); font-size: 13px; font-weight: 500;
}
.more:hover { background: var(--wash); color: var(--tx); }

/* Wide lift layout: the Lifts view on desktop. */
.l-cols { display: block; }
@container (min-width: 760px) {
  .l-wrap { max-width: 1120px; padding: 36px 44px 56px; }
  .l-head h2 { font-size: 28px; letter-spacing: -0.025em; }
  .hero { justify-content: flex-start; gap: 22px; }
  .hero-v { font-size: 56px; }
  .hero-side { text-align: left; }
  .l-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: end; }
  .l-top .facts { margin-top: 0; border-top: 0; }
  .l-cols { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 48px; align-items: start; }
  .l-cols > div:first-child { position: sticky; top: 24px; }
}

/* tooltip */
.tip {
  position: fixed; z-index: 50; pointer-events: none;
  min-width: 132px; padding: 8px 10px; border-radius: 8px;
  background: var(--tip-bg); box-shadow: 0 0 0 1px var(--line-2), 0 8px 24px var(--tip-shadow);
  font-size: 12px; line-height: 1.4;
}
.tip-d { margin-bottom: 4px; color: var(--tx-3); white-space: nowrap; }
.tip-r { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tip-r b { font-weight: 600; }
.tip-r span { color: var(--tx-3); }
.tip-k { flex: none; width: 10px; height: 2px; border-radius: 1px; }

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .app { display: block; height: auto; min-height: 100dvh; }
  .rail, .pane { display: none; overflow: visible; border: 0; }
  .app[data-screen="log"] .rail,
  .app[data-screen="lifts"] .rail,
  .app[data-screen="session"] .pane-session,
  .app[data-screen="lift"] .pane-lift { display: block; }

  .notice { padding: 32px 20px; }
  .rail-head { padding: calc(env(safe-area-inset-top) + 18px) 20px 0; }
  .tabs { gap: 18px; }
  .tab { font-size: 30px; letter-spacing: -0.03em; }
  .rail-body { overflow: visible; }
  .rail-foot { justify-content: center; gap: 16px; padding: 24px 20px calc(env(safe-area-inset-bottom) + 32px); border-top: 0; }
  .cal { padding: 20px 20px 4px; }
  .cal-sum { font-size: 13px; }
  .cal-sum b { font-size: 15px; }
  .week-h { padding: 22px 12px 6px; font-size: 13px; }
  .srow { grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; padding: 11px 12px; }
  .srow-date .d { font-size: 18px; }
  .srow-date .w { font-size: 12px; }
  .srow-m { font-size: 14px; }
  .srow-pr { font-size: 13px; }
  .search { height: 42px; font-size: 16px; }
  .seg button { height: 32px; font-size: 13.5px; }
  .xrow { grid-template-columns: minmax(0, 1fr) 56px 68px; padding: 12px; }
  .xrow-n { font-size: 16px; }
  .xrow-m { font-size: 14px; }

  .mbar {
    position: sticky; top: 0; z-index: 10;
    display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center;
    height: calc(env(safe-area-inset-top) + 48px); padding: env(safe-area-inset-top) 12px 0;
    background: color-mix(in oklab, var(--bg) 82%, transparent);
    backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-bottom: 1px solid transparent;
  }
  .mbar[data-stuck] { border-bottom-color: var(--line); }
  .mbar-back { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; height: 40px; padding-right: 8px; justify-self: start; color: var(--tx-2); font-size: 16px; font-weight: 500; white-space: nowrap; }
  .mbar-back svg { flex: none; width: 22px; height: 22px; }
  .mbar-back span { overflow: hidden; text-overflow: ellipsis; }
  .mbar-t { max-width: 46vw; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0; transition: opacity 0.15s; }
  .mbar[data-stuck] .mbar-t { opacity: 1; }
  .mbar-step { display: flex; align-items: center; gap: 2px; justify-self: end; }
  .mbar-step span { margin-right: 4px; font-size: 13px; color: var(--tx-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .mbar-step a { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--tx-2); }
  .mbar-step a[aria-disabled="true"] { color: var(--tx-4); pointer-events: none; }
  .mbar-step svg { width: 20px; height: 20px; }

  .s-wrap { padding: 8px 20px 48px; }
  .s-head h1 { font-size: 30px; }
  .s-date { font-size: 15px; }
  .stats { margin-top: 22px; }
  .stat { padding: 14px 14px 0; }
  .stat dt { font-size: 13px; }
  .stat dd { font-size: 22px; }
  .stat .dl { font-size: 12.5px; }
  .lifts { margin-top: 26px; }
  .lifts-h { display: none; }
  .lrow { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; margin: 0 -12px; padding: 14px 12px; border-top: 1px solid var(--line); border-radius: 0; }
  .lrow:first-of-type { border-top: 0; }
  .lrow .spark-cell { display: none; }
  .lrow-main { grid-row: span 2; }
  .lrow-n { font-size: 16px; white-space: normal; }
  .lrow-v { font-size: 16px; }
  .lrow-v small { display: inline; margin-left: 3px; font-size: 13px; color: var(--tx-3); }
  .lrow .dl { font-size: 13.5px; }
  .set { padding: 2px 7px; font-size: 14px; }
  .tot { font-size: 14px; }

  .l-wrap { padding: 8px 20px 48px; }
  .l-head h2 { font-size: 26px; letter-spacing: -0.025em; }
  .l-meta { font-size: 14px; }
  .hero-v { font-size: 48px; }
  .hero-side .dl { font-size: 14px; }
  .hero-side p { font-size: 13px; }
  .fact dt { font-size: 13px; }
  .fact dd { font-size: 15px; }
  .fact dd .sub { font-size: 13px; }
  .block-h h3 { font-size: 15px; }
  .block-h p { font-size: 13px; }
  .label { font-size: 13px; }
  .next-row { grid-template-columns: 60px minmax(0, 1fr); }
  .target { padding: 4px 9px; font-size: 15px; }
  .rec { grid-template-columns: 84px minmax(0, 1fr) auto; padding: 10px 0; }
  .rec-v { font-size: 16px; }
  .rec-d { font-size: 13px; }
  .hrow { grid-template-columns: 62px minmax(0, 1fr) 52px; padding: 13px 0; }
  .hrow-d, .hrow-v { font-size: 15px; }
  .hrow-w { font-size: 13px; }
  .more { height: 44px; font-size: 15px; }
}
