.health-module {
  --health-module-ink: var(--ink, #111111);
  --health-module-muted: var(--muted, #69655d);
  --health-module-line: var(--line, #cbc7bc);
  --health-module-track: #dedbd2;
  --health-module-fill: #3d5a46;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  border: 1px solid var(--health-module-line);
  background: transparent;
  padding: 16px 15px;
  color: var(--health-module-ink);
  box-shadow: none;
}

.health-module[data-module-shape="rounded"] { border-radius: 18px; }
.health-module[hidden] { display: none; }
.health-module[data-module-shape="circle"] {
  aspect-ratio: 1;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
}

.health-module--calories,
.health-module--macros { border: 0; }

.health-module--home {
  --health-module-ink: var(--home-ink, #f7fbff);
  --health-module-muted: var(--home-muted, #b9cfde);
  --health-module-line: var(--home-line, rgba(220, 244, 255, .2));
  --health-module-track: rgba(255, 255, 255, .18);
  --health-module-fill: #bfeef6;
  padding: 14px;
}

.health-module-label {
  display: block;
  color: var(--health-module-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
}

.health-module-meta {
  margin: 0;
  color: var(--health-module-muted);
  font-size: 12px;
  line-height: 1.45;
}

.health-module-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--health-module-track);
}

.health-module-progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--health-module-fill);
}

.health-module-progress-fill.is-over { background: var(--accent, #c41e24); }

.health-calorie-module { gap: 8px; }
.health-calorie-module--detail { padding: 8px 15px 3px; }

.health-calorie-value-row {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.health-calorie-value {
  color: var(--health-module-ink);
  font-family: inherit;
  font-size: clamp(36px, 11vw, 44px);
  font-weight: 850;
  line-height: .92;
  letter-spacing: -.04em;
  overflow-wrap: normal;
  white-space: nowrap;
}
.health-calorie-value.is-over { color: var(--accent, #c41e24); }

.health-calorie-unit {
  color: var(--health-module-muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
}

.health-calorie-progress { height: 6px; margin: 0; }
.health-calorie-meta-row {
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--health-module-muted);
  font-size: 11px;
  line-height: 1.3;
}
.health-calorie-consumed {
  min-width: 0;
  white-space: nowrap;
}
.health-calorie-target {
  flex: none;
  text-align: right;
  white-space: nowrap;
}

.health-macros-module {
  --health-macro-eaten: #256f7a;
  --health-macro-left: #626f75;
  --health-macro-name: #68747a;
  --health-macro-empty: #8a9295;
  gap: 0;
}
.health-macros-module.health-module--home {
  --health-macro-eaten: #79b8c4;
  --health-macro-left: #d9e3e6;
  --health-macro-name: #bfced4;
  --health-macro-empty: #82949c;
}
.health-macros-module.health-module--detail { padding: 0 15px 5px; }
.health-macro-gauges {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: clamp(6px, 2.5vw, 12px);
}

.health-macro-item {
  min-width: 0;
  display: grid;
  justify-items: center;
  text-align: center;
}

.health-macro-gauge {
  position: relative;
  width: min(100%, 112px);
  height: 88px;
}

.health-macro-gauge-svg {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: auto;
  overflow: visible;
}

.health-macro-gauge-track,
.health-macro-gauge-arc {
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.health-macro-gauge-track { stroke: var(--health-macro-left); }
.health-macro-gauge-arc {
  stroke: var(--health-macro-eaten);
}
.health-macro-gauge.is-empty .health-macro-gauge-track {
  stroke: var(--health-macro-empty);
  stroke-dasharray: 2 5;
}
.health-macro-gauge.is-empty .health-macro-gauge-arc { display: none; }

.health-macro-gauge-center {
  position: absolute;
  inset: 25px 0 auto;
  z-index: 1;
  min-width: 0;
  line-height: 1;
}

.health-macro-percent,
.health-macro-remaining {
  position: absolute;
  inset-inline: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.health-macro-percent { color: var(--health-macro-eaten); }
.health-macro-percent-value {
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -.035em;
  line-height: 1;
}
.health-macro-percent-unit {
  margin-left: 1px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
}

.health-macro-remaining {
  inset-block-start: 42px;
  color: var(--health-macro-left);
}
.health-macro-remaining-value {
  font-size: 15px;
  font-weight: 620;
  line-height: 1;
}
.health-macro-remaining-unit {
  margin-left: 1px;
  font-size: 10px;
  font-weight: 450;
  line-height: 1;
}

.health-macro-label {
  max-width: 100%;
  margin-top: 5px;
  color: var(--health-macro-name);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 11.5px;
  font-weight: 520;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
}
.health-macro-gauge.is-empty .health-macro-percent,
.health-macro-gauge.is-empty .health-macro-remaining { color: var(--health-macro-empty); }
.health-macro-gauge.is-empty .health-macro-percent-value,
.health-macro-gauge.is-empty .health-macro-remaining-value { font-weight: 450; }

.health-metric-value {
  color: var(--health-module-ink);
  font-family: Georgia, "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(28px, 8vw, 42px);
  line-height: 1.05;
  letter-spacing: -.03em;
  overflow-wrap: anywhere;
}

.health-module--activity {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}
.health-module.health-activity-module {
  min-height: 120px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.health-activity-action {
  min-width: 0;
  min-height: 120px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 6px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--health-module-ink);
  padding: 12px;
  text-align: left;
}
.health-activity-action:hover { background: rgba(17, 17, 17, .04); }
.health-module--home .health-activity-action:hover { background: rgba(255, 255, 255, .08); }
.health-activity-label {
  color: var(--health-module-muted);
  font-size: 12px;
  font-weight: 800;
}
.health-activity-primary {
  min-width: 0;
  align-self: end;
  display: flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}
.health-activity-primary-value {
  min-width: 0;
  font-size: clamp(24px, 6vw, 30px);
  line-height: 1;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}
.health-activity-action--exercise .health-activity-primary-value { color: var(--accent, #c41e24); }
.health-module--home .health-activity-action--exercise .health-activity-primary-value { color: #ff9d96; }
.health-activity-unit {
  color: var(--health-module-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
}
.health-activity-caption {
  min-width: 0;
  overflow: hidden;
  color: var(--health-module-muted);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.health-activity-steps-kcal {
  color: var(--health-module-fill);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 375px) {
  .health-activity-action { padding-inline: 10px; }
  .health-activity-primary-value { font-size: clamp(23px, 7.5vw, 28px); }
}

.health-trend-bars {
  height: 72px;
  display: flex;
  align-items: end;
  gap: 6px;
  padding-top: 6px;
}

.health-trend-bar {
  min-height: 4px;
  flex: 1;
  border-radius: 999px 999px 3px 3px;
  background: var(--health-module-fill);
}
.health-trend-bar.is-over { background: var(--accent, #c41e24); }

.health-module--home .health-module-label { font-size: .76rem; letter-spacing: 0; }
.health-module--home .health-module-meta { font-size: .72rem; }
.health-module--home .health-calorie-value {
  font-family: inherit;
  font-size: clamp(1.8rem, 7vw, 2.5rem);
}
.health-module--home .health-calorie-unit { font-size: .72rem; }
.health-module--home .health-calorie-meta-row { font-size: 10px; }
.health-module--home-small.health-calorie-module { gap: 5px; }
.health-module--home-small .health-calorie-progress { height: 4px; }
.health-module--home-small .health-calorie-value { font-size: 1.7rem; }
.health-module--home-small .health-calorie-meta-row { gap: 6px; font-size: 9px; }
.health-module--home .health-calorie-value.is-over { color: #ff9d96; }
.health-module--home .health-metric-value {
  font-family: inherit;
  font-size: clamp(1.45rem, 5vw, 2.5rem);
}
.health-module--home .health-macro-gauges { gap: 6px; }
.health-module--home .health-trend-bars { height: 52px; }
.health-module--home-small .health-module-meta { display: none; }

/* Medium and large home cards keep the same nutrition density as detail. */
.health-calorie-module--home-medium,
.health-calorie-module--home-large { padding: 8px 15px 3px; }
.health-macros-module.health-module--home-medium,
.health-macros-module.health-module--home-large { padding: 0 15px 5px; }
.health-module--home-medium .health-calorie-value,
.health-module--home-large .health-calorie-value { font-size: clamp(36px, 11vw, 44px); }
.health-module--home-medium .health-calorie-unit,
.health-module--home-large .health-calorie-unit { font-size: 13px; }
.health-module--home-medium .health-calorie-meta-row,
.health-module--home-large .health-calorie-meta-row { font-size: 11px; }
.health-module--home-medium .health-macro-gauges,
.health-module--home-large .health-macro-gauges { gap: clamp(6px, 2.5vw, 12px); }

@media (max-width: 375px) {
  .health-macros-module.health-module--detail { padding-inline: 11px; }
  .health-macro-gauges { gap: 4px; }
  .health-macro-percent-value { font-size: 22px; }
  .health-macro-remaining-value { font-size: 14px; }
}
