:root {
  color-scheme: dark;
  --bg: #100c14;
  --panel: transparent;
  --panel-solid: #121019;
  --panel-2: #111b24;
  --panel-3: #142734;
  --line: rgba(122, 145, 161, 0.08);
  --text: #f7f3fb;
  --muted: #a4b2c1;
  --muted-2: #6f8096;
  --accent: #06b6d4;
  --accent-strong: #22d3ee;
  --accent-2: #0ea5e9;
  --danger: #ff6b7a;
  --blue: #6ea8ff;
  --violet: #d58cff;
  --shadow: none;
  --shadow-soft: none;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: #100c14;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    linear-gradient(180deg, #100c14 0%, #0d1018 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

input,
textarea {
  -webkit-touch-callout: default;
  user-select: text;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

button,
input,
select {
  transition:
    border-color 160ms var(--ease),
    background-color 160ms var(--ease),
    color 160ms var(--ease),
    box-shadow 160ms var(--ease),
    transform 160ms var(--ease);
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(49, 208, 170, 0.55);
  outline-offset: 2px;
}

.auth,
.onboarding,
.dashboard {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
}

.auth,
.onboarding {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 0;
}

.auth-box,
.onboarding-box,
.panel,
.modal form {
  background: var(--panel);
  border: 0;
  border-radius: 0;
  box-shadow: var(--shadow);
  backdrop-filter: none;
}

.auth-box,
.onboarding-box {
  width: min(440px, 100%);
  padding: 28px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(2rem, 7vw, 4.8rem);
  line-height: 0.9;
  letter-spacing: 0;
  text-wrap: balance;
}

h2 {
  margin-bottom: 10px;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

h3 {
  margin-bottom: 6px;
  font-size: 1rem;
}

.muted,
.error,
.hint {
  color: var(--muted);
}

.error {
  min-height: 20px;
  color: var(--danger);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  margin-bottom: 18px;
  background: rgba(9, 13, 20, 0.8);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tabs button,
.range button {
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  min-height: 38px;
}

.tabs button:hover,
.range button:hover {
  color: var(--text);
  background: rgba(147, 163, 184, 0.08);
}

.tabs button.active,
.range button.active {
  color: var(--text);
  background: var(--panel-2);
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
}

.form-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(147, 163, 184, 0.2);
  border-radius: 7px;
  padding: 0 12px;
  background: rgba(10, 15, 24, 0.92);
  color: var(--text);
}

input:hover,
select:hover {
  border-color: rgba(147, 163, 184, 0.34);
}

input:focus,
select:focus {
  border-color: rgba(49, 208, 170, 0.58);
  box-shadow: 0 0 0 4px rgba(49, 208, 170, 0.08);
}

.language-picker {
  position: relative;
}

.language-button,
.language-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
}

.language-button {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(147, 163, 184, 0.2);
  border-radius: 7px;
  padding: 0 12px;
  color: var(--text);
  background: rgba(10, 15, 24, 0.92);
}

.language-button:hover,
.language-button[aria-expanded="true"] {
  border-color: rgba(49, 208, 170, 0.42);
  background: rgba(14, 24, 34, 0.96);
}

.language-button img,
.language-menu img {
  width: 24px;
  height: 18px;
  border-radius: 3px;
  object-fit: cover;
}

.language-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  padding: 6px;
  background: rgba(10, 15, 24, 0.98);
  border: 1px solid rgba(147, 163, 184, 0.2);
  border-radius: 9px;
  box-shadow: var(--shadow);
}

.language-menu[hidden] {
  display: none;
}

.language-menu button {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  padding: 0 10px;
  color: var(--text);
  background: transparent;
}

.language-menu button:hover {
  background: rgba(147, 163, 184, 0.1);
}

.settings-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.settings-choice-grid button {
  min-width: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid rgba(147, 163, 184, 0.2);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(10, 15, 24, 0.92);
}

.settings-choice-grid button.active {
  border-color: rgba(34, 211, 238, 0.72);
  color: var(--text);
  background: rgba(18, 183, 211, 0.14);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.12);
}

.settings-choice-grid button img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.settings-language-choices button,
.settings-sex-choices button {
  min-height: 52px;
}

.settings-language-choices button img {
  width: 38px;
  height: 28px;
  border-radius: 4px;
  object-fit: cover;
}

.settings-sex-choices button span {
  font-weight: 800;
}

.settings-unit-choices button {
  flex-direction: column;
  gap: 0;
  line-height: 1.05;
}

.settings-unit-choices b {
  font-size: 0.92rem;
}

.settings-unit-choices small {
  color: var(--muted-2);
  font-size: 0.67rem;
}

.weekly-goal-settings {
  display: grid;
  gap: 9px;
  margin: 4px 0 2px;
  padding: 12px;
  border: 1px solid rgba(124, 202, 221, 0.14);
  border-radius: 10px;
  background: rgba(8, 13, 20, 0.34);
}

.weekly-goal-settings legend {
  padding: 0 6px;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 780;
}

.weekly-goal-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.weekly-goal-options button {
  min-width: 0;
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid rgba(147, 163, 184, 0.18);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(10, 15, 24, 0.86);
  font-size: 0.7rem;
  font-weight: 760;
}

.weekly-goal-options button.active {
  border-color: rgba(34, 211, 238, 0.7);
  color: var(--text);
  background: rgba(18, 183, 211, 0.16);
}

.weekly-goal-options button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.weekly-goal-custom-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.weekly-goal-custom-input b {
  min-width: 68px;
  color: var(--muted);
  font-size: 0.7rem;
  text-align: center;
}

.weekly-goal-message {
  min-height: 0;
  margin: 0;
  color: var(--muted-2);
  font-size: 0.68rem;
  line-height: 1.35;
}

.weekly-goal-message:empty {
  display: none;
}

.weekly-goal-message.maintain {
  color: #7ccadd;
}

.weekly-goal-message.warning {
  color: #ffbd59;
}

.weekly-goal-message.danger {
  color: var(--danger);
}

.settings-app-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 10px;
  align-items: center;
}

.install-app-button,
.refresh-app-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.install-app-button {
  min-width: 0;
}

.install-app-button img,
.refresh-app-button img {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.install-app-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.install-app-button.is-installed {
  color: var(--muted);
}

.refresh-app-button {
  width: 46px;
  padding: 0;
}

.weekday-selector {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.weekday-selector[hidden] {
  display: none;
}

.weekday-selector button {
  min-width: 0;
  min-height: 38px;
  border: 1px solid rgba(147, 163, 184, 0.16);
  border-radius: 999px;
  padding: 0;
  color: var(--muted);
  background: rgba(10, 15, 24, 0.92);
  font-size: 0.72rem;
  font-weight: 820;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  touch-action: manipulation;
}

.weekday-selector button.active {
  color: #04110d;
  border-color: rgba(34, 211, 238, 0.65);
  background: var(--accent);
}

.injection-schedule-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(147, 163, 184, 0.14);
  border-radius: 12px;
  background: rgba(5, 10, 18, 0.62);
}

.injection-schedule-mode button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-weight: 760;
}

.injection-schedule-mode button.active {
  color: #061017;
  background: var(--accent);
}

#injectionScheduleIntervalField[hidden],
#injectionScheduleDoseField[hidden] {
  display: none;
}

input[type="file"] {
  padding: 10px 12px;
}

.primary,
.secondary,
.ghost {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 16px;
  color: #04110d;
  background: var(--accent);
  font-weight: 750;
}

.primary:hover {
  background: var(--accent-strong);
  box-shadow: 0 10px 24px rgba(49, 208, 170, 0.2);
}

.secondary {
  color: var(--text);
  background: var(--panel-2);
  border-color: var(--line);
}

.secondary:hover,
.ghost:hover {
  border-color: rgba(147, 163, 184, 0.36);
  background: var(--panel-3);
}

.danger-button {
  min-height: 44px;
  border: 1px solid rgba(255, 107, 122, 0.38);
  border-radius: 7px;
  padding: 0 16px;
  color: #fff5f6;
  background: rgba(255, 107, 122, 0.22);
  font-weight: 750;
}

.danger-button:hover {
  background: rgba(255, 107, 122, 0.34);
}

.ghost {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

.dashboard {
  padding: 12px 0 116px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.topbar h1 {
  font-size: clamp(2rem, 5vw, 3.6rem);
  font-weight: 800;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 0.14em;
  line-height: 0.92;
}

.brand-title img {
  width: auto;
  height: 1em;
  object-fit: contain;
  flex: 0 0 auto;
  transform: translateY(0.03em);
}

.trackhub-wordmark {
  display: inline;
  white-space: nowrap;
}

.trackhub-flag-hub {
  display: inline;
  color: inherit;
}

.trackhub-flag-hub > span {
  color: inherit;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.trackhub-flag-hub.ready > span {
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 0.025em rgba(255, 255, 255, 0.08);
}

.flag-picker {
  position: relative;
}

.flag-picker-button {
  width: 100%;
  min-height: 46px;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  color: var(--text);
  text-align: left;
  background: #09131d;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.flag-picker-button > img:last-child {
  transition: transform 160ms ease;
}

.flag-picker.open .flag-picker-button > img:last-child {
  transform: rotate(180deg);
}

.flag-picker-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  padding: 8px;
  background: #0d1823;
  border: 1px solid #253748;
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.48);
}

.flag-picker-search {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  margin: 0 0 7px;
  padding: 0 10px;
  background: #08121b;
  border: 1px solid #263747;
  border-radius: 9px;
}

.flag-picker-search input {
  min-width: 0;
  height: 40px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.flag-picker-options {
  max-height: min(330px, 42vh);
  overflow-y: auto;
  scrollbar-color: #516273 #101a24;
  scrollbar-width: thin;
}

.flag-picker-option {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  color: #dce7f1;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.flag-picker-option:hover,
.flag-picker-option:focus-visible,
.flag-picker-option.active {
  background: #142838;
  color: #fff;
}

.flag-option-icon {
  width: 32px;
  height: 22px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 4px;
  object-fit: cover;
}

.flag-option-icon img,
img.flag-option-icon {
  width: 32px;
  height: 22px;
  object-fit: cover;
}

.flag-option-empty {
  box-sizing: border-box;
  border: 1px dashed #637487;
  background: #0a131c;
}

.account-menu {
  position: relative;
  align-self: flex-start;
}

.profile-account-menu {
  justify-self: end;
}

.profile-menu-button {
  width: 50px;
  height: 50px;
  padding: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 2px solid rgba(164, 178, 193, 0.28);
  border-radius: 50%;
  color: var(--text);
  background: #111b24;
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.04);
}

.profile-menu-button:hover,
.profile-menu-button.active {
  border-color: rgba(34, 211, 238, 0.72);
  background: #142734;
}

.profile-menu-button img:not(.avatar-image) {
  width: 24px;
  height: 24px;
}

.avatar-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.menu-button {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  color: var(--text);
  background: var(--panel-2);
  font-weight: 800;
}

.menu-button:hover {
  background: var(--panel-3);
}

.menu-list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  display: none;
  width: 210px;
  padding: 6px;
  background: rgba(10, 15, 24, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  transform-origin: top right;
  animation: menuIn 140ms var(--ease);
}

.menu-list.open {
  display: grid;
  gap: 4px;
}

.menu-list button,
.menu-list .menu-link {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  color: var(--text);
  background: transparent;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.menu-list button img,
.menu-list .menu-link img {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  opacity: 0.92;
}

.menu-list button:hover,
.menu-list .menu-link:hover {
  background: var(--panel-2);
}

.bottom-more .menu-list {
  position: fixed;
  top: auto;
  right: max(14px, calc((100vw - 520px) / 2));
  bottom: 92px;
  z-index: 35;
  transform-origin: bottom right;
}

.app-nav {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 30;
  width: min(560px, calc(100vw - 18px));
  min-height: 74px;
  display: grid;
  grid-template-columns: 1fr 1fr 86px 1fr 1fr;
  align-items: end;
  gap: 4px;
  padding: 8px 10px 9px;
  background: rgba(8, 10, 15, 0.84);
  border: 1px solid rgba(122, 145, 161, 0.08);
  border-radius: 18px;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

.nav-item,
.nav-track {
  min-height: 54px;
  border: 0;
  border-radius: 14px;
  padding: 5px 4px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 750;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation;
}

.nav-item img {
  width: 23px;
  height: 23px;
  opacity: 0.9;
}

.nav-item.active {
  color: var(--accent-strong);
  background: rgba(6, 182, 212, 0.1);
}

.nav-item.active img {
  filter: brightness(1.4);
}

.nav-track {
  position: relative;
  min-height: 72px;
  margin-top: -32px;
  color: var(--text);
  background: transparent;
}

.nav-track:hover,
.nav-track:active {
  transform: none;
}

.track-plus-bg {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--accent);
  box-shadow: none;
  display: grid;
  place-items: center;
  position: relative;
  transform: translate3d(0, 0, 0) rotate(0deg);
  transform-origin: center;
  backface-visibility: hidden;
  contain: paint;
  will-change: transform, background-color, border-radius;
  transition:
    transform 560ms cubic-bezier(0.18, 0.92, 0.2, 1),
    background-color 260ms var(--ease),
    border-radius 560ms var(--ease);
}

.track-plus-bg::before,
.track-plus-bg::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 3px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 0.7px rgba(255, 255, 255, 0.78);
  z-index: 1;
  transform: translate(-50%, -50%) rotate(0deg);
}

.track-plus-bg::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.nav-track-label {
  margin-top: -2px;
  font-size: 0.74rem;
}

.nav-track.active .track-plus-bg {
  background: #c86f78;
  box-shadow: none;
  border-radius: 20px;
  transform: translate3d(0, -1px, 0) rotate(45deg);
}

.track-menu {
  position: fixed;
  left: 50%;
  bottom: 98px;
  z-index: 34;
  width: min(340px, calc(100vw - 34px));
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(10, 15, 24, 0.94);
  border: 1px solid rgba(122, 145, 161, 0.1);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
  animation: trackMenuIn 220ms var(--ease);
}

.track-menu.closing {
  pointer-events: none;
  animation: trackMenuOut 220ms var(--ease) forwards;
}

.track-menu button {
  min-height: 54px;
  border: 0;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 15px;
  color: var(--text);
  background: rgba(17, 27, 36, 0.86);
  font-size: 0.88rem;
  font-weight: 800;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation;
}

.track-menu-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.track-menu-split button {
  min-width: 0;
}

.track-menu img {
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 10px;
  text-align: center;
}

.empty-state h2 {
  margin: 0;
  font-size: 1.4rem;
}

.friends-panel {
  min-height: 420px;
}

.friends-section + .friends-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(148, 163, 184, 0.13);
}

.my-progress-section .friends-head {
  margin-bottom: 12px;
}

.friends-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.friends-head h2 {
  margin: 0 0 5px;
}

.friend-add-button,
.friend-icon {
  border: 1px solid rgba(148, 163, 184, 0.15);
  background: #101e29;
  display: grid;
  place-items: center;
  transition: transform 160ms var(--ease), border-color 160ms var(--ease), background 160ms var(--ease);
}

.friend-add-button {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background: var(--accent);
  box-shadow: 0 16px 38px rgba(6, 182, 212, 0.18);
}

.friend-add-button:hover,
.friend-icon:hover {
  transform: translateY(-1px);
}

.friends-list {
  display: grid;
  gap: 10px;
}

.friend-row {
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 16px;
  background: rgba(16, 30, 41, 0.58);
  min-height: 68px;
}

.friend-row:not(details),
.friend-row summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
}

.friend-row summary {
  cursor: pointer;
  list-style: none;
}

.friend-row summary::-webkit-details-marker {
  display: none;
}

.friend-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.settings-profile-photo {
  padding: 12px;
  border: 1px solid rgba(147, 163, 184, 0.12);
  border-radius: 10px;
  background: rgba(10, 15, 24, 0.48);
}

.profile-photo-editor {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-photo-preview {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 2px solid rgba(164, 178, 193, 0.26);
  border-radius: 50%;
  background: #111b24;
}

.profile-photo-preview > img:not(.avatar-image) {
  width: 32px;
  height: 32px;
}

.profile-photo-actions {
  min-width: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.profile-photo-upload,
.profile-photo-remove {
  min-height: 42px;
  padding: 0 10px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 750;
  text-align: center;
  cursor: pointer;
}

.profile-photo-upload img,
.profile-photo-remove img {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.profile-photo-remove:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.food-dashboard {
  --food: #d77b82;
  --food-soft: rgba(215, 123, 130, 0.12);
  display: grid;
  gap: 18px;
  padding-bottom: 104px;
}

.food-dashboard-head,
.food-section-head,
.meal-builder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.meal-final-weight-control {
  display: grid;
  gap: 4px;
}

.meal-final-weight-control small {
  color: var(--muted-2);
  font-size: 0.66rem;
}

.meal-final-weight-control small b {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.meal-expiry-control {
  display: grid;
  gap: 8px;
}

.meal-expiry-control > label[hidden] { display: none; }

.meal-food-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: stretch;
  gap: 8px;
}

.meal-food-search-row .food-search-input { min-width: 0; }
.meal-food-search-row .food-scan-button { min-width: 44px; padding: 0; }

.food-dashboard-head h2,
.food-section-head h3,
.meal-builder-head h3 {
  margin: 0;
}

.food-dashboard-head .muted {
  margin: 3px 0 0;
  font-size: 0.78rem;
}

.food-create-actions,
.food-row-actions,
.food-track-actions,
.meal-totals,
.food-log-preview {
  display: flex;
  align-items: center;
  gap: 7px;
}

.food-history-button {
  position: relative;
  width: 42px;
  min-width: 42px;
  min-height: 38px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(124, 202, 221, 0.18);
  border-radius: 8px;
  background: rgba(16, 29, 39, 0.76);
  cursor: pointer;
}

.food-history-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.food-action-button,
.food-section-head button,
.food-track-actions button,
.food-scan-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid rgba(215, 123, 130, 0.18);
  border-radius: 8px;
  color: var(--text);
  background: var(--food-soft);
  font-size: 0.76rem;
  font-weight: 750;
}

.food-action-button img,
.food-section-head button img,
.food-track-actions button img,
.food-scan-button img,
.food-icon-button img,
.meal-search-result img,
.scanner-close img {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.food-summary-grid {
  display: grid;
  grid-template-columns: 1.35fr repeat(5, 1fr);
  gap: 7px;
}

.food-summary-grid > div {
  min-width: 0;
  min-height: 78px;
  display: grid;
  align-content: center;
  grid-template-columns: auto auto;
  justify-content: start;
  column-gap: 4px;
  padding: 12px 14px;
  background: #111b24;
  border-top: 2px solid rgba(215, 123, 130, 0.36);
}

.food-summary-grid span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.72rem;
}

.food-summary-grid b {
  color: var(--text);
  font-size: 1.38rem;
  line-height: 1;
}

.food-summary-grid small {
  align-self: end;
  color: var(--muted);
  font-size: 0.7rem;
}

.food-summary-grid .food-calorie-total {
  border-color: var(--food);
  background: linear-gradient(90deg, rgba(215, 123, 130, 0.1), #111b24 48%);
}

.food-calorie-goal-row {
  display: grid;
  gap: 8px;
  padding: 11px 13px;
  border: 1px solid rgba(124, 202, 221, 0.14);
  border-left: 3px solid #7ccadd;
  border-radius: 9px;
  background: linear-gradient(90deg, rgba(124, 202, 221, 0.07), rgba(17, 27, 36, 0.74) 42%);
}

.food-calorie-goal-row.deficit {
  border-left-color: #20d6a3;
}

.food-calorie-goal-row.surplus {
  border-left-color: #d58cff;
}

.food-calorie-goal-row.maintain {
  border-left-color: #7ccadd;
}

.food-calorie-goal-row.unsafe,
.food-calorie-goal-row.unavailable {
  border-left-color: var(--danger);
}

.calorie-goal-heading {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted-2);
  font-size: 0.66rem;
}

.calorie-goal-heading img {
  width: 20px;
  height: 20px;
}

.calorie-goal-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.calorie-goal-metrics > div {
  min-width: 0;
  display: grid;
  grid-template-columns: auto auto;
  align-content: center;
  justify-content: start;
  column-gap: 4px;
  padding: 8px 10px;
  border-radius: 7px;
  background: rgba(8, 13, 20, 0.38);
}

.calorie-goal-metrics span {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.64rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calorie-goal-metrics b {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.1;
}

.calorie-goal-metrics small {
  align-self: end;
  color: var(--muted-2);
  font-size: 0.61rem;
}

.calorie-goal-metrics .remaining b,
.calorie-goal-metrics .deficit b {
  color: #20d6a3;
}

.calorie-goal-metrics .over b {
  color: var(--danger);
}

.calorie-goal-metrics .surplus b {
  color: #d58cff;
}

.calorie-goal-metrics .maintain b {
  color: #7ccadd;
}

.calorie-goal-metrics .goal-favorable b {
  color: #20d6a3;
}

.calorie-goal-metrics .goal-unfavorable b {
  color: var(--danger);
}

.calorie-goal-metrics .goal-neutral b {
  color: #7ccadd;
}

.calorie-goal-warning,
.food-calorie-goal-row.unavailable p {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--danger);
  font-size: 0.68rem;
}

.calorie-goal-warning.caution {
  color: #ffbd59;
}

.calorie-goal-warning img {
  width: 16px;
  height: 16px;
}

.food-search-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
}

.food-search-input {
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid rgba(124, 202, 221, 0.1);
  border-radius: 8px;
  background: rgba(17, 27, 36, 0.78);
}

.food-search-input img {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.food-search-input input {
  width: 100%;
  min-height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
}

.food-scan-button {
  width: 44px;
  padding: 0;
}

.food-search-results {
  display: grid;
  gap: 4px;
}

.food-search-results:empty {
  display: none;
}

.food-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 24px;
}

.food-section {
  min-width: 0;
  position: relative;
  display: grid;
  align-content: start;
  gap: 8px;
}

.food-section.filter-menu-open {
  z-index: 30;
}

.food-product-filter[open] {
  z-index: 31;
}

.food-logs-section {
  grid-column: 1 / -1;
}

.food-list {
  display: grid;
}

.food-pagination {
  margin-top: 10px;
}

.food-pagination button.active {
  background: #d77b82;
  color: #17080d;
}

.food-product-filter {
  position: relative;
  z-index: 5;
}

.food-product-filter summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid rgba(215, 123, 130, 0.32);
  border-radius: 8px;
  color: #f1c4c8;
  background: rgba(82, 31, 40, 0.28);
  font-size: 0.72rem;
  font-weight: 750;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}

.food-product-filter summary::-webkit-details-marker { display: none; }
.food-product-filter summary img { width: 17px; height: 17px; }

.food-product-filter-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  min-width: 172px;
  padding: 5px;
  display: grid;
  gap: 3px;
  border: 1px solid rgba(215, 123, 130, 0.32);
  border-radius: 9px;
  background: #171017;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.food-product-filter-menu button {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 700;
}

.food-product-filter-menu button.active {
  color: #ffe5e8;
  background: rgba(215, 123, 130, 0.18);
}

.meal-list-filter summary {
  border-color: rgba(255, 189, 89, 0.28);
  color: #ead69b;
  background: rgba(91, 71, 28, 0.24);
}

.meal-list-filter .food-product-filter-menu { border-color: rgba(255, 189, 89, 0.25); }
.meal-list-filter .food-product-filter-menu button.active {
  color: #ffedbd;
  background: rgba(255, 189, 89, 0.12);
}

.food-product-filter-menu button img { width: 17px; height: 17px; }

.food-library-row,
.food-log-row,
.selected-food-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 3px;
  border-bottom: 1px solid var(--line);
}

.food-row-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
}

.food-row-icon.product,
.food-row-icon.log,
.food-row-icon.food {
  background: rgba(215, 123, 130, 0.12);
  border: 1px solid rgba(215, 123, 130, 0.2);
}

.food-row-icon.meal {
  background: rgba(255, 189, 89, 0.1);
  border: 1px solid rgba(255, 189, 89, 0.18);
}

.food-row-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.food-row-main > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.food-row-main > .meal-expiry-pill {
  width: max-content;
  max-width: 100%;
  min-height: 19px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border: 1px solid rgba(255, 189, 89, 0.24);
  border-radius: 999px;
  color: #e6c979;
  background: rgba(255, 189, 89, 0.09);
  font-size: 0.6rem;
  font-weight: 750;
  white-space: nowrap;
}

.meal-expiry-pill img { width: 13px; height: 13px; flex: 0 0 13px; }
.food-row-main > .meal-expiry-pill.expired {
  border-color: rgba(169, 147, 98, 0.25);
  color: #ad9b71;
  background: rgba(169, 147, 98, 0.08);
}

.meal-library-row.meal-expired .food-row-icon.meal,
.meal-library-row.meal-expired .food-type-pill.meal { filter: saturate(0.38); opacity: 0.76; }
.meal-library-row.meal-expired .food-row-main > div:first-child b { color: #c8b991; }
.meal-library-row.meal-expired .food-row-main > small,
.meal-library-row.meal-expired .food-row-main > span { color: #7f7a69; }

.meal-library-row {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.meal-library-row > * {
  position: relative;
  z-index: 2;
}

.meal-library-row::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transform: scaleX(var(--meal-expiry-progress, 0));
  transform-origin: left center;
  clip-path: polygon(0 0, 97.5% 0, 100% 16%, 98.2% 34%, 100% 55%, 97.8% 74%, 100% 100%, 0 100%);
  background:
    radial-gradient(circle at 18% 28%, rgba(255, 255, 255, 0.34) 0 1px, transparent 2px),
    radial-gradient(circle at 62% 72%, rgba(255, 242, 191, 0.2) 0 1.5px, transparent 2.5px),
    repeating-linear-gradient(112deg, transparent 0 22px, rgba(255, 255, 255, 0.075) 23px 29px, transparent 30px 54px),
    linear-gradient(96deg, rgba(102, 67, 12, 0.52), rgba(255, 179, 36, 0.48) 42%, rgba(255, 216, 109, 0.7) 76%, rgba(255, 244, 186, 0.88));
  background-size: 92px 68px, 118px 76px, 230% 100%, 100% 100%;
  box-shadow: inset -16px 0 24px rgba(255, 244, 190, 0.42), 12px 0 22px rgba(255, 189, 89, 0.22);
  filter: saturate(1.12);
}

.meal-library-row.meal-expiry-holding {
  transition-duration: 0.3s;
  box-shadow: inset 0 0 0 1px rgba(255, 205, 99, 0.28), 0 0 18px rgba(255, 189, 89, 0.08);
}

.meal-library-row.meal-delete-holding {
  transition-duration: 0.3s;
  box-shadow: inset 0 0 0 1px rgba(255, 107, 122, 0.34), 0 0 18px rgba(255, 73, 94, 0.1);
}

.meal-library-row.meal-expiry-holding::before,
.meal-library-row.meal-expiry-releasing::before {
  opacity: 1;
  animation: meal-expiry-liquid-flow 750ms linear infinite;
}

.meal-library-row.meal-expiry-committing::before {
  opacity: 1;
  transform: scaleX(1);
  animation: meal-expiry-liquid-flow 750ms linear infinite;
}

.meal-library-row.meal-delete-holding::before,
.meal-library-row.meal-delete-releasing::before,
.meal-library-row.meal-delete-committing::before {
  opacity: 1;
  transform: scaleX(var(--meal-delete-progress, 0));
  background:
    radial-gradient(circle at 18% 28%, rgba(255, 255, 255, 0.3) 0 1px, transparent 2px),
    radial-gradient(circle at 62% 72%, rgba(255, 202, 207, 0.2) 0 1.5px, transparent 2.5px),
    repeating-linear-gradient(112deg, transparent 0 22px, rgba(255, 255, 255, 0.07) 23px 29px, transparent 30px 54px),
    linear-gradient(96deg, rgba(95, 18, 29, 0.56), rgba(202, 46, 65, 0.56) 42%, rgba(255, 87, 105, 0.72) 76%, rgba(255, 183, 192, 0.86));
  box-shadow: inset -16px 0 24px rgba(255, 188, 196, 0.36), 12px 0 22px rgba(255, 70, 92, 0.23);
  animation: meal-delete-liquid-flow 750ms linear infinite;
}

.meal-library-row.meal-delete-committing::before {
  transform: scaleX(1);
}

@keyframes meal-expiry-liquid-flow {
  from { background-position: 0 0, 0 0, 0 0, 0 0; }
  to { background-position: 92px 10px, -118px -8px, 150% 0, 0 0; }
}

@keyframes meal-delete-liquid-flow {
  from { background-position: 0 0, 0 0, 0 0, 0 0; }
  to { background-position: 92px 10px, -118px -8px, 150% 0, 0 0; }
}

.meal-expire-button {
  touch-action: manipulation;
  border-color: rgba(255, 189, 89, 0.28);
  color: #ffbd59;
  background: rgba(255, 189, 89, 0.1);
}

.meal-expire-button:hover {
  border-color: rgba(255, 205, 117, 0.52);
  background: rgba(255, 189, 89, 0.17);
}

.meal-delete-button {
  touch-action: manipulation;
  border-color: rgba(255, 107, 122, 0.28);
  color: #ff6b7a;
  background: rgba(255, 75, 96, 0.1);
}

.meal-delete-button:hover {
  border-color: rgba(255, 132, 145, 0.52);
  background: rgba(255, 75, 96, 0.17);
}

.expire-meal-dialog {
  width: min(440px, calc(100vw - 24px));
}

.expire-meal-dialog form > p:not(.error) {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.expire-meal-confirm-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 189, 89, 0.28);
  border-radius: 14px;
  background: radial-gradient(circle at 35% 28%, rgba(255, 231, 168, 0.2), rgba(255, 189, 89, 0.08));
  box-shadow: 0 0 24px rgba(255, 189, 89, 0.09);
}

.expire-meal-confirm-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.expire-meal-confirm-actions button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.meal-expire-confirm {
  border-color: #ffbd59;
  color: #0b1018;
  background: linear-gradient(135deg, #ffd16f, #ffad32);
}

.food-row-main b,
.food-row-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.food-log-time {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--muted-2);
  font-size: 0.65rem;
  font-variant-numeric: tabular-nums;
}

.food-log-time img {
  width: 13px;
  height: 13px;
}

.food-row-main b {
  color: var(--text);
  font-size: 0.86rem;
}

.food-row-main strong {
  margin-left: auto;
  color: var(--text);
  font-size: 0.8rem;
}

.food-row-main small,
.food-row-main > span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.food-row-main > span {
  color: #88a7bf;
}

.food-type-pill {
  flex: 0 0 auto;
  padding: 2px 5px;
  border-radius: 999px;
  color: var(--food);
  background: rgba(215, 123, 130, 0.1);
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
}

.food-type-pill.meal {
  color: var(--med-major, #ffbd59);
  background: var(--med-background, rgba(255, 189, 89, 0.1));
}

.food-icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 13, 20, 0.56);
}

.food-icon-button.log {
  border-color: rgba(215, 123, 130, 0.22);
  background: rgba(215, 123, 130, 0.12);
}

.food-row-icon.log.ai {
  border-color: rgba(197, 140, 255, 0.28);
  background: rgba(111, 69, 151, 0.15);
}

.food-type-pill.ai {
  color: #d7b4ff;
  background: rgba(111, 69, 151, 0.18);
}

.food-log-row.ai-generated {
  margin-inline: -5px;
  padding-inline: 8px;
  border-bottom-color: rgba(197, 140, 255, 0.2);
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(111, 69, 151, 0.17), rgba(19, 29, 39, 0.55) 56%, rgba(111, 69, 151, 0.06));
  box-shadow: inset 3px 0 0 rgba(197, 140, 255, 0.5);
}

.food-log-row.ai-generated:hover {
  background: linear-gradient(90deg, rgba(111, 69, 151, 0.23), rgba(19, 29, 39, 0.62) 56%, rgba(111, 69, 151, 0.09));
}

.food-empty-inline {
  padding: 18px 4px;
  color: var(--muted-2);
  font-size: 0.76rem;
}

.food-form-dialog,
.meal-dialog,
.food-track-dialog,
.ai-food-dialog,
.ai-food-edit-dialog {
  width: min(560px, calc(100vw - 24px));
}

.ai-food-edit-badge {
  width: max-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid rgba(197, 140, 255, 0.28);
  border-radius: 999px;
  color: #dec1ff;
  background: rgba(111, 69, 151, 0.16);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.food-track-actions .ai-food-action {
  border-color: rgba(197, 140, 255, 0.28);
  background: rgba(111, 69, 151, 0.14);
  color: #ead7ff;
}

.ai-food-dialog form {
  position: relative;
  animation: none;
  transform: none;
}

.ai-food-dialog::backdrop {
  backdrop-filter: none;
}

.ai-food-photo-field {
  position: relative;
  display: grid;
  gap: 7px;
}

.ai-food-photo-field > span {
  color: var(--muted);
  font-size: 0.78rem;
}

.ai-food-photo-picker {
  position: relative;
  width: 100%;
  height: 280px;
  min-height: 280px;
  padding: 0;
  overflow: hidden;
  border: 1px dashed rgba(197, 140, 255, 0.42);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(67, 43, 88, 0.22), rgba(13, 20, 29, 0.92));
}

.ai-food-photo-picker:hover:not(.processing) {
  border-color: rgba(197, 140, 255, 0.72);
  background: linear-gradient(145deg, rgba(91, 55, 122, 0.3), rgba(13, 20, 29, 0.94));
}

.ai-food-photo-picker.has-photo {
  border-style: solid;
}

.ai-food-photo-empty {
  width: 100%;
  height: 100%;
  min-height: 280px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  color: #dec9f5;
}

.ai-food-photo-empty b {
  font-size: 0.82rem;
}

.ai-food-photo-picker > img {
  display: block;
  width: 100%;
  height: 280px;
  object-fit: contain;
  background: #090e15;
}

.ai-food-photo-picker.processing {
  cursor: wait;
}

.ai-food-photo-picker.processing::after {
  content: "";
  position: absolute;
  z-index: 3;
  inset: 0;
  background: rgba(5, 9, 15, 0.28);
  pointer-events: none;
}

.ai-food-photo-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ai-food-photo-actions button {
  min-height: 40px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #ead7ff;
  border-color: rgba(197, 140, 255, 0.3);
  background: rgba(45, 29, 61, 0.84);
}

.ai-food-photo-actions button img {
  width: 18px;
  height: 18px;
}

.ai-food-photo-actions-overlay {
  position: absolute;
  z-index: 4;
  top: 10px;
  right: 10px;
}

.ai-food-photo-actions-overlay button {
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(5, 9, 15, 0.8);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}

.ai-food-info {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-left: 3px solid rgba(197, 140, 255, 0.72);
  background: rgba(111, 69, 151, 0.12);
}

.ai-food-info p {
  margin: 0;
  color: #cbbbd9;
  font-size: 0.72rem;
  line-height: 1.4;
}

.ai-food-weight {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
}

.ai-food-weight input {
  border-radius: 7px 0 0 7px;
}

.ai-food-weight > b {
  height: 100%;
  display: grid;
  place-items: center;
  border: 1px solid #243342;
  border-left: 0;
  border-radius: 0 7px 7px 0;
  color: #c58cff;
  background: #101d27;
}

.ai-food-description > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-food-description > span b {
  color: #9b83ad;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.ai-food-description textarea {
  resize: vertical;
  min-height: 82px;
}

.ai-food-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  color: #dec9f5;
  font-size: 0.78rem;
  font-weight: 700;
}

.ai-food-loading img {
  animation: ai-food-spin 900ms linear infinite;
}

@keyframes ai-food-spin {
  to { transform: rotate(360deg); }
}

.ai-food-submit-row {
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  gap: 8px;
}

.ai-food-submit-row button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.barcode-form-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 8px;
  align-items: stretch;
}

.barcode-form-control button {
  display: grid;
  place-items: center;
  min-width: 46px;
  padding: 0;
  border: 1px solid #243342;
  border-radius: 7px;
  background: #101d27;
  color: #f7f3fb;
}

.food-autofill-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: -2px 0 8px;
}

.food-autofill-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.food-autofill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(124, 202, 221, 0.24);
  border-radius: 7px;
  background: rgba(18, 183, 211, 0.08);
  color: #c9f4fc;
  font-weight: 750;
}

.food-autofill-button:disabled {
  opacity: 0.55;
}

.food-autofill-row small {
  color: var(--muted-2);
  font-size: 0.68rem;
  line-height: 1.3;
}

.nutrition-fieldset {
  margin: 8px 0 14px;
  padding: 12px;
  border: 1px solid rgba(124, 202, 221, 0.12);
  border-radius: 9px;
}

.named-serving-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  margin: 2px 0 8px;
  border: 1px solid rgba(124, 202, 221, 0.12);
  border-radius: 9px;
  background: rgba(8, 13, 20, 0.36);
}

.named-serving-toggle-row > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.named-serving-toggle-row b {
  font-size: 0.78rem;
}

.named-serving-toggle-row small {
  color: var(--muted-2);
  font-size: 0.66rem;
}

.settings-toggle-switch {
  position: relative;
  width: 44px;
  min-width: 44px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(147, 163, 184, 0.25);
  border-radius: 999px;
  background: rgba(10, 15, 24, 0.92);
}

.settings-toggle-switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 160ms var(--ease), background 160ms var(--ease);
}

.settings-toggle-switch.active {
  border-color: rgba(34, 211, 238, 0.68);
  background: rgba(18, 183, 211, 0.2);
}

.settings-toggle-switch.active span {
  transform: translateX(20px);
  background: var(--accent-strong);
}

.nutrition-fieldset legend {
  padding: 0 5px;
  color: var(--muted);
  font-size: 0.72rem;
}

.nutrition-input-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.food-track-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 10px 0;
}

.food-track-actions button {
  min-width: 0;
  min-height: 64px;
  flex-direction: column;
  padding: 8px;
  text-align: center;
}

.food-track-results,
.meal-food-results {
  max-height: 230px;
  overflow-y: auto;
  margin-bottom: 10px;
}

.selected-food-card {
  margin: 10px 0;
  padding: 10px;
  border: 1px solid rgba(215, 123, 130, 0.16);
  border-radius: 9px;
  background: rgba(215, 123, 130, 0.06);
}

.selected-food-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.quantity-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.quantity-input span {
  min-width: 62px;
  color: var(--muted);
  text-align: center;
}

.food-quantity-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin: 8px 0 10px;
  padding: 3px;
  border: 1px solid rgba(124, 202, 221, 0.14);
  border-radius: 9px;
  background: rgba(8, 13, 20, 0.45);
}

.food-quantity-mode[hidden] {
  display: none;
}

.food-quantity-mode button {
  min-height: 34px;
  padding: 6px 10px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-weight: 750;
}

.food-quantity-mode button.active {
  color: #f7f3fb;
  background: rgba(18, 183, 211, 0.16);
}

.food-serving-stepper {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.food-serving-stepper.serving-mode {
  grid-template-columns: 38px minmax(0, 1fr) 38px;
}

.food-serving-stepper button {
  display: grid;
  place-items: center;
  min-width: 38px;
  padding: 0;
  border: 1px solid rgba(124, 202, 221, 0.2);
  border-radius: 7px;
  color: #d8f7fb;
  background: rgba(18, 183, 211, 0.08);
  font-size: 1.15rem;
  font-weight: 800;
}

.food-serving-stepper button[hidden] {
  display: none;
}

.food-log-preview,
.meal-totals {
  min-height: 40px;
  justify-content: space-between;
  padding: 8px 10px;
  margin: 8px 0;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(8, 13, 20, 0.5);
  font-size: 0.7rem;
}

.food-log-preview b,
.meal-totals b {
  color: var(--text);
}

.meal-search-result {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 20px;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  background: transparent;
  text-align: left;
}

.meal-search-result span {
  min-width: 0;
}

.meal-search-result b,
.meal-search-result small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meal-search-result small,
.meal-search-result strong {
  color: var(--muted);
  font-size: 0.68rem;
}

.meal-draft-items {
  display: grid;
  margin-bottom: 10px;
}

.meal-draft-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px 32px;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.meal-draft-row b,
.meal-draft-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meal-draft-row small {
  color: var(--muted);
  font-size: 0.68rem;
}

.meal-draft-quantity {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 5px;
  margin: 0;
}

.meal-draft-quantity input,
.meal-draft-quantity select {
  min-width: 0;
  min-height: 36px;
  padding: 0 7px;
  font-size: 0.74rem;
}

.meal-draft-row button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: rgba(8, 13, 20, 0.55);
}

.barcode-scanner-dialog {
  width: min(620px, 100vw);
  max-height: 100dvh;
  margin: auto;
}

.barcode-scanner-shell {
  position: relative;
  overflow: hidden;
  min-height: min(720px, 100dvh);
  display: grid;
  grid-template-rows: minmax(360px, 1fr) auto;
  color: var(--text);
  background: #080d14;
}

.scanner-close {
  position: absolute;
  z-index: 4;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: rgba(8, 13, 20, 0.72);
  backdrop-filter: blur(12px);
}

.scanner-camera {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  background: #05080c;
}

.scanner-camera video {
  width: 100%;
  height: 100%;
  min-height: 360px;
  object-fit: cover;
}

.scanner-camera::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.34);
  pointer-events: none;
}

.scanner-frame {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  width: min(76%, 430px);
  aspect-ratio: 1.8;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  overflow: hidden;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.34);
}

.scanner-line {
  position: absolute;
  z-index: 3;
  left: 5%;
  top: 50%;
  width: 90%;
  height: 2px;
  background: #d77b82;
  box-shadow: 0 0 12px rgba(215, 123, 130, 0.9);
  transform: translateY(-50%);
  animation: barcodeScan 1.8s ease-in-out infinite alternate;
}

.scanner-copy {
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  text-align: center;
}

.scanner-copy h2 {
  margin-bottom: 5px;
}

.scanner-copy p {
  min-height: 22px;
  margin-bottom: 14px;
  color: var(--muted);
}

.scanner-copy .secondary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.scanner-error .scanner-line {
  display: none;
}

@keyframes barcodeScan {
  from { top: 10%; }
  to { top: 90%; }
}

.friend-main {
  min-width: 0;
}

.friend-main b,
.friend-main span {
  display: block;
}

.friend-main b {
  color: var(--text);
  font-size: 1rem;
}

.friend-name-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.friend-name-flag {
  display: block;
  width: 22px;
  height: 16px;
  flex: 0 0 22px;
  border: 1px solid rgba(164, 178, 193, 0.2);
  border-radius: 2px;
  object-fit: cover;
}

.friend-presence {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
}

.friend-presence.online {
  color: #20d6a3;
}

.friend-presence.online::before {
  content: "";
  display: inline-block;
  width: 0.46em;
  height: 0.46em;
  margin-right: 0.38em;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 0.08em;
}

.friend-main span,
.friend-pill {
  color: var(--muted);
  font-size: 0.78rem;
}

.friend-actions-inline {
  display: flex;
  gap: 8px;
}

.friend-icon {
  width: 40px;
  height: 40px;
  border-radius: 13px;
}

.friend-icon.accept {
  background: rgba(32, 214, 163, 0.09);
}

.friend-icon.deny {
  background: rgba(255, 107, 129, 0.09);
}

.friend-dropdown {
  display: grid;
  gap: 4px;
  padding: 0 12px 12px 66px;
}

.friend-dropdown button {
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  background: rgba(8, 14, 21, 0.72);
  font-weight: 800;
  text-align: left;
}

.friend-empty {
  min-height: 260px;
  border: 1px dashed rgba(148, 163, 184, 0.18);
  border-radius: 18px;
}

.nav-item {
  position: relative;
}

.nav-badge {
  position: absolute;
  top: 7px;
  right: 20%;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #ff2f5f;
  border: 2px solid #070b12;
  font-size: 0.68rem;
  line-height: 1;
  font-weight: 900;
}

.viewer-pill {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 189, 89, 0.35);
  border-radius: 999px;
  color: var(--accent-2);
  font-size: 0.82rem;
}

.share-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  align-content: start;
  gap: 18px;
  width: min(calc(100vw - 24px), 2018px);
  margin: 0 auto;
  padding: 12px 0 28px;
  background: #000;
}

.share-panel {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 14px;
}

.share-card {
  width: min(100%, 1000px);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 0;
  container-type: inline-size;
  position: relative;
  background: #090e15;
  color: #f7f3fb;
}

@media (max-width: 520px) {
  .share-page { width: 100%; padding-left: 0; padding-right: 0; }
  .share-card { width: 100vw; }
}

@media (max-width: 900px) {
  .share-page { grid-template-columns: minmax(0, 1fr); }
}

.share-food-card {
  background: #160b10;
}

.share-food-header {
  grid-template-columns: 1fr;
}

.share-food-week-status {
  display: flex;
  gap: 0.45cqw;
  margin-top: 0.9cqw;
}

.share-food-week-status span {
  box-sizing: border-box;
  display: grid;
  min-width: 3.1cqw;
  height: 2.2cqw;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(215, 91, 104, 0.2);
  color: #9f727a;
  background: rgba(88, 30, 39, 0.26);
  font-size: 1.2cqw;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.share-food-week-status span.met {
  color: #75d7ad;
  border-color: rgba(75, 196, 140, 0.58);
  background: rgba(44, 150, 105, 0.2);
}

.share-food-week-status span.partial {
  color: #b6d96b;
  border-color: rgba(150, 192, 75, 0.58);
  background: rgba(111, 146, 43, 0.18);
}

.share-food-week-status span.maintenance {
  color: #ffc76e;
  border-color: rgba(238, 163, 50, 0.64);
  background: rgba(178, 112, 23, 0.18);
}

.share-food-week-status span.missed {
  color: #ff9da9;
  border-color: rgba(232, 78, 97, 0.68);
  background: rgba(168, 37, 55, 0.25);
}

.share-food-chart {
  top: 49.2%;
  height: 28%;
}

.share-food-card .share-food-placeholders > div {
  background: #2b121a;
}

.share-food-card .share-food-goal-maintenance .share-card-icon {
  opacity: 0.9;
}

.share-food-card .share-food-goal-maintenance .share-stat-copy > span {
  color: #c59aa2;
}

.share-food-card .share-food-goal-maintenance .share-stat-copy > em {
  color: #e45e6f;
}

.share-food-medications {
  position: absolute;
  top: 19.6125%;
  right: 4%;
  width: 48.6%;
  height: 28.1875%;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(var(--medication-rows, 1), minmax(0, 1fr));
  align-content: stretch;
  overflow: hidden;
  column-gap: 0.42cqw;
  /* Keep the two columns apart, but reclaim vertical room for the names. */
  row-gap: 0.084cqw;
}

.share-food-medication-summary {
  position: absolute;
  top: 16.3%;
  right: 4%;
  width: 48.6%;
  height: 2.5625%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 0.45cqw;
  padding: 0 0.65cqw;
  overflow: hidden;
  background: #2b121a;
  color: #c6929b;
  /* Deliberately fill the slim strip instead of leaving vertical breathing room. */
  font-size: 1.75cqw;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.share-food-medication-summary img {
  width: 1.8cqw;
  height: 1.8cqw;
  flex: 0 0 auto;
}

.share-food-medication-card {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  /* Give the medication identity more room than its seven dose cells. */
  grid-template-rows: minmax(0, 1.08fr) minmax(0, 1.34fr);
  border: 1px solid color-mix(in srgb, var(--med-major) 62%, #5b3139);
  border-radius: 0.48cqw;
  overflow: hidden;
  background: #241219;
}

.share-food-medication-card-header {
  position: relative;
  min-width: 0;
  display: grid;
  place-items: center;
  padding: 0 2cqw 0 0.5cqw;
  background: color-mix(in srgb, var(--med-major) 15%, #241219);
}

.share-food-medication-card-header > b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0 0.55cqw;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: color-mix(in srgb, var(--med-minor) 72%, #f7f3fb);
  font-size: 1.38cqw;
  font-weight: 800;
  line-height: 1;
}

.share-food-medication-card-header > i {
  position: absolute;
  z-index: 1;
  top: 0.14cqw;
  right: 0.22cqw;
  width: 1.72cqw;
  height: 1.72cqw;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--med-major) 28%, #241219);
  color: var(--med-minor);
  font-size: 0.94cqw;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
}

.share-food-medication-week {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
}

.share-food-medication-day {
  min-width: 0;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  border: 2px solid #09080d;
  border-right: 0;
  color: color-mix(in srgb, var(--med-major) 58%, #77727a);
  background: #160b10;
  font-size: 1.5cqw;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
}

.share-food-medication-day:last-child {
  border-right: 2px solid #09080d;
}

.share-food-medication-day.taken {
  color: #f8f6f8;
  background: color-mix(in srgb, var(--med-major) 38%, #241219);
}

.share-food-medication-day.pending img {
  width: 1.35cqw;
  height: 1.35cqw;
  opacity: 0.9;
}

.share-food-grid-line {
  stroke: #3c2027;
  stroke-width: 1;
}

.share-food-legend-pill {
  fill: rgba(35, 14, 20, 0.9);
  stroke: rgba(153, 69, 78, 0.5);
  stroke-width: 1;
}

.share-maintenance-calorie-line,
.share-logged-calorie-line,
.share-deficit-calorie-line,
.share-food-weight-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.share-maintenance-calorie-line {
  stroke: #d75b68;
}

.share-logged-calorie-line {
  stroke: #ff9f43;
}

.share-deficit-calorie-line {
  stroke: #32d296;
}

.share-maintenance-calorie-line,
.share-logged-calorie-line,
.share-deficit-calorie-line {
  stroke-dasharray: 8 7;
}

.share-food-weight-line {
  stroke: #f4f7fb;
  stroke-width: 2.6;
}

.share-logged-calorie-dot {
  fill: #ff9f43;
  stroke: #ffd0a3;
  stroke-width: 1.5;
}

.share-deficit-calorie-dot {
  fill: #32d296;
  stroke: #a9f2d8;
  stroke-width: 1.2;
}

.share-food-weight-dot {
  fill: #f4f7fb;
  stroke: #8f9aa8;
  stroke-width: 1.1;
}

.share-food-private-note {
  color: #8c5961;
}

.share-food-card .share-food-footer > div {
  background: #2b121a;
}

.share-food-footer span {
  color: #9f747b;
}


.share-chart {
  cursor: crosshair;
  touch-action: pan-y;
}

.share-graph-preview {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  opacity: 0;
  transition: opacity 100ms ease;
}

.share-graph-preview.visible {
  opacity: 1;
}

.share-graph-preview > i {
  position: absolute;
  width: 1px;
  display: block;
  background: rgba(238, 244, 255, 0.42);
  box-shadow: 0 0 10px rgba(238, 244, 255, 0.12);
}

.share-graph-preview > div {
  position: absolute;
  min-width: 15cqw;
  max-width: 34cqw;
  padding: 0.65cqw 0.85cqw;
  border: 1px solid rgba(112, 139, 168, 0.42);
  border-radius: 0.65cqw;
  color: #f7f3fb;
  background: rgba(9, 14, 21, 0.95);
  box-shadow: 0 0.8cqw 2.2cqw rgba(0, 0, 0, 0.28);
  transform: translate(-50%, -108%);
}

.share-graph-preview-food > div {
  border-color: rgba(215, 91, 104, 0.46);
  background: rgba(31, 12, 18, 0.96);
}

.share-graph-preview b,
.share-graph-preview span {
  display: block;
  font-size: 1.12cqw;
  line-height: 1.35;
  white-space: nowrap;
}

.share-graph-preview b {
  margin-bottom: 0.28cqw;
  font-size: 1.24cqw;
}

.share-graph-preview-food span.maintenance { color: #ef7b86; }
.share-graph-preview-food span.logged { color: #ffad61; }
.share-graph-preview-food span.deficit { color: #5de0ad; }
.share-graph-preview-food span.weight { color: #f4f7fb; }

.share-capture-mode .share-graph-preview {
  display: none !important;
}

.share-food-actions .share-native,
.share-food-actions .share-download {
  background: #2a1118;
  border-color: rgba(215, 91, 104, 0.34);
}

.share-header {
  position: absolute;
  top: 3.7%;
  left: 4%;
  right: 4%;
  height: 18%;
  display: grid;
  grid-template-columns: 1fr 18cqw;
  align-items: start;
  gap: 2cqw;
  min-height: 0;
}

.share-brand {
  display: flex;
  align-items: flex-start;
  gap: 1.5cqw;
  min-width: 0;
}

.share-brand img {
  width: 8.4cqw;
  height: 8.4cqw;
  flex: 0 0 8.4cqw;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}

.share-brand h1 {
  margin: 0;
  font-size: 5.2cqw;
  font-weight: 800;
  line-height: 0.95;
}

.share-brand .trackhub-flag-hub {
  font: inherit;
  line-height: inherit;
  vertical-align: baseline;
}

.share-brand p {
  margin: 0.8cqw 0 0;
  color: var(--muted);
  font-size: 1.85cqw;
}

.share-injection-days {
  display: flex;
  gap: 0.45cqw;
  margin-top: 0.9cqw;
}

.share-injection-days span {
  box-sizing: border-box;
  display: grid;
  min-width: 3.1cqw;
  height: 2.2cqw;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(164, 178, 193, 0.18);
  color: #778595;
  font-size: 1.2cqw;
  font-weight: 700;
  line-height: 1;
}

.share-injection-days span.active {
  border-color: transparent;
  background:
    linear-gradient(rgba(16, 26, 35, 0.86), rgba(16, 26, 35, 0.86)) padding-box,
    var(--schedule-fill) padding-box,
    var(--schedule-fill) border-box;
}

.share-injection-days span > b {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font: inherit;
}

.share-injection-days span.active > b {
  color: transparent;
  background: var(--schedule-fill);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.share-injection-interval {
  font-weight: 600;
}

.share-injection-schedule-combined,
.share-injection-intervals {
  display: flex;
  align-items: center;
  gap: 0.45cqw;
  max-width: 100%;
  margin-top: 0.9cqw;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

.share-injection-schedule-combined::-webkit-scrollbar,
.share-injection-intervals::-webkit-scrollbar {
  display: none;
}

.share-injection-schedule-combined .share-injection-days {
  flex: 0 0 auto;
  margin-top: 0;
}

.share-injection-schedule-combined .share-injection-intervals {
  margin-top: 0;
}

.share-injection-schedule-divider {
  display: grid;
  flex: 0 0 auto;
  width: 0.9cqw;
  height: 2.2cqw;
  place-items: center;
  color: rgba(164, 178, 193, 0.38);
  font-size: 1.55cqw;
  font-style: normal;
  font-weight: 500;
  line-height: 1;
}

.share-injection-interval-box {
  box-sizing: border-box;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 3.1cqw;
  height: 2.2cqw;
  padding: 0 0.65cqw;
  border: 1px solid color-mix(in srgb, var(--interval-color) 70%, transparent);
  color: var(--interval-color);
  background: color-mix(in srgb, var(--interval-color) 13%, transparent);
  font-size: 1.2cqw;
  font-weight: 760;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.share-bmi-mini {
  align-self: start;
  overflow: hidden;
}

.share-bmi-mini .bmi-gauge {
  width: 100%;
  height: 11.6cqw;
  transform: translateY(-1.2cqw);
}

.share-bmi-mini .bmi-label,
.share-bmi-mini .bmi-class {
  display: none;
}

.share-bmi-mini .bmi-value {
  font-size: 50px;
}

.share-stats > div {
  background: #101a23;
  padding: 0.55cqw 0.9cqw;
}

.share-footer > div {
  background: #101a23;
  padding: 1.35cqw;
}

.share-stats span,
.share-footer span {
  display: block;
  color: var(--muted);
  font-size: 1.55cqw;
  line-height: 1.05;
}

.share-stats > .share-stat-card .share-stat-copy > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.share-stats > .share-stat-card .share-stat-copy > em {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.cooking-meal-bubble {
  position: fixed;
  z-index: 29;
  width: 58px;
  height: 58px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(215, 123, 130, 0.58);
  border-radius: 50%;
  background: linear-gradient(145deg, #4b2029, #24151b);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42), 0 0 18px rgba(215, 123, 130, 0.16);
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: left 180ms ease, right 180ms ease, top 180ms ease, bottom 180ms ease, transform 140ms ease;
}

.cooking-meal-bubble > img { width: 26px; height: 26px; pointer-events: none; }
.cooking-meal-bubble > span {
  position: absolute;
  right: 7px;
  top: 7px;
  width: 8px;
  height: 8px;
  border: 2px solid #351820;
  border-radius: 50%;
  background: #ff8a74;
}
.cooking-meal-bubble.dragging { cursor: grabbing; transform: scale(1.06); transition: none; }
.cooking-meal-bubble.corner-tl { left: 16px; top: max(16px, calc(env(safe-area-inset-top) + 10px)); }
.cooking-meal-bubble.corner-tr { right: 16px; top: max(16px, calc(env(safe-area-inset-top) + 10px)); }
.cooking-meal-bubble.corner-bl { left: 16px; bottom: max(100px, calc(env(safe-area-inset-bottom) + 92px)); }
.cooking-meal-bubble.corner-br { right: 16px; bottom: max(100px, calc(env(safe-area-inset-bottom) + 92px)); }

.cooking-meal-row {
  border-color: rgba(215, 123, 130, 0.48);
  background: linear-gradient(105deg, rgba(93, 35, 46, 0.34), rgba(16, 26, 35, 0.96));
}
.food-row-icon.cooking { color: #ffe4c7; background: rgba(215, 123, 130, 0.16); border-color: rgba(215, 123, 130, 0.4); }
.food-type-pill.cooking { color: #ffe4c7; background: rgba(215, 123, 130, 0.22); }
.food-icon-button.cooking { border-color: rgba(215, 123, 130, 0.46); }
.food-icon-button.cooking-delete { border-color: rgba(255, 107, 122, 0.42); background: rgba(105, 31, 43, 0.24); }

.cooking-meal-actions {
  display: grid;
  grid-template-columns: 44px minmax(0, 0.9fr) minmax(0, 1.15fr);
  gap: 8px;
  align-items: stretch;
}
.cooking-meal-actions button,
.meal-edit-submit {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.cancel-cooking-meal {
  padding: 0;
  border: 1px solid rgba(255, 107, 122, 0.42);
  background: rgba(105, 31, 43, 0.32);
}
.save-cooking-draft {
  border: 1px solid #263747;
  background: #101a23;
  color: #f7f3fb;
}

@media (max-width: 560px) {
  .cooking-meal-actions { grid-template-columns: 42px minmax(0, 0.9fr) minmax(0, 1.12fr); gap: 6px; }
  .cooking-meal-actions button { padding-inline: 7px; font-size: 0.75rem; }
}

.share-stats b,
.share-footer b {
  display: block;
  margin-top: 0.12cqw;
  color: #fff;
  font-size: 2.65cqw;
  line-height: 1.05;
}

.share-stats em {
  display: block;
  margin-top: 0.125125cqw;
  color: #7fb7ff;
  font-size: 1.55cqw;
  font-style: normal;
  font-weight: 500;
  line-height: 1.28;
  transform: translateY(-0.302cqw);
}

/* The exported share clone rounds container-query lengths differently from the live card.
   Keep the complete three-line stat group inside its grid track during capture. */
.share-card.share-capture-mode .share-stats > .share-stat-card {
  padding-top: 0.2cqw;
  padding-bottom: 0.2cqw;
}

.share-card.share-capture-mode .share-stats > .share-stat-card .share-stat-copy {
  height: 100%;
  box-sizing: border-box;
  display: flex;
  min-height: 0;
  flex-direction: column;
  justify-content: center;
  padding: 0;
  overflow: visible;
  position: relative;
  top: 0.1cqw;
}

.share-card.share-capture-mode .share-stats > .share-stat-card .share-stat-copy > b {
  margin-top: 0.08cqw;
}

.share-card.share-capture-mode .share-stats > .share-stat-card .share-stat-copy > em {
  margin-top: 0.05005cqw;
  line-height: 1.28;
  transform: none;
}

/*
 * html-to-image uses a foreignObject clone whose font baselines sit optically
 * higher than the live card in Chromium/WebKit. Keep every exported Share Data
 * text group centred here, in one place, rather than accumulating per-label
 * offsets. These rules affect generated PNGs only.
 */
.share-card.share-capture-mode .share-week-row > * {
  position: relative;
  top: 0.13cqw;
}

.share-card.share-capture-mode .share-injection-days span > b,
.share-card.share-capture-mode .share-injection-interval-box,
.share-card.share-capture-mode .share-injection-schedule-divider {
  position: relative;
  top: 0.12cqw;
}

.share-card.share-capture-mode .share-stack-strip > span,
.share-card.share-capture-mode .share-stack-strip .share-medication-pill > :is(.share-medication-full, .share-medication-short, i) {
  position: relative;
  top: 0.12cqw;
}

.share-card.share-capture-mode .share-footer-copy {
  position: relative;
  top: 0.12cqw;
}

.share-medication-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35cqw;
  margin-top: 0.42cqw;
}

.share-stats .share-medication-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 0.28cqw;
  margin: 0;
  padding: 0.28cqw 0.48cqw;
  border: 1px solid currentColor;
  border-radius: 0.35cqw;
  color: #ffbd59;
  background: rgba(255, 189, 89, 0.1);
  font-size: 1.26cqw;
  font-weight: 750;
  line-height: 1;
}

.share-stats .share-medication-pill i {
  color: var(--med-minor, #ffd18b);
  font-size: 1em;
  font-style: normal;
  font-weight: 800;
}

.share-stats .share-medication-pill.med-semaglutide {
  color: #74c8ff;
  background: rgba(116, 200, 255, 0.1);
}

.share-stats .share-medication-pill.med-semaglutide i { color: #a5ddff; }

.share-stats .share-medication-pill.med-tirzepatide {
  color: #caa3ff;
  background: rgba(202, 163, 255, 0.1);
}

.share-stats .share-medication-pill.med-tirzepatide i { color: #e1caff; }

.share-stack-card .share-stat-copy > em,
.share-prediction-card .share-stat-copy > em {
  margin-top: 0.3cqw;
  font-size: 1.2cqw;
  line-height: 1.1;
}

.share-prediction-card b {
  font-size: 1.9cqw;
}

.share-stat-card,
.share-footer-card {
  display: grid;
  grid-template-columns: 4.4cqw minmax(0, 1fr);
  align-items: center;
  column-gap: 0.9cqw;
}

.share-stat-copy,
.share-footer-copy {
  min-width: 0;
}

.share-stat-card > .share-card-icon {
  width: 4.4cqw;
  height: 4.4cqw;
  opacity: 0.88;
}

.share-footer-card {
  grid-template-columns: 3.8cqw minmax(0, 1fr);
  column-gap: 0.9cqw;
}

.share-footer-card > .share-card-icon {
  width: 3.8cqw;
  height: 3.8cqw;
  opacity: 0.88;
}

.share-stats {
  position: absolute;
  top: 16.3%;
  left: 4%;
  width: 42.4cqw;
  height: 31.5%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 0.7cqw 1cqw;
  min-height: 0;
}

.share-chart {
  position: absolute;
  left: 4%;
  top: 49.2%;
  width: 92%;
  height: 28%;
  min-height: 0;
}

.share-card.share-card-no-strips .share-chart {
  height: 39.7%;
}

.share-card.share-card-no-stack .share-chart,
.share-card.share-card-no-supplements .share-chart {
  height: 32.7%;
}

.share-card.share-card-no-strips .share-chart {
  height: 39.7%;
}

.share-legend-pill {
  fill: rgba(12, 20, 30, 0.84);
  stroke: rgba(74, 101, 127, 0.48);
  stroke-width: 1;
}

.share-grid-line {
  stroke: #203047;
  stroke-width: 1;
}

.share-weight-line {
  fill: none;
  stroke: #e9eef5;
  stroke-width: 4;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.share-weight-average-line {
  fill: none;
  stroke: rgba(145, 165, 190, 0.66);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 5 5;
}

.share-weight-dot {
  fill: #f7f9fc;
  stroke: #c7d0dc;
  stroke-width: 2;
}

.share-medication-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 8 7;
}

.share-goal-weight-line {
  stroke: rgba(99, 210, 171, 0.9);
  stroke-width: 2;
  stroke-dasharray: 7 5;
}

.share-goal-weight-label {
  fill: #78dfb9;
  paint-order: stroke;
  stroke: #090e15;
  stroke-width: 4px;
  stroke-linejoin: round;
  font: 800 12px system-ui, sans-serif;
}

.share-chart-title,
.share-chart-sub,
.share-axis,
.share-legend {
  fill: #a4b2c1;
  font: 700 14px system-ui, sans-serif;
}

.share-legend {
  font-size: 12px;
}

.share-chart-title {
  fill: #f7f3fb;
  font-size: 18px;
}

.share-chart-sub,
.share-axis.end {
  text-anchor: end;
}

.share-axis.y-axis {
  text-anchor: end;
}

.share-axis.medication-axis {
  text-anchor: start;
}

.share-axis-unit {
  fill: #718096;
  font-size: 0.76em;
  font-weight: 700;
}

.share-weekly {
  position: absolute;
  top: 16.3%;
  right: 4%;
  width: 48.6%;
  height: 31.5%;
  box-sizing: border-box;
  overflow: hidden;
  padding: 0 0.9cqw;
  background: #101a23;
}

.share-weekly-rows {
  display: grid;
  grid-template-rows: repeat(12, minmax(0, 1fr));
  align-content: stretch;
  min-width: 0;
  height: 100%;
}

.share-week-row {
  min-width: 0;
  display: grid;
  grid-template-columns:
    minmax(0, 20fr)
    minmax(0, 25fr)
    minmax(0, 18fr)
    minmax(0, 20fr)
    minmax(0, 17fr);
  align-items: center;
  gap: 0.12cqw;
  min-height: 0;
  padding: 0.025cqw 0;
  border-top: 1px solid rgba(113, 139, 168, 0.13);
  font-size: 1.58cqw;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.share-weekly-dose-count-2 .share-week-row {
  grid-template-columns:
    minmax(0, 19fr)
    minmax(0, 23fr)
    minmax(0, 17fr)
    minmax(0, 19fr)
    minmax(0, 22fr);
}

.share-weekly-dose-count-3 .share-week-row {
  grid-template-columns:
    minmax(0, 18fr)
    minmax(0, 21fr)
    minmax(0, 16fr)
    minmax(0, 18fr)
    minmax(0, 27fr);
}

.share-weekly-dose-count-4 .share-week-row {
  grid-template-columns:
    minmax(0, 17fr)
    minmax(0, 20fr)
    minmax(0, 16fr)
    minmax(0, 18fr)
    minmax(0, 29fr);
}

.share-weekly.share-weekly-no-dose .share-week-row {
  grid-template-columns:
    minmax(0, 1.35fr)
    minmax(0, 1.75fr)
    minmax(0, 1.2fr)
    minmax(0, 1.25fr);
}

.share-week-row:first-child {
  border-top: 0;
}

.share-week-row > * {
  display: block;
  line-height: 1.15;
  transform: none;
}

.share-week-row > span {
  overflow: hidden;
  color: #a4b2c1;
  font-weight: 650;
  text-overflow: ellipsis;
}

.share-week-row small {
  overflow: hidden;
  color: #7f90a3;
  font-size: 1.14cqw;
  font-weight: 650;
  text-align: left;
  text-overflow: ellipsis;
}

.share-week-row small.ongoing {
  overflow: visible;
  color: #72aa91;
  font-size: 1.22cqw;
  font-weight: 750;
  line-height: 1.35;
}

.share-week-row b {
  --unit-color: #aab7c6;
  color: #edf3fb;
  font-size: 1.62cqw;
  font-weight: 800;
  text-align: right;
}

.share-week-row strong {
  --unit-color: #8798aa;
  color: #91a5be;
  font-size: 1.62cqw;
  font-weight: 850;
  text-align: right;
}

.share-week-row strong.loss {
  --unit-color: #82bfae;
  color: #4bd7b3;
}

.share-week-row strong.gain {
  --unit-color: #d99aa2;
  color: #ff7c88;
}

.share-week-row em {
  --unit-color: #d2b477;
  color: #ffbd59;
  font-size: 1.62cqw;
  font-style: normal;
  font-weight: 750;
  text-align: right;
}

.share-week-row .share-week-dose {
  color: var(--dose-major);
  min-width: 0;
  overflow: hidden;
  text-overflow: clip;
}

.share-week-doses {
  display: grid;
  grid-template-columns: repeat(var(--share-dose-columns, 1), minmax(0, 1fr));
  align-items: center;
  gap: 0.18cqw;
  min-width: 0;
  margin-left: 0.4cqw;
}

.share-weekly-dose-count-2 .share-week-doses { --share-dose-columns: 2; }
.share-weekly-dose-count-3 .share-week-doses { --share-dose-columns: 3; }
.share-weekly-dose-count-4 .share-week-doses { --share-dose-columns: 4; }

.share-weekly-dose-count-2 .share-week-dose {
  font-size: 1.46cqw;
}

.share-weekly-dose-count-3 .share-week-dose {
  font-size: 1.3cqw;
}

.share-weekly-dose-count-4 .share-week-dose {
  font-size: 1.18cqw;
}

.share-week-dose span {
  color: var(--dose-major);
}

.share-week-dose i {
  color: var(--dose-minor);
  font-size: 0.76em;
  font-style: normal;
  font-weight: 750;
}

.share-week-row .share-week-dose-start,
.share-week-dose-start span,
.share-week-dose-start i {
  color: #a4b2c1;
}

.share-week-unit {
  color: var(--unit-color, #8392a4);
  font-size: 0.82em;
  font-style: normal;
  font-weight: 700;
}

.share-week-row.start b,
.share-week-row.start em {
  --unit-color: #788899;
  color: #91a5be;
}

.share-stack-strip {
  position: absolute;
  top: 77.8%;
  left: 4%;
  right: 4%;
  height: 4.3%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 0.9cqw;
  padding: 0.2cqw 1.1cqw;
  background: #101a23;
}

.share-card.share-card-no-supplements .share-stack-strip:not(.share-supplements-strip) {
  top: 82.7%;
}

.share-stack-strip > .share-card-icon {
  width: 2.8cqw;
  height: 2.8cqw;
  flex: 0 0 auto;
  opacity: 0.88;
}

.share-stack-strip > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 1.68cqw;
  font-weight: 800;
}

.share-stack-strip .share-medication-stack {
  margin: 0;
  align-self: center;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  overflow: visible;
  min-width: 0;
}

.share-stack-strip .share-medication-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45cqw;
  margin: 0;
  height: auto;
  box-sizing: border-box;
  padding: 0.14cqw 0.7cqw;
  border: 1px solid currentColor;
  border-radius: 0.35cqw;
  color: var(--med-major, #ffbd59);
  background: var(--med-background, rgba(255, 189, 89, 0.1));
  font-size: 2.1cqw;
  font-weight: 750;
  line-height: 1;
  flex: 0 0 auto;
}

.share-medication-short {
  display: none !important;
}

.share-medication-stack.compact .share-medication-full {
  display: none;
}

.share-medication-stack.compact .share-medication-short {
  display: inline !important;
}

.share-stack-strip .share-medication-pill i {
  color: var(--med-minor, #ffd18b);
  font-size: 1em;
  font-style: normal;
  font-weight: 800;
}

.share-stack-strip .share-medication-pill > img {
  width: 1.85cqw;
  height: 1.85cqw;
  flex: 0 0 1.85cqw;
  object-fit: contain;
}

.share-stack-strip .share-medication-pill.med-semaglutide {
  color: #74c8ff;
  background: rgba(116, 200, 255, 0.1);
}

.share-stack-strip .share-medication-pill.med-semaglutide i { color: #a5ddff; }

.share-stack-strip .share-medication-pill.med-tirzepatide {
  color: #caa3ff;
  background: rgba(202, 163, 255, 0.1);
}

.share-stack-strip .share-medication-pill.med-tirzepatide i { color: #e1caff; }

.share-stack-strip em {
  color: #8796a8;
  font-size: 1.25cqw;
  font-style: normal;
}

.share-footer {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 89.6%;
  bottom: auto;
  height: 4.3%;
  display: grid;
  grid-template-columns: 20.8cqw 20.8cqw minmax(0, 48.4cqw);
  align-items: center;
  gap: 1cqw;
  min-height: 0;
  background: transparent;
  padding: 0;
}

.share-footer b {
  margin-top: 0.12cqw;
  font-size: 1.72cqw;
}

.share-footer .share-duration-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.share-footer .share-duration-days {
  display: inline;
  margin: 0;
  color: #7fb7ff;
  font-size: 1.55cqw;
  font-style: normal;
  font-weight: 650;
  line-height: 1;
}

.share-supplements-strip {
  top: 82.7%;
  height: 6.2%;
}

.share-supplements-strip .share-supplement-stack.two-line {
  height: 4.8cqw;
  flex-wrap: wrap;
  align-content: center;
  column-gap: 0.42cqw;
  row-gap: 0.24cqw;
  overflow: hidden;
}

.share-footer > div {
  padding: 0.2cqw 0.8cqw;
  height: 100%;
  box-sizing: border-box;
}

.share-footer-card {
  grid-template-columns: 2.55cqw minmax(0, 1fr);
  column-gap: 0.55cqw;
}

.share-footer-card > .share-card-icon {
  width: 2.55cqw;
  height: 2.55cqw;
}

.share-footer span {
  font-size: 1.35cqw;
}

.share-stack-strip .share-medication-stack em {
  font-size: 1.65cqw;
}

.share-supplements-strip > .share-card-icon {
  opacity: 0.82;
}

.share-supplements-strip .share-medication-pill {
  gap: 0.37cqw;
  padding: 0.13cqw 0.57cqw;
  font-size: 1.65cqw;
  line-height: 1;
  transform: none;
}

.share-supplements-strip .share-medication-pill > :is(.share-medication-full, .share-medication-short, i) {
  display: inline-block;
  line-height: 1;
  /* Optical centering keeps descenders such as g and y clear of the pill edge. */
  transform: translateY(-0.06cqw);
}

.share-supplements-strip .share-medication-short {
  display: none !important;
}

.share-supplements-strip .share-medication-stack.compact .share-medication-full {
  display: none !important;
}

.share-supplements-strip .share-medication-stack.compact .share-medication-short {
  display: inline-block !important;
}

.share-supplements-strip .share-medication-pill > img {
  width: 1.43cqw;
  height: 1.43cqw;
  flex-basis: 1.43cqw;
}

/* html-to-image resolves inline glyph baselines differently on some mobile engines. */
.share-card.share-capture-mode .share-supplements-strip .share-medication-pill {
  height: 2.12cqw;
  min-height: 2.12cqw;
  padding-top: 0;
  padding-bottom: 0;
  align-items: center;
}

.share-card.share-capture-mode .share-supplements-strip .share-medication-pill > :is(.share-medication-full, .share-medication-short, i) {
  display: flex;
  align-items: center;
  height: 100%;
  line-height: 1;
  transform: none;
  position: relative;
  top: 0.12cqw;
}

/* Mobile foreignObject export overestimates a full-height flex text line and
   pins its glyphs to the pill's top edge. Use the natural line box on phones;
   desktop capture is already correctly centred and remains unchanged. */
@media (max-width: 520px) {
  .share-card.share-capture-mode .share-supplements-strip .share-medication-pill > :is(.share-medication-full, .share-medication-short, i) {
    display: inline-block;
    align-self: center;
    height: auto;
    position: static;
    top: auto;
    line-height: 1;
    transform: translateY(0.18cqw);
  }
}

.share-goal-progress-wrap {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 2.35%;
}

.share-goal-progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.7cqw;
  color: var(--muted);
  font-size: 1.45cqw;
  font-weight: 650;
  line-height: 1;
}

.share-goal-progress-label b {
  color: var(--muted);
  font-size: 1.45cqw;
}

.share-goal-progress {
  height: 1.15cqw;
  overflow: hidden;
  background: #101a23;
}

.share-goal-progress span {
  display: block;
  height: 100%;
  background: #29c78d;
  box-shadow: 0 0 16px rgba(41, 199, 141, 0.22);
}

.share-private-note {
  position: absolute;
  right: 4%;
  bottom: 0.75%;
  width: 48%;
  margin: 0;
  color: #607184;
  font-size: 0.9cqw;
  font-style: italic;
  line-height: 1.1;
  text-align: right;
}

.share-actions {
  width: min(92vw, 360px);
  display: flex;
  gap: 10px;
}

.share-back,
.share-native,
.share-download,
.share-shot-privacy,
.share-graph-settings {
  min-height: 46px;
}

.share-back {
  min-width: 0;
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.share-back img {
  width: 20px;
  height: 20px;
}

.share-native,
.share-download,
.share-shot-privacy,
.share-graph-settings {
  flex: 0 0 46px;
  width: 46px;
  padding: 0;
  display: grid;
  place-items: center;
  background: #101a23;
}

.share-native img,
.share-download img,
.share-shot-privacy img,
.share-graph-settings img {
  width: 22px;
  height: 22px;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.share-native:hover img,
.share-download:hover img,
.share-shot-privacy:hover img,
.share-graph-settings:hover img {
  transform: translateY(1px);
}

.share-native:disabled img,
.share-download:disabled img {
  opacity: 0.48;
}

.share-native.is-hidden {
  display: none;
}

.share-actions:has(.share-native.is-hidden) {
  grid-template-columns: 1fr 46px;
}

.share-actions:has(.share-shot-privacy) {
  grid-template-columns: 1fr 46px 46px 46px;
}

.share-actions:has(.share-native.is-hidden):has(.share-shot-privacy) {
  grid-template-columns: 1fr 46px 46px;
}

.share-shot-privacy.active {
  border-color: rgba(99, 210, 171, 0.65);
  background: rgba(31, 111, 89, 0.28);
}

.share-graph-settings-dialog {
  width: min(520px, calc(100vw - 24px));
}

.share-graph-settings-dialog form {
  padding: 22px;
  background: linear-gradient(155deg, #111d28 0%, #0b111a 68%, #0b1018 100%);
  border: 1px solid rgba(121, 171, 211, 0.22);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.62);
}

.share-graph-settings-dialog header {
  align-items: flex-start;
  margin-bottom: 20px;
}

.share-graph-settings-heading {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
}

.share-graph-settings-heading > img {
  width: 28px;
  height: 28px;
}

.share-graph-settings-heading h2 {
  margin: 0;
  font-size: 1.25rem;
}

.share-graph-settings-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.share-weight-range-settings {
  min-width: 0;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.share-weight-range-settings legend {
  margin-bottom: 9px;
  color: #dceaf6;
  font-size: 0.83rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.share-weight-range-option {
  width: 100%;
  min-height: 76px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid rgba(124, 158, 188, 0.19);
  border-radius: 13px;
  color: var(--text);
  background: rgba(10, 18, 27, 0.82);
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.share-weight-range-option:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(115, 185, 230, 0.48);
  background: rgba(17, 34, 47, 0.9);
}

.share-weight-range-option.active {
  border-color: rgba(99, 210, 171, 0.7);
  background: linear-gradient(90deg, rgba(36, 113, 92, 0.28), rgba(17, 35, 48, 0.84));
}

.share-weight-range-option > img {
  width: 25px;
  height: 25px;
}

.share-weight-range-option span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.share-weight-range-option b {
  font-size: 0.98rem;
}

.share-weight-range-option small {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.share-weight-range-option > i {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(143, 165, 185, 0.55);
  border-radius: 50%;
}

.share-weight-range-option.active > i {
  border-color: #63d2ab;
  box-shadow: inset 0 0 0 4px #101b25;
  background: #63d2ab;
}

.share-weight-range-option:disabled {
  cursor: default;
  opacity: 0.46;
}

.share-weight-range-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 2px 0;
  color: #e9c27c;
  font-size: 0.82rem;
}

.share-weight-range-warning img {
  width: 16px;
  height: 16px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.topbar-action-button {
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(122, 145, 161, 0.18);
  border-radius: 50%;
  background: #101a23;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.025);
}

.topbar-action-button img {
  width: 21px;
  height: 21px;
  opacity: 0.72;
}

.topbar-action-button:hover,
.topbar-action-button.active {
  border-color: rgba(6, 182, 212, 0.52);
  background: rgba(6, 182, 212, 0.14);
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.08);
}

.topbar-action-button.progress {
  border-color: rgba(110, 168, 255, 0.3);
  background: rgba(42, 91, 146, 0.14);
}

.topbar-action-button:hover img,
.topbar-action-button.active img {
  opacity: 1;
}

.stat {
  min-height: 50px;
  padding: 9px 10px;
  background: #101e29;
  border: 0;
  border-radius: 9px;
  box-shadow: var(--shadow-soft);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.stat b {
  display: block;
  margin-top: 3px;
  font-size: clamp(0.9rem, 1.6vw, 1.08rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.home-weight-stat {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}

.home-weight-stat-icon {
  width: 32px;
  height: 32px;
  display: grid !important;
  place-items: center;
  border: 1px solid rgba(110, 168, 255, 0.22);
  border-radius: 8px;
  background: rgba(110, 168, 255, 0.08);
}

.home-weight-stat-current .home-weight-stat-icon {
  border-color: rgba(99, 214, 164, 0.24);
  background: rgba(99, 214, 164, 0.08);
}

.home-weight-stat-goal .home-weight-stat-icon {
  border-color: rgba(245, 185, 95, 0.25);
  background: rgba(245, 185, 95, 0.08);
}

.home-weight-stat-icon img {
  width: 26.25px;
  height: 26.25px;
}

.home-weight-stat-copy {
  min-width: 0;
}

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

.home-post-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.home-post-column {
  display: grid;
  gap: 18px;
  min-width: 0;
  align-content: start;
}

.home-weight-column {
  gap: 9px;
}

.weight-comparison-panel {
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(110, 168, 255, 0.13);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(125, 180, 230, 0.055), rgba(125, 180, 230, 0.012)),
    #111b24;
}

.weight-tracking-panel {
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(110, 168, 255, 0.13);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(125, 180, 230, 0.055), rgba(125, 180, 230, 0.012)),
    #111b24;
}

.weight-tracking-content {
  padding: 0 16px 16px;
}

.weight-tracking-tools {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.weight-comparison-head {
  width: 100%;
  min-height: 66px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.weight-comparison-head > span {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.weight-comparison-head > .home-section-heading {
  display: flex;
  align-items: center;
  gap: 11px;
}

.home-section-heading-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(122, 145, 161, 0.16);
  border-radius: 9px;
  background: rgba(7, 15, 23, 0.34);
}

.home-section-heading-icon img {
  width: 33.75px;
  height: 33.75px;
}

.home-section-heading-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.home-section-heading-copy b,
.home-section-heading-copy small {
  display: block;
}

.weight-comparison-head b {
  font-size: 1.05rem;
}

.weight-comparison-head small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.weight-comparison-head > img {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.weight-comparison-grid {
  padding: 0 16px 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.weight-comparison-side {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 7px;
}

.weight-comparison-side > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.weight-comparison-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  isolation: isolate;
  contain: paint;
  border: 1px solid rgba(110, 168, 255, 0.2);
  border-radius: 12px;
  background: #090e15;
}

.weight-comparison-image {
  width: 100%;
  height: 100%;
  display: block;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #090e15;
}

.weight-comparison-image:hover,
.weight-comparison-image:active {
  transform: none;
}

.weight-comparison-image img {
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  max-width: none;
  margin: -1px;
  display: block;
  object-fit: cover;
  object-position: var(--comparison-x, 50%) var(--comparison-y, 50%);
  transform: scale(var(--comparison-zoom, 1));
  transform-origin: var(--comparison-x, 50%) var(--comparison-y, 50%);
  transition: transform 140ms var(--ease), object-position 140ms var(--ease);
}

/* Keep touch scrolling on the normal paint path. Permanent compositing of the
   two cropped photos can flicker on Android while the page is moving. */
@media (hover: hover) and (pointer: fine) {
  .weight-comparison-image-wrap,
  .weight-comparison-image {
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }

  .weight-comparison-image img {
    transform: translateZ(0) scale(var(--comparison-zoom, 1));
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }
}

@media (hover: none), (pointer: coarse) {
  .weight-comparison-image img { transition: none; }
}

.weight-comparison-settings {
  position: absolute;
  z-index: 2;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(5, 9, 14, 0.78);
  backdrop-filter: blur(6px);
}

.weight-comparison-settings img {
  width: 18px;
  height: 18px;
}

.weight-comparison-meta {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 66px;
  padding: 24px 12px 10px;
  display: grid;
  align-content: end;
  gap: 2px;
  pointer-events: none;
  color: #fff;
  background: linear-gradient(180deg, transparent 0%, rgba(4, 7, 12, 0.28) 25%, rgba(4, 7, 12, 0.9) 100%);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.86);
}

.weight-comparison-meta b {
  font-size: clamp(0.92rem, 2vw, 1.18rem);
  font-weight: 850;
  line-height: 1;
  letter-spacing: -0.015em;
}

.weight-comparison-meta span {
  color: rgba(230, 238, 248, 0.78);
  font-size: clamp(0.66rem, 1.25vw, 0.78rem);
  font-weight: 650;
  line-height: 1.1;
}

.weight-comparison-side > small {
  overflow: hidden;
  color: #8ea4bd;
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weight-comparison-select {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.68rem;
}

.weight-comparison-select select {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 8px;
  border: 1px solid rgba(122, 145, 161, 0.16);
  border-radius: 8px;
  background: #0b1119;
  color: var(--text);
  font-size: 0.72rem;
}

.weight-comparison-select select:disabled {
  cursor: default;
  opacity: 0.48;
  color: var(--muted);
  background: #090d13;
}

.weight-comparison-empty {
  min-height: 135px;
  padding: 18px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
}

.weight-comparison-empty p {
  max-width: 330px;
  margin: 0;
  font-size: 0.8rem;
}

.remove-weight-photo {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #ff8794;
  border-color: rgba(255, 107, 122, 0.24);
}

.remove-weight-photo img {
  width: 18px;
  height: 18px;
}

.modal.comparison-editor-modal {
  width: min(520px, calc(100vw - 24px));
  margin: auto;
}

.comparison-editor-modal form {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.comparison-editor-preview {
  position: relative;
  width: min(320px, 100%);
  aspect-ratio: 3 / 4;
  margin: 0 auto 16px;
  overflow: hidden;
  border: 1px solid rgba(110, 168, 255, 0.2);
  border-radius: 14px;
  background: #090e15;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.comparison-editor-preview.dragging {
  cursor: grabbing;
}

.comparison-editor-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: var(--comparison-x, 50%) var(--comparison-y, 50%);
  transform: scale(var(--comparison-zoom, 1));
  transform-origin: var(--comparison-x, 50%) var(--comparison-y, 50%);
}

.comparison-editor-guides {
  position: absolute;
  z-index: 2;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  border-radius: inherit;
}

.comparison-editor-guides i {
  position: absolute;
  display: block;
  margin: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.75);
}

.comparison-editor-guides .vertical {
  top: 0;
  bottom: 0;
  width: 1px;
}

.comparison-editor-guides .vertical:nth-child(1) { left: 33.333%; }
.comparison-editor-guides .vertical:nth-child(2) { left: 66.666%; }

.comparison-editor-guides .horizontal {
  left: 0;
  right: 0;
  height: 1px;
}

.comparison-editor-guides .horizontal:nth-child(3) { top: 20%; }
.comparison-editor-guides .horizontal:nth-child(4) { top: 40%; }
.comparison-editor-guides .horizontal:nth-child(5) { top: 60%; }
.comparison-editor-guides .horizontal:nth-child(6) { top: 80%; }

.comparison-editor-control {
  display: grid;
  gap: 8px;
}

.comparison-editor-control > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.comparison-editor-control output {
  color: var(--blue);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.comparison-editor-control input[type="range"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.comparison-editor-position-control {
  display: none;
}

.comparison-editor-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.comparison-editor-actions button {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.comparison-editor-actions button img {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

@media (max-width: 600px) {
  .comparison-editor-control {
    display: none;
  }

  .comparison-editor-preview {
    margin-bottom: 14px;
  }
}

.panel {
  min-width: 0;
  padding: 0;
  transition: border-color 180ms var(--ease), transform 180ms var(--ease), box-shadow 180ms var(--ease);
}

.panel:hover {
  border-color: transparent;
  box-shadow: none;
}

/* Collapsed injection charts deliberately render only this header. */
.body-level-panel-collapsed {
  width: 100%;
  min-height: 0 !important;
  height: auto !important;
  box-sizing: border-box;
  margin: 0 !important;
  padding: 0 !important;
  align-self: stretch;
}

.body-level-collapsed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.body-level-collapsed-head h2 {
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
}

.body-level-expand {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid rgba(122, 145, 161, 0.16);
  border-radius: 50%;
  background: #0b1018;
}

.body-level-expand img {
  width: 20px;
  height: 20px;
}

.body-level-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}

.medication-body-panel .body-level-actions,
.body-level-panel-collapsed .body-level-actions {
  margin-right: 10px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-head .muted {
  margin-bottom: 0;
  font-size: 0.86rem;
}

.panel-head h2:has(.medication-name-pill),
.body-level-collapsed-head h2:has(.medication-name-pill) {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.medication-weekdays {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
}

.medication-schedule-details {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  margin-left: auto;
  min-width: 0;
}

.medication-schedule-details .medication-weekdays {
  margin-left: 0;
}

.medication-next-dose {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 0.62rem;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}

.medication-next-dose b {
  color: var(--muted);
  font-weight: 750;
}

.medication-next-dose i {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  padding: 1px 4px;
  border: 1px solid color-mix(in srgb, var(--schedule-color) 72%, transparent);
  border-radius: 999px;
  color: var(--schedule-color);
  background: color-mix(in srgb, var(--schedule-color) 14%, transparent);
  font-size: 0.92em;
  font-style: normal;
  font-weight: 820;
  line-height: 1.1;
}

.medication-interval-schedule {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 6px;
  border: 1px solid color-mix(in srgb, var(--schedule-color) 74%, transparent);
  color: var(--schedule-color);
  background: color-mix(in srgb, var(--schedule-color) 12%, transparent);
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.medication-weekdays span {
  min-width: 24px;
  padding: 3px 2px;
  border: 1px solid rgba(164, 178, 193, 0.18);
  color: #778595;
  font-size: 0.62rem;
  font-weight: 750;
  line-height: 1;
  text-align: center;
}

.medication-weekdays span.active {
  border-color: color-mix(in srgb, var(--weekday-color) 72%, transparent);
  color: var(--weekday-color);
  background: color-mix(in srgb, var(--weekday-color) 12%, transparent);
}

@media (max-width: 820px) {
  .medication-schedule-details {
    flex: 1 1 0;
  }

  .medication-schedule-details .medication-weekdays {
    width: 100%;
    flex: 1 1 0;
  }

  .body-level-collapsed-head {
    gap: 8px;
  }

  .body-level-collapsed-head h2:has(.medication-name-pill) {
    min-width: 0;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    gap: 5px;
  }

  .body-level-collapsed-head .medication-weekdays {
    min-width: 0;
    flex: 1 1 0;
    gap: 2px;
  }

  .body-level-collapsed-head .medication-weekdays span {
    min-width: 0;
    flex: 1 1 0;
    padding: 3px 0;
    font-size: clamp(0.42rem, 1.8vw, 0.62rem);
  }
}

.medication-panel-range {
  display: flex;
  justify-content: flex-end;
  margin: -2px 0 10px;
}

.medication-body-panel .panel-head h2 {
  margin-bottom: 0;
}

.medication-header-copy {
  width: 100%;
  min-width: 0;
}

.medication-title-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  padding-right: 80px;
}

.medication-title-row h2 {
  min-width: 0;
  margin: 0;
  flex: 1 1 auto;
}

.body-level-collapsed-head {
  position: relative;
  min-height: 32px;
  padding-right: 80px;
}

.medication-title-row .body-level-actions,
.body-level-collapsed-head .body-level-actions {
  position: absolute;
  top: 0;
  right: 11px;
  margin: 0;
}

.medication-body-panel .panel-head .muted {
  margin-top: 8px;
}

@media (min-width: 901px) {
  .medication-title-row h2,
  .body-level-collapsed-head h2 {
    margin-right: 8px;
  }

  .medication-title-row .body-level-actions,
  .body-level-collapsed-head .body-level-actions {
    top: 50%;
    transform: translateY(-50%);
  }

  .panel:has(.body-level-collapse) .panel-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .panel:has(.body-level-collapse) .panel-head > div:first-child {
    display: contents;
  }

  .panel:has(.body-level-collapse) .panel-head h2 {
    grid-column: 1;
    grid-row: 1;
  }

  .panel:has(.body-level-collapse) .panel-head .muted {
    grid-column: 1 / -1;
    grid-row: 2;
    white-space: nowrap;
  }

  .panel:has(.body-level-collapse) .panel-tools {
    grid-column: 2;
    grid-row: 1;
  }

  .medication-body-panel:has(.body-level-collapse) .panel-head {
    display: flex;
    align-items: flex-start;
  }

  .medication-body-panel:has(.body-level-collapse) .panel-head > div:first-child {
    display: block;
  }

  .medication-body-panel:has(.body-level-collapse) .panel-head h2,
  .medication-body-panel:has(.body-level-collapse) .panel-head .muted {
    grid-column: auto;
    grid-row: auto;
  }

  .medication-body-panel .body-level-actions {
    margin-left: auto;
    align-self: auto;
  }
}

.medication-name-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--med-major) 72%, transparent);
  border-radius: 999px;
  color: var(--med-minor);
  background: color-mix(in srgb, var(--med-major) 12%, transparent);
  font-size: 0.86em;
  line-height: 1;
}

.medication-name-pill img {
  width: 16px;
  height: 16px;
}

@media (min-width: 901px) {
  .medication-title-row .medication-name-pill > span,
  .body-level-collapsed-head .medication-name-pill > span {
    display: inline-block;
    transform: translateY(-0.08em);
  }
}

.panel-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.medication-tracking-card {
  --medication-card-surface: color-mix(in srgb, var(--panel-2) 72%, var(--bg));
  position: relative;
  isolation: isolate;
  overflow: hidden;
  grid-column: 1 / -1;
  padding: 0.075rem 10px;
  background: var(--medication-card-surface);
  border: 1px solid rgba(122, 145, 161, 0.14);
  border-radius: 8px;
}

.medication-tracking-card > * {
  position: relative;
  z-index: 2;
}

.medication-tracking-card::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transform: scaleX(var(--quick-add-row-progress, 0));
  transform-origin: left center;
  clip-path: polygon(0 0, 97.5% 0, 100% 16%, 98.2% 34%, 100% 55%, 97.8% 74%, 100% 100%, 0 100%);
  background:
    radial-gradient(circle at 18% 28%, rgba(255, 255, 255, 0.3) 0 1px, transparent 2px),
    radial-gradient(circle at 62% 72%, color-mix(in srgb, var(--quick-add-color) 28%, transparent) 0 1.5px, transparent 2.5px),
    repeating-linear-gradient(112deg, transparent 0 22px, rgba(255, 255, 255, 0.065) 23px 29px, transparent 30px 54px),
    linear-gradient(96deg, color-mix(in srgb, var(--quick-add-color) 20%, transparent), color-mix(in srgb, var(--quick-add-color) 52%, transparent) 42%, color-mix(in srgb, var(--quick-add-color) 76%, white) 76%, color-mix(in srgb, var(--quick-add-color) 88%, white));
  background-size: 92px 68px, 118px 76px, 230% 100%, 100% 100%;
  box-shadow: inset -16px 0 24px color-mix(in srgb, var(--quick-add-color) 36%, white), 12px 0 22px color-mix(in srgb, var(--quick-add-color) 23%, transparent);
  filter: saturate(1.12);
}

.medication-tracking-card.quick-add-row-holding {
  transition: box-shadow 0.3s ease;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--quick-add-color) 34%, transparent), 0 0 18px color-mix(in srgb, var(--quick-add-color) 10%, transparent);
}

.medication-tracking-card.quick-add-row-releasing {
  transition: box-shadow 0.2s ease;
}

.medication-tracking-card.quick-add-row-holding::before,
.medication-tracking-card.quick-add-row-releasing::before,
.medication-tracking-card.quick-add-row-committing::before {
  opacity: 1;
  animation: quick-add-row-liquid-flow 750ms linear infinite;
}

.medication-tracking-card.quick-add-row-committing::before {
  transform: scaleX(1);
}

@keyframes quick-add-row-liquid-flow {
  from { background-position: 0 0, 0 0, 0 0, 0 0; }
  to { background-position: 92px 10px, -118px -8px, 150% 0, 0 0; }
}

/* Keep repeated medication rows compact without tightening surrounding charts. */
.medication-tracking-card + .medication-tracking-card {
  margin-top: -0.9rem;
}

.medication-tracking-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.medication-tracking-head h2 {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0;
  margin: 0;
  font-size: 1rem;
}

.medication-tracking-head .medication-name-pill {
  position: relative;
  z-index: 2;
  border-radius: 999px;
  background: color-mix(in srgb, var(--med-major) 12%, var(--medication-card-surface));
}

.medication-dose-unit {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: auto;
  flex: 0 0 auto;
  height: 1.25rem;
  padding: 0 0.32rem 0 calc(0.1728rem + 7px);
  margin-left: -7px;
  border: 1px solid rgba(122, 145, 161, 0.3);
  border-radius: 0 999px 999px 0;
  background: #0b1018;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
}

.medication-dose-unit > span {
  display: block;
  line-height: 1;
}

.medication-dose-unit > .has-descender {
  transform: translateY(-0.07em);
}

.medication-collapse {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(122, 145, 161, 0.16);
  border-radius: 50%;
  background: #0b1018;
}

.medication-card-actions,
.panel-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.medication-quick-add,
.body-level-schedule,
.body-level-collapse {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(122, 145, 161, 0.16);
  border-radius: 50%;
  background: #0b1018;
}

.medication-quick-add {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
}

.medication-quick-add > img {
  position: relative;
  z-index: 2;
  pointer-events: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.medication-quick-add:disabled {
  cursor: default;
  opacity: 0.55;
}

.medication-quick-add img,
.body-level-schedule img,
.body-level-collapse img {
  width: 20px;
  height: 20px;
}

.medication-quick-add,
.body-level-schedule,
.body-level-collapse,
.body-level-expand {
  width: 32px;
  height: 32px;
}

.medication-quick-add img,
.body-level-schedule img,
.body-level-collapse img,
.body-level-expand img {
  width: 18px;
  height: 18px;
}

.medication-collapse img {
  width: 20px;
  height: 20px;
}

.medication-week-strip {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(7, 28px);
  gap: 0.66px;
  margin: 0 0 0 auto;
}

.medication-week-day {
  display: grid;
  justify-items: center;
  gap: 1px;
  color: var(--muted-2);
}

.medication-week-day span {
  font-size: 0.48rem;
  font-weight: 800;
  white-space: nowrap;
}

.medication-week-day b {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(122, 145, 161, 0.16);
  border-radius: 50%;
  background: #0b1018;
  font-size: 0.72rem;
}

.medication-week-day.taken b {
  color: #e8fff6;
  background: rgba(32, 214, 163, 0.16);
  border-color: rgba(32, 214, 163, 0.48);
}

.medication-week-day.today b {
  color: #e8f7ff;
  background: rgba(14, 165, 233, 0.22);
  border-color: rgba(34, 211, 238, 0.68);
}

@media (max-width: 520px) {
  .medication-tracking-card { padding: 0.075rem 8px; }
  .medication-tracking-head { gap: 5px; }
  .medication-tracking-head h2 { gap: 0; }
  .medication-tracking-head .medication-name-pill { font-size: 0.688em; }
  .medication-week-strip { grid-template-columns: repeat(7, 25px); gap: 0.44px; }
  .medication-week-day span { font-size: 0.43rem; }
  .medication-week-day b { width: 25px; height: 25px; font-size: 0.66rem; }

  .medication-body-panel .body-level-actions,
  .body-level-panel-collapsed .body-level-actions { margin-right: 0; right: 9px !important; }
}


.range {
  display: grid;
  grid-template-columns: repeat(3, minmax(62px, 1fr));
  gap: 4px;
  padding: 4px;
  background: #0b1018;
  border: 0;
  border-radius: 999px;
}

.range-four {
  grid-template-columns: repeat(4, minmax(50px, 1fr));
}

.range-two {
  grid-template-columns: repeat(2, minmax(62px, 1fr));
}

.range button {
  min-height: 32px;
  padding: 0 8px;
  font-size: 0.82rem;
  border-radius: 999px;
}

canvas {
  display: block;
  width: 100%;
  height: 275px;
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    #090e15;
  background-size: 100% 34px;
}

.chart-wrap {
  position: relative;
}

.chart-wrap canvas {
  cursor: crosshair;
  touch-action: pan-y;
}

#bmiChart {
  height: 330px;
}

#bmiChart.is-hidden {
  display: none;
}

.bmi-gauge-holder {
  width: 100%;
  height: 330px;
  overflow: hidden;
  isolation: isolate;
  contain: layout paint;
  border-radius: 8px;
  background: #090e15;
}

.bmi-gauge {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.bmi-collar {
  fill: url(#bmiCollar);
}

.bmi-band {
  filter: none;
}

.bmi-band-bleed {
  filter: none;
}

.bmi-collar-separator {
  stroke: rgba(238, 244, 255, 0.28);
  stroke-width: 4;
  stroke-linecap: round;
}

.bmi-label {
  fill: #f7fbff;
  stroke: #081018;
  stroke-width: 7px;
  paint-order: stroke fill;
  font: 900 27px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 1.4px;
  dominant-baseline: middle;
  baseline-shift: -2px;
  filter: none;
}

.bmi-tick {
  fill: #f7fbff;
  stroke: #081018;
  stroke-width: 6px;
  paint-order: stroke fill;
  font: 900 28px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-anchor: middle;
  dominant-baseline: middle;
}

.bmi-needle {
  fill: #f8fbff;
  filter: none;
}

.bmi-needle-start {
  fill: rgba(238, 244, 255, 0.28);
}

.bmi-hub {
  fill: #f8fbff;
}

.bmi-hub-center {
  fill: #091018;
}

.bmi-value {
  fill: #eef4ff;
  stroke: #091018;
  stroke-width: 9px;
  paint-order: stroke fill;
  font: 900 58px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-anchor: middle;
}

.bmi-class {
  fill: #ff6b78;
  stroke: #091018;
  stroke-width: 5px;
  paint-order: stroke fill;
  font: 900 24px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-anchor: middle;
}

.chart-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  pointer-events: none;
  opacity: 0;
  background: rgba(238, 244, 255, 0.3);
  box-shadow: 0 0 0 1px rgba(238, 244, 255, 0.08), 0 0 18px rgba(238, 244, 255, 0.1);
  transition: opacity 120ms var(--ease), left 80ms linear;
}

.chart-marker.visible {
  opacity: 1;
}

.chart-note {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.medication-body-panel .chart-note {
  min-height: 0;
}

.medication-level-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.medication-level-stats > div {
  min-width: 0;
  min-height: 44px;
  padding: 3px 9px;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: center;
  column-gap: 4px;
  border: 1px solid color-mix(in srgb, var(--med-major) 62%, transparent);
  border-radius: 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--med-major) 22%, #111b24), rgba(17, 27, 36, 0.94));
}

.medication-level-stats > div:nth-child(2) {
  border-color: color-mix(in srgb, var(--med-minor) 58%, transparent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--med-minor) 20%, #111b24), rgba(17, 27, 36, 0.94));
}

.medication-level-stat > img {
  width: 14px;
  height: 14px;
  opacity: 0.94;
}

.medication-level-stat > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.medication-level-stat span {
  overflow: hidden;
  color: color-mix(in srgb, var(--med-minor) 72%, #c7d3e1);
  font-size: 0.69rem;
  font-weight: 750;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.medication-level-stats b {
  overflow: hidden;
  color: #f7fbff;
  font-size: clamp(0.88rem, 1.7vw, 1.12rem);
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.medication-level-stats small {
  color: var(--med-minor);
  font-size: 0.7em;
  font-weight: 750;
}

@media (max-width: 520px) {
  .medication-level-stats { gap: 5px; }
  .medication-level-stats > div { min-height: 42px; padding: 3px 7px; }
  .medication-level-stat span { font-size: 0.62rem; }
}

.chart-tooltip {
  position: absolute;
  top: 12px;
  z-index: 4;
  min-width: 112px;
  padding: 7px 9px;
  border: 1px solid rgba(6, 182, 212, 0.28);
  border-radius: 8px;
  color: var(--text);
  background: rgba(12, 18, 27, 0.94);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-4px);
  transition: opacity 120ms var(--ease), transform 120ms var(--ease);
}

.chart-tooltip.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.chart-tooltip b,
.chart-tooltip span {
  display: block;
  white-space: nowrap;
  font-size: 0.78rem;
}

.chart-tooltip span {
  color: var(--accent-strong);
}

.timeline-panel {
  margin-top: 14px;
}

.timeline-panel .panel-head > div:first-child {
  min-width: 0;
}

.timeline-filter {
  position: relative;
  z-index: 12;
  width: 210px;
  flex: 0 0 210px;
}

.timeline-filter summary {
  min-height: 42px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid color-mix(in srgb, var(--timeline-filter-color) 24%, var(--line));
  border-radius: 10px;
  color: var(--timeline-filter-color);
  background: rgba(10, 15, 24, 0.84);
  font-size: 0.78rem;
  font-weight: 750;
  list-style: none;
  cursor: pointer;
}

.timeline-filter summary::-webkit-details-marker {
  display: none;
}

.timeline-filter summary > img,
.timeline-filter-option > img {
  width: 18px;
  height: 18px;
  display: block;
}

.timeline-filter summary > img:last-child {
  width: 16px;
  height: 16px;
  transition: transform 150ms var(--ease);
}

.timeline-filter[open] summary > img:last-child {
  transform: rotate(180deg);
}

.timeline-filter-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 100%;
  display: grid;
  gap: 3px;
  padding: 6px;
  border: 1px solid rgba(122, 145, 161, 0.16);
  border-radius: 11px;
  background: #0d1119;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
}

.timeline-filter-option {
  width: 100%;
  min-height: 36px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--timeline-filter-color);
  background: transparent;
  font-size: 0.76rem;
  font-weight: 700;
  text-align: left;
}

.timeline-filter-option:hover,
.timeline-filter-option.active {
  border-color: color-mix(in srgb, var(--timeline-filter-color) 24%, transparent);
  background: color-mix(in srgb, var(--timeline-filter-color) 10%, transparent);
  transform: none;
}

@media (min-width: 821px) {
  .timeline-panel {
    width: min(100%, 980px);
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 820px) {
  .timeline-panel .panel-head {
    flex-direction: row;
    align-items: flex-start;
  }

  .timeline-filter {
    width: min(190px, 45vw);
    flex-basis: min(190px, 45vw);
  }
}

@media (max-width: 520px) {
  .timeline-filter {
    width: 46px;
    flex-basis: 46px;
  }

  .timeline-filter summary {
    grid-template-columns: 22px;
    justify-content: center;
    padding: 0;
  }

  .timeline-filter summary > span,
  .timeline-filter summary > img:last-child {
    display: none;
  }

  .timeline-filter-menu {
    width: 190px;
  }
}

.weight-summary-panel {
  align-self: start;
  padding: 0;
  border: 1px solid rgba(110, 168, 255, 0.13);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(125, 180, 230, 0.055), rgba(125, 180, 230, 0.012)),
    #111b24;
}

.weight-comparison-panel.collapsed .weight-comparison-head,
.weight-summary-panel.collapsed .weight-comparison-head,
.weight-tracking-panel.collapsed .weight-comparison-head {
  height: 66px;
  min-height: 66px;
}

.summary-list {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.summary-group {
  display: grid;
  gap: 2px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.026);
}

.summary-group p {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.summary-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.15;
}

.summary-row > span {
  white-space: nowrap;
}

.summary-row + .summary-row {
  border-top: 1px solid rgba(122, 145, 161, 0.055);
}

.summary-row b {
  color: var(--text);
  font-weight: 750;
  font-size: 0.8rem;
}

.summary-value {
  display: grid;
  grid-template-columns: 76px 72px 62px;
  gap: 5px;
  justify-content: end;
  align-items: baseline;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.summary-main,
.summary-delta,
.summary-percent {
  text-align: right;
}

.summary-delta:not(:empty),
.summary-percent:not(:empty) {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  text-align: center;
}

.sign-up {
  color: var(--danger);
  font-weight: 850;
}

.sign-down {
  color: #20d6a3;
  font-weight: 850;
}

.timeline-list {
  display: grid;
  gap: 2px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) max-content;
  gap: 9px;
  align-items: center;
  padding: 5px 4px;
  border: 0;
  border-radius: 8px;
  background: rgba(11, 16, 24, 0.46);
}

.timeline-item + .timeline-item {
  border-top: 1px solid rgba(122, 145, 161, 0.045);
}

.timeline-kind {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--blue);
  background: rgba(110, 168, 255, 0.13);
  box-shadow: inset 0 0 0 1px rgba(110, 168, 255, 0.16);
}

.timeline-item.shot .timeline-kind {
  color: #ffbd59;
  background: rgba(255, 189, 89, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 189, 89, 0.18);
}

.timeline-item.step .timeline-kind {
  color: #20d6a3;
  background: rgba(32, 214, 163, 0.13);
  box-shadow: inset 0 0 0 1px rgba(32, 214, 163, 0.18);
}

.timeline-item.food .timeline-kind {
  color: #d77b82;
  background: rgba(215, 123, 130, 0.13);
  box-shadow: inset 0 0 0 1px rgba(215, 123, 130, 0.18);
}

.timeline-item.food.ai-generated {
  background: linear-gradient(90deg, rgba(111, 69, 151, 0.13), rgba(11, 16, 24, 0.46) 52%);
}

.timeline-item.food.ai-generated .timeline-kind {
  color: #c58cff;
  background: rgba(111, 69, 151, 0.17);
  box-shadow: inset 0 0 0 1px rgba(197, 140, 255, 0.24);
}

.timeline-kind img {
  width: 18px;
  height: 18px;
  display: block;
}

.timeline-date {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
}

.timeline-line {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.15;
}

.timeline-line b {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.timeline-line span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.icon-action {
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.icon-action svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  display: block;
}

.photo-icon {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  fill: var(--muted);
  opacity: 0.85;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}

.pagination button {
  min-width: 34px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(10, 15, 24, 0.7);
}

.pagination button.active {
  color: #031018;
  background: var(--accent);
}

.pagination button:disabled {
  color: var(--muted-2);
  opacity: 0.42;
  cursor: default;
}

.pagination button:disabled:hover {
  transform: none;
}

.small-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.timeline-actions .icon-action {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
}

.timeline-actions .icon-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.danger-text {
  color: var(--danger);
}

.bottom-actions {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: min(520px, calc(100vw - 28px));
  padding: 10px;
  background: rgba(8, 10, 15, 0.78);
  border: 0;
  border-radius: 14px;
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.34);
}

.modal {
  width: min(460px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  border: 0;
  padding: 0;
  overflow: hidden;
  background: transparent;
  color: var(--text);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(3px);
}

.modal form {
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  scrollbar-width: none;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(17, 27, 36, 0.98), rgba(13, 18, 27, 0.98));
  border: 1px solid rgba(124, 202, 221, 0.12);
  border-radius: 16px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.52);
  animation: modalIn 180ms var(--ease);
}

.modal form::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.modal header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.modal h2 {
  margin-bottom: 0;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(8, 13, 20, 0.72);
}

.modal .icon-button:hover {
  color: var(--text);
  border-color: rgba(147, 163, 184, 0.26);
  background: rgba(20, 39, 52, 0.9);
}

.split {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 10px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: 18px;
  min-height: 18px;
}

.checkbox-row.disabled {
  color: var(--muted-2);
  opacity: 0.62;
}

.checkbox-row.disabled input {
  cursor: not-allowed;
}

.photo-modal {
  width: min(760px, calc(100vw - 24px));
}

.photo-modal img {
  display: block;
  max-width: 100%;
  max-height: 86vh;
  margin: 0 auto;
  border-radius: 8px;
}

.modal.weight-comparison-viewer {
  width: min(1200px, calc(100vw - 20px));
  max-height: calc(100dvh - 20px);
  margin: auto;
  overflow: visible;
}

.weight-comparison-viewer-grid {
  width: 100%;
  max-height: calc(100dvh - 20px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: clamp(4px, 1vw, 12px);
}

.weight-comparison-viewer-pane {
  min-width: 0;
  width: fit-content;
  max-width: 100%;
  height: fit-content;
  max-height: calc(100dvh - 20px);
  justify-self: center;
  align-self: center;
  display: inline-grid;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.weight-comparison-viewer-pane:hover,
.weight-comparison-viewer-pane:active {
  transform: none;
}

.weight-comparison-viewer-pane > img {
  grid-area: 1 / 1;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100dvh - 20px);
  display: block;
}

.weight-comparison-viewer-meta {
  grid-area: 1 / 1;
  align-self: end;
  width: 100%;
  min-height: 84px;
  padding: 34px clamp(10px, 2vw, 20px) 14px;
  display: grid;
  align-content: end;
  justify-items: start;
  gap: 3px;
  color: #fff;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(1, 3, 6, 0.92));
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.92);
}

.weight-comparison-viewer-meta b {
  font-size: clamp(0.9rem, 2.5vw, 1.45rem);
  line-height: 1;
}

.weight-comparison-viewer-meta small {
  color: rgba(235, 241, 248, 0.84);
  font-size: clamp(0.66rem, 1.4vw, 0.9rem);
  font-weight: 700;
  line-height: 1.15;
}

.weight-comparison-viewer > .floating-close {
  z-index: 5;
  top: 18px;
  right: 18px;
}

@media (max-width: 640px) {
  .weight-comparison-viewer-grid {
    max-height: calc(100dvh - 12px);
    gap: 3px;
  }

  .weight-comparison-viewer-pane {
    max-height: calc(100dvh - 12px);
  }

  .weight-comparison-viewer-pane > img {
    max-height: calc(100dvh - 12px);
  }

  .weight-comparison-viewer-meta {
    min-height: 68px;
    padding: 28px 8px 9px;
  }

  .weight-comparison-viewer > .floating-close {
    top: 10px;
    right: 10px;
  }
}

.chart-modal {
  width: min(1120px, calc(100vw - 18px));
}

.chart-modal .expanded-panel {
  padding-top: 46px;
}

.chart-modal canvas {
  height: min(62vh, 560px);
}

@keyframes menuIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes trackMenuIn {
  from {
    opacity: 0;
    transform: translate(-50%, 10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes trackMenuOut {
  from {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, 10px) scale(0.98);
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.floating-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 40;
  max-width: min(420px, calc(100vw - 28px));
  padding: 10px 13px;
  border: 1px solid rgba(49, 208, 170, 0.28);
  border-radius: 8px;
  color: var(--text);
  background: rgba(10, 15, 24, 0.94);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
  backdrop-filter: blur(18px);
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 820px) {
  .topbar {
    align-items: start;
    grid-template-columns: minmax(0, 1fr) auto;
  }

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

  .weekly-goal-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calorie-goal-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .food-calorie-goal-row {
    padding: 10px;
  }

  .topbar h1 {
    font-size: 2rem;
    line-height: 1;
  }

  .brand-title img {
    height: 0.74em;
    transform: translateY(-0.03em);
  }

  .topbar .muted {
    font-size: 0.86rem;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .home-post-columns {
    grid-template-columns: 1fr;
  }

  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-tools {
    align-items: stretch;
    justify-content: space-between;
  }

  /* Medication body-level panels keep their calendar and chevron together,
     independent from the full-width range selector below the title. */
  .panel:has(.body-level-collapse) .panel-head {
    position: relative;
    padding-right: 80px;
  }

  .panel:has(.body-level-collapse) .panel-tools {
    width: 100%;
  }

  .panel:has(.body-level-collapse) .body-level-actions {
    position: absolute;
    top: 0;
    right: 0;
  }

  .medication-body-panel .medication-title-row .body-level-actions,
  .body-level-panel-collapsed .body-level-actions {
    position: absolute !important;
    top: 0;
    right: 11px !important;
  }

  .medication-panel-head { padding-right: 0 !important; }

  .medication-body-panel .panel-head > div:first-child {
    width: 100%;
    min-width: 0;
  }

  .medication-body-panel .panel-head h2:has(.medication-name-pill),
  .body-level-collapsed-head h2:has(.medication-name-pill) {
    min-width: 0;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    gap: 5px;
  }

  .medication-body-panel .medication-weekdays,
  .body-level-collapsed-head .medication-weekdays {
    min-width: 0;
    flex: 1 1 0;
    gap: 0;
  }

  .medication-body-panel .medication-weekdays span,
  .body-level-collapsed-head .medication-weekdays span {
    min-width: 0;
    flex: 1 1 0;
    padding: 3px 0;
    font-size: clamp(0.42rem, 1.8vw, 0.62rem);
  }

  .medication-body-panel .medication-panel-range {
    width: 100%;
    justify-content: flex-end;
    margin: 0 0 10px;
  }

  /* A collapsed body-level panel is header-only.  Do not leave the chart's
     former footprint between its header and the compact medication rows. */
  .panel.panel-collapsed:has(.body-level-collapse) {
    min-height: 0;
    height: auto;
    padding-bottom: 0;
    margin: 0;
  }

  .panel.panel-collapsed:has(.body-level-collapse) .panel-head {
    min-height: 0;
    height: auto;
    margin: 0;
  }

  .panel.panel-collapsed:has(.body-level-collapse) .panel-tools {
    width: 0;
    height: 0;
    min-height: 0;
    margin: 0;
  }

  .home-medication-column {
    row-gap: 12px;
  }

  .range {
    width: 100%;
  }

  canvas {
    height: 245px;
  }

  #bmiChart {
    height: 315px;
  }

  .bmi-gauge-holder {
    height: auto;
    aspect-ratio: 1000 / 640;
  }

  .summary-row {
    grid-template-columns: minmax(122px, 1fr) auto;
    gap: 6px;
  }

  .summary-value {
    grid-template-columns: 74px 70px 60px;
    gap: 4px;
  }

  .timeline-item {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    gap: 7px;
    padding: 5px 2px;
  }

  .timeline-actions {
    grid-column: auto;
    flex-direction: row;
    align-items: flex-end;
    justify-content: center;
  }

  .food-dashboard-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .food-logs-section {
    grid-column: auto;
  }
}

@media (max-width: 520px) {
  .auth,
  .onboarding,
  .dashboard {
    width: min(100% - 18px, 1180px);
  }

  .dashboard {
    padding-top: 12px;
  }

  .stats {
    gap: 5px;
  }

  .stat {
    min-height: 46px;
    padding: 7px 7px;
  }

  .stat span {
    font-size: 0.68rem;
  }

  .stat b {
    font-size: 0.82rem;
    white-space: nowrap;
  }

  .home-weight-stat {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 5px;
    padding-left: 6px;
    padding-right: 6px;
  }

  .home-weight-stat-icon {
    width: 23px;
    height: 23px;
    border-radius: 6px;
  }

  .home-weight-stat-icon img {
    width: 15px;
    height: 15px;
  }

  .home-section-heading-icon {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .home-section-heading-icon img {
    width: 24px;
    height: 24px;
  }

  .panel {
    padding: 12px;
  }

  .panel.panel-collapsed:has(.body-level-collapse) {
    padding: 12px 12px 0;
  }

  .panel.body-level-panel-collapsed {
    padding: 12px !important;
  }

  .weight-comparison-panel,
  .weight-summary-panel,
  .weight-tracking-panel {
    padding: 0;
  }

  .weight-tracking-content {
    padding: 0 12px 12px;
  }

  .weight-summary-panel .summary-list {
    padding: 0 12px 12px;
  }

  .summary-group {
    padding: 9px;
  }

  .summary-row {
    font-size: 0.72rem;
  }

  .summary-row b {
    font-size: 0.74rem;
  }

  .summary-value {
    grid-template-columns: 64px 62px 56px;
  }

  .bottom-actions {
    bottom: 10px;
    width: min(100% - 18px, 520px);
  }

  .split {
    grid-template-columns: 1fr;
  }

  .food-dashboard {
    gap: 14px;
  }

  .food-dashboard-head {
    align-items: flex-start;
  }

  .food-create-actions {
    gap: 5px;
  }

  .food-action-button {
    width: 40px;
    padding: 0;
  }

  .food-action-button span {
    display: none;
  }

  .food-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .food-summary-grid > div {
    min-height: 64px;
    padding: 9px 7px;
  }

  .food-summary-grid span {
    overflow: hidden;
    font-size: 0.6rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .food-summary-grid b {
    font-size: 1rem;
  }

  .food-summary-grid small {
    font-size: 0.58rem;
  }

  .food-library-row,
  .food-log-row {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 7px;
  }

  .food-row-icon {
    width: 32px;
    height: 32px;
  }

  .food-row-actions {
    gap: 4px;
  }

  .food-icon-button {
    width: 31px;
    height: 31px;
  }

  .food-icon-button img {
    width: 18px;
    height: 18px;
  }

  .food-row-main b {
    font-size: 0.78rem;
  }

  .food-row-main small,
  .food-row-main > span {
    font-size: 0.62rem;
  }

  .food-track-actions button {
    min-height: 60px;
    font-size: 0.67rem;
  }

  .nutrition-input-grid {
    gap: 6px;
  }

  .meal-draft-row {
    grid-template-columns: minmax(0, 1fr) 132px 30px;
    gap: 5px;
  }

  .meal-draft-quantity {
    gap: 3px;
  }

  .meal-draft-quantity input,
  .meal-draft-quantity select {
    padding-inline: 5px;
    font-size: 0.67rem;
  }

  .food-log-preview,
  .meal-totals {
    gap: 5px;
    padding-inline: 7px;
    font-size: 0.62rem;
  }

  .barcode-scanner-dialog {
    width: 100vw;
  }

  .barcode-scanner-shell {
    min-height: 100dvh;
  }
}

/* On narrow layouts, body-level headers and medication rows share the same
   card geometry. Controls therefore align through layout, not pixel offsets. */
@media (max-width: 820px) {
  .home-medication-column {
    --medication-row-inline-padding: 10px;
  }

  .medication-tracking-card {
    padding-inline: var(--medication-row-inline-padding);
  }

  .panel.body-level-panel-collapsed,
  .panel.medication-body-panel {
    box-sizing: border-box;
    padding-left: var(--medication-row-inline-padding) !important;
    padding-right: var(--medication-row-inline-padding) !important;
    border-left: 1px solid transparent;
    border-right: 1px solid transparent;
  }

  .body-level-collapsed-head,
  .medication-title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding-right: 0;
  }

  .medication-body-panel .medication-title-row .body-level-actions,
  .body-level-panel-collapsed .body-level-actions {
    position: static !important;
    justify-self: end;
    margin: 0;
  }
}

@media (max-width: 520px) {
  .home-medication-column {
    --medication-row-inline-padding: 8px;
  }
}

.home-medication-column.weekday-strips-normalized .medication-weekdays {
  width: var(--medication-weekdays-shared-width);
  flex: 0 0 auto;
  margin-left: auto;
}

@media (max-width: 820px) {
  .home-medication-column .medication-schedule-details .medication-weekdays {
    flex: 0 0 auto;
  }

  /* Both states use exactly one shot-only spacing rule. Medication tracking
     cards are excluded completely. */
  .home-medication-column > .shot-body-level-panel {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  .home-medication-column > .shot-body-level-panel:first-child {
    margin-top: -13.5px !important;
  }

  .home-medication-column > .shot-body-level-panel + .shot-body-level-panel {
    margin-top: -8.4px !important;
  }

  .home-medication-column > .shot-body-level-panel:has(+ .medication-tracking-card) {
    margin-bottom: -8.4px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
