/* Weight analysis: full-screen sheet on phones, a squared panel on larger screens. */
.wl{position:fixed;inset:0;z-index:300;background:oklch(0.17 0.03 266 / .6);display:flex;justify-content:center;align-items:flex-start;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;-webkit-text-size-adjust:100%;text-size-adjust:100%;padding:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) 32px max(16px,env(safe-area-inset-left))}
.wl button{touch-action:manipulation;-webkit-tap-highlight-color:transparent}
.wl-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0;list-style:none}
.wl-card{--wl-pad:24px;background:var(--surface);color:var(--text);width:min(920px,100%);border:1px solid var(--line-strong);border-radius:12px;box-shadow:0 24px 60px oklch(0.17 0.03 266 / .3);margin:auto 0;font-variant-numeric:tabular-nums}
.wl-card h2,.wl-card h3,.wl-card p{margin:0}

.wl-top{position:sticky;top:0;z-index:2;background:var(--surface);border-radius:12px 12px 0 0;border-bottom:1px solid var(--line)}
.wl-h{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:16px var(--wl-pad) 4px}
.wl-h h2{font-size:1.25rem;font-weight:800;letter-spacing:-.015em}
.wl-x{display:grid;place-items:center;width:40px;height:40px;border:1px solid var(--line-strong);border-radius:6px;background:var(--surface);color:var(--text);cursor:pointer;transition:background-color .15s var(--ease-out),border-color .15s var(--ease-out)}
.wl-x:hover{background:var(--surface-2);border-color:var(--text-muted)}
.wl-x svg{width:18px;height:18px}

/* Primary menu: flat underline tabs */
.wl-tabs{display:flex;overflow-x:auto;scrollbar-width:none;padding:0 calc(var(--wl-pad) - 12px)}
.wl-tabs::-webkit-scrollbar{display:none}
.wl-tabs button{flex:0 0 auto;min-height:44px;padding:0 12px;border:0;border-bottom:2px solid transparent;margin-bottom:-1px;background:none;font:inherit;font-size:.875rem;font-weight:700;color:var(--text-muted);cursor:pointer;transition:color .15s var(--ease-out),border-color .15s var(--ease-out)}
.wl-tabs button:hover{color:var(--text)}
.wl-tabs button[aria-pressed="true"]{color:var(--text);border-bottom-color:var(--cobalt)}

/* Sub menu: small boxed control that lives with the bars it changes */
.wl-seg{display:inline-flex;max-width:100%;border:1px solid var(--line-strong);border-radius:6px;overflow:hidden;background:var(--surface)}
.wl-seg button{flex:1 1 auto;min-width:0;min-height:32px;padding:0 12px;border:0;background:none;font:inherit;font-size:.8125rem;font-weight:700;color:var(--text-muted);cursor:pointer;transition:background-color .15s var(--ease-out),color .15s var(--ease-out)}
.wl-seg button+button{border-left:1px solid var(--line-strong)}
.wl-seg button:hover{background:var(--surface-2);color:var(--text)}
.wl-seg button[aria-pressed="true"]{background:var(--ink);color:#fff}

.wl-x:focus-visible,.wl-tabs button:focus-visible,.wl-seg button:focus-visible,.wl-link:focus-visible,.wl-btn:focus-visible{outline:3px solid var(--cobalt);outline-offset:2px}
.wl-seg button:focus-visible{outline-offset:-3px}
.wl-svg:focus-visible,.wl-bars:focus-visible{outline:3px solid var(--cobalt);outline-offset:2px;border-radius:6px}

.wl-body{display:grid;grid-template-columns:minmax(0,1fr);gap:32px;padding:24px var(--wl-pad) var(--wl-pad)}
.wl-from{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;margin-bottom:-12px}
.wl-from label{font-size:.875rem;font-weight:700;color:var(--text-muted)}
/* 16px keeps iOS from zooming the page when the date field gets focus */
.wl-from input,.wl-from select{min-height:40px;padding:0 10px;border:1px solid var(--line-strong);border-radius:6px;background:var(--surface);color:var(--text);font:inherit;font-size:16px;font-variant-numeric:tabular-nums}
.wl-from select{max-width:100%;min-width:0}
/* Native date fields differ per browser and can overflow on phones; draw one shape with a calendar icon, and let a tap anywhere open the picker */
.wl-dt{position:relative;display:inline-block;min-width:0;max-width:100%}
.wl-dt input{-webkit-appearance:none;appearance:none;box-sizing:border-box;display:flex;align-items:center;justify-content:center;width:100%;min-width:11em;max-width:100%;height:44px;min-height:44px;padding:0 40px;text-align:center;line-height:normal;cursor:pointer}
/* iOS Safari pins the value to the top-left of a date field; centre it both ways */
.wl-dt input::-webkit-date-and-time-value{display:flex;align-items:center;justify-content:center;width:100%;height:100%;margin:0;padding:0;text-align:center;min-height:0}
.wl-dt input::-webkit-datetime-edit{display:flex;align-items:center;justify-content:center;padding:0;text-align:center}
.wl-dt input::-webkit-datetime-edit-fields-wrapper{padding:0}
.wl-dt input::-webkit-calendar-picker-indicator{position:absolute;inset:0;width:100%;height:100%;margin:0;padding:0;opacity:0;cursor:pointer}
.wl-dt::after{content:"";position:absolute;right:12px;top:50%;width:18px;height:18px;margin-top:-9px;background:var(--text-muted);pointer-events:none;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4.5' width='18' height='16.5' rx='2'/%3E%3Cpath d='M3 10h18M8 2.5v4M16 2.5v4'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4.5' width='18' height='16.5' rx='2'/%3E%3Cpath d='M3 10h18M8 2.5v4M16 2.5v4'/%3E%3C/svg%3E") center/contain no-repeat}
.wl-from input:hover,.wl-from select:hover{border-color:var(--text-muted)}
.wl-from input:focus-visible,.wl-from select:focus-visible{outline:3px solid var(--cobalt);outline-offset:2px}

/* Typo notice */
.wl-note{display:grid;gap:12px;padding:14px 16px;border:1px solid var(--amber);border-radius:8px;background:var(--warn-soft)}
.wl-note p{font-size:.9375rem;line-height:1.45;color:var(--text)}
.wl-note-a{display:flex;flex-wrap:wrap;gap:8px}
.wl-btn{min-height:40px;max-width:100%;padding:8px 14px;border:1px solid var(--line-strong);border-radius:6px;background:var(--surface);color:var(--text);font:inherit;font-size:.875rem;font-weight:700;line-height:1.25;text-align:center;white-space:normal;cursor:pointer;transition:background-color .15s var(--ease-out),border-color .15s var(--ease-out)}
.wl-btn:hover{border-color:var(--text-muted);background:var(--surface-2)}
.wl-btn-q{border-color:transparent;background:none;color:var(--text-muted);text-decoration:underline}
.wl-sh{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 12px;margin-bottom:12px}
.wl-sh h3{font-size:1rem;font-weight:800;letter-spacing:-.01em}

/* Summary */
.wl-sum{display:grid;gap:20px}
.wl-main{display:grid;gap:2px}
.wl-k{font-size:.8125rem;font-weight:700;color:var(--text-muted)}
.wl-big{font-size:clamp(2.25rem,7vw,3.25rem);font-weight:800;line-height:1.05;letter-spacing:-.03em}
.wl-main.dn .wl-big{color:var(--ok)}.wl-main.up .wl-big{color:var(--bad)}
.wl-sub{font-size:.875rem;color:var(--text-muted)}
.wl-facts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1px;background:var(--line);border:1px solid var(--line);border-radius:8px;overflow:hidden}
.wl-facts.wl-facts-bc,.wl-gp .wl-facts.wl-facts-bc{grid-template-columns:repeat(2,minmax(0,1fr))}
.wl-gp .wl-facts-bc .wl-fact:nth-child(3){grid-column:auto}
.wl-fact{background:var(--surface);padding:12px 14px;display:grid;gap:2px;align-content:start}
.wl-fact span{font-size:.8125rem;font-weight:600;color:var(--text-muted)}
.wl-fact strong{font-size:1.125rem;font-weight:800;letter-spacing:-.01em}
.wl-fact em{font-style:normal;font-size:.8125rem;color:var(--text-muted)}

/* Weight chart: one honest line */
.wl-chart{position:relative}
.wl-svg{width:100%;height:auto;display:block;touch-action:pan-y}
.wl-grid{stroke:var(--line);stroke-width:1}
.wl-ax{font-size:12px;fill:var(--text-muted);font-weight:600}
.wl-line{fill:none;stroke:var(--cobalt);stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}
.wl-goal{stroke:var(--ok);stroke-width:1.5;stroke-dasharray:5 5}
.wl-goal-t{font-size:12px;fill:var(--ok);font-weight:800}
.wl-cross{stroke:var(--text-muted);stroke-width:1}
.wl-hdot{fill:var(--cobalt);stroke:#fff;stroke-width:2.5}
.wl-hv[hidden],.wl-tip[hidden]{display:none}
.wl-tip{position:absolute;top:0;transform:translateX(-50%);background:var(--ink);color:#fff;border-radius:6px;padding:6px 10px;font-size:.8125rem;display:grid;pointer-events:none;white-space:nowrap}
.wl-tip b{font-size:.9375rem}

/* Change bars, anchored at zero: loss below, gain above */
.wl-bars-wrap{display:grid;grid-template-columns:16px minmax(0,1fr);gap:6px}
.wl-zero{padding-top:84px;font-size:.75rem;font-weight:600;color:var(--text-muted)}
.wl-bars{display:flex;gap:4px;overflow-x:auto;padding-bottom:6px}
.wl-bar{flex:1 0 44px;min-width:44px;display:grid;grid-template-rows:180px auto;gap:6px;text-align:center}
.wl-bar-plot{position:relative}
.wl-bar-plot::before{content:"";position:absolute;left:0;right:-4px;top:50%;border-top:1px solid var(--text-muted)}
.wl-bar:last-child .wl-bar-plot::before{right:0}
.wl-bar i{position:absolute;left:12%;width:76%;height:var(--bar-height);bottom:50%;border-radius:3px 3px 0 0;background:var(--line)}
.wl-bar.dn i{top:50%;bottom:auto;border-radius:0 0 3px 3px;background:var(--ok)}
.wl-bar.up i{background:var(--coral)}
.wl-bv{position:absolute;left:50%;bottom:calc(50% + var(--bar-height) + 4px);transform:translateX(-50%);font-size:.75rem;font-weight:800;color:var(--text);white-space:nowrap}
.wl-bar.dn .wl-bv{top:calc(50% + var(--bar-height) + 4px);bottom:auto}
.wl-bar em{font-style:normal;font-size:.6875rem;font-weight:600;color:var(--text-muted);white-space:nowrap}

/* Insights: plain rows */
.wl-ins{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 32px}
.wl-ins>div{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:0 12px;align-items:baseline;padding:12px 0;border-top:1px solid var(--line)}
.wl-ins span{font-size:.875rem;font-weight:600;color:var(--text-muted)}
.wl-ins strong{font-size:1rem;font-weight:800;text-align:right}
.wl-ins em{grid-column:1/-1;font-style:normal;font-size:.8125rem;color:var(--text-muted)}

/* Goal progress: headline, bar with labelled milestones, three facts */
.wl-gp,.wl-gp-bar,.wl-sum{grid-template-columns:minmax(0,1fr)}
.wl-gp{display:grid;gap:16px}
.wl-gp-h{font-size:1.125rem;font-weight:800;letter-spacing:-.01em;margin-bottom:-6px}
.wl-gp-bar{display:grid;gap:6px}
/* The right margin leaves room for the Goal label to sit centred under the end of the bar */
.wl-gp-track{position:relative;height:12px;margin-right:38px;border-radius:6px;background:var(--surface-2);overflow:hidden}
.wl-gp-track i{position:absolute;top:0;bottom:0;left:0;background:var(--ok)}
.wl-gp-track s{position:absolute;top:0;bottom:0;width:2px;margin-left:-1px;background:var(--surface)}
.wl-gp-ticks{position:relative;height:4.9em;margin-right:38px;font-size:.75rem;color:var(--text-muted)}
.wl-gp-ticks span{position:absolute;top:0;transform:translateX(-50%);display:grid;gap:1px;justify-items:center;white-space:nowrap}
.wl-gp-ticks b{font-weight:800}
.wl-gp-ticks b small{font-size:inherit;font-weight:700}
.wl-gp-ticks em{font-style:normal;font-weight:600;min-height:1.2em}
.wl-gp-ticks .lost{font-size:inherit;font-weight:600}
.wl-gp-ticks .hit{color:var(--ok)}
.wl-gp-ticks .est{color:var(--text-muted)}
/* Two rows when the labels would collide: every second label drops down, joined to its notch by a hairline */
.wl-gp-ticks.stag{height:10.4em}
.wl-gp-ticks.stag span:nth-child(even){top:5.2em}
.wl-gp-ticks.stag span:nth-child(even)::before{content:"";position:absolute;left:50%;top:-5em;height:4.8em;border-left:1px solid var(--line-strong)}
.wl-gp-ticks.stag3{height:15.6em}
.wl-gp-ticks.stag3 span:nth-child(3n+2){top:5.2em}
.wl-gp-ticks.stag3 span:nth-child(3n){top:10.4em}
.wl-gp-ticks.stag3 span:nth-child(3n+2)::before,.wl-gp-ticks.stag3 span:nth-child(3n)::before{content:"";position:absolute;left:50%;border-left:1px solid var(--line-strong)}
.wl-gp-ticks.stag3 span:nth-child(3n+2)::before{top:-5em;height:4.8em}
.wl-gp-ticks.stag3 span:nth-child(3n)::before{top:-10.2em;height:10em}
.wl-gp-key{font-size:.8125rem;color:var(--text-muted)}
.wl-fact.ok strong{color:var(--ok)}
.wl-fact.wide{grid-column:1/-1}

/* BMI class changes: a band above the bar, with a blue notch on the bar itself */
.wl-gp-bmi{position:relative;height:calc(6.4em + 7px);margin-right:38px;font-size:.75rem;color:var(--text-muted)}
.wl-gp-bmi span{position:absolute;bottom:7px;transform:translateX(-50%);display:grid;gap:1px;justify-items:center;white-space:nowrap}
.wl-gp-bmi span::after{content:"";position:absolute;left:50%;top:100%;height:7px;border-left:1px solid var(--cobalt)}
.wl-gp-bmi b{font-weight:800;color:var(--cobalt)}
.wl-gp-bmi em{font-style:normal;font-weight:600}
.wl-gp-bmi .cls{color:var(--text)}
.wl-gp-bmi .when{min-height:1.2em}
.wl-gp-bmi .lost{font-size:inherit;font-weight:600}
.wl-gp-bmi .hit .when,.wl-gp-bmi .hit .lost{color:var(--ok)}
.wl-gp-bmi.stag{height:calc(12.4em + 7px)}
.wl-gp-bmi.stag span:nth-child(even){bottom:calc(7px + 6em)}
.wl-gp-bmi.stag span:nth-child(even)::after{height:calc(7px + 6em)}
.wl-gp-track u{position:absolute;top:0;bottom:0;width:2px;margin-left:-1px;background:var(--cobalt)}
.wl-gp-key-bmi{margin-top:-2px}

/* Badges that belong to a mark: dimmed until earned */
.wl-bd{width:20px;height:20px;object-fit:contain;vertical-align:-5px;margin-right:4px}
.wl-bd.lock{filter:grayscale(1);opacity:.4}
.wl-gp-ticks b{display:inline-flex;align-items:center;justify-content:center;gap:.3em}
.wl-gp-ticks .wl-bd,.wl-gp-ticks .wl-bd-off{vertical-align:middle;margin-right:0}

/* Plateau */
.wl-btn-p{background:var(--cobalt);border-color:var(--cobalt);color:#fff}
.wl-btn-p:hover{background:var(--cobalt);border-color:var(--cobalt);filter:brightness(1.1)}
.wl-plat{border-color:var(--line-strong);background:var(--surface-2)}
.wl-plat strong{font-weight:800}
.wl-cele{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:12px;padding:14px 16px;border:1px solid var(--ok);border-radius:8px;background:var(--ok-soft)}
.wl-cele ul{list-style:none;margin:8px 0 0;padding:0;display:grid;gap:8px}
.wl-cele li{display:flex;align-items:center;gap:10px;font-size:.9375rem}
.wl-cele li .wl-bd,.wl-cele li .wl-bd-off{width:36px;height:36px;margin:0;flex:none}
.wl-cele li div{display:grid;gap:1px;min-width:0}
.wl-cele li p{margin:0}
.wl-cele small{font-size:.8125rem;color:var(--ok);font-weight:700}
.wl-cele strong{color:var(--ok);font-weight:800}

/* Header actions and the share sheet */
.wl-h-a{display:flex;gap:8px}
.wl-share{position:fixed;inset:0;z-index:10;display:flex;justify-content:center;align-items:flex-start;overflow-y:auto;overscroll-behavior:contain;background:oklch(0.17 0.03 266 / .6);padding:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left))}
.wl-share-c{display:grid;gap:14px;width:min(460px,100%);margin:auto 0;padding:20px;background:var(--surface);border:1px solid var(--line-strong);border-radius:12px;box-shadow:0 24px 60px oklch(0.17 0.03 266 / .3)}
.wl-share-c h3{font-size:1.125rem;font-weight:800}
.wl-share-v{border:1px solid var(--line);border-radius:8px;overflow:hidden;background:var(--surface-2)}
.wl-share-v canvas{display:block;width:100%;height:auto;max-height:55vh;max-height:55dvh;object-fit:contain}
.wl-share-o{display:flex;align-items:center;gap:10px;font-size:.9375rem;font-weight:600;min-height:44px;cursor:pointer}
.wl-share-o input{width:20px;height:20px;accent-color:var(--cobalt);flex:none}

/* Breakdown table */
.wl-tw{overflow-x:auto}
.wl-t{width:100%;border-collapse:collapse;font-size:.875rem}
.wl-t th,.wl-t td{text-align:left;padding:10px 8px;border-bottom:1px solid var(--line)}
.wl-t th{font-size:.8125rem;font-weight:700;color:var(--text-muted);border-bottom-color:var(--line-strong)}
.wl-t th:nth-child(n+2),.wl-t td:nth-child(n+2){text-align:right}
.wl-t .dn{color:var(--ok);font-weight:700}.wl-t .up{color:var(--bad);font-weight:700}
.wl-empty,.wl-fn{color:var(--text-muted);font-size:.8125rem}
.wl-empty{padding:24px var(--wl-pad)}
.wl-link{border:0;background:none;color:var(--cobalt);font:inherit;font-weight:700;font-size:.8125rem;padding:10px 0 0;cursor:pointer}
.wl-ov{font-size:.6875rem;font-weight:600;color:var(--text-muted);white-space:nowrap}
.wl-bar[data-long]{flex-basis:76px;min-width:76px}
.wl-bar[data-long] .wl-ov{text-align:center}

@media (max-width:600px){
  .wl{padding:0 env(safe-area-inset-right) 0 env(safe-area-inset-left)}
  .wl-card{--wl-pad:16px;border:0;border-radius:0;min-height:100vh;min-height:100dvh;box-shadow:none}
  .wl-top{border-radius:0;padding-top:env(safe-area-inset-top)}
  .wl-body{padding-bottom:calc(var(--wl-pad) + env(safe-area-inset-bottom))}
  .wl-from{display:grid;grid-template-columns:minmax(0,1fr);gap:8px;margin-bottom:0}
  .wl-from label:not(:first-child){margin-top:8px}
  .wl-from input,.wl-from select{width:100%;min-width:0;min-height:44px}
  .wl-dt{display:block;width:100%}
  .wl-dt input{min-width:0}
  .wl-facts{grid-template-columns:repeat(2,minmax(0,1fr))}
  .wl-ins{grid-template-columns:minmax(0,1fr)}
  .wl-gp .wl-fact:nth-child(3){grid-column:1/-1}
}
@media (max-width:420px){
  .wl-gp-ticks{font-size:.6875rem;margin-right:34px}
  .wl-gp-bmi{font-size:.6875rem;margin-right:34px}
  .wl-gp-track{margin-right:34px}
}
@media (max-width:360px){
  .wl-seg button{padding:0 8px}
}
/* Phones turned sideways: the sticky header would eat a third of the screen */
@media (max-height:480px){
  .wl-top{position:static}
}
/* Fingers need bigger targets than a mouse */
@media (pointer:coarse){
  .wl-x{width:44px;height:44px}
  .wl-seg button,.wl-btn,.wl-from input,.wl-from select{min-height:44px}
}
@media (prefers-reduced-motion:no-preference){.wl-card{animation:wlin .2s var(--ease-out)}@keyframes wlin{from{opacity:0;transform:translateY(8px)}}}
