/* BerryTree web client, in the "Bright" look: your numbers as a friendly
   scoreboard under a green canopy, with big rounded numbers and bold colour
   cards. System fonts and same-origin assets only. The rounded face is the
   system's own (ui-rounded); where a browser has none, the system face. */
:root {
  color-scheme: light;
  /* Bright's own colours. Leaf, sun, berry, blue and tang are fills: text on
     them is ink, or white on blue. Text colours are the ink tokens below. */
  --leaf: #22C772;
  --leaf-tint: #CFF5DE;
  --sun: #FFD03D;
  --sun-tint: #FFF0B8;
  --berry: #FF4D5E;
  --berry-tint: #FFD9DC;
  --blue: #2348E8;
  --blue-tint: #DCE4FF;
  --tang: #FF8A2B;
  --tang-tint: #FFE1C7;
  /* the canopy across the top of each screen, with a darker rim under its curve */
  --canopy: #22C772;
  --canopy-rim: #17A85C;
  --canopy-ink: #15171E;
  --canopy-ink-2: #3D404A;
  --canopy-btn: rgba(255, 255, 255, 0.36);
  --canopy-btn-hover: rgba(255, 255, 255, 0.56);
  /* the big blue card: last night's sleep */
  --hero: #2348E8;
  --hero-ink: #FFFFFF;
  --hero-ink-2: #E3E8FF;
  /* the dark pill: primary buttons and the chosen tab */
  --strong: #15171E;
  --strong-hover: #30333D;
  --on-strong: #FFFFFF;
  /* the dark card: Look back */
  --deep: #15171E;
  --on-deep: #FFFFFF;
  --on-deep-2: #C9CBD3;
  /* soft fills for secondary buttons and chips, on any card */
  --fill: rgba(21, 23, 30, 0.07);
  --fill-hover: rgba(21, 23, 30, 0.12);
  --tabbar: rgba(255, 255, 255, 0.96);
  --tabbar-edge: 0 10px 30px rgba(21, 23, 30, 0.12), 0 0 0 1px rgba(21, 23, 30, 0.06);
  --switch-on: #17A85C;
  --switch-off: #8F8577;
  /* the edge of a field: 3 to 1 or more against the field and the card round it */
  --field-edge: rgba(21, 23, 30, 0.5);
  /* a ring in two tones, so focus shows on cream, white, green, yellow, blue and ink alike */
  --focus: #15171E;
  --focus-gap: #FFFFFF;
  /* the colour cards for today's numbers, and the colour of each one's mark */
  --t-heart: #FFD6D1;
  --t-hrv: #CFF5DE;
  --t-steps: #FFD03D;
  --t-glucose: #FFE1C7;
  --m-heart: #FF4D5E;
  --m-hrv: #12A85A;
  --m-steps: #15171E;
  --m-glucose: #FF8A2B;
  --m-sleep: #2348E8;
  --m-exercise: #E5701A;
  --m-meals: #12A85A;
  --m-mind: #7A5AF0;
  /* the circle card */
  --circle: #FFD03D;
  --circle-edge: none;
  --circle-ink-2: #3D404A;
  --circle-lane: rgba(255, 255, 255, 0.62);
  --circle-line: rgba(21, 23, 30, 0.14);
  --sparkle-dot: #15171E;
  --round: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --text: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* the names the rest of the stylesheet uses */
  --page: #FFF7EC;
  --surface: #FFFFFF;
  --raised: #FFFFFF;
  --ink: #15171E;
  --ink-2: #3D404A;
  --muted: #5E6270;
  --hairline: #EFE4D3;
  --axis: #D5C9B5;
  --border: rgba(21, 23, 30, 0.13);
  --accent-fill: #2348E8;
  --accent-ink: #2348E8;
  --user-bubble: #2348E8;
  --warn-bg: #FFF0B8;
  --warn-ink: #5C4300;
  --alert-bg: #FFD9DC;
  --alert-ink: #8A1020;
  /* chart palette: validated categorical slots, light steps */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #6250d6;
  --series-8: #e34948;
  --viz-deemphasis: #a8a69f;
  /* sleep stages: one-hue ordinal ramp, lighter to darker with depth */
  --stage-1: #86b6ef;
  --stage-2: #3987e5;
  --stage-3: #1c5cab;
  --stage-4: #0d366b;
  --radius: 24px;
  --shadow: 0 1px 2px rgba(21, 23, 30, 0.06), 0 14px 36px rgba(21, 23, 30, 0.14);
  /* icons, drawn as masks in the colour of the text around them */
  --i-tab-data: 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.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 20v-6M10 20V9M15 20v-8M20 20V4'/%3E%3C/svg%3E");
  --i-tab-body: 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.1' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='4.6' r='2.4'/%3E%3Cpath d='M4 8.6c2.6 1.1 5.2 1.6 8 1.6s5.4-.5 8-1.6M12 10.2v5.2M12 15.4l-3.6 6.1M12 15.4l3.6 6.1'/%3E%3C/svg%3E");
  --i-tab-rank: 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.1' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.5' y='11' width='6.3' height='9.5' rx='1.6'/%3E%3Crect x='8.8' y='5' width='6.4' height='15.5' rx='1.6'/%3E%3Crect x='15.2' y='14' width='6.3' height='6.5' rx='1.6'/%3E%3C/svg%3E");
  --i-tab-ask: 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.1' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5c5 0 9 3.4 9 7.6s-4 7.6-9 7.6c-1 0-2-.1-2.9-.4L4.5 20.5l1.2-4.1C4 15 3 13.1 3 11.1 3 6.9 7 3.5 12 3.5z'/%3E%3Cpath d='m12 7.6.9 2.2 2.2.9-2.2.9-.9 2.2-.9-2.2-2.2-.9 2.2-.9z' fill='black' stroke-width='1'/%3E%3C/svg%3E");
  --i-moon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M20.5 14.6A8.6 8.6 0 0 1 9.4 3.5a8.6 8.6 0 1 0 11.1 11.1z'/%3E%3C/svg%3E");
  --i-heart: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 20.5s-8-4.7-8-10.6A4.4 4.4 0 0 1 12 7.3a4.4 4.4 0 0 1 8 2.6c0 5.9-8 10.6-8 10.6z'/%3E%3C/svg%3E");
  --i-pulse: 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.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 12h4l2.5-6 4.5 12 3-8 1.5 2h3.5'/%3E%3C/svg%3E");
  --i-steps: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cellipse cx='8.5' cy='8' rx='3.2' ry='4.6' transform='rotate(-12 8.5 8)'/%3E%3Ccircle cx='9.6' cy='15.2' r='1.9'/%3E%3Cellipse cx='15.5' cy='12' rx='3.2' ry='4.6' transform='rotate(12 15.5 12)'/%3E%3Ccircle cx='14.4' cy='19.2' r='1.9'/%3E%3C/svg%3E");
  --i-drop: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2.8s6.4 6.9 6.4 11.6a6.4 6.4 0 0 1-12.8 0C5.6 9.7 12 2.8 12 2.8z'/%3E%3C/svg%3E");
  --i-bolt: 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.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13 2.5 5.5 13.5H12l-1 8 7.5-11H12z'/%3E%3C/svg%3E");
  --i-gauge: 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.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 15.5a9 9 0 0 1 18 0'/%3E%3Cpath d='M12 15.5l4-5'/%3E%3C/svg%3E");
  --i-bowl: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M2.8 11.5h18.4a9.2 9.2 0 0 1-18.4 0z'/%3E%3Cpath d='M11.6 9.6c-.3-3.6 1.9-6 5.6-6.1.2 3.6-2 5.9-5.6 6.1z'/%3E%3C/svg%3E");
  --i-smile: 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.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.6'/%3E%3Cpath d='M8.4 13.8a4.4 4.4 0 0 0 7.2 0M9 9.4v.1M15 9.4v.1'/%3E%3C/svg%3E");
  --i-sparkle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='m12 2 2.4 6.6L21 11l-6.6 2.4L12 20l-2.4-6.6L3 11l6.6-2.4z'/%3E%3C/svg%3E");
  --i-info: 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.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5.5M12 7.6v.1'/%3E%3C/svg%3E");
  --i-plus: 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.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
  --i-check: 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.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  --i-sparkle-sun: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m12 2 2.4 6.6L21 11l-6.6 2.4L12 20l-2.4-6.6L3 11l6.6-2.4z' fill='%23FFD03D'/%3E%3C/svg%3E");
}
/* Bright at night: the same canopy, cards and colours, on an evergreen near-black. */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --leaf: #2FD07E;
    --leaf-tint: #12301F;
    --sun: #FFD03D;
    --sun-tint: #33290F;
    --berry: #FF6B78;
    --berry-tint: #3A1719;
    --blue: #2A44C8;
    --blue-tint: #18244F;
    --tang: #FF9F4D;
    --tang-tint: #3A2614;
    --canopy: #11583A;
    --canopy-rim: #0A3D27;
    --canopy-ink: #EFF5F4;
    --canopy-ink-2: #C9E8D6;
    --canopy-btn: rgba(255, 255, 255, 0.12);
    --canopy-btn-hover: rgba(255, 255, 255, 0.2);
    --hero: #2A44C8;
    --hero-ink: #FFFFFF;
    --hero-ink-2: #DCE4FF;
    --strong: #EFF5F4;
    --strong-hover: #FFFFFF;
    --on-strong: #0B1311;
    --deep: #1E2826;
    --on-deep: #EFF5F4;
    --on-deep-2: #B4C0BE;
    --fill: rgba(239, 245, 244, 0.09);
    --fill-hover: rgba(239, 245, 244, 0.15);
    --tabbar: rgba(24, 33, 31, 0.97);
    --tabbar-edge: 0 14px 34px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(239, 245, 244, 0.08);
    --switch-on: #2FD07E;
    --switch-off: #6F7B78;
    --field-edge: rgba(239, 245, 244, 0.45);
    --focus: #EFF5F4;
    --focus-gap: #0B1311;
    --t-heart: #3A1D22;
    --t-hrv: #12301F;
    --t-steps: #3A300B;
    --t-glucose: #3A2614;
    --m-heart: #FF6B78;
    --m-hrv: #2FD07E;
    --m-steps: #FFD03D;
    --m-glucose: #FF9F4D;
    --m-sleep: #8FB0FF;
    --m-exercise: #FF9F4D;
    --m-meals: #2FD07E;
    --m-mind: #B3A1FF;
    /* a clearer dark yellow with a sun-yellow top edge, so it still reads as the yellow card and apart from the notice */
    --circle: #3A2E00;
    --circle-edge: inset 0 3px 0 var(--sun);
    --circle-ink-2: #D9CFA8;
    --circle-lane: rgba(255, 208, 61, 0.13);
    --circle-line: rgba(255, 240, 200, 0.14);
    --sparkle-dot: #2A3634;
    --page: #0B1311;
    --surface: #141D1B;
    --raised: #1E2826;
    --ink: #EFF5F4;
    --ink-2: #B4C0BE;
    --muted: #97A3A1;
    --hairline: #27302F;
    --axis: #3A4644;
    --border: rgba(239, 245, 244, 0.13);
    --accent-fill: #2A44C8;
    --accent-ink: #8FB0FF;
    --user-bubble: #2A44C8;
    --warn-bg: #33290F;
    --warn-ink: #F3D590;
    --alert-bg: #3A1719;
    --alert-ink: #FFC2C8;
    /* dark steps chosen for the dark surface, not an automatic flip */
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #0ca30c;
    --series-7: #9085e9;
    --series-8: #e66767;
    --viz-deemphasis: #6b6a66;
    --stage-1: #184f95;
    --stage-2: #2a78d6;
    --stage-3: #6da7ec;
    --stage-4: #b7d3f6;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 14px 36px rgba(0, 0, 0, 0.55);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.5 var(--text);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
button, textarea, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 2px var(--focus-gap); }

#app { height: 100%; }
.screen { height: 100%; max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; }
/* An icon drawn as a mask: it takes the colour of the text around it. */
.view-tab::before, .tile-label::before, .wk-name::before, .rk-cat::after, .wk-ask::before, .notice::before, #rankInviteBtn::before {
  content: ""; flex: none; display: block; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}

/* ------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: var(--fill); color: var(--ink); border-radius: 999px; padding: 10px 18px; font: 700 15px/1.2 var(--text); min-height: 44px; text-align: center; }
.btn:hover { background: var(--fill-hover); }
.btn-primary { background: var(--strong); color: var(--on-strong); }
.btn-primary:hover { background: var(--strong-hover); }
/* Quiet buttons (Not now, Skip, Done, Remove) have the same soft fill as other buttons, so every
   button looks like one wherever it is; only the primary one is dark. */
.btn-danger { color: var(--alert-ink); }
.btn-wide { width: 100%; min-height: 56px; font-size: 17px; }
.btn[disabled] { opacity: 0.5; cursor: default; }
/* a button that stays pressed shows a ring: Bright buttons have no border to colour */
.btn[aria-pressed="true"] { box-shadow: inset 0 0 0 2px currentColor; }
.icon-btn { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 999px; border: 0; background: transparent; color: inherit; }
.icon-btn:hover { background: var(--fill); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn-fill { background: var(--strong); color: var(--on-strong); }
.icon-btn-fill:hover { background: var(--strong-hover); }
.icon-btn[disabled] { opacity: 0.4; }
.chip { border: 0; background: var(--fill); color: var(--ink); border-radius: 999px; padding: 9px 16px; font: 600 15px/1.3 var(--text); min-height: 40px; text-align: left; }
.chip:hover { background: var(--fill-hover); }
.chip[disabled] { opacity: 0.5; cursor: default; }
.chip-ref { display: inline-flex; align-items: center; gap: 6px; padding: 2px 11px; min-height: 28px; font-size: 14px; font-weight: 700; vertical-align: baseline; color: var(--accent-ink); background: var(--blue-tint); }
.chip-ref:hover { background: var(--blue-tint); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent-ink) 40%, transparent); }
.chip-ref::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ------------------------------------------------------------ onboarding */
/* The welcome screen spans the window so its canopy can; what is read keeps to a column. */
.onboarding { overflow-y: auto; overflow-x: hidden; max-width: none; }
.onboarding-inner { padding: 0 0 48px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.onboarding-inner > * { width: min(560px, 100% - 40px); }
.onboarding h1 { font: 800 36px/1 var(--round); letter-spacing: -0.03em; }
/* The mark beside the name. The picture has its own rounded corners. */
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { flex: none; display: block; }
.brand-lg { gap: 12px; margin-top: 4px; }
.tagline { font: 800 21px/1.15 var(--round); letter-spacing: -0.01em; color: var(--ink); margin-top: -4px; }
.onboarding h2 { font: 800 20px/1.2 var(--round); letter-spacing: -0.01em; margin-top: 14px; }
.lede { font-size: 17px; line-height: 1.45; color: var(--ink-2); }
.fine { font-size: 14px; color: var(--ink-2); }
.notice { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); }
.notice::before { --icon: var(--i-info); width: 17px; height: 17px; margin-top: 2px; }
.disclosure p { color: var(--ink-2); font-size: 15px; }
.disclosure p + p { margin-top: 8px; }
.sharing { border: 0; border-radius: var(--radius); padding: 0 18px 14px; background: var(--surface); margin: 0; min-width: 0; }
/* floated, the legend sits inside the card instead of on its edge */
.sharing legend { float: left; width: 100%; padding: 16px 0 4px; font: 800 17px/1.2 var(--round); }
.sharing legend + * { clear: both; }
.sharing .btn-quiet { margin-top: 6px; }
.toggle-row { display: flex; gap: 14px; align-items: flex-start; padding: 13px 0; border-bottom: 1px solid var(--hairline); }
.toggle-row:last-of-type { border-bottom: 0; }
.toggle-row .toggle-text { flex: 1; min-width: 0; }
.toggle-row strong { display: block; font-size: 15px; font-weight: 700; }
.toggle-row span.covers { display: block; font-size: 14px; color: var(--ink-2); }
.switch { position: relative; flex: none; width: 50px; height: 30px; margin-top: 1px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: var(--switch-off); transition: background 0.15s; pointer-events: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
.switch input:checked + .track { background: var(--switch-on); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 2px var(--focus-gap); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--ink-2); }
.check input { margin-top: 3px; width: 20px; height: 20px; flex: none; accent-color: var(--switch-on); }
.error { color: var(--alert-ink); background: var(--alert-bg); border-radius: 16px; padding: 12px 14px; font-size: 14px; font-weight: 600; }

/* The canopy over the welcome screen, and a few made-up numbers under it to
   show what the app is for. It is a picture: hidden from screen readers. */
.welcome-art { position: relative; overflow: hidden; height: calc(408px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); margin-bottom: 4px; }
.onboarding-inner > .welcome-art { width: 100%; }
.welcome-art::before { content: ""; position: absolute; inset: 0 -40px 9px; background: var(--canopy); border-radius: 0 0 50% 50% / 0 0 80px 80px; box-shadow: 0 9px 0 var(--canopy-rim); }
.wa-stage { position: relative; width: 360px; height: 100%; margin: 0 auto; }
.wa-card { position: absolute; margin: 0; box-shadow: 0 16px 28px rgba(8, 70, 36, 0.28); color: #15171E; }
.wa-sleep { left: 14px; top: 34px; width: 236px; height: 172px; padding: 16px 18px; border-radius: 26px; background: #2348E8; color: #fff; transform: rotate(-4deg); }
.wa-sleep .wa-label { font: 600 13px/1 var(--text); color: #E3E8FF; }
.wa-big { margin-top: 7px; font: 800 42px/1 var(--round); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.wa-big small { font: 700 19px/1 var(--round); letter-spacing: 0; margin: 0 5px 0 2px; }
.wa-sleep svg { position: absolute; left: 18px; bottom: 18px; }
.wa-circle { left: 168px; top: 182px; width: 182px; padding: 13px 13px 14px; border-radius: 22px; background: #FFD03D; transform: rotate(5deg); }
/* one line each, as on the mockup, in the system face as well as the rounded one */
.wa-head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; white-space: nowrap; }
.wa-head b { font: 800 15px/1 var(--round); }
.wa-head span { font: 600 11px/1 var(--text); color: #3D404A; }
.wa-lane { margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.wa-av { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 800 11px/1 var(--round); flex: none; font-style: normal; }
.wa-av-b { background: #FF4D5E; }
.wa-av-y { background: #22C772; }
.wa-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wa-who > span { display: flex; justify-content: space-between; align-items: baseline; font: 600 12px/1 var(--text); }
.wa-who b { font: 800 14px/1 var(--round); font-variant-numeric: tabular-nums; }
.wa-track { margin-top: 4px; height: 6px; border-radius: 3px; background: rgba(21, 23, 30, 0.12); overflow: hidden; display: block; }
.wa-track i { display: block; height: 100%; border-radius: 3px; background: #15171E; }
.wa-track .wa-other { width: 100%; background: #fff; }
.wa-track .wa-you { width: 75%; }
/* clear of the circle card above it, and inside the canopy's curve */
.wa-ask { left: 18px; top: 312px; display: flex; align-items: center; gap: 10px; padding: 11px 16px 11px 11px; border-radius: 22px 22px 22px 6px; background: #fff; font: 600 15px/1.2 var(--text); transform: rotate(-3deg); }
.wa-spark { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--i-sparkle-sun) center / 16px 16px no-repeat, #15171E; }
.wa-twinkle { position: absolute; right: 18px; top: 38px; }

/* ------------------------------------------------------------ main */
/* The canopy runs edge to edge, so the main screen spans the window and its
   parts keep to a centred column: --gutter is the space either side of it. */
#main { --col: 720px; --gutter: max(16px, (100% - var(--col)) / 2); max-width: none; }
.topbar {
  position: relative; z-index: 1; isolation: isolate; overflow: hidden; flex: none;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) 30px max(var(--gutter), env(safe-area-inset-left));
  color: var(--canopy-ink);
}
/* The band is wider than the screen, so only the middle of its curve shows. */
.topbar::before { content: ""; position: absolute; z-index: -1; inset: 0 -40px 7px; background: var(--canopy); border-radius: 0 0 50% 50% / 0 0 34px 34px; box-shadow: 0 7px 0 var(--canopy-rim); }
.topbar-title { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.topbar h1 { font: 600 13px/1.2 var(--text); color: var(--canopy-ink-2); }
/* The name of the tab on screen, as a title. All four are in the page; the one for the tab showing is drawn. */
.view-name { font: 800 32px/1.05 var(--round); letter-spacing: -0.02em; white-space: nowrap; }
.view-name > span { display: none; }
#app:not([data-tab]) .vn-data, #app[data-tab="data"] .vn-data, #app[data-tab="body"] .vn-body, #app[data-tab="rank"] .vn-rank, #app[data-tab="ask"] .vn-ask { display: inline; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.topbar .icon-btn { background: var(--canopy-btn); color: var(--canopy-ink); }
.topbar .icon-btn:hover { background: var(--canopy-btn-hover); }
.topbar-mark { display: block; flex: none; width: 40px; height: 40px; margin-left: 2px; }
#thread { flex: 1; min-height: 0; overflow-y: auto; padding: 12px max(var(--gutter), env(safe-area-inset-right)) 16px max(var(--gutter), env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }

/* Today's numbers as colour cards: last night's sleep across the top, the rest two by two. */
.today { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; flex: none; }
.tile { min-width: 0; min-height: 100px; display: flex; flex-direction: column; align-items: flex-start; padding: 14px 14px 13px 16px; background: var(--surface); color: var(--ink); border: 0; border-radius: var(--radius); text-align: left; }
button.tile:hover { filter: brightness(0.97) saturate(1.05); }
.tile-label { display: flex; align-items: center; gap: 6px; font: 600 13px/1.25 var(--text); color: inherit; }
.tile-label::before { display: none; width: 15px; height: 15px; color: var(--mark); }
.tile:is([data-tile="sleep_duration_h"], [data-tile="sleeping_hr"], [data-tile="sleeping_hrv"], [data-tile="steps"], [data-tile="glucose_mean"]) .tile-label::before { display: block; }
.tile-value { margin-top: auto; padding-top: 6px; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 3px; font: 800 clamp(28px, 8.6vw, 34px)/1.05 var(--round); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile-value small { font: 700 15px/1 var(--round); letter-spacing: 0; }
/* the "h" in "7 h 22 min": a little more room before the minutes than after the hours */
.tile-value small:not(:last-child), .wk-value small:not(:last-child), .rc-value small:not(:last-child) { margin-right: 4px; }
.tile-usual { margin-top: 4px; font-size: 13px; line-height: 1.2; color: var(--ink-2); }
.tile[data-tile="sleep_duration_h"] { grid-column: 1 / -1; padding: 16px 18px 17px; background: var(--hero) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 34'%3E%3Cpath d='m30 1 1.9 5.1L37 8l-5.1 1.9L30 15l-1.9-5.1L23 8l5.1-1.9z' fill='%23FFD03D'/%3E%3Cpath d='m40 17 1 2.7 2.7 1-2.7 1-1 2.7-1-2.7-2.7-1 2.7-1z' fill='%23fff' fill-opacity='.7'/%3E%3Cpath d='m12 20 .8 2.2 2.2.8-2.2.8-.8 2.2-.8-2.2L9 23l2.2-.8z' fill='%23fff' fill-opacity='.55'/%3E%3C/svg%3E") top 14px right 16px / 44px 34px no-repeat; color: var(--hero-ink); --mark: var(--hero-ink); --icon: var(--i-moon); }
.tile[data-tile="sleep_duration_h"] .tile-label { font-size: 15px; }
.tile[data-tile="sleep_duration_h"] .tile-label::before { width: 18px; height: 18px; }
.tile[data-tile="sleep_duration_h"] .tile-value { font-size: clamp(42px, 13.4vw, 54px); padding-top: 10px; }
.tile[data-tile="sleep_duration_h"] .tile-value small { font-size: 22px; }
.tile[data-tile="sleep_duration_h"] .tile-usual { color: var(--hero-ink-2); font-size: 15px; }
.tile[data-tile="sleeping_hr"] { background: var(--t-heart); --mark: var(--m-heart); --icon: var(--i-heart); }
.tile[data-tile="sleeping_hrv"] { background: var(--t-hrv); --mark: var(--m-hrv); --icon: var(--i-pulse); }
.tile[data-tile="steps"] { background: var(--t-steps); --mark: var(--m-steps); --icon: var(--i-steps); }
/* "Steps so far" already names the unit, as on the mockup */
.tile[data-tile="steps"] .tile-value small { display: none; }
.tile[data-tile="glucose_mean"] { background: var(--t-glucose); --mark: var(--m-glucose); --icon: var(--i-drop); }

.card { background: var(--surface); border: 0; border-radius: var(--radius); padding: 16px 18px; }
.card-kicker { font: 700 13px/1.3 var(--text); color: var(--ink-2); margin-bottom: 6px; }
.card-why { font-size: 15px; color: var(--ink); }
.card-question { font: 800 17px/1.3 var(--round); margin-top: 8px; }
.card-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.card-foot { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: 12px; font-size: 13px; color: var(--muted); }
.card-foot .btn { flex: none; white-space: nowrap; }
.card-safety { background: var(--alert-bg); color: var(--alert-ink); }
.card-safety h3 { font: 800 17px/1.25 var(--round); margin-bottom: 4px; }
.card-safety a { display: inline-block; margin-top: 10px; font-weight: 700; color: inherit; }
.card-consent { background: var(--warn-bg); color: var(--warn-ink); }
/* What the app noticed, or a follow-up: a question from the app, in blue. */
#checkins { display: flex; flex-direction: column; gap: 14px; }
#checkins:empty { display: none; }
#checkins .card { background: var(--blue-tint); --muted: var(--ink-2); }
#checkins .chip { background: var(--surface); }
#checkins .chip:hover { background: var(--raised); box-shadow: inset 0 0 0 2px var(--border); }

.empty { margin: auto 0; padding: 24px 0; text-align: center; }
.empty-title { font: 800 24px/1.2 var(--round); letter-spacing: -0.01em; margin-bottom: 16px; }
.suggestions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; max-width: 440px; margin: 0 auto; }
/* each suggestion is a question waiting to be asked */
.suggestions .chip { display: flex; align-items: center; gap: 10px; text-align: left; background: var(--surface); border-radius: 22px 22px 22px 6px; padding: 10px 16px 10px 10px; font-size: 15px; box-shadow: 0 4px 14px rgba(21, 23, 30, 0.06); }
.suggestions .chip::before { content: ""; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--i-sparkle-sun) center / 16px 16px no-repeat, var(--sparkle-dot); }
.suggestions .chip:hover { background: var(--surface); box-shadow: 0 4px 14px rgba(21, 23, 30, 0.06), inset 0 0 0 2px var(--border); }

.log { display: flex; flex-direction: column; gap: 14px; }
.msg-user { align-self: flex-end; max-width: 86%; background: var(--user-bubble); color: #fff; border-radius: 22px 22px 6px 22px; padding: 10px 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-origin { display: block; font-size: 12px; font-weight: 600; color: var(--hero-ink-2); margin-bottom: 2px; }
.msg-assistant { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.msg-assistant p { overflow-wrap: anywhere; }
.msg-assistant ul, .msg-assistant ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.msg-assistant h4 { margin: 4px 0 0; font: 800 17px/1.25 var(--round); }
.status { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--switch-on); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .status::before { animation: none; } #thread { scroll-behavior: auto; } }
.verify { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: baseline; }
.verify-warn { color: var(--warn-ink); background: var(--warn-bg); border-radius: 14px; padding: 9px 12px; }
.msg-error { color: var(--alert-ink); background: var(--alert-bg); border-radius: 16px; padding: 11px 14px; font-size: 15px; font-weight: 600; }

.meal { display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: start; }
.meal-photo { width: 76px; height: 76px; border-radius: 18px; object-fit: cover; background: var(--fill); }
.meal-title { font: 800 16px/1.25 var(--round); }
.meal-energy { font: 800 26px/1.15 var(--round); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.meal-energy small { font: 600 13px/1.2 var(--text); letter-spacing: 0; color: var(--ink-2); }
.meal-macros { font-size: 14px; color: var(--ink-2); }
.meal-body { grid-column: 1 / -1; }
.meal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
/* what went wrong with a change, and the way to make it again */
.meal-problem { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 10px; }

/* recent meals: one swipeable row on a phone */
.recent { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: none; }
.recent-title { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); }
.recent-row { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding: 0 16px; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
.recent-row::-webkit-scrollbar { display: none; }
.recent-meal { flex: 0 0 auto; width: 216px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 1px; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.recent-meal:hover { border-color: var(--accent-ink); }
.recent-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-meta { font-size: 13px; color: var(--ink-2); }
.recent-open { font-size: 13px; color: var(--accent-ink); }

/* The box you type into: a white pill over the tab bar. */
.composer { flex: none; display: flex; align-items: flex-end; gap: 8px; margin: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left)); padding: 6px; background: var(--surface); border-radius: 28px; box-shadow: 0 6px 20px rgba(21, 23, 30, 0.08), 0 0 0 1px var(--border); }
.composer textarea { flex: 1; min-width: 0; border: 0; background: transparent; resize: none; padding: 8px 4px; max-height: 140px; outline: none; font-size: 16px; }
/* hint text in every field: the browser's own grey is too faint on the dark fields */
::placeholder { color: var(--muted); opacity: 1; }
/* typing shows a ring round the whole pill; the buttons in it have rings of their own */
.composer:has(textarea:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.composer #mealBtn { background: var(--fill); }
.composer #mealBtn:hover { background: var(--fill-hover); }
.footnote { flex: none; text-align: center; font-size: clamp(11px, 3.2vw, 12px); line-height: 1.35; color: var(--muted); padding: 6px 12px 0; }

/* ------------------------------------------------------------ views */
/* The tab bar: a white pill at the foot of the screen, the tab showing in ink.
   It comes after the conversation box on screen; in the page it stays where it was, after the top bar. */
.views { order: 1; flex: none; display: flex; gap: 4px; margin: 8px max(16px, (100% - 460px) / 2) max(10px, env(safe-area-inset-bottom)); padding: 5px; border-radius: 32px; background: var(--tabbar); box-shadow: var(--tabbar-edge); }
/* nowrap: four tabs share the row, and a name breaking onto two lines would make the bar taller */
.view-tab { flex: 1; min-width: 0; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: transparent; border-radius: 27px; padding: 6px 4px; font: 600 11px/1.15 var(--text); color: var(--muted); white-space: nowrap; }
.view-tab::before { width: 24px; height: 24px; }
#tabData { --icon: var(--i-tab-data); }
#tabBody { --icon: var(--i-tab-body); }
#tabRank { --icon: var(--i-tab-rank); }
#tabAsk { --icon: var(--i-tab-ask); }
.view-tab:hover { color: var(--ink); }
.view-tab.is-on { background: var(--strong); color: var(--on-strong); }
.view { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
#askView { flex: 1; }

/* ------------------------------------------------------------ body tab */
/* The figure gets the room: a wider page, and no composer under it. */
#app[data-tab="body"] #main { --col: 1180px; }
#app[data-tab="body"] .composer, #app[data-tab="body"] .footnote { display: none; }
#app[data-tab="body"] #thread { padding-bottom: 6px; }
/* A drag on the figure turns the body, so the tab has to fit the screen: a
   lower canopy, and the cards that are not about the body (the notice that the
   assistant is off, and check-ins) are left to the other tabs, where they still show. */
#app[data-tab="body"] .topbar { padding-bottom: 20px; }
/* flatter, so the title and buttons stay on the green where the page is wide and they sit near its ends */
#app[data-tab="body"] .topbar::before { border-radius: 0 0 50% 50% / 0 0 20px 20px; }
#app[data-tab="body"] .view-name { font-size: 24px; }
#app[data-tab="body"] #thread > .card-consent, #app[data-tab="body"] #checkins { display: none; }
.view-body { flex: 1; min-height: 0; }
.body-status { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; flex: none; padding: 14px 16px; }
.body-text { flex: 1 1 180px; min-width: 0; display: flex; flex-direction: column; gap: 6px; font-size: 15px; font-weight: 600; }
.body-week { display: grid; grid-template-columns: repeat(7, 14px); gap: 4px; flex: none; }
.body-day { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.body-track { width: 10px; height: 36px; display: flex; align-items: flex-end; border-bottom: 1px solid var(--axis); }
.body-bar { display: block; width: 100%; border-radius: 5px 5px 1px 1px; background: var(--blue); }
.body-day.is-unlogged .body-bar { display: none; }
.body-day-name { font-size: 11px; line-height: 1; color: var(--ink-2); }
.body-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.body-actions .btn { min-height: 40px; padding: 8px 15px; font-size: 14px; }
/* The figure takes whatever height is left, so the tab fits the screen: a drag on the figure turns the body, it cannot scroll the page. */
.body-frame { flex: 1; width: 100%; min-height: 260px; border: 0; border-radius: 26px; background: #04060c; display: block; }

/* ------------------------------------------------------------ rank tab */
/* Fields here and on the welcome screen. 16px text keeps a phone from zooming in on them. */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.field-hint { font-size: 13px; color: var(--muted); }
.field input, .field select { width: 100%; min-height: 46px; padding: 10px 14px; font-size: 16px; color: var(--ink); background: var(--raised); border: 1.5px solid var(--field-edge); border-radius: 14px; }
.field input:focus, .field select:focus { border-color: var(--ink); }
/* the invitation a new person arrived with */
.invite-banner { display: flex; flex-direction: column; gap: 4px; background: var(--blue-tint); }
.invite-from { font: 800 19px/1.2 var(--round); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.onboarding .join-title { font-size: 26px; letter-spacing: -0.02em; margin-top: 0; overflow-wrap: anywhere; }
.join-step .card-kicker { margin-bottom: -8px; }
/* The join step has the canopy too, with the mark under it. It keeps its full
   height, so on a short screen the welcome screen scrolls to Join and Not now;
   only the canopy's overhang either side is trimmed. */
.onboarding-inner.join-step { position: relative; flex: none; overflow: visible; overflow-x: clip; }
.join-step::before { content: ""; flex: none; width: calc(100% + 80px); height: 138px; margin-bottom: 6px; background: url("../img/icon.svg") center calc(50% - 6px) / 56px 56px no-repeat, var(--canopy); border-radius: 0 0 50% 50% / 0 0 40px 40px; box-shadow: 0 7px 0 var(--canopy-rim); }

/* The tab is read, not typed into, so the composer is put away here too. */
#app[data-tab="rank"] .composer, #app[data-tab="rank"] .footnote { display: none; }
#app[data-tab="rank"] #thread { padding-bottom: 20px; }
/* The hidden labels for screen readers are placed inside the tab, so a long tab scrolls in its own frame and not the whole page. */
.view-rank { position: relative; }
.rk-section { display: flex; flex-direction: column; gap: 14px; padding: 18px 16px 16px; min-width: 0; border-radius: 28px; }
.rk-head { display: flex; flex-direction: column; gap: 3px; }
.rk-title { font: 800 21px/1.15 var(--round); letter-spacing: -0.01em; color: var(--ink); }
.rk-sub { font-size: 13px; color: var(--ink-2); }
.rk-note { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.rk-notice { color: var(--ink); font-weight: 600; }
.rk-h3 { font: 800 16px/1.25 var(--round); }
.rk-block { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--hairline); padding-top: 12px; }
.rk-block .card-options { margin-top: 2px; }
.rk-wait { display: flex; flex-direction: column; gap: 4px; }
.rk-about { display: flex; flex-direction: column; gap: 8px; font-size: 15px; color: var(--ink-2); }
.rk-about p:first-child { color: var(--ink); }
.rk-unnamed { color: var(--muted); font-style: italic; }

/* Your circle: a sun-yellow card, the boards as lanes, your own lane lit. Inside
   it, the shared colour names are set again so every part pairs with yellow. */
#rankCircle { background: var(--circle); box-shadow: var(--circle-edge); --ink-2: var(--circle-ink-2); --muted: var(--circle-ink-2); --hairline: var(--circle-line); --border: var(--circle-line); --raised: var(--surface); --accent-ink: var(--ink); }
#rankCircle .btn-danger { color: var(--alert-ink); background: var(--alert-bg); }
/* the three boards, one under another at every width: side by side, a long name breaks every few letters */
.rk-boards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.rk-board { min-width: 0; }
.rk-board-title { font: 800 16px/1.2 var(--round); margin-bottom: 4px; }
.rk-table { width: 100%; border-collapse: separate; border-spacing: 0 3px; font-size: 15px; font-variant-numeric: tabular-nums; }
.rk-table td { padding: 7px 6px; vertical-align: middle; }
.rk-table td:first-child { padding-left: 6px; border-radius: 20px 0 0 20px; }
.rk-table td:last-child { padding-right: 12px; border-radius: 0 20px 20px 0; }
/* the place, in a round badge like a scoreboard's */
.rk-place { width: 46px; text-align: center; font: 800 14px/1 var(--round); color: var(--ink); background: radial-gradient(circle at 50% 50%, var(--fill-hover) 15px, transparent 15.5px); }
.rk-place:empty { background: none; }
.rk-name { font-weight: 600; overflow-wrap: anywhere; }
.rk-value { text-align: right; white-space: nowrap; font: 800 17px/1.2 var(--round); letter-spacing: -0.01em; }
.rk-value.is-empty { color: var(--muted); font-weight: 700; }
/* your own row */
.rk-table tr.is-you td { background-color: var(--circle-lane); }
/* the green disc only round a place: with no place yet, the cell is just your lane */
.rk-table tr.is-you .rk-place:not(:empty) { background: radial-gradient(circle at 50% 50%, var(--leaf) 15px, transparent 15.5px), var(--circle-lane); color: #15171E; }
.rk-you { margin-left: 7px; padding: 2px 7px; border-radius: 999px; font: 800 11px/1.2 var(--round); color: var(--on-strong); background: var(--strong); vertical-align: 1px; }

/* people and invitations */
.rk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rk-member, .rk-invite { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--hairline); }
.rk-list > li:last-child { border-bottom: 0; }
.rk-member-text { flex: 1 1 12em; min-width: 0; display: flex; flex-direction: column; }
.rk-member-name { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.rk-member-since { font-size: 13px; color: var(--ink-2); }
.rk-member.is-confirming, .rk-invite.is-confirming { display: block; margin: 4px 0; padding: 12px 14px; border: 0; border-radius: 18px; background: var(--raised); }
.rk-member.is-confirming .card-options, .rk-invite.is-confirming .card-options { margin-top: 10px; }
.rk-confirm-text { font-size: 15px; overflow-wrap: anywhere; }
.rk-invite-text { flex: 1 1 12em; min-width: 0; display: flex; flex-direction: column; font-size: 15px; }
.rk-invite-detail { font-size: 13px; color: var(--ink-2); }
.rk-remove { min-height: 36px; padding: 6px 13px; font-size: 14px; }
/* Invite someone: the dark pill across the card, as on the mockup */
#rankInviteBtn { --icon: var(--i-plus); width: 100%; min-height: 46px; background: var(--strong); color: var(--on-strong); font-size: 16px; gap: 8px; }
#rankInviteBtn:hover { background: var(--strong-hover); }

/* the link just made, shown whole so it can be checked by eye */
.rk-made { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 20px; background: var(--raised); border: 0; }
.rk-made .card-options { margin-top: 0; }
.rk-made-title { font: 800 16px/1.3 var(--round); }
.rk-link { font: 14px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 10px 12px; border-radius: 12px; background: var(--fill); border: 0; overflow-wrap: anywhere; word-break: break-all; -webkit-user-select: all; user-select: all; }

/* forms */
.rk-form { display: flex; flex-direction: column; gap: 12px; }
.rk-form .card-options { margin-top: 0; }
/* side by side only where "For example, 1990" fits whole in the birth year field: on a phone, one under the other */
.rk-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.rk-section .toggle-row { border-bottom: 0; border-top: 1px solid var(--hairline); padding: 12px 0 0; }
/* in place of the switch, for someone under 18 by the birth year given */
.rk-adults { border-top: 1px solid var(--hairline); padding-top: 12px; font-size: 14px; color: var(--ink-2); }

/* where you stand: a row for each number, with its mark, the place in a dark pill, and the server's own line under it */
.rk-cats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rk-cat { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; grid-template-areas: "mark head pill" ". line line"; column-gap: 11px; row-gap: 4px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.rk-cat:first-child { padding-top: 2px; }
.rk-cat:last-child { border-bottom: 0; }
.rk-cat::before { content: ""; grid-area: mark; width: 32px; height: 32px; border-radius: 11px; background: var(--fill); }
.rk-cat::after { grid-area: mark; justify-self: center; width: 17px; height: 17px; color: var(--mark); display: none; }
.rk-cat:is([data-category="steps"], [data-category="exercise"], [data-category="sleep"], [data-category="resting_hr"], [data-category="hrv"], [data-category="cardio"])::after { display: block; }
.rk-cat[data-category="steps"] { --mark: var(--m-steps); --icon: var(--i-steps); }
.rk-cat[data-category="steps"]::before { background: var(--t-steps); }
.rk-cat[data-category="exercise"] { --mark: var(--m-exercise); --icon: var(--i-bolt); }
.rk-cat[data-category="exercise"]::before { background: var(--t-glucose); }
.rk-cat[data-category="sleep"] { --mark: var(--m-sleep); --icon: var(--i-moon); }
.rk-cat[data-category="sleep"]::before { background: var(--blue-tint); }
.rk-cat[data-category="resting_hr"] { --mark: var(--m-heart); --icon: var(--i-heart); }
.rk-cat[data-category="resting_hr"]::before { background: var(--t-heart); }
.rk-cat[data-category="hrv"] { --mark: var(--m-hrv); --icon: var(--i-pulse); }
.rk-cat[data-category="hrv"]::before { background: var(--t-hrv); }
.rk-cat[data-category="cardio"] { --mark: var(--m-heart); --icon: var(--i-gauge); }
.rk-cat[data-category="cardio"]::before { background: var(--t-heart); }
.rk-cat-head { grid-area: head; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rk-cat-label { font-weight: 700; overflow-wrap: anywhere; }
.rk-cat-value { font: 800 17px/1.2 var(--round); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--ink-2); }
/* Sized for a band such as "Bottom 25%" as well as a place such as "12th of 60". */
.rk-pill { grid-area: pill; justify-self: end; white-space: nowrap; padding: 7px 11px; border-radius: 999px; background: var(--strong); color: var(--on-strong); font: 800 13px/1 var(--round); font-variant-numeric: tabular-nums; }
.rk-cat-line { grid-area: line; font-size: 13px; color: var(--ink-2); }
/* What the band goes by, and its source: under the line, clear of the mark. */
.rk-cat-basis, .rk-cat-source { grid-column: 2 / -1; }
.rk-details { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; border-top: 1px solid var(--hairline); padding-top: 12px; }
.rk-details-text { flex: 1 1 14em; min-width: 0; font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }

/* an invitation waiting for an answer */
.rk-join { display: flex; flex-direction: column; gap: 10px; background: var(--blue-tint); }
.rk-join .card-kicker { margin-bottom: -4px; }
.rk-join .card-options { margin-top: 2px; }
.rk-join-title { font: 800 22px/1.2 var(--round); letter-spacing: -0.01em; overflow-wrap: anywhere; }

/* ------------------------------------------------------------ your week */
.week { display: flex; flex-direction: column; gap: 14px; }
.wk-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px; border-radius: 999px; background: var(--surface); }
.wk-nav .icon-btn { background: var(--fill); }
.wk-nav .icon-btn:hover { background: var(--fill-hover); }
.wk-when { display: flex; flex-direction: column; align-items: center; line-height: 1.25; text-align: center; }
.wk-when strong { font: 800 17px/1.25 var(--round); }
.wk-when span { font-size: 13px; color: var(--ink-2); }
.wk-icon { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .wk-chev { width: 18px; height: 18px; stroke-width: 2.4; }
.wk-empty { color: var(--ink-2); text-align: center; padding: 32px 16px; background: var(--surface); border-radius: var(--radius); }

.wk-card { background: var(--surface); border: 0; border-radius: 26px; padding: 16px 18px 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.wk-name { display: flex; align-items: center; gap: 9px; font: 800 20px/1.15 var(--round); letter-spacing: -0.01em; color: var(--ink); }
.wk-name::before { display: none; width: 20px; height: 20px; color: var(--mark); }
.wk-card:is([data-section="sleep"], [data-section="activity"], [data-section="heart"], [data-section="glucose"], [data-section="meals"], [data-section="mind"]) .wk-name::before { display: block; }
/* each section's mark, in the colour that thing has everywhere */
.wk-card[data-section="sleep"] { --mark: var(--m-sleep); --icon: var(--i-moon); }
/* its headline is steps, so it takes the steps colour, as on Today and Rank */
.wk-card[data-section="activity"] { --mark: var(--m-steps); --icon: var(--i-steps); }
.wk-card[data-section="heart"] { --mark: var(--m-heart); --icon: var(--i-heart); }
.wk-card[data-section="glucose"] { --mark: var(--m-glucose); --icon: var(--i-drop); }
.wk-card[data-section="meals"] { --mark: var(--m-meals); --icon: var(--i-bowl); }
.wk-card[data-section="mind"] { --mark: var(--m-mind); --icon: var(--i-smile); }
.wk-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 0; border: 0; background: transparent; text-align: left; border-radius: 14px; }
button.wk-head:hover .wk-more, button.wk-fact:hover .wk-more { color: var(--ink); }
.wk-more { color: var(--muted); }
.wk-head .wk-more { width: 18px; height: 18px; stroke-width: 2.4; }
.wk-label { font-size: 14px; color: var(--ink-2); }
/* a row, as on today's cards: the gap sets the spacing, so the spaces kept in "7 h 22 min" take no room */
.wk-value { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 5px; font: 800 40px/1.1 var(--round); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.wk-value small { font: 700 17px/1 var(--round); letter-spacing: 0; color: var(--ink-2); }
.wk-change { display: flex; align-items: center; gap: 5px; font-size: 14px; color: var(--ink-2); margin-top: 3px; }

/* the seven days */
.wk-plot { margin-top: 4px; }
.wk-area { position: relative; height: 148px; margin: 0 30px 0 38px; border-bottom: 1px solid var(--axis); }
.wk-grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--hairline); }
.wk-grid span { position: absolute; right: 100%; top: -8px; margin-right: 8px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wk-usual { position: absolute; left: 0; right: 0; background: color-mix(in srgb, var(--viz-deemphasis) 24%, transparent); border-radius: 6px; }
.wk-avg { position: absolute; left: 0; right: 0; height: 0; border-top: 2px dashed var(--ink-2); z-index: 2; pointer-events: none; }
/* the label sits in the margin, clear of the last day */
.wk-avg span { position: absolute; left: 100%; top: -8px; margin-left: 5px; font-size: 11px; line-height: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.wk-key { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); margin-left: 38px; }
.wk-key-band { width: 16px; height: 10px; border-radius: 3px; flex: none; background: color-mix(in srgb, var(--viz-deemphasis) 34%, transparent); }
.wk-cols { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(7, 1fr); z-index: 1; }
.wk-col { position: relative; border: 0; background: transparent; padding: 0; display: flex; align-items: flex-end; justify-content: center; border-radius: 10px; min-width: 0; }
.wk-col[disabled] { cursor: default; }
.wk-col:not([disabled]):hover { background: color-mix(in srgb, var(--viz-deemphasis) 12%, transparent); }
/* round at the data end, like the bars on the mockup */
.wk-bar { width: min(26px, 62%); display: flex; flex-direction: column-reverse; gap: 2px; border-radius: 13px 13px 4px 4px; overflow: hidden; min-height: 2px; }
.wk-bar i { display: block; min-height: 1px; }
.wk-dot { position: absolute; left: 50%; width: 12px; height: 12px; margin: 0 0 -6px -6px; border-radius: 50%; background: var(--series-1); box-shadow: 0 0 0 2px var(--surface); z-index: 1; }
.wk-range { position: absolute; left: 50%; width: 10px; margin-left: -5px; min-height: 10px; border-radius: 5px; background: color-mix(in srgb, var(--series-1) 34%, transparent); }
.wk-col.is-partial .wk-bar, .wk-col.is-partial .wk-dot, .wk-col.is-partial .wk-range { opacity: 0.5; }
.wk-plot.has-choice .wk-col:not(.is-chosen) .wk-bar, .wk-plot.has-choice .wk-col:not(.is-chosen) .wk-dot, .wk-plot.has-choice .wk-col:not(.is-chosen) .wk-range { opacity: 0.35; }
.wk-col.is-chosen { background: color-mix(in srgb, var(--viz-deemphasis) 16%, transparent); }
.wk-days { display: grid; grid-template-columns: repeat(7, 1fr); margin: 0 30px 0 38px; padding-top: 6px; text-align: center; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.wk-days .is-today { color: var(--ink); font-weight: 800; }
.wk-readout { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; font-size: 14px; padding: 4px 4px 4px 14px; border-radius: 18px; background: var(--fill); }
.wk-hint { color: var(--muted); }
.wk-readout-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.wk-readout-day, .wk-readout-parts { color: var(--ink-2); font-size: 13px; }
.wk-readout-text strong { font: 800 17px/1.3 var(--round); }
.wk-open { flex: none; min-height: 40px; padding: 8px 15px; font-size: 14px; background: var(--strong); color: var(--on-strong); }
.wk-open:hover { background: var(--strong-hover); }

/* what the bars are made of */
.wk-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; }
.wk-legend li { display: flex; align-items: baseline; gap: 6px; }
.wk-swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; position: relative; top: 1px; }
.wk-swatch-aside { border: 2px solid var(--muted); }
.wk-legend-name { color: var(--ink-2); }
.wk-legend-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.wk-legend-share { color: var(--muted); font-variant-numeric: tabular-nums; }

/* what stood out */
.wk-facts { display: flex; flex-direction: column; border-top: 1px solid var(--hairline); }
.wk-fact { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 0; border: 0; border-bottom: 1px solid var(--hairline); background: transparent; text-align: left; font-size: 15px; border-radius: 0; }
.wk-fact:last-child { border-bottom: 0; }
.wk-fact-label { color: var(--ink-2); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wk-fact-label small { font-size: 12px; color: var(--muted); }
.wk-fact-value { font: 800 16px/1.3 var(--round); font-variant-numeric: tabular-nums; text-align: right; flex: none; max-width: 62%; }

/* a ranked list */
.wk-list { display: flex; flex-direction: column; gap: 9px; }
.wk-list h3 { font: 800 15px/1.25 var(--round); color: var(--ink); }
.wk-row { display: flex; flex-direction: column; gap: 5px; width: 100%; padding: 0; border: 0; background: transparent; text-align: left; font-size: 15px; border-radius: 8px; }
.wk-row-text { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.wk-row-label { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.wk-row-value { color: var(--ink-2); flex: none; font-variant-numeric: tabular-nums; text-align: right; }
.wk-track { height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; }
.wk-track i { display: block; height: 100%; border-radius: 4px; background: var(--series-1); }

.wk-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.wk-note { font-size: 12px; color: var(--muted); flex: 1 1 180px; }
.wk-ask { --icon: var(--i-sparkle); display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; min-height: 38px; padding: 7px 14px 7px 11px; color: var(--accent-ink); background: var(--blue-tint); }
.wk-ask::before { width: 15px; height: 15px; }
.wk-ask:hover { background: var(--blue-tint); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent-ink) 40%, transparent); }
.fact-detail { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------ look back */
/* The dark card with two bright pills, as on the mockup. */
.lb-card { display: flex; flex-direction: column; align-items: stretch; gap: 12px; background: var(--deep); color: var(--on-deep); border: 0; border-radius: 26px; padding: 15px 16px 16px; }
.lb-card > div:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.lb-kicker { font: 800 19px/1.15 var(--round); letter-spacing: -0.01em; color: var(--on-deep); }
.lb-title { font-size: 13px; font-weight: 500; color: var(--on-deep-2); }
/* Each name stays on one line, in any font: where two do not fit side by side, they stack. */
.lb-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.lb-btn { flex: 1 1 0; min-width: max-content; white-space: nowrap; display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 48px; padding: 4px 10px 4px 15px; border-radius: 24px; background: var(--sun); color: #15171E; font: 800 clamp(14px, 4.1vw, 17px)/1.1 var(--round); }
.lb-btn:hover { background: var(--sun); filter: brightness(1.06); }
.lb-btn[data-period="year"], .lb-btn[data-period="year"]:hover { background: var(--leaf); }
.lb-btn .wk-icon { width: 16px; height: 16px; stroke-width: 2.6; color: #15171E; }
/* on the dark card the usual dark ring would vanish: here it is drawn in the card's light ink */
.lb-card :focus-visible { outline-color: var(--on-deep); box-shadow: 0 0 0 2px var(--deep); }
.rc-moment { border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; --muted: var(--ink-2); }
.rc-tint-1 { background: var(--blue-tint); }
.rc-tint-2 { background: var(--t-steps); }
.rc-tint-3 { background: var(--t-hrv); }
.rc-tint-4 { background: var(--t-glucose); }
.rc-tint-5 { background: var(--t-heart); }
.rc-main { display: block; width: 100%; padding: 0; border: 0; background: transparent; text-align: left; border-radius: 14px; }
.rc-kicker { font: 700 13px/1.3 var(--text); color: var(--ink-2); }
.rc-value { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; font: 800 44px/1.05 var(--round); letter-spacing: -0.02em; margin: 6px 0 6px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.rc-value small { font: 700 17px/1 var(--round); letter-spacing: 0; color: var(--ink-2); }
.rc-line { font-size: 15px; color: var(--ink); }
.rc-list .wk-track { background: color-mix(in srgb, var(--ink) 10%, transparent); }
.rc-nav { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* ------------------------------------------------------------ sheet */
.scrim { position: fixed; inset: 0; background: rgba(11, 19, 17, 0.45); z-index: 10; }
.sheet { position: fixed; z-index: 11; left: 0; right: 0; bottom: 0; max-height: 88dvh; max-width: 720px; margin: 0 auto; background: var(--page); border-radius: 28px 28px 0 0; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 12px; }
.sheet-head h2 { font: 800 24px/1.2 var(--round); letter-spacing: -0.01em; }
.sheet-sub { font-size: 14px; color: var(--ink-2); margin-top: 3px; }
.sheet-head .btn-quiet { flex: none; }
.sheet-body { overflow-y: auto; padding: 4px 20px max(24px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
/* each part of a sheet sits on a white card of its own */
.sheet-body > div:not([class]), .sheet-body > .facts { background: var(--surface); border-radius: 22px; padding: 14px 16px; }
.sheet-body > .facts { padding-top: 4px; padding-bottom: 4px; }
.sheet-body h3 { font: 800 16px/1.25 var(--round); margin-bottom: 8px; }
/* a compact two-column list of label and value */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); column-gap: 20px; }
.fact { padding: 9px 0; border-bottom: 1px solid var(--hairline); }
.fact-label { font-size: 13px; color: var(--ink-2); }
.fact-value { font: 800 18px/1.3 var(--round); font-variant-numeric: tabular-nums; }
.fact-value small { font: 600 13px/1 var(--text); color: var(--ink-2); margin-left: 3px; }
.rows { display: flex; flex-direction: column; }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--hairline); font-size: 15px; }
.row:last-child { border-bottom: 0; }
.row span:last-child { color: var(--ink-2); text-align: right; }
.sheet-note { font-size: 14px; color: var(--ink-2); }
.sheet textarea { width: 100%; min-height: 84px; border: 1.5px solid var(--field-edge); border-radius: 16px; background: var(--raised); padding: 10px 12px; font-size: 16px; }
.sheet textarea:focus { border-color: var(--ink); }
/* a meal entered by hand: the name and the energy across, the nutrients two by two */
.meal-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.meal-form > * { grid-column: 1 / -1; }
.meal-form > label:not(.is-wide) { grid-column: auto; }
/* a field with its label above it, there and for the note that goes with a photo */
.meal-form label, .meal-extra { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--ink-2); }
.meal-form input, .meal-extra input { width: 100%; min-height: 44px; border: 1.5px solid var(--field-edge); border-radius: 12px; background: var(--surface); padding: 8px 12px; font-size: 16px; color: var(--ink); }
.meal-extra input[disabled] { opacity: 0.5; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper .icon-btn { background: var(--fill); font: 700 20px/1 var(--round); }
.stepper output { min-width: 20px; text-align: center; font: 800 18px/1 var(--round); }

/* ------------------------------------------------------------ a meal, opened */
.meal-photos { display: grid; gap: 10px; }
.meal-photos.is-many { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.meal-view { margin: 0; min-width: 0; }
.meal-view figcaption { margin-top: 4px; text-align: center; font-size: 12px; color: var(--muted); }
/* The frame takes the picture's own shape (--ratio is set once the picture has
   loaded), so nothing is cropped and an outline given as a share of the
   picture lands on the food. */
.meal-frame { --ratio: 1.3333; --tall: min(46dvh, 380px); position: relative; width: min(100%, calc(var(--tall) * var(--ratio))); aspect-ratio: var(--ratio); margin: 0 auto; border-radius: 12px; overflow: hidden; background: var(--hairline); }
.meal-photos.is-many .meal-frame { --tall: 220px; }
.meal-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
/* An outline has to show on any photo: white, with a dark edge on both sides. */
.meal-box { position: absolute; padding: 0; background: transparent; border: 2px solid #fff; border-radius: 6px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(0, 0, 0, 0.6); }
.meal-frame:not(.is-loaded) .meal-box { display: none; }
.meal-box.is-unsure { border-style: dashed; }
.meal-box:focus-visible { outline-offset: -4px; }
.meal-box .meal-n { position: absolute; top: 3px; left: 3px; }
.meal-box.is-chosen { border-width: 3px; background: rgba(255, 255, 255, 0.24); }
.meal-frame.has-choice .meal-box:not(.is-chosen) { opacity: 0.45; }
.meal-box[disabled] { opacity: 0.45; cursor: default; }
.meal-n { flex: none; display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: rgba(11, 11, 11, 0.82); color: #fff; font-size: 12px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.meal-item .meal-n { background: var(--ink); color: var(--page); }
.is-chosen > .meal-n, .is-chosen > .meal-item-head .meal-n { background: var(--accent-fill); color: #fff; }

.meal-items { display: flex; flex-direction: column; margin-top: 6px; }
.meal-item { display: flex; flex-direction: column; gap: 5px; margin: 0 -10px; padding: 5px 10px 10px; border-top: 1px solid var(--hairline); }
.meal-item.is-chosen { border-radius: 10px; background: color-mix(in srgb, var(--viz-deemphasis) 16%, transparent); }
.meal-item.is-chosen, .meal-item.is-chosen + .meal-item { border-top-color: transparent; }
/* a food's corrections open when it is chosen */
.meal-item:not(.is-chosen) .meal-item-acts, .meal-item:not(.is-chosen) .meal-edit { display: none; }
/* tall enough to tap: the row's own padding is taken in above it */
.meal-item-head { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 0; border: 0; background: transparent; text-align: left; font-size: 15px; }
.meal-item-head[disabled] { opacity: 0.5; cursor: default; }
.meal-item-head::after { content: ""; flex: none; width: 7px; height: 7px; margin: -4px 3px 0 2px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); }
.meal-item.is-chosen .meal-item-head::after { margin-top: 4px; transform: rotate(-135deg); }
.meal-item-name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.meal-item-kcal { flex: none; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.meal-tag { flex: none; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--hairline); border-radius: 999px; padding: 1px 8px; }
.meal-item-detail { font-size: 13px; color: var(--ink-2); }
.meal-item-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.btn-small { min-height: 34px; padding: 5px 10px; font-size: 13px; }
.meal-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 3px; font-size: 14px; }
.meal-edit label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1 1 200px; min-width: 0; color: var(--ink-2); }
.meal-edit > span { color: var(--ink-2); }
/* 16px, like every field: a phone's browser zooms the page in on a smaller one */
.meal-edit input { min-height: 36px; border: 1.5px solid var(--field-edge); border-radius: 10px; background: var(--surface); padding: 6px 10px; font-size: 16px; color: var(--ink); }
.meal-edit .btn[aria-pressed="true"] { border-color: var(--accent-ink); color: var(--accent-ink); }
.meal-actions > .meal-edit { flex: 1 1 100%; margin-top: 0; }
.meal-edit input[type="number"] { width: 96px; }
.meal-edit input[type="text"] { flex: 1 1 140px; min-width: 0; }

/* ------------------------------------------------------------ charts */
.viz { margin: 0; background: var(--surface); border: 0; border-radius: 22px; padding: 14px 14px 12px; min-width: 0; }
.viz-title { font: 800 16px/1.25 var(--round); }
.viz-legend { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.viz-legend-item { display: flex; gap: 8px; align-items: baseline; font-size: 13px; color: var(--ink-2); }
.viz-legend-name { color: var(--ink); font-weight: 700; }
.viz-legend-detail { margin-left: 6px; }
.viz-swatch { flex: none; position: relative; top: -1px; }
.viz-swatch-line { width: 14px; height: 3px; border-radius: 2px; align-self: center; top: 0; }
.viz-swatch-dot { width: 9px; height: 9px; border-radius: 50%; align-self: center; top: 0; }
.viz-plot { position: relative; margin-top: 8px; }
.viz-plot svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.viz-plot svg:focus-visible { outline-offset: 4px; }
.viz-grid { stroke: var(--hairline); stroke-width: 1; }
.viz-axis { stroke: var(--axis); stroke-width: 1; }
.viz-ref { stroke: var(--axis); stroke-width: 1; }
.viz-cross { stroke: var(--axis); stroke-width: 1; }
.viz-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.viz-fit { stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; }
.viz-mean { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.viz-dot { stroke: var(--surface); stroke-width: 2; }
.viz-dot.is-hover { stroke: var(--ink); }
.viz-bar { fill: var(--series-1); }
.viz-bar.is-hover, .viz-stage.is-hover { filter: brightness(1.18); }
.viz-tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-label { fill: var(--ink); font-size: 12px; font-weight: 700; }
.viz-note { fill: var(--ink-2); font-size: 11px; }
.viz-axis-note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.viz-empty { font-size: 14px; color: var(--muted); padding: 16px 0; }
.viz-tip { position: absolute; z-index: 2; pointer-events: none; background: var(--raised); border: 0; border-radius: 12px; box-shadow: var(--shadow); padding: 7px 11px; font-size: 13px; white-space: nowrap; }
.viz-tip-title { color: var(--ink-2); font-size: 12px; }
.viz-tip-row { display: flex; align-items: center; gap: 6px; }
.viz-tip-row span:last-child { color: var(--ink-2); }
.viz-key { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.viz-toggle { margin-top: 6px; border: 0; background: transparent; padding: 4px 0; font-size: 13px; font-weight: 700; color: var(--accent-ink); }
.viz-table { max-height: 220px; overflow: auto; margin-top: 4px; border-top: 1px solid var(--hairline); }
.viz-table table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.viz-table th, .viz-table td { text-align: left; padding: 5px 8px 5px 0; border-bottom: 1px solid var(--hairline); font-weight: 400; }
.viz-table thead th { color: var(--ink-2); font-weight: 700; position: sticky; top: 0; background: var(--surface); }

@media (min-width: 760px) {
  .view-name { font-size: 34px; }
  .sheet { bottom: auto; top: 50%; transform: translateY(-50%); border-radius: 28px; max-height: 84dvh; }
  /* the sleep card and four more, as one block */
  .today { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tile[data-tile="sleep_duration_h"] { grid-column: span 2; grid-row: span 2; }
  .tile[data-tile="sleep_duration_h"] .tile-value { font-size: 58px; }
  /* until it has its seven nights drawn under it, the number (and its usual line, once there is one) sits in the middle of the space under the label */
  .tile[data-tile="sleep_duration_h"] > :last-child { margin-bottom: auto; }
  .recent-row { margin: 0; padding: 0; overflow: visible; flex-wrap: wrap; }
}
